Class: AWSCDK::Lambda::VersionWeight

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lambda/version_weight.rb

Overview

A version/weight pair for routing traffic to Lambda functions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version:, weight:) ⇒ VersionWeight

Returns a new instance of VersionWeight.

Parameters:

  • version (AWSCDK::Lambda::IVersion)

    The version to route traffic to.

  • weight (Numeric)

    How much weight to assign to this version (0..1).



9
10
11
12
13
14
# File 'lambda/version_weight.rb', line 9

def initialize(version:, weight:)
  @version = version
  Jsii::Type.check_type(@version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklWZXJzaW9uIn0=")), "version")
  @weight = weight
  Jsii::Type.check_type(@weight, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "weight")
end

Instance Attribute Details

#versionAWSCDK::Lambda::IVersion (readonly)

The version to route traffic to.



19
20
21
# File 'lambda/version_weight.rb', line 19

def version
  @version
end

#weightNumeric (readonly)

How much weight to assign to this version (0..1).

Returns:

  • (Numeric)


23
24
25
# File 'lambda/version_weight.rb', line 23

def weight
  @weight
end

Class Method Details

.jsii_propertiesObject



25
26
27
28
29
30
# File 'lambda/version_weight.rb', line 25

def self.jsii_properties
  {
    :version => "version",
    :weight => "weight",
  }
end

Instance Method Details

#to_jsiiObject



32
33
34
35
36
37
38
39
# File 'lambda/version_weight.rb', line 32

def to_jsii
  result = {}
  result.merge!({
    "version" => @version,
    "weight" => @weight,
  })
  result.compact
end