Interface IAssetOptions
Inherited Members
Namespace: Amazon.CDK.AWS.S3.Assets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IAssetOptions : IAssetOptions, IFileCopyOptions
Syntax (vb)
Public Interface IAssetOptions Inherits IAssetOptions, IFileCopyOptions
Remarks
ExampleMetadata: infused
Examples
new Function(this, "Function", new FunctionProps {
Code = Code.FromAsset(Join(__dirname, "my-python-handler"), new AssetOptions {
Bundling = new BundlingOptions {
Image = Runtime.PYTHON_3_9.BundlingImage,
Command = new [] { "bash", "-c", "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output" }
}
}),
Runtime = Runtime.PYTHON_3_9,
Handler = "index.handler"
});
Synopsis
Properties
| DeployTime | Whether or not the asset needs to exist beyond deployment time; |
| DisplayName | A display name for this asset. |
| Readers | A list of principals that should be able to read this asset from S3. |
| SourceKMSKey | The ARN of the KMS key used to encrypt the handler code. |
Properties
DeployTime
Whether or not the asset needs to exist beyond deployment time;
bool? DeployTime { get; }
Property Value
bool?
Remarks
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
DisplayName
A display name for this asset.
string? DisplayName { get; }
Property Value
Remarks
If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information. If the same asset is added multiple times, the display name of the first occurrence is used.
The default is the construct path of the Asset construct, with respect to
the enclosing stack. If the asset is produced by a construct helper
function (such as lambda.Code.fromAsset()), this will look like
MyFunction/Code.
We use the stack-relative construct path so that in the common case where
you have multiple stacks with the same asset, we won't show something like
/MyBetaStack/MyFunction/Code when you are actually deploying to
production.
Default: - Stack-relative construct path
Readers
A list of principals that should be able to read this asset from S3.
IGrantable[]? Readers { get; }
Property Value
Remarks
You can use asset.grantRead(principal) to grant read permissions later.
Default: - No principals that can read file asset.
SourceKMSKey
The ARN of the KMS key used to encrypt the handler code.
IKeyRef? SourceKMSKey { get; }
Property Value
Remarks
Default: - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.