Class: AWSCDK::ECS::PlacementConstraint

Inherits:
Jsii::Object
  • Object
show all
Defined in:
ecs/placement_constraint.rb

Overview

The placement constraints to use for tasks in the service. For more information, see Amazon ECS Task Placement Constraints.

Tasks will only be placed on instances that match these rules.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PlacementConstraint

Returns a new instance of PlacementConstraint.

Raises:

  • (NoMethodError)


10
11
12
# File 'ecs/placement_constraint.rb', line 10

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_ecs.PlacementConstraint does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.distinct_instancesAWSCDK::ECS::PlacementConstraint

Use distinctInstance to ensure that each task in a particular group is running on a different container instance.

Returns:

  • (AWSCDK::ECS::PlacementConstraint)


23
24
25
# File 'ecs/placement_constraint.rb', line 23

def self.distinct_instances()
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementConstraint", "distinctInstances", [])
end

.jsii_overridable_methodsObject



14
15
16
17
18
# File 'ecs/placement_constraint.rb', line 14

def self.jsii_overridable_methods
  {
    :to_json => { kind: :method, name: "toJson", is_optional: false },
  }
end

.member_of(*expressions) ⇒ AWSCDK::ECS::PlacementConstraint

Use memberOf to restrict the selection to a group of valid candidates specified by a query expression.

Multiple expressions can be specified. For more information, see Cluster Query Language.

You can specify multiple expressions in one call. The tasks will only be placed on instances matching all expressions.

Parameters:

  • expressions (Array<String>)

Returns:

  • (AWSCDK::ECS::PlacementConstraint)

See Also:



37
38
39
40
41
42
# File 'ecs/placement_constraint.rb', line 37

def self.member_of(*expressions)
  expressions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expressions[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.PlacementConstraint", "memberOf", [*expressions])
end

Instance Method Details

#to_jsonArray<AWSCDK::ECS::CfnService::PlacementConstraintProperty>

Return the placement JSON.



47
48
49
# File 'ecs/placement_constraint.rb', line 47

def to_json()
  jsii_call_method("toJson", [])
end