Class: AWSCDK::ECS::PlacementStrategy
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::ECS::PlacementStrategy
- Defined in:
- ecs/placement_strategy.rb
Overview
The placement strategies to use for tasks in the service. For more information, see Amazon ECS Task Placement Strategies.
Tasks will preferentially be placed on instances that match these rules.
Class Method Summary collapse
- .jsii_overridable_methods ⇒ Object
-
.packed_by(resource) ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on the container instances with the least available capacity of the specified resource.
-
.packed_by_cpu ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on container instances with the least available amount of CPU capacity.
-
.packed_by_memory ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on container instances with the least available amount of memory capacity.
-
.randomly ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks randomly.
-
.spread_across(*fields) ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks evenly based on the specified value.
-
.spread_across_instances ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks evenly across all container instances in the cluster.
Instance Method Summary collapse
-
#initialize(*args) ⇒ PlacementStrategy
constructor
A new instance of PlacementStrategy.
-
#to_json ⇒ Array<AWSCDK::ECS::CfnService::PlacementStrategyProperty>
Return the placement JSON.
Constructor Details
#initialize(*args) ⇒ PlacementStrategy
Returns a new instance of PlacementStrategy.
10 11 12 |
# File 'ecs/placement_strategy.rb', line 10 def initialize(*args) raise NoMethodError, "aws-cdk-lib.aws_ecs.PlacementStrategy does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.jsii_overridable_methods ⇒ Object
14 15 16 17 18 |
# File 'ecs/placement_strategy.rb', line 14 def self.jsii_overridable_methods { :to_json => { kind: :method, name: "toJson", is_optional: false }, } end |
.packed_by(resource) ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on the container instances with the least available capacity of the specified resource.
24 25 26 27 |
# File 'ecs/placement_strategy.rb', line 24 def self.packed_by(resource) Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJpblBhY2tSZXNvdXJjZSJ9")), "resource") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "packedBy", [resource]) end |
.packed_by_cpu ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on container instances with the least available amount of CPU capacity.
This minimizes the number of instances in use.
34 35 36 |
# File 'ecs/placement_strategy.rb', line 34 def self.packed_by_cpu() Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "packedByCpu", []) end |
.packed_by_memory ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks on container instances with the least available amount of memory capacity.
This minimizes the number of instances in use.
43 44 45 |
# File 'ecs/placement_strategy.rb', line 43 def self.packed_by_memory() Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "packedByMemory", []) end |
.randomly ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks randomly.
50 51 52 |
# File 'ecs/placement_strategy.rb', line 50 def self.randomly() Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "randomly", []) end |
.spread_across(*fields) ⇒ AWSCDK::ECS::PlacementStrategy
Default: attributes instanceId
Places tasks evenly based on the specified value.
You can use one of the built-in attributes found on BuiltInAttributes
or supply your own custom instance attributes. If more than one attribute
is supplied, spreading is done in order.
63 64 65 66 67 68 |
# File 'ecs/placement_strategy.rb', line 63 def self.spread_across(*fields) fields.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "fields[#{index}]") end Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "spreadAcross", [*fields]) end |
.spread_across_instances ⇒ AWSCDK::ECS::PlacementStrategy
Places tasks evenly across all container instances in the cluster.
73 74 75 |
# File 'ecs/placement_strategy.rb', line 73 def self.spread_across_instances() Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementStrategy", "spreadAcrossInstances", []) end |
Instance Method Details
#to_json ⇒ Array<AWSCDK::ECS::CfnService::PlacementStrategyProperty>
Return the placement JSON.
80 81 82 |
# File 'ecs/placement_strategy.rb', line 80 def to_json() jsii_call_method("toJson", []) end |