Class: AWSCDK::Lambda::VersionOptions

Inherits:
EventInvokeConfigOptions
  • Object
show all
Defined in:
lambda/version_options.rb

Overview

Options for lambda.Version.

Direct Known Subclasses

VersionProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_event_age: nil, on_failure: nil, on_success: nil, retry_attempts: nil, code_sha256: nil, description: nil, max_execution_environments: nil, min_execution_environments: nil, provisioned_concurrent_executions: nil, removal_policy: nil) ⇒ VersionOptions

Returns a new instance of VersionOptions.

Parameters:

  • max_event_age (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum age of a request that Lambda sends to a function for processing.

  • on_failure (AWSCDK::Lambda::IDestination, nil) (defaults to: nil)

    The destination for failed invocations.

  • on_success (AWSCDK::Lambda::IDestination, nil) (defaults to: nil)

    The destination for successful invocations.

  • retry_attempts (Numeric, nil) (defaults to: nil)

    The maximum number of times to retry when the function returns an error.

  • code_sha256 (String, nil) (defaults to: nil)

    SHA256 of the version of the Lambda source code.

  • description (String, nil) (defaults to: nil)

    Description of the version.

  • max_execution_environments (Numeric, nil) (defaults to: nil)

    The maximum number of execution environments allowed for this version when published into a capacity provider.

  • min_execution_environments (Numeric, nil) (defaults to: nil)

    The minimum number of execution environments to maintain for this version when published into a capacity provider.

  • provisioned_concurrent_executions (Numeric, nil) (defaults to: nil)

    Specifies a provisioned concurrency configuration for a function's version.

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    Whether to retain old versions of this function when a new version is created.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lambda/version_options.rb', line 17

def initialize(max_event_age: nil, on_failure: nil, on_success: nil, retry_attempts: nil, code_sha256: nil, description: nil, max_execution_environments: nil, min_execution_environments: nil, provisioned_concurrent_executions: nil, removal_policy: nil)
  @max_event_age = max_event_age
  Jsii::Type.check_type(@max_event_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxEventAge") unless @max_event_age.nil?
  @on_failure = on_failure
  Jsii::Type.check_type(@on_failure, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklEZXN0aW5hdGlvbiJ9")), "onFailure") unless @on_failure.nil?
  @on_success = on_success
  Jsii::Type.check_type(@on_success, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklEZXN0aW5hdGlvbiJ9")), "onSuccess") unless @on_success.nil?
  @retry_attempts = retry_attempts
  Jsii::Type.check_type(@retry_attempts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retryAttempts") unless @retry_attempts.nil?
  @code_sha256 = code_sha256
  Jsii::Type.check_type(@code_sha256, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "codeSha256") unless @code_sha256.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @max_execution_environments = max_execution_environments
  Jsii::Type.check_type(@max_execution_environments, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxExecutionEnvironments") unless @max_execution_environments.nil?
  @min_execution_environments = min_execution_environments
  Jsii::Type.check_type(@min_execution_environments, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minExecutionEnvironments") unless @min_execution_environments.nil?
  @provisioned_concurrent_executions = provisioned_concurrent_executions
  Jsii::Type.check_type(@provisioned_concurrent_executions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "provisionedConcurrentExecutions") unless @provisioned_concurrent_executions.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
end

Instance Attribute Details

#code_sha256String? (readonly)

Note:

Default: No validation is performed

SHA256 of the version of the Lambda source code.

Specify to validate that you're deploying the right version.

Returns:

  • (String, nil)


72
73
74
# File 'lambda/version_options.rb', line 72

def code_sha256
  @code_sha256
end

#descriptionString? (readonly)

Note:

Default: Description of the Lambda

Description of the version.

Returns:

  • (String, nil)


77
78
79
# File 'lambda/version_options.rb', line 77

def description
  @description
end

#max_event_ageAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(6)

The maximum age of a request that Lambda sends to a function for processing.

Minimum: 60 seconds Maximum: 6 hours

Returns:



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

def max_event_age
  @max_event_age
end

#max_execution_environmentsNumeric? (readonly)

Note:

Default: - No maximum specified

The maximum number of execution environments allowed for this version when published into a capacity provider.

This setting limits the total number of execution environments that can be created to handle concurrent invocations of this specific version.

Returns:

  • (Numeric, nil)


85
86
87
# File 'lambda/version_options.rb', line 85

def max_execution_environments
  @max_execution_environments
end

#min_execution_environmentsNumeric? (readonly)

Note:

Default: - 3 execution environments are set to be the minimum

The minimum number of execution environments to maintain for this version when published into a capacity provider.

This setting ensures that at least this many execution environments are always available to handle function invocations for this specific version, reducing cold start latency.

Returns:

  • (Numeric, nil)


93
94
95
# File 'lambda/version_options.rb', line 93

def min_execution_environments
  @min_execution_environments
end

#on_failureAWSCDK::Lambda::IDestination? (readonly)

Note:

Default: - no destination

The destination for failed invocations.



52
53
54
# File 'lambda/version_options.rb', line 52

def on_failure
  @on_failure
end

#on_successAWSCDK::Lambda::IDestination? (readonly)

Note:

Default: - no destination

The destination for successful invocations.



57
58
59
# File 'lambda/version_options.rb', line 57

def on_success
  @on_success
end

#provisioned_concurrent_executionsNumeric? (readonly)

Note:

Default: No provisioned concurrency

Specifies a provisioned concurrency configuration for a function's version.

Returns:

  • (Numeric, nil)


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

def provisioned_concurrent_executions
  @provisioned_concurrent_executions
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

Whether to retain old versions of this function when a new version is created.

Returns:



103
104
105
# File 'lambda/version_options.rb', line 103

def removal_policy
  @removal_policy
end

#retry_attemptsNumeric? (readonly)

Note:

Default: 2

The maximum number of times to retry when the function returns an error.

Minimum: 0 Maximum: 2

Returns:

  • (Numeric, nil)


65
66
67
# File 'lambda/version_options.rb', line 65

def retry_attempts
  @retry_attempts
end

Class Method Details

.jsii_propertiesObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lambda/version_options.rb', line 105

def self.jsii_properties
  {
    :max_event_age => "maxEventAge",
    :on_failure => "onFailure",
    :on_success => "onSuccess",
    :retry_attempts => "retryAttempts",
    :code_sha256 => "codeSha256",
    :description => "description",
    :max_execution_environments => "maxExecutionEnvironments",
    :min_execution_environments => "minExecutionEnvironments",
    :provisioned_concurrent_executions => "provisionedConcurrentExecutions",
    :removal_policy => "removalPolicy",
  }
end

Instance Method Details

#to_jsiiObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lambda/version_options.rb', line 120

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "maxEventAge" => @max_event_age,
    "onFailure" => @on_failure,
    "onSuccess" => @on_success,
    "retryAttempts" => @retry_attempts,
    "codeSha256" => @code_sha256,
    "description" => @description,
    "maxExecutionEnvironments" => @max_execution_environments,
    "minExecutionEnvironments" => @min_execution_environments,
    "provisionedConcurrentExecutions" => @provisioned_concurrent_executions,
    "removalPolicy" => @removal_policy,
  })
  result.compact
end