@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:41.821Z") @Stability(value=Stable) public class Asset extends software.constructs.Construct implements IAsset
Example:
Asset asset = Asset.Builder.create(this, "BundledAsset")
.path(join(__dirname, "markdown-asset")) // /asset-input and working directory in the container
.bundling(BundlingOptions.builder()
.image(DockerImage.fromBuild(join(__dirname, "alpine-markdown"))) // Build an image
.command(List.of("sh", "-c", "\n markdown index.md > /asset-output/index.html\n "))
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
Asset.Builder
A fluent builder for
Asset. |
software.amazon.jsii.JsiiObject.InitializationModeIAsset.Jsii$Default, IAsset.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
Asset(software.constructs.Construct scope,
String id,
AssetProps props) |
protected |
Asset(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Asset(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addResourceMetadata(CfnResource resource,
String resourceProperty)
Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
|
String |
getAssetHash()
A hash of this asset, which is available at construction time.
|
String |
getAssetPath()
The path to the asset, relative to the current Cloud Assembly.
|
IBucket |
getBucket()
The S3 bucket in which this asset resides.
|
String |
getHttpUrl()
Attribute which represents the S3 HTTP URL of this asset.
|
Boolean |
getIsFile()
Indicates if this asset is a single file.
|
Boolean |
getIsZipArchive()
Indicates if this asset is a zip archive.
|
String |
getS3BucketName()
Attribute that represents the name of the bucket this asset exists in.
|
String |
getS3ObjectKey()
Attribute which represents the S3 object key of this asset.
|
String |
getS3ObjectUrl()
Attribute which represents the S3 URL of this asset.
|
void |
grantRead(IGrantable grantee)
Grants read permissions to the principal on the assets bucket.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Asset(software.amazon.jsii.JsiiObjectRef objRef)
protected Asset(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Asset(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
AssetProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable)
public void addResourceMetadata(@NotNull
CfnResource resource,
@NotNull
String resourceProperty)
This can be used by tools such as SAM CLI to provide local experience such as local invocation and debugging of Lambda functions.
Asset metadata will only be included if the stack is synthesized with the "aws:cdk:enable-asset-metadata" context key defined, which is the default behavior when synthesizing via the CDK Toolkit.
resource - The CloudFormation resource which is using this asset [disable-awslint:ref-via-interface]. This parameter is required.resourceProperty - The property name where this asset is referenced (e.g. "Code" for AWS::Lambda::Function). This parameter is required.@Stability(value=Stable)
public void grantRead(@NotNull
IGrantable grantee)
grantee - This parameter is required.@Stability(value=Stable) @NotNull public String getAssetHash()
As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
getAssetHash in interface IAsset@Stability(value=Stable) @NotNull public String getAssetPath()
If asset staging is disabled, this will just be the original path. If asset staging is enabled it will be the staged path.
@Stability(value=Stable) @NotNull public IBucket getBucket()
@Stability(value=Stable) @NotNull public String getHttpUrl()
For example, https://s3.us-west-1.amazonaws.com/bucket/key
@Stability(value=Stable) @NotNull public Boolean getIsFile()
Allows constructs to ensure that the correct file type was used.
@Stability(value=Stable) @NotNull public Boolean getIsZipArchive()
Allows constructs to ensure that the correct file type was used.
@Stability(value=Stable) @NotNull public String getS3BucketName()
@Stability(value=Stable) @NotNull public String getS3ObjectKey()
@Stability(value=Stable) @NotNull public String getS3ObjectUrl()
For example, s3://bucket/key
Copyright © 2022. All rights reserved.