Interface AssetOptions

All Superinterfaces:
AssetOptions, FileCopyOptions, software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
AssetProps, CustomCommandOptions, InitFileAssetOptions, InitSourceAssetOptions
All Known Implementing Classes:
AssetOptions.Jsii$Proxy, AssetProps.Jsii$Proxy, CustomCommandOptions.Jsii$Proxy, InitFileAssetOptions.Jsii$Proxy, InitSourceAssetOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.110.0 (build 336b265)", date="2025-05-07T19:18:55.651Z") @Stability(Stable) public interface AssetOptions extends software.amazon.jsii.JsiiSerializable, AssetOptions, FileCopyOptions
Example:

 Function.Builder.create(this, "Function")
         .code(Code.fromAsset(join(__dirname, "my-python-handler"), AssetOptions.builder()
                 .bundling(BundlingOptions.builder()
                         .image(Runtime.PYTHON_3_9.getBundlingImage())
                         .command(List.of("bash", "-c", "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output"))
                         .build())
                 .build()))
         .runtime(Runtime.PYTHON_3_9)
         .handler("index.handler")
         .build();
 
  • Method Details

    • getDeployTime

      @Stability(Stable) @Nullable default Boolean getDeployTime()
      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

    • getDisplayName

      @Stability(Stable) @Nullable default String getDisplayName()
      A display name for this asset.

      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

    • getReaders

      @Stability(Stable) @Nullable default List<IGrantable> getReaders()
      A list of principals that should be able to read this asset from S3.

      You can use asset.grantRead(principal) to grant read permissions later.

      Default: - No principals that can read file asset.

    • getSourceKMSKey

      @Stability(Stable) @Nullable default IKey getSourceKMSKey()
      The ARN of the KMS key used to encrypt the handler code.

      Default: - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.

    • builder

      @Stability(Stable) static AssetOptions.Builder builder()
      Returns:
      a AssetOptions.Builder of AssetOptions