aws-sdk-autoscaling 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aws-sdk-autoscaling.rb +1 -1
- data/lib/aws-sdk-autoscaling/activity.rb +106 -11
- data/lib/aws-sdk-autoscaling/auto_scaling_group.rb +124 -29
- data/lib/aws-sdk-autoscaling/client.rb +1 -1
- data/lib/aws-sdk-autoscaling/instance.rb +102 -7
- data/lib/aws-sdk-autoscaling/launch_configuration.rb +113 -18
- data/lib/aws-sdk-autoscaling/lifecycle_hook.rb +102 -7
- data/lib/aws-sdk-autoscaling/load_balancer.rb +96 -1
- data/lib/aws-sdk-autoscaling/notification_configuration.rb +95 -0
- data/lib/aws-sdk-autoscaling/scaling_policy.rb +110 -15
- data/lib/aws-sdk-autoscaling/scheduled_action.rb +106 -11
- data/lib/aws-sdk-autoscaling/tag.rb +97 -2
- metadata +2 -2
@@ -4221,7 +4221,7 @@ module Aws::AutoScaling
|
|
4221
4221
|
params: params,
|
4222
4222
|
config: config)
|
4223
4223
|
context[:gem_name] = 'aws-sdk-autoscaling'
|
4224
|
-
context[:gem_version] = '1.
|
4224
|
+
context[:gem_version] = '1.3.0'
|
4225
4225
|
Seahorse::Client::Request.new(handlers, context)
|
4226
4226
|
end
|
4227
4227
|
|
@@ -43,7 +43,7 @@ module Aws::AutoScaling
|
|
43
43
|
# The Availability Zone for the instance.
|
44
44
|
# @return [String]
|
45
45
|
def availability_zone
|
46
|
-
data
|
46
|
+
data[:availability_zone]
|
47
47
|
end
|
48
48
|
|
49
49
|
# The lifecycle state for the instance. For more information, see [Auto
|
@@ -54,7 +54,7 @@ module Aws::AutoScaling
|
|
54
54
|
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/AutoScalingGroupLifecycle.html
|
55
55
|
# @return [String]
|
56
56
|
def lifecycle_state
|
57
|
-
data
|
57
|
+
data[:lifecycle_state]
|
58
58
|
end
|
59
59
|
|
60
60
|
# The last reported health status of this instance. "Healthy" means
|
@@ -63,21 +63,21 @@ module Aws::AutoScaling
|
|
63
63
|
# should terminate and replace it.
|
64
64
|
# @return [String]
|
65
65
|
def health_status
|
66
|
-
data
|
66
|
+
data[:health_status]
|
67
67
|
end
|
68
68
|
|
69
69
|
# The launch configuration used to launch the instance. This value is
|
70
70
|
# not available if you attached the instance to the Auto Scaling group.
|
71
71
|
# @return [String]
|
72
72
|
def launch_configuration_name
|
73
|
-
data
|
73
|
+
data[:launch_configuration_name]
|
74
74
|
end
|
75
75
|
|
76
76
|
# Indicates whether the instance is protected from termination by Auto
|
77
77
|
# Scaling when scaling in.
|
78
78
|
# @return [Boolean]
|
79
79
|
def protected_from_scale_in
|
80
|
-
data
|
80
|
+
data[:protected_from_scale_in]
|
81
81
|
end
|
82
82
|
|
83
83
|
# @!endgroup
|
@@ -115,6 +115,101 @@ module Aws::AutoScaling
|
|
115
115
|
!!@data
|
116
116
|
end
|
117
117
|
|
118
|
+
# @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
|
119
|
+
#
|
120
|
+
# Waiter polls an API operation until a resource enters a desired
|
121
|
+
# state.
|
122
|
+
#
|
123
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
124
|
+
#
|
125
|
+
# ## Basic Usage
|
126
|
+
#
|
127
|
+
# Waiter will polls until it is successful, it fails by
|
128
|
+
# entering a terminal state, or until a maximum number of attempts
|
129
|
+
# are made.
|
130
|
+
#
|
131
|
+
# # polls in a loop until condition is true
|
132
|
+
# resource.wait_until(options) {|resource| condition}
|
133
|
+
#
|
134
|
+
# ## Example
|
135
|
+
#
|
136
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
137
|
+
#
|
138
|
+
# ## Configuration
|
139
|
+
#
|
140
|
+
# You can configure the maximum number of polling attempts, and the
|
141
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
142
|
+
# by passing a block to {#wait_until}:
|
143
|
+
#
|
144
|
+
# # poll for ~25 seconds
|
145
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
146
|
+
#
|
147
|
+
# ## Callbacks
|
148
|
+
#
|
149
|
+
# You can be notified before each polling attempt and before each
|
150
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
151
|
+
# it will terminate the waiter.
|
152
|
+
#
|
153
|
+
# started_at = Time.now
|
154
|
+
# # poll for 1 hour, instead of a number of attempts
|
155
|
+
# proc = Proc.new do |attempts, response|
|
156
|
+
# throw :failure if Time.now - started_at > 3600
|
157
|
+
# end
|
158
|
+
#
|
159
|
+
# # disable max attempts
|
160
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
161
|
+
#
|
162
|
+
# ## Handling Errors
|
163
|
+
#
|
164
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
165
|
+
# fails, it raises an error.
|
166
|
+
#
|
167
|
+
# begin
|
168
|
+
# resource.wait_until(...)
|
169
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
170
|
+
# # resource did not enter the desired state in time
|
171
|
+
# end
|
172
|
+
#
|
173
|
+
#
|
174
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
175
|
+
#
|
176
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
177
|
+
# because the waiter has entered a state that it will not transition
|
178
|
+
# out of, preventing success.
|
179
|
+
#
|
180
|
+
# yet successful.
|
181
|
+
#
|
182
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
183
|
+
# while polling for a resource that is not expected.
|
184
|
+
#
|
185
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
186
|
+
#
|
187
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
188
|
+
# attempts
|
189
|
+
# @option options [Integer] :delay (10) Delay between each
|
190
|
+
# attempt in seconds
|
191
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
192
|
+
# invoked before each attempt
|
193
|
+
# @option options [Proc] :before_wait (nil) Callback
|
194
|
+
# invoked before each wait
|
195
|
+
# @return [Resource] if the waiter was successful
|
196
|
+
def wait_until(options = {}, &block)
|
197
|
+
self_copy = self.dup
|
198
|
+
attempts = 0
|
199
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
200
|
+
options[:delay] ||= 10
|
201
|
+
options[:poller] = Proc.new do
|
202
|
+
attempts += 1
|
203
|
+
if block.call(self_copy)
|
204
|
+
[:success, self_copy]
|
205
|
+
else
|
206
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
207
|
+
:retry
|
208
|
+
end
|
209
|
+
end
|
210
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
211
|
+
end
|
212
|
+
|
118
213
|
# @!group Actions
|
119
214
|
|
120
215
|
# @example Request syntax with placeholder values
|
@@ -268,9 +363,9 @@ module Aws::AutoScaling
|
|
268
363
|
|
269
364
|
# @return [LaunchConfiguration, nil]
|
270
365
|
def launch_configuration
|
271
|
-
if data
|
366
|
+
if data[:launch_configuration_name]
|
272
367
|
LaunchConfiguration.new(
|
273
|
-
name: data
|
368
|
+
name: data[:launch_configuration_name],
|
274
369
|
client: @client
|
275
370
|
)
|
276
371
|
else
|
@@ -34,25 +34,25 @@ module Aws::AutoScaling
|
|
34
34
|
# The Amazon Resource Name (ARN) of the launch configuration.
|
35
35
|
# @return [String]
|
36
36
|
def launch_configuration_arn
|
37
|
-
data
|
37
|
+
data[:launch_configuration_arn]
|
38
38
|
end
|
39
39
|
|
40
40
|
# The ID of the Amazon Machine Image (AMI).
|
41
41
|
# @return [String]
|
42
42
|
def image_id
|
43
|
-
data
|
43
|
+
data[:image_id]
|
44
44
|
end
|
45
45
|
|
46
46
|
# The name of the key pair.
|
47
47
|
# @return [String]
|
48
48
|
def key_name
|
49
|
-
data
|
49
|
+
data[:key_name]
|
50
50
|
end
|
51
51
|
|
52
52
|
# The security groups to associate with the instances.
|
53
53
|
# @return [Array<String>]
|
54
54
|
def security_groups
|
55
|
-
data
|
55
|
+
data[:security_groups]
|
56
56
|
end
|
57
57
|
|
58
58
|
# The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances
|
@@ -65,7 +65,7 @@ module Aws::AutoScaling
|
|
65
65
|
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
|
66
66
|
# @return [String]
|
67
67
|
def classic_link_vpc_id
|
68
|
-
data
|
68
|
+
data[:classic_link_vpc_id]
|
69
69
|
end
|
70
70
|
|
71
71
|
# The IDs of one or more security groups for the VPC specified in
|
@@ -79,78 +79,78 @@ module Aws::AutoScaling
|
|
79
79
|
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
|
80
80
|
# @return [Array<String>]
|
81
81
|
def classic_link_vpc_security_groups
|
82
|
-
data
|
82
|
+
data[:classic_link_vpc_security_groups]
|
83
83
|
end
|
84
84
|
|
85
85
|
# The user data available to the instances.
|
86
86
|
# @return [String]
|
87
87
|
def user_data
|
88
|
-
data
|
88
|
+
data[:user_data]
|
89
89
|
end
|
90
90
|
|
91
91
|
# The instance type for the instances.
|
92
92
|
# @return [String]
|
93
93
|
def instance_type
|
94
|
-
data
|
94
|
+
data[:instance_type]
|
95
95
|
end
|
96
96
|
|
97
97
|
# The ID of the kernel associated with the AMI.
|
98
98
|
# @return [String]
|
99
99
|
def kernel_id
|
100
|
-
data
|
100
|
+
data[:kernel_id]
|
101
101
|
end
|
102
102
|
|
103
103
|
# The ID of the RAM disk associated with the AMI.
|
104
104
|
# @return [String]
|
105
105
|
def ramdisk_id
|
106
|
-
data
|
106
|
+
data[:ramdisk_id]
|
107
107
|
end
|
108
108
|
|
109
109
|
# A block device mapping, which specifies the block devices for the
|
110
110
|
# instance.
|
111
111
|
# @return [Array<Types::BlockDeviceMapping>]
|
112
112
|
def block_device_mappings
|
113
|
-
data
|
113
|
+
data[:block_device_mappings]
|
114
114
|
end
|
115
115
|
|
116
116
|
# Controls whether instances in this group are launched with detailed
|
117
117
|
# (`true`) or basic (`false`) monitoring.
|
118
118
|
# @return [Types::InstanceMonitoring]
|
119
119
|
def instance_monitoring
|
120
|
-
data
|
120
|
+
data[:instance_monitoring]
|
121
121
|
end
|
122
122
|
|
123
123
|
# The price to bid when launching Spot Instances.
|
124
124
|
# @return [String]
|
125
125
|
def spot_price
|
126
|
-
data
|
126
|
+
data[:spot_price]
|
127
127
|
end
|
128
128
|
|
129
129
|
# The name or Amazon Resource Name (ARN) of the instance profile
|
130
130
|
# associated with the IAM role for the instance.
|
131
131
|
# @return [String]
|
132
132
|
def iam_instance_profile
|
133
|
-
data
|
133
|
+
data[:iam_instance_profile]
|
134
134
|
end
|
135
135
|
|
136
136
|
# The creation date and time for the launch configuration.
|
137
137
|
# @return [Time]
|
138
138
|
def created_time
|
139
|
-
data
|
139
|
+
data[:created_time]
|
140
140
|
end
|
141
141
|
|
142
142
|
# Controls whether the instance is optimized for EBS I/O (`true`) or not
|
143
143
|
# (`false`).
|
144
144
|
# @return [Boolean]
|
145
145
|
def ebs_optimized
|
146
|
-
data
|
146
|
+
data[:ebs_optimized]
|
147
147
|
end
|
148
148
|
|
149
149
|
# \[EC2-VPC\] Indicates whether to assign a public IP address to each
|
150
150
|
# instance.
|
151
151
|
# @return [Boolean]
|
152
152
|
def associate_public_ip_address
|
153
|
-
data
|
153
|
+
data[:associate_public_ip_address]
|
154
154
|
end
|
155
155
|
|
156
156
|
# The tenancy of the instance, either `default` or `dedicated`. An
|
@@ -158,7 +158,7 @@ module Aws::AutoScaling
|
|
158
158
|
# hardware and can only be launched into a VPC.
|
159
159
|
# @return [String]
|
160
160
|
def placement_tenancy
|
161
|
-
data
|
161
|
+
data[:placement_tenancy]
|
162
162
|
end
|
163
163
|
|
164
164
|
# @!endgroup
|
@@ -196,6 +196,101 @@ module Aws::AutoScaling
|
|
196
196
|
!!@data
|
197
197
|
end
|
198
198
|
|
199
|
+
# @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
|
200
|
+
#
|
201
|
+
# Waiter polls an API operation until a resource enters a desired
|
202
|
+
# state.
|
203
|
+
#
|
204
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
205
|
+
#
|
206
|
+
# ## Basic Usage
|
207
|
+
#
|
208
|
+
# Waiter will polls until it is successful, it fails by
|
209
|
+
# entering a terminal state, or until a maximum number of attempts
|
210
|
+
# are made.
|
211
|
+
#
|
212
|
+
# # polls in a loop until condition is true
|
213
|
+
# resource.wait_until(options) {|resource| condition}
|
214
|
+
#
|
215
|
+
# ## Example
|
216
|
+
#
|
217
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
218
|
+
#
|
219
|
+
# ## Configuration
|
220
|
+
#
|
221
|
+
# You can configure the maximum number of polling attempts, and the
|
222
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
223
|
+
# by passing a block to {#wait_until}:
|
224
|
+
#
|
225
|
+
# # poll for ~25 seconds
|
226
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
227
|
+
#
|
228
|
+
# ## Callbacks
|
229
|
+
#
|
230
|
+
# You can be notified before each polling attempt and before each
|
231
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
232
|
+
# it will terminate the waiter.
|
233
|
+
#
|
234
|
+
# started_at = Time.now
|
235
|
+
# # poll for 1 hour, instead of a number of attempts
|
236
|
+
# proc = Proc.new do |attempts, response|
|
237
|
+
# throw :failure if Time.now - started_at > 3600
|
238
|
+
# end
|
239
|
+
#
|
240
|
+
# # disable max attempts
|
241
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
242
|
+
#
|
243
|
+
# ## Handling Errors
|
244
|
+
#
|
245
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
246
|
+
# fails, it raises an error.
|
247
|
+
#
|
248
|
+
# begin
|
249
|
+
# resource.wait_until(...)
|
250
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
251
|
+
# # resource did not enter the desired state in time
|
252
|
+
# end
|
253
|
+
#
|
254
|
+
#
|
255
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
256
|
+
#
|
257
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
258
|
+
# because the waiter has entered a state that it will not transition
|
259
|
+
# out of, preventing success.
|
260
|
+
#
|
261
|
+
# yet successful.
|
262
|
+
#
|
263
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
264
|
+
# while polling for a resource that is not expected.
|
265
|
+
#
|
266
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
267
|
+
#
|
268
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
269
|
+
# attempts
|
270
|
+
# @option options [Integer] :delay (10) Delay between each
|
271
|
+
# attempt in seconds
|
272
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
273
|
+
# invoked before each attempt
|
274
|
+
# @option options [Proc] :before_wait (nil) Callback
|
275
|
+
# invoked before each wait
|
276
|
+
# @return [Resource] if the waiter was successful
|
277
|
+
def wait_until(options = {}, &block)
|
278
|
+
self_copy = self.dup
|
279
|
+
attempts = 0
|
280
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
281
|
+
options[:delay] ||= 10
|
282
|
+
options[:poller] = Proc.new do
|
283
|
+
attempts += 1
|
284
|
+
if block.call(self_copy)
|
285
|
+
[:success, self_copy]
|
286
|
+
else
|
287
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
288
|
+
:retry
|
289
|
+
end
|
290
|
+
end
|
291
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
292
|
+
end
|
293
|
+
|
199
294
|
# @!group Actions
|
200
295
|
|
201
296
|
# @example Request syntax with placeholder values
|
@@ -45,7 +45,7 @@ module Aws::AutoScaling
|
|
45
45
|
# DescribeLifecycleHookTypes.
|
46
46
|
# @return [String]
|
47
47
|
def lifecycle_transition
|
48
|
-
data
|
48
|
+
data[:lifecycle_transition]
|
49
49
|
end
|
50
50
|
|
51
51
|
# The ARN of the target that Auto Scaling sends notifications to when an
|
@@ -53,21 +53,21 @@ module Aws::AutoScaling
|
|
53
53
|
# notification target can be either an SQS queue or an SNS topic.
|
54
54
|
# @return [String]
|
55
55
|
def notification_target_arn
|
56
|
-
data
|
56
|
+
data[:notification_target_arn]
|
57
57
|
end
|
58
58
|
|
59
59
|
# The ARN of the IAM role that allows the Auto Scaling group to publish
|
60
60
|
# to the specified notification target.
|
61
61
|
# @return [String]
|
62
62
|
def role_arn
|
63
|
-
data
|
63
|
+
data[:role_arn]
|
64
64
|
end
|
65
65
|
|
66
66
|
# Additional information that you want to include any time Auto Scaling
|
67
67
|
# sends a message to the notification target.
|
68
68
|
# @return [String]
|
69
69
|
def notification_metadata
|
70
|
-
data
|
70
|
+
data[:notification_metadata]
|
71
71
|
end
|
72
72
|
|
73
73
|
# The maximum time, in seconds, that can elapse before the lifecycle
|
@@ -76,7 +76,7 @@ module Aws::AutoScaling
|
|
76
76
|
# by calling RecordLifecycleActionHeartbeat.
|
77
77
|
# @return [Integer]
|
78
78
|
def heartbeat_timeout
|
79
|
-
data
|
79
|
+
data[:heartbeat_timeout]
|
80
80
|
end
|
81
81
|
|
82
82
|
# The maximum time, in seconds, that an instance can remain in a
|
@@ -85,7 +85,7 @@ module Aws::AutoScaling
|
|
85
85
|
# smaller.
|
86
86
|
# @return [Integer]
|
87
87
|
def global_timeout
|
88
|
-
data
|
88
|
+
data[:global_timeout]
|
89
89
|
end
|
90
90
|
|
91
91
|
# Defines the action the Auto Scaling group should take when the
|
@@ -94,7 +94,7 @@ module Aws::AutoScaling
|
|
94
94
|
# `CONTINUE`.
|
95
95
|
# @return [String]
|
96
96
|
def default_result
|
97
|
-
data
|
97
|
+
data[:default_result]
|
98
98
|
end
|
99
99
|
|
100
100
|
# @!endgroup
|
@@ -135,6 +135,101 @@ module Aws::AutoScaling
|
|
135
135
|
!!@data
|
136
136
|
end
|
137
137
|
|
138
|
+
# @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
|
139
|
+
#
|
140
|
+
# Waiter polls an API operation until a resource enters a desired
|
141
|
+
# state.
|
142
|
+
#
|
143
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
144
|
+
#
|
145
|
+
# ## Basic Usage
|
146
|
+
#
|
147
|
+
# Waiter will polls until it is successful, it fails by
|
148
|
+
# entering a terminal state, or until a maximum number of attempts
|
149
|
+
# are made.
|
150
|
+
#
|
151
|
+
# # polls in a loop until condition is true
|
152
|
+
# resource.wait_until(options) {|resource| condition}
|
153
|
+
#
|
154
|
+
# ## Example
|
155
|
+
#
|
156
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
157
|
+
#
|
158
|
+
# ## Configuration
|
159
|
+
#
|
160
|
+
# You can configure the maximum number of polling attempts, and the
|
161
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
162
|
+
# by passing a block to {#wait_until}:
|
163
|
+
#
|
164
|
+
# # poll for ~25 seconds
|
165
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
166
|
+
#
|
167
|
+
# ## Callbacks
|
168
|
+
#
|
169
|
+
# You can be notified before each polling attempt and before each
|
170
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
171
|
+
# it will terminate the waiter.
|
172
|
+
#
|
173
|
+
# started_at = Time.now
|
174
|
+
# # poll for 1 hour, instead of a number of attempts
|
175
|
+
# proc = Proc.new do |attempts, response|
|
176
|
+
# throw :failure if Time.now - started_at > 3600
|
177
|
+
# end
|
178
|
+
#
|
179
|
+
# # disable max attempts
|
180
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
181
|
+
#
|
182
|
+
# ## Handling Errors
|
183
|
+
#
|
184
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
185
|
+
# fails, it raises an error.
|
186
|
+
#
|
187
|
+
# begin
|
188
|
+
# resource.wait_until(...)
|
189
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
190
|
+
# # resource did not enter the desired state in time
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
#
|
194
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
195
|
+
#
|
196
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
197
|
+
# because the waiter has entered a state that it will not transition
|
198
|
+
# out of, preventing success.
|
199
|
+
#
|
200
|
+
# yet successful.
|
201
|
+
#
|
202
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
203
|
+
# while polling for a resource that is not expected.
|
204
|
+
#
|
205
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
206
|
+
#
|
207
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
208
|
+
# attempts
|
209
|
+
# @option options [Integer] :delay (10) Delay between each
|
210
|
+
# attempt in seconds
|
211
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
212
|
+
# invoked before each attempt
|
213
|
+
# @option options [Proc] :before_wait (nil) Callback
|
214
|
+
# invoked before each wait
|
215
|
+
# @return [Resource] if the waiter was successful
|
216
|
+
def wait_until(options = {}, &block)
|
217
|
+
self_copy = self.dup
|
218
|
+
attempts = 0
|
219
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
220
|
+
options[:delay] ||= 10
|
221
|
+
options[:poller] = Proc.new do
|
222
|
+
attempts += 1
|
223
|
+
if block.call(self_copy)
|
224
|
+
[:success, self_copy]
|
225
|
+
else
|
226
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
227
|
+
:retry
|
228
|
+
end
|
229
|
+
end
|
230
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
231
|
+
end
|
232
|
+
|
138
233
|
# @!group Actions
|
139
234
|
|
140
235
|
# @example Request syntax with placeholder values
|