Class: Aws::AutoScaling::AutoScalingGroup
- Inherits:
-
Object
- Object
- Aws::AutoScaling::AutoScalingGroup
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-autoscaling/auto_scaling_group.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#auto_scaling_group_arn ⇒ String
The Amazon Resource Name (ARN) of the Auto Scaling group.
-
#availability_zones ⇒ Array<String>
One or more Availability Zones for the group.
-
#created_time ⇒ Time
The date and time the group was created.
-
#default_cooldown ⇒ Integer
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
-
#desired_capacity ⇒ Integer
The desired size of the group.
-
#enabled_metrics ⇒ Array<Types::EnabledMetric>
The metrics enabled for the group.
-
#health_check_grace_period ⇒ Integer
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
-
#health_check_type ⇒ String
The service to use for the health checks.
-
#launch_configuration_name ⇒ String
The name of the associated launch configuration.
-
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the group.
-
#load_balancer_names ⇒ Array<String>
One or more load balancers associated with the group.
-
#max_size ⇒ Integer
The maximum size of the group.
-
#min_size ⇒ Integer
The minimum size of the group.
-
#mixed_instances_policy ⇒ Types::MixedInstancesPolicy
The mixed instances policy for the group.
- #name ⇒ String (also: #auto_scaling_group_name)
-
#new_instances_protected_from_scale_in ⇒ Boolean
Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
-
#placement_group ⇒ String
The name of the placement group into which to launch your instances, if any.
-
#service_linked_role_arn ⇒ String
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf.
-
#status ⇒ String
The current state of the group when DeleteAutoScalingGroup is in progress.
-
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the group.
-
#target_group_arns ⇒ Array<String>
The Amazon Resource Names (ARN) of the target groups for your load balancer.
-
#termination_policies ⇒ Array<String>
The termination policies for the group.
-
#vpc_zone_identifier ⇒ String
One or more subnet IDs, if applicable, separated by commas.
Actions collapse
- #attach_instances(options = {}) ⇒ EmptyStructure
- #delete(options = {}) ⇒ EmptyStructure
- #detach_instances(options = {}) ⇒ Activity::Collection
- #disable_metrics_collection(options = {}) ⇒ EmptyStructure
- #enable_metrics_collection(options = {}) ⇒ EmptyStructure
- #put_scaling_policy(options = {}) ⇒ ScalingPolicy
- #put_scheduled_update_group_action(options = {}) ⇒ ScheduledAction
- #resume_processes(options = {}) ⇒ EmptyStructure
- #set_desired_capacity(options = {}) ⇒ EmptyStructure
- #suspend_processes(options = {}) ⇒ EmptyStructure
- #update(options = {}) ⇒ AutoScalingGroup
Associations collapse
- #activities(options = {}) ⇒ Activity::Collection
- #identifiers ⇒ Object deprecated private Deprecated.
- #instances ⇒ Instance::Collection
- #launch_configuration ⇒ LaunchConfiguration?
- #lifecycle_hook(name) ⇒ LifecycleHook
- #lifecycle_hooks(options = {}) ⇒ LifecycleHook::Collection
- #load_balancer(name) ⇒ LoadBalancer
- #load_balancers(options = {}) ⇒ LoadBalancer::Collection
- #notification_configurations(options = {}) ⇒ NotificationConfiguration::Collection
- #policies(options = {}) ⇒ ScalingPolicy::Collection
- #scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
- #tag(key) ⇒ Tag
- #tags ⇒ Tag::Collection
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::AutoScalingGroup
Returns the data for this AutoScalingGroup.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if the AutoScalingGroup exists.
-
#initialize(*args) ⇒ AutoScalingGroup
constructor
A new instance of AutoScalingGroup.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current AutoScalingGroup.
-
#wait_until(options = {}, &block) ⇒ Resource
deprecated
Deprecated.
Use [Aws::AutoScaling::Client] #wait_until instead
- #wait_until_exists(options = {}) ⇒ AutoScalingGroup
- #wait_until_in_service(options = {}) ⇒ AutoScalingGroup
- #wait_until_not_exists(options = {}) ⇒ AutoScalingGroup
Constructor Details
#initialize(name, options = {}) ⇒ AutoScalingGroup #initialize(options = {}) ⇒ AutoScalingGroup
Returns a new instance of AutoScalingGroup.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @name = extract_name(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#activities(options = {}) ⇒ Activity::Collection
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 928 def activities( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = @client.describe_scaling_activities() resp.each_page do |page| batch = [] page.data.activities.each do |a| batch << Activity.new( id: a.activity_id, data: a, client: @client ) end y.yield(batch) end end Activity::Collection.new(batches) end |
#attach_instances(options = {}) ⇒ EmptyStructure
390 391 392 393 394 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 390 def attach_instances( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.attach_instances() resp.data end |
#auto_scaling_group_arn ⇒ String
The Amazon Resource Name (ARN) of the Auto Scaling group.
36 37 38 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 36 def auto_scaling_group_arn data[:auto_scaling_group_arn] end |
#availability_zones ⇒ Array<String>
One or more Availability Zones for the group.
85 86 87 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 85 def availability_zones data[:availability_zones] end |
#client ⇒ Client
187 188 189 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 187 def client @client end |
#created_time ⇒ Time
The date and time the group was created.
119 120 121 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 119 def created_time data[:created_time] end |
#data ⇒ Types::AutoScalingGroup
Returns the data for this Aws::AutoScaling::AutoScalingGroup. Calls Client#describe_auto_scaling_groups if #data_loaded? is ‘false`.
207 208 209 210 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 207 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
215 216 217 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 215 def data_loaded? !!@data end |
#default_cooldown ⇒ Integer
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
79 80 81 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 79 def default_cooldown data[:default_cooldown] end |
#delete(options = {}) ⇒ EmptyStructure
408 409 410 411 412 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 408 def delete( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.delete_auto_scaling_group() resp.data end |
#desired_capacity ⇒ Integer
The desired size of the group.
72 73 74 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 72 def desired_capacity data[:desired_capacity] end |
#detach_instances(options = {}) ⇒ Activity::Collection
427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 427 def detach_instances( = {}) batch = [] = .merge(auto_scaling_group_name: @name) resp = @client.detach_instances() resp.data.activities.each do |a| batch << Activity.new( id: a.activity_id, data: a, client: @client ) end Activity::Collection.new([batch], size: batch.size) end |
#disable_metrics_collection(options = {}) ⇒ EmptyStructure
467 468 469 470 471 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 467 def disable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.disable_metrics_collection() resp.data end |
#enable_metrics_collection(options = {}) ⇒ EmptyStructure
503 504 505 506 507 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 503 def enable_metrics_collection( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.enable_metrics_collection() resp.data end |
#enabled_metrics ⇒ Array<Types::EnabledMetric>
The metrics enabled for the group.
153 154 155 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 153 def enabled_metrics data[:enabled_metrics] end |
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if the AutoScalingGroup exists.
222 223 224 225 226 227 228 229 230 231 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 222 def exists?( = {}) begin wait_until_exists(.merge(max_attempts: 1)) true rescue Aws::Waiters::Errors::UnexpectedError => e raise e.error rescue Aws::Waiters::Errors::WaiterFailed false end end |
#health_check_grace_period ⇒ Integer
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
113 114 115 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 113 def health_check_grace_period data[:health_check_grace_period] end |
#health_check_type ⇒ String
The service to use for the health checks. The valid values are ‘EC2` and `ELB`.
105 106 107 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 105 def health_check_type data[:health_check_type] end |
#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.
1181 1182 1183 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1181 def identifiers { name: @name } end |
#instances ⇒ Instance::Collection
948 949 950 951 952 953 954 955 956 957 958 959 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 948 def instances batch = [] data[:instances].each do |d| batch << Instance.new( group_name: @name, id: d[:instance_id], data: d, client: @client ) end Instance::Collection.new([batch], size: batch.size) end |
#launch_configuration ⇒ LaunchConfiguration?
962 963 964 965 966 967 968 969 970 971 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 962 def launch_configuration if data[:launch_configuration_name] LaunchConfiguration.new( name: data[:launch_configuration_name], client: @client ) else nil end end |
#launch_configuration_name ⇒ String
The name of the associated launch configuration.
42 43 44 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 42 def launch_configuration_name data[:launch_configuration_name] end |
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the group.
48 49 50 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 48 def launch_template data[:launch_template] end |
#lifecycle_hook(name) ⇒ LifecycleHook
975 976 977 978 979 980 981 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 975 def lifecycle_hook(name) LifecycleHook.new( group_name: @name, name: name, client: @client ) end |
#lifecycle_hooks(options = {}) ⇒ LifecycleHook::Collection
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 993 def lifecycle_hooks( = {}) batches = Enumerator.new do |y| batch = [] = .merge(auto_scaling_group_name: @name) resp = @client.describe_lifecycle_hooks() resp.data.lifecycle_hooks.each do |l| batch << LifecycleHook.new( group_name: l.auto_scaling_group_name, name: l.lifecycle_hook_name, data: l, client: @client ) end y.yield(batch) end LifecycleHook::Collection.new(batches) end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::AutoScaling::AutoScalingGroup. Returns ‘self` making it possible to chain methods.
auto_scaling_group.reload.data
197 198 199 200 201 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 197 def load resp = @client.describe_auto_scaling_groups(auto_scaling_group_names: [@name]) @data = resp.auto_scaling_groups[0] self end |
#load_balancer(name) ⇒ LoadBalancer
1013 1014 1015 1016 1017 1018 1019 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1013 def load_balancer(name) LoadBalancer.new( group_name: @name, name: name, client: @client ) end |
#load_balancer_names ⇒ Array<String>
One or more load balancers associated with the group.
91 92 93 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 91 def load_balancer_names data[:load_balancer_names] end |
#load_balancers(options = {}) ⇒ LoadBalancer::Collection
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1035 def load_balancers( = {}) batches = Enumerator.new do |y| batch = [] = .merge(auto_scaling_group_name: @name) resp = @client.describe_load_balancers() resp.data.load_balancers.each do |l| batch << LoadBalancer.new( group_name: @name, name: l.load_balancer_name, data: l, client: @client ) end y.yield(batch) end LoadBalancer::Collection.new(batches) end |
#max_size ⇒ Integer
The maximum size of the group.
66 67 68 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 66 def max_size data[:max_size] end |
#min_size ⇒ Integer
The minimum size of the group.
60 61 62 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 60 def min_size data[:min_size] end |
#mixed_instances_policy ⇒ Types::MixedInstancesPolicy
The mixed instances policy for the group.
54 55 56 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 54 def mixed_instances_policy data[:mixed_instances_policy] end |
#name ⇒ String Also known as: auto_scaling_group_name
29 30 31 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 29 def name @name end |
#new_instances_protected_from_scale_in ⇒ Boolean
Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
173 174 175 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 173 def new_instances_protected_from_scale_in data[:new_instances_protected_from_scale_in] end |
#notification_configurations(options = {}) ⇒ NotificationConfiguration::Collection
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1058 def notification_configurations( = {}) batches = Enumerator.new do |y| = Aws::Util.deep_merge(, auto_scaling_group_names: [@name]) resp = @client.describe_notification_configurations() resp.each_page do |page| batch = [] page.data.notification_configurations.each do |n| batch << NotificationConfiguration.new( group_name: n.auto_scaling_group_name, type: n.notification_type, topic_arn: n.topic_arn, data: n, client: @client ) end y.yield(batch) end end NotificationConfiguration::Collection.new(batches) end |
#placement_group ⇒ String
The name of the placement group into which to launch your instances, if any. For more information, see [Placement Groups] in the *Amazon Elastic Compute Cloud User Guide*.
[1]: docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
137 138 139 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 137 def placement_group data[:placement_group] end |
#policies(options = {}) ⇒ ScalingPolicy::Collection
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1095 def policies( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = @client.describe_policies() resp.each_page do |page| batch = [] page.data.scaling_policies.each do |s| batch << ScalingPolicy.new( name: s.policy_name, data: s, client: @client ) end y.yield(batch) end end ScalingPolicy::Collection.new(batches) end |
#put_scaling_policy(options = {}) ⇒ ScalingPolicy
625 626 627 628 629 630 631 632 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 625 def put_scaling_policy( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.put_scaling_policy() ScalingPolicy.new( name: [:policy_name], client: @client ) end |
#put_scheduled_update_group_action(options = {}) ⇒ ScheduledAction
678 679 680 681 682 683 684 685 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 678 def put_scheduled_update_group_action( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.put_scheduled_update_group_action() ScheduledAction.new( name: [:scheduled_action_name], client: @client ) end |
#resume_processes(options = {}) ⇒ EmptyStructure
713 714 715 716 717 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 713 def resume_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.resume_processes() resp.data end |
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1134 def scheduled_actions( = {}) batches = Enumerator.new do |y| = .merge(auto_scaling_group_name: @name) resp = @client.describe_scheduled_actions() resp.each_page do |page| batch = [] page.data.scheduled_update_group_actions.each do |s| batch << ScheduledAction.new( name: s.scheduled_action_name, data: s, client: @client ) end y.yield(batch) end end ScheduledAction::Collection.new(batches) end |
#service_linked_role_arn ⇒ String
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf.
180 181 182 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 180 def service_linked_role_arn data[:service_linked_role_arn] end |
#set_desired_capacity(options = {}) ⇒ EmptyStructure
736 737 738 739 740 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 736 def set_desired_capacity( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.set_desired_capacity() resp.data end |
#status ⇒ String
The current state of the group when DeleteAutoScalingGroup is in progress.
160 161 162 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 160 def status data[:status] end |
#suspend_processes(options = {}) ⇒ EmptyStructure
768 769 770 771 772 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 768 def suspend_processes( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.suspend_processes() resp.data end |
#suspended_processes ⇒ Array<Types::SuspendedProcess>
The suspended processes associated with the group.
125 126 127 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 125 def suspended_processes data[:suspended_processes] end |
#tag(key) ⇒ Tag
1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1155 def tag(key) Tag.new( key: key, resource_id: @name, resource_type: "auto-scaling-group", client: @client ) end |
#tags ⇒ Tag::Collection
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 1165 def batch = [] data[:tags].each do |d| batch << Tag.new( key: d[:key], resource_id: d[:resource_id], resource_type: d[:resource_type], data: d, client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#target_group_arns ⇒ Array<String>
The Amazon Resource Names (ARN) of the target groups for your load balancer.
98 99 100 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 98 def target_group_arns data[:target_group_arns] end |
#termination_policies ⇒ Array<String>
The termination policies for the group.
166 167 168 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 166 def termination_policies data[:termination_policies] end |
#update(options = {}) ⇒ AutoScalingGroup
904 905 906 907 908 909 910 911 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 904 def update( = {}) = .merge(auto_scaling_group_name: @name) resp = @client.update_auto_scaling_group() AutoScalingGroup.new( name: [:auto_scaling_group_name], client: @client ) end |
#vpc_zone_identifier ⇒ String
One or more subnet IDs, if applicable, separated by commas.
If you specify ‘VPCZoneIdentifier` and `AvailabilityZones`, ensure that the Availability Zones of the subnets match the values for `AvailabilityZones`.
147 148 149 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 147 def vpc_zone_identifier data[:vpc_zone_identifier] end |
#wait_until(options = {}, &block) ⇒ Resource
Use [Aws::AutoScaling::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) {|instance| instance.state.name == 'running' }
## 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
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 362 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::Waiters::Waiter.new().wait({}) end |
#wait_until_exists(options = {}) ⇒ AutoScalingGroup
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 239 def wait_until_exists( = {}) , params = () waiter = Waiters::GroupExists.new() yield_waiter_and_warn(waiter, &Proc.new) if block_given? waiter.wait(params.merge(auto_scaling_group_names: [@name])) AutoScalingGroup.new({ name: @name, client: @client }) end |
#wait_until_in_service(options = {}) ⇒ AutoScalingGroup
256 257 258 259 260 261 262 263 264 265 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 256 def wait_until_in_service( = {}) , params = () waiter = Waiters::GroupInService.new() yield_waiter_and_warn(waiter, &Proc.new) if block_given? waiter.wait(params.merge(auto_scaling_group_names: [@name])) AutoScalingGroup.new({ name: @name, client: @client }) end |
#wait_until_not_exists(options = {}) ⇒ AutoScalingGroup
273 274 275 276 277 278 279 280 281 282 |
# File 'lib/aws-sdk-autoscaling/auto_scaling_group.rb', line 273 def wait_until_not_exists( = {}) , params = () waiter = Waiters::GroupNotExists.new() yield_waiter_and_warn(waiter, &Proc.new) if block_given? waiter.wait(params.merge(auto_scaling_group_names: [@name])) AutoScalingGroup.new({ name: @name, client: @client }) end |