Class: Aws::EC2::PlacementGroup
- Inherits:
-
Object
- Object
- Aws::EC2::PlacementGroup
- Extended by:
- Deprecations
- Defined in:
- sig/placement_group.rbs,
lib/aws-sdk-ec2/placement_group.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#group_arn ⇒ String
The Amazon Resource Name (ARN) of the placement group.
-
#group_id ⇒ String
The ID of the placement group.
-
#linked_group_id ⇒ String
Reserved for future use.
- #name ⇒ String (also: #group_name)
-
#operator ⇒ Types::OperatorResponse
The service provider that manages the Placement Group.
-
#parent_group_id ⇒ String
The ID of the parent placement group.
-
#partition_count ⇒ Integer
The number of partitions.
-
#spread_level ⇒ String
The spread level for the placement group.
-
#state ⇒ String
The state of the placement group.
-
#strategy ⇒ String
The placement strategy.
-
#tags ⇒ Array<Types::Tag>
Any tags applied to the placement group.
Actions collapse
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #instances(options = {}) ⇒ Instance::Collection
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::PlacementGroup
Returns the data for this PlacementGroup.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#initialize(*args) ⇒ PlacementGroup
constructor
A new instance of PlacementGroup.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current PlacementGroup.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
Constructor Details
#initialize(name, options = {}) ⇒ PlacementGroup #initialize(options = {}) ⇒ PlacementGroup
Returns a new instance of PlacementGroup.
13 14 15 |
# File 'sig/placement_group.rbs', line 13
def initialize: (String name, Hash[Symbol, untyped] options) -> void
| (name: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void
|
Instance Method Details
#data ⇒ Types::PlacementGroup
Returns the data for this Aws::EC2::PlacementGroup. Calls
Client#describe_placement_groups if #data_loaded? is false.
58 |
# File 'sig/placement_group.rbs', line 58
def data: () -> Types::PlacementGroup
|
#data_loaded? ⇒ Boolean
61 |
# File 'sig/placement_group.rbs', line 61
def data_loaded?: () -> bool
|
#delete(options = {}) ⇒ EmptyStructure
65 |
# File 'sig/placement_group.rbs', line 65
def delete: (
|
#group_arn ⇒ String
The Amazon Resource Name (ARN) of the placement group.
37 |
# File 'sig/placement_group.rbs', line 37
def group_arn: () -> ::String
|
#group_id ⇒ String
The ID of the placement group.
31 |
# File 'sig/placement_group.rbs', line 31
def group_id: () -> ::String
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
764 765 766 |
# File 'lib/aws-sdk-ec2/placement_group.rb', line 764 def identifiers { name: @name } end |
#instances(options = {}) ⇒ Instance::Collection
71 |
# File 'sig/placement_group.rbs', line 71
def instances: (
|
#linked_group_id ⇒ String
Reserved for future use.
43 |
# File 'sig/placement_group.rbs', line 43
def linked_group_id: () -> ::String
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::PlacementGroup.
Returns self making it possible to chain methods.
placement_group.reload.data
54 |
# File 'sig/placement_group.rbs', line 54
def load: () -> self
|
#name ⇒ String Also known as: group_name
18 |
# File 'sig/placement_group.rbs', line 18
def name: () -> String
|
#operator ⇒ Types::OperatorResponse
The service provider that manages the Placement Group.
46 |
# File 'sig/placement_group.rbs', line 46
def operator: () -> Types::OperatorResponse
|
#parent_group_id ⇒ String
The ID of the parent placement group.
49 |
# File 'sig/placement_group.rbs', line 49
def parent_group_id: () -> ::String
|
#partition_count ⇒ Integer
The number of partitions. Valid only if strategy is set to
partition.
28 |
# File 'sig/placement_group.rbs', line 28
def partition_count: () -> ::Integer
|
#spread_level ⇒ String
The spread level for the placement group. Only Outpost placement groups can be spread across hosts.
40 |
# File 'sig/placement_group.rbs', line 40
def spread_level: () -> ("host" | "rack")
|
#state ⇒ String
The state of the placement group.
22 |
# File 'sig/placement_group.rbs', line 22
def state: () -> ("pending" | "available" | "deleting" | "deleted")
|
#strategy ⇒ String
The placement strategy.
25 |
# File 'sig/placement_group.rbs', line 25
def strategy: () -> ("cluster" | "spread" | "partition" | "precision-time")
|
#tags ⇒ Array<Types::Tag>
Any tags applied to the placement group.
34 |
# File 'sig/placement_group.rbs', line 34
def tags: () -> ::Array[Types::Tag]
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::EC2::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/aws-sdk-ec2/placement_group.rb', line 217 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |