Class: AWSCDK::Lambda::Version

Inherits:
QualifiedFunctionBase
  • Object
show all
Includes:
IVersion
Defined in:
lambda/version.rb

Overview

Tag the current state of a Function with a Version number.

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 code_sha256 property while creating the `Version.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ Version

Returns a new instance of Version.

Parameters:



26
27
28
29
30
31
32
# File 'lambda/version.rb', line 26

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Lambda::VersionProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlZlcnNpb25Qcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_version_arn(scope, id, version_arn) ⇒ AWSCDK::Lambda::IVersion

Construct a Version object from a Version ARN.

Parameters:

  • scope (Constructs::Construct)

    The cdk scope creating this resource.

  • id (String)

    The cdk id of this resource.

  • version_arn (String)

    The version ARN to create this version from.

Returns:



93
94
95
96
97
98
# File 'lambda/version.rb', line 93

def self.from_version_arn(scope, id, version_arn)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(version_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "versionArn")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_lambda.Version", "fromVersionArn", [scope, id, version_arn])
end

.from_version_attributes(scope, id, attrs) ⇒ AWSCDK::Lambda::IVersion

Parameters:

Returns:



104
105
106
107
108
109
110
# File 'lambda/version.rb', line 104

def self.from_version_attributes(scope, id, attrs)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  attrs = attrs.is_a?(Hash) ? ::AWSCDK::Lambda::VersionAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlZlcnNpb25BdHRyaWJ1dGVzIn0=")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_lambda.Version", "fromVersionAttributes", [scope, id, attrs])
end

.jsii_overridable_methodsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lambda/version.rb', line 34

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :physical_name => { kind: :property, name: "physicalName", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :architecture => { kind: :property, name: "architecture", is_optional: false },
    :can_create_permissions => { kind: :property, name: "canCreatePermissions", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :function_arn => { kind: :property, name: "functionArn", is_optional: false },
    :function_name => { kind: :property, name: "functionName", is_optional: false },
    :function_ref => { kind: :property, name: "functionRef", is_optional: false },
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :is_bound_to_vpc => { kind: :property, name: "isBoundToVpc", is_optional: false },
    :latest_version => { kind: :property, name: "latestVersion", is_optional: false },
    :permissions_node => { kind: :property, name: "permissionsNode", is_optional: false },
    :resource_arns_for_grant_invoke => { kind: :property, name: "resourceArnsForGrantInvoke", is_optional: false },
    :role => { kind: :property, name: "role", is_optional: true },
    :tenancy_config => { kind: :property, name: "tenancyConfig", is_optional: true },
    :lambda => { kind: :property, name: "lambda", is_optional: false },
    :qualifier => { kind: :property, name: "qualifier", is_optional: false },
    :edge_arn => { kind: :property, name: "edgeArn", is_optional: false },
    :version => { kind: :property, name: "version", is_optional: false },
    :version_ref => { kind: :property, name: "versionRef", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false },
    :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false },
    :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false },
    :add_event_source => { kind: :method, name: "addEventSource", is_optional: false },
    :add_event_source_mapping => { kind: :method, name: "addEventSourceMapping", is_optional: false },
    :add_function_url => { kind: :method, name: "addFunctionUrl", is_optional: false },
    :add_permission => { kind: :method, name: "addPermission", is_optional: false },
    :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false },
    :configure_async_invoke => { kind: :method, name: "configureAsyncInvoke", is_optional: false },
    :consider_warning_on_invoke_function_permissions => { kind: :method, name: "considerWarningOnInvokeFunctionPermissions", is_optional: false },
    :grant_invoke => { kind: :method, name: "grantInvoke", is_optional: false },
    :grant_invoke_composite_principal => { kind: :method, name: "grantInvokeCompositePrincipal", is_optional: false },
    :grant_invoke_latest_version => { kind: :method, name: "grantInvokeLatestVersion", is_optional: false },
    :grant_invoke_url => { kind: :method, name: "grantInvokeUrl", is_optional: false },
    :grant_invoke_version => { kind: :method, name: "grantInvokeVersion", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_duration => { kind: :method, name: "metricDuration", is_optional: false },
    :metric_errors => { kind: :method, name: "metricErrors", is_optional: false },
    :metric_invocations => { kind: :method, name: "metricInvocations", is_optional: false },
    :metric_throttles => { kind: :method, name: "metricThrottles", is_optional: false },
    :warn_invoke_function_permissions => { kind: :method, name: "warnInvokeFunctionPermissions", is_optional: false },
    :add_alias => { kind: :method, name: "addAlias", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


281
282
283
# File 'lambda/version.rb', line 281

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_lambda.Version", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_alias(alias_name, options = nil) ⇒ AWSCDK::Lambda::Alias

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.

Defines an alias for this version.

Parameters:

  • alias_name (String)

    The name of the alias (e.g. "live").

  • options (AWSCDK::Lambda::AliasOptions, nil) (defaults to: nil)

    Alias options.

Returns:



614
615
616
617
618
619
# File 'lambda/version.rb', line 614

def add_alias(alias_name, options = nil)
  Jsii::Type.check_type(alias_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "aliasName")
  options = options.is_a?(Hash) ? ::AWSCDK::Lambda::AliasOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkFsaWFzT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("addAlias", [alias_name, options])
end

#add_event_source(source) ⇒ void

This method returns an undefined value.

Adds an event source to this function.

Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:



409
410
411
412
# File 'lambda/version.rb', line 409

def add_event_source(source)
  Jsii::Type.check_type(source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklFdmVudFNvdXJjZSJ9")), "source")
  jsii_call_method("addEventSource", [source])
end

#add_event_source_mapping(id, options) ⇒ AWSCDK::Lambda::EventSourceMapping

Adds an event source that maps to this AWS Lambda function.



419
420
421
422
423
424
# File 'lambda/version.rb', line 419

def add_event_source_mapping(id, options)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::Lambda::EventSourceMappingOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkV2ZW50U291cmNlTWFwcGluZ09wdGlvbnMifQ==")), "options")
  jsii_call_method("addEventSourceMapping", [id, options])
end

#add_function_url(options = nil) ⇒ AWSCDK::Lambda::FunctionURL

Adds a url to this lambda function.

Parameters:

Returns:



430
431
432
433
434
# File 'lambda/version.rb', line 430

def add_function_url(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::Lambda::FunctionURLOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkZ1bmN0aW9uVXJsT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("addFunctionUrl", [options])
end

#add_permission(id, permission) ⇒ void

This method returns an undefined value.

Adds a permission to the Lambda resource policy.

Parameters:

  • id (String)

    The id for the permission construct.

  • permission (AWSCDK::Lambda::Permission)

    The permission to grant to this Lambda function.

See Also:



442
443
444
445
446
447
# File 'lambda/version.rb', line 442

def add_permission(id, permission)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  permission = permission.is_a?(Hash) ? ::AWSCDK::Lambda::Permission.new(**permission.transform_keys(&:to_sym)) : permission
  Jsii::Type.check_type(permission, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlBlcm1pc3Npb24ifQ==")), "permission")
  jsii_call_method("addPermission", [id, permission])
end

#add_to_role_policy(statement) ⇒ void

This method returns an undefined value.

Adds a statement to the IAM role assumed by the instance.

Parameters:



453
454
455
456
# File 'lambda/version.rb', line 453

def add_to_role_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToRolePolicy", [statement])
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Override the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters:



339
340
341
342
# File 'lambda/version.rb', line 339

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



356
357
358
359
# File 'lambda/version.rb', line 356

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#architectureAWSCDK::Lambda::Architecture

The architecture of this Lambda Function.



158
159
160
# File 'lambda/version.rb', line 158

def architecture()
  jsii_get_property("architecture")
end

#can_create_permissionsBoolean

Whether the addPermission() call adds any permissions.

True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.

Returns:

  • (Boolean)


168
169
170
# File 'lambda/version.rb', line 168

def can_create_permissions()
  jsii_get_property("canCreatePermissions")
end

#configure_async_invoke(options) ⇒ void

This method returns an undefined value.

Configures options for asynchronous invocation.



462
463
464
465
466
# File 'lambda/version.rb', line 462

def configure_async_invoke(options)
  options = options.is_a?(Hash) ? ::AWSCDK::Lambda::EventInvokeConfigOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkV2ZW50SW52b2tlQ29uZmlnT3B0aW9ucyJ9")), "options")
  jsii_call_method("configureAsyncInvoke", [options])
end

#connectionsAWSCDK::EC2::Connections

Access the Connections object.

Will fail if not a VPC-enabled Lambda Function



177
178
179
# File 'lambda/version.rb', line 177

def connections()
  jsii_get_property("connections")
end

#consider_warning_on_invoke_function_permissions(_scope, _action) ⇒ void

This method returns an undefined value.

A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.

  • function.currentVersion is invoked before or after the permission is created.

This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.

Parameters:

  • _scope (Constructs::Construct)
  • _action (String)


478
479
480
481
482
# File 'lambda/version.rb', line 478

def consider_warning_on_invoke_function_permissions(_scope, _action)
  Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope")
  Jsii::Type.check_type(_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "_action")
  jsii_call_method("considerWarningOnInvokeFunctionPermissions", [_scope, _action])
end

#edge_arnString

The ARN of the version for Lambda@Edge.

Returns:

  • (String)


288
289
290
# File 'lambda/version.rb', line 288

def edge_arn()
  jsii_get_property("edgeArn")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



130
131
132
# File 'lambda/version.rb', line 130

def env()
  jsii_get_property("env")
end

#function_arnString

The ARN fo the function.

Returns:

  • (String)


184
185
186
# File 'lambda/version.rb', line 184

def function_arn()
  jsii_get_property("functionArn")
end

#function_nameString

The name of the function.

Returns:

  • (String)


191
192
193
# File 'lambda/version.rb', line 191

def function_name()
  jsii_get_property("functionName")
end

#function_refAWSCDK::Interfaces::AWSLambda::FunctionReference

A reference to a Function resource.



198
199
200
# File 'lambda/version.rb', line 198

def function_ref()
  jsii_get_property("functionRef")
end

#generate_physical_nameString

Returns:

  • (String)


362
363
364
# File 'lambda/version.rb', line 362

def generate_physical_name()
  jsii_call_method("generatePhysicalName", [])
end

#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arn_attr, but if the resource is referenced across environments, arn_components will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arn_components.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


376
377
378
379
380
381
# File 'lambda/version.rb', line 376

def get_resource_arn_attribute(arn_attr, arn_components)
  Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr")
  arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components
  Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents")
  jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components])
end

#get_resource_name_attribute(name_attr) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to name_attr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


391
392
393
394
# File 'lambda/version.rb', line 391

def get_resource_name_attribute(name_attr)
  Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr")
  jsii_call_method("getResourceNameAttribute", [name_attr])
end

#grant_invoke(grantee) ⇒ AWSCDK::IAM::Grant

Grant the given identity permissions to invoke this Lambda.

[disable-awslint:no-grants]

Parameters:

Returns:



490
491
492
493
# File 'lambda/version.rb', line 490

def grant_invoke(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvoke", [grantee])
end

#grant_invoke_composite_principal(composite_principal) ⇒ Array<AWSCDK::IAM::Grant>

Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.

[disable-awslint:no-grants]

Parameters:

Returns:



501
502
503
504
# File 'lambda/version.rb', line 501

def grant_invoke_composite_principal(composite_principal)
  Jsii::Type.check_type(composite_principal, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLkNvbXBvc2l0ZVByaW5jaXBhbCJ9")), "compositePrincipal")
  jsii_call_method("grantInvokeCompositePrincipal", [composite_principal])
end

#grant_invoke_latest_version(grantee) ⇒ AWSCDK::IAM::Grant

Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.

[disable-awslint:no-grants]

Parameters:

Returns:



512
513
514
515
# File 'lambda/version.rb', line 512

def grant_invoke_latest_version(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvokeLatestVersion", [grantee])
end

#grant_invoke_url(grantee) ⇒ AWSCDK::IAM::Grant

Grant the given identity permissions to invoke this Lambda Function URL.

[disable-awslint:no-grants]

Parameters:

Returns:



523
524
525
526
# File 'lambda/version.rb', line 523

def grant_invoke_url(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvokeUrl", [grantee])
end

#grant_invoke_version(grantee, version) ⇒ AWSCDK::IAM::Grant

Grant the given identity permissions to invoke the given version of this Lambda.

[disable-awslint:no-grants]

Parameters:

Returns:



535
536
537
538
539
# File 'lambda/version.rb', line 535

def grant_invoke_version(grantee, version)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  Jsii::Type.check_type(version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklWZXJzaW9uIn0=")), "version")
  jsii_call_method("grantInvokeVersion", [grantee, version])
end

#grant_principalAWSCDK::IAM::IPrincipal

The principal this Lambda Function is running as.



205
206
207
# File 'lambda/version.rb', line 205

def grant_principal()
  jsii_get_property("grantPrincipal")
end

#is_bound_to_vpcBoolean

Whether or not this Lambda function was bound to a VPC.

If this is false, trying to access the connections object will fail.

Returns:

  • (Boolean)


214
215
216
# File 'lambda/version.rb', line 214

def is_bound_to_vpc()
  jsii_get_property("isBoundToVpc")
end

#lambdaAWSCDK::Lambda::IFunction

The underlying IFunction.



265
266
267
# File 'lambda/version.rb', line 265

def lambda()
  jsii_get_property("lambda")
end

#latest_versionAWSCDK::Lambda::IVersion

The $LATEST version of this function.

Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.

To obtain a reference to an explicit version which references the current function configuration, use lambdaFunction.currentVersion instead.



228
229
230
# File 'lambda/version.rb', line 228

def latest_version()
  jsii_get_property("latestVersion")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this Function.

Parameters:

Returns:



546
547
548
549
550
551
# File 'lambda/version.rb', line 546

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_duration(props = nil) ⇒ AWSCDK::CloudWatch::Metric

How long execution of this Lambda takes.

Average over 5 minutes

Parameters:

Returns:



559
560
561
562
563
# File 'lambda/version.rb', line 559

def metric_duration(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricDuration", [props])
end

#metric_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

How many invocations of this Lambda fail.

Sum over 5 minutes

Parameters:

Returns:



571
572
573
574
575
# File 'lambda/version.rb', line 571

def metric_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricErrors", [props])
end

#metric_invocations(props = nil) ⇒ AWSCDK::CloudWatch::Metric

How often this Lambda is invoked.

Sum over 5 minutes

Parameters:

Returns:



583
584
585
586
587
# File 'lambda/version.rb', line 583

def metric_invocations(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricInvocations", [props])
end

#metric_throttles(props = nil) ⇒ AWSCDK::CloudWatch::Metric

How often this Lambda is throttled.

Sum over 5 minutes

Parameters:

Returns:



595
596
597
598
599
# File 'lambda/version.rb', line 595

def metric_throttles(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricThrottles", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


115
116
117
# File 'lambda/version.rb', line 115

def node()
  jsii_get_property("node")
end

#permissions_nodeConstructs::Node

The construct node where permissions are attached.

Returns:

  • (Constructs::Node)


235
236
237
# File 'lambda/version.rb', line 235

def permissions_node()
  jsii_get_property("permissionsNode")
end

#physical_nameString

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

Returns:

  • (String)


144
145
146
# File 'lambda/version.rb', line 144

def physical_name()
  jsii_get_property("physicalName")
end

#qualifierString

The qualifier of the version or alias of this function.

A qualifier is the identifier that's appended to a version or alias ARN.

Returns:

  • (String)


274
275
276
# File 'lambda/version.rb', line 274

def qualifier()
  jsii_get_property("qualifier")
end

#resource_arns_for_grant_invokeArray<String>

The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().

Returns:

  • (Array<String>)


242
243
244
# File 'lambda/version.rb', line 242

def resource_arns_for_grant_invoke()
  jsii_get_property("resourceArnsForGrantInvoke")
end

#roleAWSCDK::IAM::IRole?

The IAM role associated with this function.

Undefined if the function was imported without a role.

Returns:



251
252
253
# File 'lambda/version.rb', line 251

def role()
  jsii_get_property("role")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



151
152
153
# File 'lambda/version.rb', line 151

def stack()
  jsii_get_property("stack")
end

#tenancy_configAWSCDK::Lambda::TenancyConfig?

The tenancy configuration for this function.



258
259
260
# File 'lambda/version.rb', line 258

def tenancy_config()
  jsii_get_property("tenancyConfig")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


309
310
311
# File 'lambda/version.rb', line 309

def to_string()
  jsii_call_method("toString", [])
end

#versionString

The most recently deployed version of this function.

Returns:

  • (String)


295
296
297
# File 'lambda/version.rb', line 295

def version()
  jsii_get_property("version")
end

#version_refAWSCDK::Interfaces::AWSLambda::VersionReference

A reference to a Version resource.



302
303
304
# File 'lambda/version.rb', line 302

def version_ref()
  jsii_get_property("versionRef")
end

#warn_invoke_function_permissions(scope) ⇒ void

This method returns an undefined value.

Parameters:

  • scope (Constructs::Construct)


603
604
605
606
# File 'lambda/version.rb', line 603

def warn_invoke_function_permissions(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  jsii_call_method("warnInvokeFunctionPermissions", [scope])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


322
323
324
325
326
327
# File 'lambda/version.rb', line 322

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end