Class: AWSCDK::AppMesh::CfnRoute::WeightedTargetProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
app_mesh/cfn_route.rb

Overview

An object that represents a target and its relative weight.

Traffic is distributed across targets according to their relative weight. For example, a weighted target with a relative weight of 50 receives five times as much traffic as one with a relative weight of 10. The total weight for all targets combined must be less than or equal to 100.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(virtual_node:, weight:, port: nil) ⇒ WeightedTargetProperty

Returns a new instance of WeightedTargetProperty.

Parameters:

  • virtual_node (String)

    The virtual node to associate with the weighted target.

  • weight (Numeric)

    The relative weight of the weighted target.

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

    The targeted port of the weighted object.



1951
1952
1953
1954
1955
1956
1957
1958
# File 'app_mesh/cfn_route.rb', line 1951

def initialize(virtual_node:, weight:, port: nil)
  @virtual_node = virtual_node
  Jsii::Type.check_type(@virtual_node, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "virtualNode")
  @weight = weight
  Jsii::Type.check_type(@weight, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "weight")
  @port = port
  Jsii::Type.check_type(@port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "port") unless @port.nil?
end

Instance Attribute Details

#portNumeric? (readonly)

The targeted port of the weighted object.



1974
1975
1976
# File 'app_mesh/cfn_route.rb', line 1974

def port
  @port
end

#virtual_nodeString (readonly)

The virtual node to associate with the weighted target.



1964
1965
1966
# File 'app_mesh/cfn_route.rb', line 1964

def virtual_node
  @virtual_node
end

#weightNumeric (readonly)

The relative weight of the weighted target.



1969
1970
1971
# File 'app_mesh/cfn_route.rb', line 1969

def weight
  @weight
end

Class Method Details

.jsii_propertiesObject



1976
1977
1978
1979
1980
1981
1982
# File 'app_mesh/cfn_route.rb', line 1976

def self.jsii_properties
  {
    :virtual_node => "virtualNode",
    :weight => "weight",
    :port => "port",
  }
end

Instance Method Details

#to_jsiiObject



1984
1985
1986
1987
1988
1989
1990
1991
1992
# File 'app_mesh/cfn_route.rb', line 1984

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