@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-05-10T17:05:56.492Z") @Stability(value=Stable) 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(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,
String key)
Deprecated.
use `fromBucket`
|
static S3Code |
bucket(IBucket bucket,
String key,
String objectVersion)
Deprecated.
use `fromBucket`
|
static CfnParametersCode |
cfnParameters()
Deprecated.
use `fromCfnParameters`
|
static CfnParametersCode |
cfnParameters(CfnParametersCodeProps props)
Deprecated.
use `fromCfnParameters`
|
static AssetCode |
fromAsset(String path)
Loads the function code from a local disk path.
|
static AssetCode |
fromAsset(String path,
AssetOptions options)
Loads the function code from a local disk path.
|
static AssetImageCode |
fromAssetImage(String directory)
Create an ECR image from the specified asset and bind it as the Lambda code.
|
static AssetImageCode |
fromAssetImage(String directory,
AssetImageCodeProps props)
Create an ECR image from the specified asset and bind it as the Lambda code.
|
static S3Code |
fromBucket(IBucket bucket,
String key)
Lambda handler code as an S3 object.
|
static S3Code |
fromBucket(IBucket bucket,
String key,
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(String path)
Loads the function code from an asset created by a Docker build.
|
static AssetCode |
fromDockerBuild(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(String code)
Inline code for Lambda handler.
|
abstract 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(String code)
Deprecated.
use `fromInline`
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Code(software.amazon.jsii.JsiiObjectRef objRef)
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected Code()
@Stability(value=Deprecated) @Deprecated @NotNull public static AssetCode asset(@NotNull String path)
path - This parameter is required.@Stability(value=Deprecated) @Deprecated @NotNull public static S3Code bucket(@NotNull IBucket bucket, @NotNull String key, @Nullable String objectVersion)
bucket - This parameter is required.key - This parameter is required.objectVersion - @Stability(value=Deprecated) @Deprecated @NotNull public static S3Code bucket(@NotNull IBucket bucket, @NotNull String key)
bucket - This parameter is required.key - This parameter is required.@Stability(value=Deprecated) @Deprecated @NotNull public static CfnParametersCode cfnParameters(@Nullable CfnParametersCodeProps props)
props - @Stability(value=Deprecated) @Deprecated @NotNull public static CfnParametersCode cfnParameters()
@Stability(value=Stable) @NotNull public static AssetCode fromAsset(@NotNull String path, @Nullable AssetOptions options)
path - Either a directory with the Lambda code bundle or a .zip file. This parameter is required.options - @Stability(value=Stable) @NotNull public static AssetCode fromAsset(@NotNull String path)
path - Either a directory with the Lambda code bundle or a .zip file. This parameter is required.@Stability(value=Stable) @NotNull public static AssetImageCode fromAssetImage(@NotNull String directory, @Nullable AssetImageCodeProps props)
directory - the directory from which the asset must be created. This parameter is required.props - properties to further configure the selected image.@Stability(value=Stable) @NotNull public static AssetImageCode fromAssetImage(@NotNull String directory)
directory - the directory from which the asset must be created. This parameter is required.@Stability(value=Stable) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key, @Nullable String objectVersion)
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.objectVersion - Optional S3 object version.@Stability(value=Stable) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key)
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.@Stability(value=Stable) @NotNull public static CfnParametersCode fromCfnParameters(@Nullable CfnParametersCodeProps props)
props - optional construction properties of CfnParametersCode.@Stability(value=Stable) @NotNull public static CfnParametersCode fromCfnParameters()
@Stability(value=Stable) @NotNull public static AssetCode fromDockerBuild(@NotNull String path, @Nullable 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.@Stability(value=Stable) @NotNull public static AssetCode fromDockerBuild(@NotNull 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.@Stability(value=Stable) @NotNull public static EcrImageCode fromEcrImage(@NotNull IRepository repository, @Nullable EcrImageCodeProps props)
repository - the ECR repository that the image is in. This parameter is required.props - properties to further configure the selected image.@Stability(value=Stable) @NotNull public static EcrImageCode fromEcrImage(@NotNull IRepository repository)
repository - the ECR repository that the image is in. This parameter is required.@Stability(value=Stable) @NotNull public static InlineCode fromInline(@NotNull String code)
code - The actual handler code (limited to 4KiB). This parameter is required.@Stability(value=Deprecated) @Deprecated @NotNull public static InlineCode inline(@NotNull String code)
code - This parameter is required.@Stability(value=Stable) @NotNull public abstract CodeConfig bind(@NotNull Construct scope)
scope - The binding scope. This parameter is required.@Stability(value=Stable)
public void bindToResource(@NotNull
CfnResource _resource,
@Nullable
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 - @Stability(value=Stable)
public void bindToResource(@NotNull
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.@Stability(value=Deprecated) @Deprecated @NotNull public abstract Boolean getIsInline()
Copyright © 2023. All rights reserved.