Class Version
- All Implemented Interfaces:
IResource
,IClientVpnConnectionHandler
,IConnectable
,IGrantable
,IFunction
,IVersion
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Avoid using this resource directly. If you need a Version object, use
function.currentVersion
instead. That will add a Version object to your
template, and make sure the Version is invalidated whenever the Function
object changes. If you use the Version
resource directly, you are
responsible for making sure it is invalidated (by changing its
logical ID) whenever necessary.
Version resources can then be used in Alias
resources to refer to a
particular deployment of a Lambda.
If you want to ensure that you're associating the right version with
the right deployment, specify the codeSha256
property while
creating the `Version.
Example:
CfnParametersCode lambdaCode = Code.fromCfnParameters(); Function func = Function.Builder.create(this, "Lambda") .code(lambdaCode) .handler("index.handler") .runtime(Runtime.NODEJS_LATEST) .build(); // used to make sure each CDK synthesis produces a different Version Version version = func.getCurrentVersion(); Alias alias = Alias.Builder.create(this, "LambdaAlias") .aliasName("Prod") .version(version) .build(); LambdaDeploymentGroup.Builder.create(this, "DeploymentGroup") .alias(alias) .deploymentConfig(LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IClientVpnConnectionHandler
IClientVpnConnectionHandler.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IFunction
IFunction.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IVersion
IVersion.Jsii$Default, IVersion.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
Version
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Version
(software.amazon.jsii.JsiiObjectRef objRef) Version
(software.constructs.Construct scope, String id, VersionProps props) -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.addAlias
(String aliasName, AliasOptions options) Deprecated.CallingaddAlias
on aVersion
object will cause the Alias to be replaced on every function update.static IVersion
fromVersionArn
(software.constructs.Construct scope, String id, String versionArn) Construct a Version object from a Version ARN.static IVersion
fromVersionAttributes
(software.constructs.Construct scope, String id, VersionAttributes attrs) The architecture of this Lambda Function.protected Boolean
Whether the addPermission() call adds any permissions.The ARN of the version for Lambda@Edge.The ARN fo the function.The name of the function.The principal this Lambda Function is running as.The underlyingIFunction
.protected String
The qualifier of the version or alias of this function.getRole()
The IAM role associated with this function.The most recently deployed version of this function.Return the given named metric for this Function.metric
(String metricName, MetricOptions props) Return the given named metric for this Function.Methods inherited from class software.amazon.awscdk.services.lambda.QualifiedFunctionBase
configureAsyncInvoke, considerWarningOnInvokeFunctionPermissions, getLatestVersion, getPermissionsNode, getResourceArnsForGrantInvoke
Methods inherited from class software.amazon.awscdk.services.lambda.FunctionBase
addEventSource, addEventSourceMapping, addFunctionUrl, addFunctionUrl, addPermission, addToRolePolicy, getConnections, getIsBoundToVpc, grantInvoke, grantInvokeCompositePrincipal, grantInvokeLatestVersion, grantInvokeUrl, grantInvokeVersion, metricDuration, metricDuration, metricErrors, metricErrors, metricInvocations, metricInvocations, metricThrottles, metricThrottles, warnInvokeFunctionPermissions
Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.services.ec2.IConnectable
getConnections
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.services.lambda.IFunction
addEventSource, addEventSourceMapping, addFunctionUrl, addFunctionUrl, addPermission, addToRolePolicy, configureAsyncInvoke, getIsBoundToVpc, getLatestVersion, getPermissionsNode, getResourceArnsForGrantInvoke, grantInvoke, grantInvokeCompositePrincipal, grantInvokeLatestVersion, grantInvokeUrl, grantInvokeVersion, metricDuration, metricDuration, metricErrors, metricErrors, metricInvocations, metricInvocations, metricThrottles, metricThrottles
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Version
protected Version(software.amazon.jsii.JsiiObjectRef objRef) -
Version
protected Version(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Version
@Stability(Stable) public Version(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull VersionProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromVersionArn
@Stability(Stable) @NotNull public static IVersion fromVersionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String versionArn) Construct a Version object from a Version ARN.- Parameters:
scope
- The cdk scope creating this resource. This parameter is required.id
- The cdk id of this resource. This parameter is required.versionArn
- The version ARN to create this version from. This parameter is required.
-
fromVersionAttributes
@Stability(Stable) @NotNull public static IVersion fromVersionAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull VersionAttributes attrs) - Parameters:
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.
-
addAlias
@Stability(Deprecated) @Deprecated @NotNull public Alias addAlias(@NotNull String aliasName, @Nullable AliasOptions options) Deprecated.CallingaddAlias
on aVersion
object will cause the Alias to be replaced on every function update. Callfunction.addAlias()
ornew Alias()
instead.(deprecated) Defines an alias for this version. -
addAlias
Deprecated.CallingaddAlias
on aVersion
object will cause the Alias to be replaced on every function update. Callfunction.addAlias()
ornew Alias()
instead.(deprecated) Defines an alias for this version. -
metric
@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Function.- Specified by:
metric
in interfaceIFunction
- Overrides:
metric
in classFunctionBase
- Parameters:
metricName
- This parameter is required.props
-
-
metric
Return the given named metric for this Function.- Specified by:
metric
in interfaceIFunction
- Overrides:
metric
in classFunctionBase
- Parameters:
metricName
- This parameter is required.
-
getArchitecture
The architecture of this Lambda Function.- Specified by:
getArchitecture
in interfaceIFunction
- Specified by:
getArchitecture
in classFunctionBase
-
getCanCreatePermissions
Whether the addPermission() call adds any permissions.True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
- Specified by:
getCanCreatePermissions
in classFunctionBase
-
getEdgeArn
The ARN of the version for Lambda@Edge.- Specified by:
getEdgeArn
in interfaceIVersion
-
getFunctionArn
The ARN fo the function.- Specified by:
getFunctionArn
in interfaceIClientVpnConnectionHandler
- Specified by:
getFunctionArn
in interfaceIFunction
- Specified by:
getFunctionArn
in classFunctionBase
-
getFunctionName
The name of the function.- Specified by:
getFunctionName
in interfaceIClientVpnConnectionHandler
- Specified by:
getFunctionName
in interfaceIFunction
- Specified by:
getFunctionName
in classFunctionBase
-
getGrantPrincipal
The principal this Lambda Function is running as.- Specified by:
getGrantPrincipal
in interfaceIGrantable
- Specified by:
getGrantPrincipal
in classFunctionBase
-
getLambda
The underlyingIFunction
.- Specified by:
getLambda
in interfaceIVersion
- Specified by:
getLambda
in classQualifiedFunctionBase
-
getQualifier
The qualifier of the version or alias of this function.A qualifier is the identifier that's appended to a version or alias ARN.
- Specified by:
getQualifier
in classQualifiedFunctionBase
- See Also:
-
getVersion
The most recently deployed version of this function.- Specified by:
getVersion
in interfaceIVersion
-
getRole
The IAM role associated with this function.Undefined if the function was imported without a role.
- Specified by:
getRole
in interfaceIFunction
- Specified by:
getRole
in classFunctionBase
-
addAlias
on aVersion
object will cause the Alias to be replaced on every function update.