Module: AWSCDK::Lambda::IVersion

Includes:
Interfaces::AWSLambda::IVersionRef, IFunction
Included in:
CloudFront::Experimental::EdgeFunction, Version
Defined in:
lambda/i_version.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lambda/i_version.rb', line 387

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :function_ref => { kind: :property, name: "functionRef", is_optional: false },
    :architecture => { kind: :property, name: "architecture", is_optional: false },
    :function_arn => { kind: :property, name: "functionArn", is_optional: false },
    :function_name => { kind: :property, name: "functionName", 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 },
    :version_ref => { kind: :property, name: "versionRef", is_optional: false },
    :edge_arn => { kind: :property, name: "edgeArn", is_optional: false },
    :lambda => { kind: :property, name: "lambda", is_optional: false },
    :version => { kind: :property, name: "version", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", 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 },
    :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 },
    :add_alias => { kind: :method, name: "addAlias", is_optional: false },
  }
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:

Returns:



380
381
382
383
384
385
# File 'lambda/i_version.rb', line 380

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:



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

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.

Parameters:

Returns:



215
216
217
218
219
220
# File 'lambda/i_version.rb', line 215

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:



226
227
228
229
230
# File 'lambda/i_version.rb', line 226

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:



238
239
240
241
242
243
# File 'lambda/i_version.rb', line 238

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:



249
250
251
252
# File 'lambda/i_version.rb', line 249

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_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:



187
188
189
190
# File 'lambda/i_version.rb', line 187

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 system architectures compatible with this lambda function.



61
62
63
# File 'lambda/i_version.rb', line 61

def architecture()
  jsii_get_property("architecture")
end

#configure_async_invoke(options) ⇒ void

This method returns an undefined value.

Configures options for asynchronous invocation.



258
259
260
261
262
# File 'lambda/i_version.rb', line 258

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

The network connections associated with this resource.



40
41
42
# File 'lambda/i_version.rb', line 40

def connections()
  jsii_get_property("connections")
end

#edge_arnString

The ARN of the version for Lambda@Edge.

Returns:

  • (String)


143
144
145
# File 'lambda/i_version.rb', line 143

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.



26
27
28
# File 'lambda/i_version.rb', line 26

def env()
  jsii_get_property("env")
end

#function_arnString

The ARN of the function.

Returns:

  • (String)


68
69
70
# File 'lambda/i_version.rb', line 68

def function_arn()
  jsii_get_property("functionArn")
end

#function_nameString

The name of the function.

Returns:

  • (String)


75
76
77
# File 'lambda/i_version.rb', line 75

def function_name()
  jsii_get_property("functionName")
end

#function_refAWSCDK::Interfaces::AWSLambda::FunctionReference

A reference to a Function resource.



54
55
56
# File 'lambda/i_version.rb', line 54

def function_ref()
  jsii_get_property("functionRef")
end

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

Grant the given identity permissions to invoke this Lambda.

Parameters:

Returns:



268
269
270
271
# File 'lambda/i_version.rb', line 268

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

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

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

Parameters:

Returns:



277
278
279
280
# File 'lambda/i_version.rb', line 277

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(identity) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



286
287
288
289
# File 'lambda/i_version.rb', line 286

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

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

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

Parameters:

Returns:



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

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

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

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

Parameters:

Returns:



305
306
307
308
309
# File 'lambda/i_version.rb', line 305

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

#grant_principalAWSCDK::IAM::IPrincipal

The principal to grant permissions to.



47
48
49
# File 'lambda/i_version.rb', line 47

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)


84
85
86
# File 'lambda/i_version.rb', line 84

def is_bound_to_vpc()
  jsii_get_property("isBoundToVpc")
end

#lambdaAWSCDK::Lambda::IFunction

The underlying AWS Lambda function.



150
151
152
# File 'lambda/i_version.rb', line 150

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.

Returns:

  • (AWSCDK::Lambda::IVersion)


98
99
100
# File 'lambda/i_version.rb', line 98

def latest_version()
  jsii_get_property("latestVersion")
end

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

Return the given named metric for this Lambda Return the given named metric for this Function.

Parameters:

Returns:



316
317
318
319
320
321
# File 'lambda/i_version.rb', line 316

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

Note:

Default: average over 5 minutes

Metric for the Duration of this Lambda How long execution of this Lambda takes.

Average over 5 minutes

Parameters:

Returns:



330
331
332
333
334
# File 'lambda/i_version.rb', line 330

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:



342
343
344
345
346
# File 'lambda/i_version.rb', line 342

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

Note:

Default: sum over 5 minutes

Metric for the number of invocations of this Lambda How often this Lambda is invoked.

Sum over 5 minutes

Parameters:

Returns:



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

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

Note:

Default: sum over 5 minutes

Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.

Sum over 5 minutes

Parameters:

Returns:



368
369
370
371
372
# File 'lambda/i_version.rb', line 368

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)


11
12
13
# File 'lambda/i_version.rb', line 11

def node()
  jsii_get_property("node")
end

#permissions_nodeConstructs::Node

The construct node where permissions are attached.

Returns:

  • (Constructs::Node)


105
106
107
# File 'lambda/i_version.rb', line 105

def permissions_node()
  jsii_get_property("permissionsNode")
end

#resource_arns_for_grant_invokeArray<String>

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

This property is for cdk modules to consume only. You should not need to use this property. Instead, use grantInvoke() directly.

Returns:

  • (Array<String>)


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

def resource_arns_for_grant_invoke()
  jsii_get_property("resourceArnsForGrantInvoke")
end

#roleAWSCDK::IAM::IRole?

The IAM role associated with this function.

Returns:



122
123
124
# File 'lambda/i_version.rb', line 122

def role()
  jsii_get_property("role")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



33
34
35
# File 'lambda/i_version.rb', line 33

def stack()
  jsii_get_property("stack")
end

#tenancy_configAWSCDK::Lambda::TenancyConfig?

The tenancy configuration for this function.



129
130
131
# File 'lambda/i_version.rb', line 129

def tenancy_config()
  jsii_get_property("tenancyConfig")
end

#versionString

The most recently deployed version of this function.

Returns:

  • (String)


157
158
159
# File 'lambda/i_version.rb', line 157

def version()
  jsii_get_property("version")
end

#version_refAWSCDK::Interfaces::AWSLambda::VersionReference

A reference to a Version resource.



136
137
138
# File 'lambda/i_version.rb', line 136

def version_ref()
  jsii_get_property("versionRef")
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.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



168
169
170
171
172
173
# File 'lambda/i_version.rb', line 168

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