AssetManifestBuilder

class aws_cdk.AssetManifestBuilder

Bases: object

Build an asset manifest from assets added to a stack.

This class does not need to be used by app builders; it is only necessary for building Stack Synthesizers.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

asset_manifest_builder = cdk.AssetManifestBuilder()

Methods

add_docker_image_asset(stack, source_hash, source, *, image_tag, repository_name, assume_role_additional_options=None, assume_role_arn=None, assume_role_external_id=None, region=None)

Add a docker asset source and destination to the manifest.

sourceHash should be unique for every source.

Parameters:
  • stack (Stack) –

  • source_hash (str) –

  • source (Union[DockerImageSource, Dict[str, Any]]) –

  • image_tag (str) – Tag of the image to publish.

  • repository_name (str) – Name of the ECR repository to publish to.

  • assume_role_additional_options (Optional[Mapping[str, Any]]) – Additional options to pass to STS when assuming the role. - RoleArn should not be used. Use the dedicated assumeRoleArn property instead. - ExternalId should not be used. Use the dedicated assumeRoleExternalId instead. Default: - No additional options.

  • assume_role_arn (Optional[str]) – The role that needs to be assumed while publishing this asset. Default: - No role will be assumed

  • assume_role_external_id (Optional[str]) – The ExternalId that needs to be supplied while assuming this role. Default: - No ExternalId will be supplied

  • region (Optional[str]) – The region where this asset will need to be published. Default: - Current region

Return type:

DockerImageDestination

add_file_asset(stack, source_hash, source, *, bucket_name, object_key, assume_role_additional_options=None, assume_role_arn=None, assume_role_external_id=None, region=None)

Add a file asset source and destination to the manifest.

sourceHash should be unique for every source.

Parameters:
  • stack (Stack) –

  • source_hash (str) –

  • source (Union[FileSource, Dict[str, Any]]) –

  • bucket_name (str) – The name of the bucket.

  • object_key (str) – The destination object key.

  • assume_role_additional_options (Optional[Mapping[str, Any]]) – Additional options to pass to STS when assuming the role. - RoleArn should not be used. Use the dedicated assumeRoleArn property instead. - ExternalId should not be used. Use the dedicated assumeRoleExternalId instead. Default: - No additional options.

  • assume_role_arn (Optional[str]) – The role that needs to be assumed while publishing this asset. Default: - No role will be assumed

  • assume_role_external_id (Optional[str]) – The ExternalId that needs to be supplied while assuming this role. Default: - No ExternalId will be supplied

  • region (Optional[str]) – The region where this asset will need to be published. Default: - Current region

Return type:

FileDestination

default_add_docker_image_asset(stack, asset, *, repository_name, docker_tag_prefix=None, role=None)

Add a docker image asset to the manifest with default settings.

Derive the region from the stack, use the asset hash as the key, and set the prefix.

Parameters:
  • stack (Stack) –

  • asset (Union[DockerImageAssetSource, Dict[str, Any]]) –

  • repository_name (str) – Repository name where the docker image asset should be written.

  • docker_tag_prefix (Optional[str]) – Prefix to add to the asset hash to make the Docker image tag. Default: ‘’

  • role (Union[RoleOptions, Dict[str, Any], None]) – Role to use to perform the upload. Default: - No role

Return type:

DockerImageDestination

default_add_file_asset(stack, asset, *, bucket_name, bucket_prefix=None, role=None)

Add a file asset to the manifest with default settings.

Derive the region from the stack, use the asset hash as the key, copy the file extension over, and set the prefix.

Parameters:
  • stack (Stack) –

  • asset (Union[FileAssetSource, Dict[str, Any]]) –

  • bucket_name (str) – Bucket name where the file asset should be written.

  • bucket_prefix (Optional[str]) – Prefix to prepend to the asset hash. Default: ‘’

  • role (Union[RoleOptions, Dict[str, Any], None]) – Role to use for uploading. Default: - current role

Return type:

FileDestination

emit_manifest(stack, session, options=None, dependencies=None)

Write the manifest to disk, and add it to the synthesis session.

Return the artifact id, which should be added to the additionalDependencies field of the stack artifact.

Parameters:
Return type:

str

Attributes

has_assets

Whether there are any assets registered in the manifest.