@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-02T20:25:31.557Z") public class Version extends QualifiedFunctionBase implements IVersion
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_12_X) .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();
Modifier and Type | Class and Description |
---|---|
static class |
Version.Builder
A fluent builder for
Version . |
IVersion.Jsii$Default, IVersion.Jsii$Proxy
IClientVpnConnectionHandler.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Version(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Version(software.amazon.jsii.JsiiObjectRef objRef) |
|
Version(software.constructs.Construct scope,
java.lang.String id,
VersionProps props) |
Modifier and Type | Method and Description |
---|---|
Alias |
addAlias(java.lang.String aliasName)
Deprecated.
Calling `addAlias` on a `Version` object will cause the Alias to be replaced on every function update. Call `function.addAlias()` or `new Alias()` instead.
|
Alias |
addAlias(java.lang.String aliasName,
AliasOptions options)
Deprecated.
Calling `addAlias` on a `Version` object will cause the Alias to be replaced on every function update. Call `function.addAlias()` or `new Alias()` instead.
|
static IVersion |
fromVersionArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String versionArn)
Construct a Version object from a Version ARN.
|
static IVersion |
fromVersionAttributes(software.constructs.Construct scope,
java.lang.String id,
VersionAttributes attrs) |
Architecture |
getArchitecture()
The architecture of this Lambda Function.
|
protected java.lang.Boolean |
getCanCreatePermissions()
Whether the addPermission() call adds any permissions.
|
java.lang.String |
getEdgeArn()
The ARN of the version for Lambda@Edge.
|
java.lang.String |
getFunctionArn()
The ARN fo the function.
|
java.lang.String |
getFunctionName()
The name of the function.
|
IPrincipal |
getGrantPrincipal()
The principal this Lambda Function is running as.
|
IFunction |
getLambda()
The underlying AWS Lambda function.
|
protected java.lang.String |
getQualifier()
The qualifier of the version or alias of this function.
|
IRole |
getRole()
The IAM role associated with this function.
|
java.lang.String |
getVersion()
The most recently deployed version of this function.
|
Metric |
metric(java.lang.String metricName)
Return the given named metric for this Function.
|
Metric |
metric(java.lang.String metricName,
MetricOptions props)
Return the given named metric for this Function.
|
configureAsyncInvoke, considerWarningOnInvokeFunctionPermissions, getLatestVersion, getPermissionsNode, getResourceArnsForGrantInvoke
addEventSource, addEventSourceMapping, addFunctionUrl, addFunctionUrl, addPermission, addToRolePolicy, getConnections, getIsBoundToVpc, grantInvoke, grantInvokeUrl, metricDuration, metricDuration, metricErrors, metricErrors, metricInvocations, metricInvocations, metricThrottles, metricThrottles, warnInvokeFunctionPermissions
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addEventSource, addEventSourceMapping, addFunctionUrl, addFunctionUrl, addPermission, addToRolePolicy, configureAsyncInvoke, getIsBoundToVpc, getLatestVersion, getPermissionsNode, getResourceArnsForGrantInvoke, grantInvoke, grantInvokeUrl, metricDuration, metricDuration, metricErrors, metricErrors, metricInvocations, metricInvocations, metricThrottles, metricThrottles
applyRemovalPolicy, getEnv, getStack
getNode
getConnections
protected Version(software.amazon.jsii.JsiiObjectRef objRef)
protected Version(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Version(software.constructs.Construct scope, java.lang.String id, VersionProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IVersion fromVersionArn(software.constructs.Construct scope, java.lang.String id, java.lang.String versionArn)
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.public static IVersion fromVersionAttributes(software.constructs.Construct scope, java.lang.String id, VersionAttributes attrs)
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.@Deprecated public Alias addAlias(java.lang.String aliasName, AliasOptions options)
@Deprecated public Alias addAlias(java.lang.String aliasName)
public Metric metric(java.lang.String metricName, MetricOptions props)
metric
in interface IFunction
metric
in class FunctionBase
metricName
- This parameter is required.props
- public Metric metric(java.lang.String metricName)
metric
in interface IFunction
metric
in class FunctionBase
metricName
- This parameter is required.public Architecture getArchitecture()
getArchitecture
in interface IFunction
getArchitecture
in class FunctionBase
protected java.lang.Boolean getCanCreatePermissions()
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
getCanCreatePermissions
in class FunctionBase
public java.lang.String getEdgeArn()
getEdgeArn
in interface IVersion
public java.lang.String getFunctionArn()
getFunctionArn
in interface IClientVpnConnectionHandler
getFunctionArn
in interface IFunction
getFunctionArn
in class FunctionBase
public java.lang.String getFunctionName()
getFunctionName
in interface IClientVpnConnectionHandler
getFunctionName
in interface IFunction
getFunctionName
in class FunctionBase
public IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
getGrantPrincipal
in class FunctionBase
public IFunction getLambda()
getLambda
in interface IVersion
getLambda
in class QualifiedFunctionBase
protected java.lang.String getQualifier()
A qualifier is the identifier that's appended to a version or alias ARN.
public java.lang.String getVersion()
getVersion
in interface IVersion
public IRole getRole()
Undefined if the function was imported without a role.
getRole
in interface IFunction
getRole
in class FunctionBase