Class: AWSCDK::CodeDeploy::TrafficRoutingConfig

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
code_deploy/traffic_routing_config.rb

Overview

Represents the structure to pass into the underlying CfnDeploymentConfig class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, time_based_canary: nil, time_based_linear: nil) ⇒ TrafficRoutingConfig

Returns a new instance of TrafficRoutingConfig.

Parameters:

  • type (String)

    The type of traffic shifting ( TimeBasedCanary or TimeBasedLinear ) used by a deployment configuration.

  • time_based_canary (AWSCDK::CodeDeploy::CanaryTrafficRoutingConfig, nil) (defaults to: nil)

    A configuration that shifts traffic from one version of a Lambda function or ECS task set to another in two increments.

  • time_based_linear (AWSCDK::CodeDeploy::LinearTrafficRoutingConfig, nil) (defaults to: nil)

    A configuration that shifts traffic from one version of a Lambda function or Amazon ECS task set to another in equal increments, with an equal number of minutes between each increment.



10
11
12
13
14
15
16
17
# File 'code_deploy/traffic_routing_config.rb', line 10

def initialize(type:, time_based_canary: nil, time_based_linear: nil)
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @time_based_canary = time_based_canary.is_a?(Hash) ? ::AWSCDK::CodeDeploy::CanaryTrafficRoutingConfig.new(**time_based_canary.transform_keys(&:to_sym)) : time_based_canary
  Jsii::Type.check_type(@time_based_canary, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWRlcGxveS5DYW5hcnlUcmFmZmljUm91dGluZ0NvbmZpZyJ9")), "timeBasedCanary") unless @time_based_canary.nil?
  @time_based_linear = time_based_linear.is_a?(Hash) ? ::AWSCDK::CodeDeploy::LinearTrafficRoutingConfig.new(**time_based_linear.transform_keys(&:to_sym)) : time_based_linear
  Jsii::Type.check_type(@time_based_linear, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWRlcGxveS5MaW5lYXJUcmFmZmljUm91dGluZ0NvbmZpZyJ9")), "timeBasedLinear") unless @time_based_linear.nil?
end

Instance Attribute Details

#time_based_canaryAWSCDK::CodeDeploy::CanaryTrafficRoutingConfig? (readonly)

Note:

Default: none

A configuration that shifts traffic from one version of a Lambda function or ECS task set to another in two increments.



27
28
29
# File 'code_deploy/traffic_routing_config.rb', line 27

def time_based_canary
  @time_based_canary
end

#time_based_linearAWSCDK::CodeDeploy::LinearTrafficRoutingConfig? (readonly)

Note:

Default: none

A configuration that shifts traffic from one version of a Lambda function or Amazon ECS task set to another in equal increments, with an equal number of minutes between each increment.



32
33
34
# File 'code_deploy/traffic_routing_config.rb', line 32

def time_based_linear
  @time_based_linear
end

#typeString (readonly)

The type of traffic shifting ( TimeBasedCanary or TimeBasedLinear ) used by a deployment configuration.

Returns:

  • (String)


22
23
24
# File 'code_deploy/traffic_routing_config.rb', line 22

def type
  @type
end

Class Method Details

.jsii_propertiesObject



34
35
36
37
38
39
40
# File 'code_deploy/traffic_routing_config.rb', line 34

def self.jsii_properties
  {
    :type => "type",
    :time_based_canary => "timeBasedCanary",
    :time_based_linear => "timeBasedLinear",
  }
end

Instance Method Details

#to_jsiiObject



42
43
44
45
46
47
48
49
50
# File 'code_deploy/traffic_routing_config.rb', line 42

def to_jsii
  result = {}
  result.merge!({
    "type" => @type,
    "timeBasedCanary" => @time_based_canary,
    "timeBasedLinear" => @time_based_linear,
  })
  result.compact
end