@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)",
date="2023-01-25T18:29:04.704Z")
public abstract class Code
extends software.amazon.jsii.JsiiObject
Example:
import software.amazon.awscdk.services.signer.*; SigningProfile signingProfile = SigningProfile.Builder.create(this, "SigningProfile") .platform(Platform.AWS_LAMBDA_SHA384_ECDSA) .build(); CodeSigningConfig codeSigningConfig = CodeSigningConfig.Builder.create(this, "CodeSigningConfig") .signingProfiles(List.of(signingProfile)) .build(); Function.Builder.create(this, "Function") .codeSigningConfig(codeSigningConfig) .runtime(Runtime.NODEJS_16_X) .handler("index.handler") .code(Code.fromAsset(join(__dirname, "lambda-handler"))) .build();
Modifier | Constructor and Description |
---|---|
protected |
Code() |
protected |
Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Code(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
static AssetCode |
asset(java.lang.String path)
Deprecated.
use `fromAsset`
|
abstract CodeConfig |
bind(Construct scope)
Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
|
void |
bindToResource(CfnResource _resource)
Called after the CFN function resource has been created to allow the code class to bind to it.
|
void |
bindToResource(CfnResource _resource,
ResourceBindOptions _options)
Called after the CFN function resource has been created to allow the code class to bind to it.
|
static S3Code |
bucket(IBucket bucket,
java.lang.String key)
Deprecated.
use `fromBucket`
|
static S3Code |
bucket(IBucket bucket,
java.lang.String key,
java.lang.String objectVersion)
Deprecated.
use `fromBucket`
|
static CfnParametersCode |
cfnParameters()
Deprecated.
use `fromCfnParameters`
|
static CfnParametersCode |
cfnParameters(CfnParametersCodeProps props)
Deprecated.
use `fromCfnParameters`
|
static AssetCode |
fromAsset(java.lang.String path)
Loads the function code from a local disk path.
|
static AssetCode |
fromAsset(java.lang.String path,
AssetOptions options)
Loads the function code from a local disk path.
|
static AssetImageCode |
fromAssetImage(java.lang.String directory)
Create an ECR image from the specified asset and bind it as the Lambda code.
|
static AssetImageCode |
fromAssetImage(java.lang.String directory,
AssetImageCodeProps props)
Create an ECR image from the specified asset and bind it as the Lambda code.
|
static S3Code |
fromBucket(IBucket bucket,
java.lang.String key)
Lambda handler code as an S3 object.
|
static S3Code |
fromBucket(IBucket bucket,
java.lang.String key,
java.lang.String objectVersion)
Lambda handler code as an S3 object.
|
static CfnParametersCode |
fromCfnParameters()
Creates a new Lambda source defined using CloudFormation parameters.
|
static CfnParametersCode |
fromCfnParameters(CfnParametersCodeProps props)
Creates a new Lambda source defined using CloudFormation parameters.
|
static AssetCode |
fromDockerBuild(java.lang.String path)
Loads the function code from an asset created by a Docker build.
|
static AssetCode |
fromDockerBuild(java.lang.String path,
DockerBuildAssetOptions options)
Loads the function code from an asset created by a Docker build.
|
static EcrImageCode |
fromEcrImage(IRepository repository)
Use an existing ECR image as the Lambda code.
|
static EcrImageCode |
fromEcrImage(IRepository repository,
EcrImageCodeProps props)
Use an existing ECR image as the Lambda code.
|
static InlineCode |
fromInline(java.lang.String code)
Inline code for Lambda handler.
|
abstract java.lang.Boolean |
getIsInline()
Deprecated.
this value is ignored since inline is now determined based on the
the `inlineCode` field of `CodeConfig` returned from `bind()`.
|
static InlineCode |
inline(java.lang.String code)
Deprecated.
use `fromInline`
|
protected Code(software.amazon.jsii.JsiiObjectRef objRef)
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected Code()
@Deprecated public static AssetCode asset(java.lang.String path)
path
- This parameter is required.@Deprecated public static S3Code bucket(IBucket bucket, java.lang.String key, java.lang.String objectVersion)
bucket
- This parameter is required.key
- This parameter is required.objectVersion
- @Deprecated public static S3Code bucket(IBucket bucket, java.lang.String key)
bucket
- This parameter is required.key
- This parameter is required.@Deprecated public static CfnParametersCode cfnParameters(CfnParametersCodeProps props)
props
- @Deprecated public static CfnParametersCode cfnParameters()
public static AssetCode fromAsset(java.lang.String path, AssetOptions options)
path
- Either a directory with the Lambda code bundle or a .zip file. This parameter is required.options
- public static AssetCode fromAsset(java.lang.String path)
path
- Either a directory with the Lambda code bundle or a .zip file. This parameter is required.public static AssetImageCode fromAssetImage(java.lang.String directory, AssetImageCodeProps props)
directory
- the directory from which the asset must be created. This parameter is required.props
- properties to further configure the selected image.public static AssetImageCode fromAssetImage(java.lang.String directory)
directory
- the directory from which the asset must be created. This parameter is required.public static S3Code fromBucket(IBucket bucket, java.lang.String key, java.lang.String objectVersion)
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.objectVersion
- Optional S3 object version.public static S3Code fromBucket(IBucket bucket, java.lang.String key)
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.public static CfnParametersCode fromCfnParameters(CfnParametersCodeProps props)
props
- optional construction properties of CfnParametersCode
.public static CfnParametersCode fromCfnParameters()
public static AssetCode fromDockerBuild(java.lang.String path, DockerBuildAssetOptions options)
By default, the asset is expected to be located at /asset
in the
image.
path
- The path to the directory containing the Docker file. This parameter is required.options
- Docker build options.public static AssetCode fromDockerBuild(java.lang.String path)
By default, the asset is expected to be located at /asset
in the
image.
path
- The path to the directory containing the Docker file. This parameter is required.public static EcrImageCode fromEcrImage(IRepository repository, EcrImageCodeProps props)
repository
- the ECR repository that the image is in. This parameter is required.props
- properties to further configure the selected image.public static EcrImageCode fromEcrImage(IRepository repository)
repository
- the ECR repository that the image is in. This parameter is required.public static InlineCode fromInline(java.lang.String code)
code
- The actual handler code (limited to 4KiB). This parameter is required.@Deprecated public static InlineCode inline(java.lang.String code)
code
- This parameter is required.public abstract CodeConfig bind(Construct scope)
scope
- The binding scope. This parameter is required.public void bindToResource(CfnResource _resource, ResourceBindOptions _options)
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.
_resource
- This parameter is required._options
- public void bindToResource(CfnResource _resource)
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.
_resource
- This parameter is required.@Deprecated public abstract java.lang.Boolean getIsInline()