FileAssetSource
- class aws_cdk.FileAssetSource(*, source_hash, deploy_time=None, executable=None, file_name=None, packaging=None)
Bases:
object
Represents the source for a file asset.
- Parameters:
source_hash (
str
) – A hash on the content source. This hash is used to uniquely identify this asset throughout the system. If this value doesn’t change, the asset will not be rebuilt or republished.deploy_time (
Optional
[bool
]) – Whether or not the asset needs to exist beyond deployment time; i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the CloudFormation deployment succeeds. For example, Lambda Function assets are copied over to Lambda during deployment. Therefore, it is not necessary to store the asset in S3, so we consider those deployTime assets. Default: falseexecutable (
Optional
[Sequence
[str
]]) – An external command that will produce the packaged asset. The command should produce the location of a ZIP file onstdout
. Default: - Exactly one offileName
andexecutable
is requiredfile_name (
Optional
[str
]) – The path, relative to the root of the cloud assembly, in which this asset source resides. This can be a path to a file or a directory, depending on the packaging type. Default: - Exactly one offileName
andexecutable
is requiredpackaging (
Optional
[FileAssetPackaging
]) – Which type of packaging to perform. Default: - Required iffileName
is specified.
- 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 file_asset_source = cdk.FileAssetSource( source_hash="sourceHash", # the properties below are optional deploy_time=False, executable=["executable"], file_name="fileName", packaging=cdk.FileAssetPackaging.ZIP_DIRECTORY )
Attributes
- deploy_time
Whether or not the asset needs to exist beyond deployment time;
i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the CloudFormation deployment succeeds.
For example, Lambda Function assets are copied over to Lambda during deployment. Therefore, it is not necessary to store the asset in S3, so we consider those deployTime assets.
- Default:
false
- executable
An external command that will produce the packaged asset.
The command should produce the location of a ZIP file on
stdout
.- Default:
Exactly one of
fileName
andexecutable
is required
- file_name
The path, relative to the root of the cloud assembly, in which this asset source resides.
This can be a path to a file or a directory, depending on the packaging type.
- Default:
Exactly one of
fileName
andexecutable
is required
- packaging
Which type of packaging to perform.
- Default:
Required if
fileName
is specified.
- source_hash
A hash on the content source.
This hash is used to uniquely identify this asset throughout the system. If this value doesn’t change, the asset will not be rebuilt or republished.