Class: AWSCDK::Pipes::CfnPipe::PlacementStrategyProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
pipes/cfn_pipe.rb

Overview

The task placement strategy for a task or service.

To learn more, see Task Placement Strategies in the Amazon Elastic Container Service Service Developer Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field: nil, type: nil) ⇒ PlacementStrategyProperty

Returns a new instance of PlacementStrategyProperty.

Parameters:

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

    The field to apply the placement strategy against.

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

    The type of placement strategy.



4065
4066
4067
4068
4069
4070
# File 'pipes/cfn_pipe.rb', line 4065

def initialize(field: nil, type: nil)
  @field = field
  Jsii::Type.check_type(@field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "field") unless @field.nil?
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type") unless @type.nil?
end

Instance Attribute Details

#fieldString? (readonly)

The field to apply the placement strategy against.

For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are cpu and memory. For the random placement strategy, this field is not used.



4078
4079
4080
# File 'pipes/cfn_pipe.rb', line 4078

def field
  @field
end

#typeString? (readonly)

The type of placement strategy.

The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).



4085
4086
4087
# File 'pipes/cfn_pipe.rb', line 4085

def type
  @type
end

Class Method Details

.jsii_propertiesObject



4087
4088
4089
4090
4091
4092
# File 'pipes/cfn_pipe.rb', line 4087

def self.jsii_properties
  {
    :field => "field",
    :type => "type",
  }
end

Instance Method Details

#to_jsiiObject



4094
4095
4096
4097
4098
4099
4100
4101
# File 'pipes/cfn_pipe.rb', line 4094

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