@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-25T18:29:02.410Z") public class Asset extends Construct implements IAsset
Example:
import software.amazon.awscdk.services.s3.assets.*; Cluster cluster; Asset chartAsset = Asset.Builder.create(this, "ChartAsset") .path("/path/to/asset") .build(); cluster.addHelmChart("test-chart", HelmChartOptions.builder() .chartAsset(chartAsset) .build());
Modifier and Type | Class and Description |
---|---|
static class |
Asset.Builder
A fluent builder for
Asset . |
IAsset.Jsii$Default, IAsset.Jsii$Proxy
IConstruct.Jsii$Default, IConstruct.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
Asset(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Asset(software.amazon.jsii.JsiiObjectRef objRef) |
|
Asset(software.constructs.Construct scope,
java.lang.String id,
AssetProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addResourceMetadata(CfnResource resource,
java.lang.String resourceProperty)
Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
|
java.lang.String |
getAssetHash()
A hash of this asset, which is available at construction time.
|
java.lang.String |
getAssetPath()
The path to the asset, relative to the current Cloud Assembly.
|
IBucket |
getBucket()
The S3 bucket in which this asset resides.
|
java.lang.String |
getHttpUrl()
Attribute which represents the S3 HTTP URL of this asset.
|
java.lang.Boolean |
getIsFile()
Indicates if this asset is a single file.
|
java.lang.Boolean |
getIsZipArchive()
Indicates if this asset is a zip archive.
|
java.lang.String |
getS3BucketName()
Attribute that represents the name of the bucket this asset exists in.
|
java.lang.String |
getS3ObjectKey()
Attribute which represents the S3 object key of this asset.
|
java.lang.String |
getS3ObjectUrl()
Attribute which represents the S3 URL of this asset.
|
java.lang.String |
getS3Url()
Deprecated.
use `httpUrl`
|
java.lang.String |
getSourceHash()
Deprecated.
see `assetHash`
|
void |
grantRead(IGrantable grantee)
Grants read permissions to the principal on the assets bucket.
|
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
protected Asset(software.amazon.jsii.JsiiObjectRef objRef)
protected Asset(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Asset(software.constructs.Construct scope, java.lang.String id, AssetProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public void addResourceMetadata(CfnResource resource, java.lang.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.public void grantRead(IGrantable grantee)
grantee
- This parameter is required.public java.lang.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
public java.lang.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.
public IBucket getBucket()
public java.lang.String getHttpUrl()
For example, https://s3.us-west-1.amazonaws.com/bucket/key
public java.lang.Boolean getIsFile()
Allows constructs to ensure that the correct file type was used.
public java.lang.Boolean getIsZipArchive()
Allows constructs to ensure that the correct file type was used.
public java.lang.String getS3BucketName()
public java.lang.String getS3ObjectKey()
public java.lang.String getS3ObjectUrl()
For example, s3://bucket/key
@Deprecated public java.lang.String getS3Url()
@Deprecated public java.lang.String getSourceHash()