class AssetImageCode
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.AssetImageCode |
Java | software.amazon.awscdk.services.lambda.AssetImageCode |
Python | aws_cdk.aws_lambda.AssetImageCode |
TypeScript (source) | @aws-cdk/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 assets from '@aws-cdk/assets';
import * as ecr_assets from '@aws-cdk/aws-ecr-assets';
import * as lambda from '@aws-cdk/aws-lambda';
import * as cdk from '@aws-cdk/core';
declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const assetImageCode = new lambda.AssetImageCode('directory', {
buildArgs: {
buildArgsKey: 'buildArgs',
},
cmd: ['cmd'],
entrypoint: ['entrypoint'],
exclude: ['exclude'],
extraHash: 'extraHash',
file: 'file',
follow: assets.FollowMode.NEVER,
followSymlinks: cdk.SymlinkFollowMode.NEVER,
ignoreMode: cdk.IgnoreMode.GLOB,
invalidation: {
buildArgs: false,
extraHash: false,
file: false,
networkMode: false,
platform: false,
repositoryName: false,
target: false,
},
networkMode: networkMode,
platform: platform,
repositoryName: 'repositoryName',
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.