class AssetImageCode
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.AssetImageCode |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#AssetImageCode |
Java | software.amazon.awscdk.services.lambda.AssetImageCode |
Python | aws_cdk.aws_lambda.AssetImageCode |
TypeScript (source) | aws-cdk-lib » aws_lambda » AssetImageCode |
Extends
Code
Represents an ECR image that will be constructed from the specified asset and can be bound as Lambda code.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const assetImageCode = new lambda.AssetImageCode('directory', {
assetName: 'assetName',
buildArgs: {
buildArgsKey: 'buildArgs',
},
buildSecrets: {
buildSecretsKey: 'buildSecrets',
},
buildSsh: 'buildSsh',
cacheDisabled: false,
cacheFrom: [{
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
}],
cacheTo: {
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
},
cmd: ['cmd'],
entrypoint: ['entrypoint'],
exclude: ['exclude'],
extraHash: 'extraHash',
file: 'file',
followSymlinks: cdk.SymlinkFollowMode.NEVER,
ignoreMode: cdk.IgnoreMode.GLOB,
invalidation: {
buildArgs: false,
buildSecrets: false,
buildSsh: false,
extraHash: false,
file: false,
networkMode: false,
outputs: false,
platform: false,
repositoryName: false,
target: false,
},
networkMode: networkMode,
outputs: ['outputs'],
platform: platform,
target: 'target',
workingDirectory: 'workingDirectory',
});
Initializer
new AssetImageCode(directory: string, props: AssetImageCodeProps)
Parameters
- directory
string
- props
Asset
Image Code Props
Properties
Name | Type | Description |
---|---|---|
is | boolean | Determines whether this Code is inline code or not. |
isInline
Type:
boolean
Determines whether this Code is inline code or not.
Methods
Name | Description |
---|---|
bind(scope) | Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. |
bind | Called after the CFN function resource has been created to allow the code class to bind to it. |
bind(scope)
public bind(scope: Construct): CodeConfig
Parameters
- scope
Construct
Returns
Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
ToResource(resource, options?)
bindpublic bindToResource(resource: CfnResource, options?: ResourceBindOptions): void
Parameters
- resource
Cfn
Resource - options
Resource
Bind Options
Called after the CFN function resource has been created to allow the code class to bind to it.
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.