Class Version_
Tag the current state of a Function with a Version number.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public class Version_ : QualifiedFunctionBase, IClientVpnConnectionHandler, IVersion, IFunction, IResource, IConstruct, IDependable, IConnectable, IGrantable
Syntax (vb)
Public Class Version_
Inherits QualifiedFunctionBase
Implements IClientVpnConnectionHandler, IVersion, IFunction, IResource, IConstruct, IDependable, IConnectable, IGrantable
Remarks
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.
ExampleMetadata: infused
Examples
var lambdaCode = Code.FromCfnParameters();
var func = new Function(this, "Lambda", new FunctionProps {
Code = lambdaCode,
Handler = "index.handler",
Runtime = Runtime.NODEJS_14_X
});
// used to make sure each CDK synthesis produces a different Version
var version = func.CurrentVersion;
var alias = new Alias(this, "LambdaAlias", new AliasProps {
AliasName = "Prod",
Version = version
});
new LambdaDeploymentGroup(this, "DeploymentGroup", new LambdaDeploymentGroupProps {
Alias = alias,
DeploymentConfig = LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE
});
Synopsis
Constructors
Version_(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Version_(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Version_(Construct, String, IVersionProps) |
Properties
Architecture | The architecture of this Lambda Function. |
CanCreatePermissions | Whether the addPermission() call adds any permissions. |
EdgeArn | The ARN of the version for Lambda@Edge. |
FunctionArn | The ARN fo the function. |
FunctionName | The name of the function. |
GrantPrincipal | The principal this Lambda Function is running as. |
Lambda | The underlying AWS Lambda function. |
Qualifier | The qualifier of the version or alias of this function. |
Role | The IAM role associated with this function. |
Version | The most recently deployed version of this function. |
Methods
AddAlias(String, IAliasOptions) | (deprecated) Defines an alias for this version. |
FromVersionArn(Construct, String, String) | Construct a Version object from a Version ARN. |
FromVersionAttributes(Construct, String, IVersionAttributes) | |
Metric(String, IMetricOptions) | Return the given named metric for this Function. |
Constructors
Version_(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Version_(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Version_(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Version_(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Version_(Construct, String, IVersionProps)
public Version_(Construct scope, string id, IVersionProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IVersionProps
Properties
Architecture
The architecture of this Lambda Function.
public override Architecture Architecture { get; }
Property Value
Overrides
CanCreatePermissions
Whether the addPermission() call adds any permissions.
protected override bool CanCreatePermissions { get; }
Property Value
System.Boolean
Overrides
Remarks
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
EdgeArn
The ARN of the version for Lambda@Edge.
public virtual string EdgeArn { get; }
Property Value
System.String
FunctionArn
The ARN fo the function.
public override string FunctionArn { get; }
Property Value
System.String
Overrides
FunctionName
The name of the function.
public override string FunctionName { get; }
Property Value
System.String
Overrides
GrantPrincipal
The principal this Lambda Function is running as.
public override IPrincipal GrantPrincipal { get; }
Property Value
Overrides
Lambda
The underlying AWS Lambda function.
public override IFunction Lambda { get; }
Property Value
Overrides
Qualifier
The qualifier of the version or alias of this function.
protected override string Qualifier { get; }
Property Value
System.String
Overrides
Remarks
A qualifier is the identifier that's appended to a version or alias ARN.
Role
The IAM role associated with this function.
public override IRole Role { get; }
Property Value
Overrides
Remarks
Undefined if the function was imported without a role.
Version
The most recently deployed version of this function.
public virtual string Version { get; }
Property Value
System.String
Methods
AddAlias(String, IAliasOptions)
(deprecated) Defines an alias for this version.
public virtual Alias AddAlias(string aliasName, IAliasOptions options = null)
Parameters
- aliasName System.String
The name of the alias (e.g. "live").
- options IAliasOptions
Alias options.
Returns
Remarks
Stability: Deprecated
FromVersionArn(Construct, String, String)
Construct a Version object from a Version ARN.
public static IVersion FromVersionArn(Construct scope, string id, string versionArn)
Parameters
- scope Constructs.Construct
The cdk scope creating this resource.
- id System.String
The cdk id of this resource.
- versionArn System.String
The version ARN to create this version from.
Returns
FromVersionAttributes(Construct, String, IVersionAttributes)
public static IVersion FromVersionAttributes(Construct scope, string id, IVersionAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IVersionAttributes
Returns
Metric(String, IMetricOptions)
Return the given named metric for this Function.
public override Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.String
- props IMetricOptions
Returns