aws-sdk-cloudformation 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-cloudformation.rb +1 -1
- data/lib/aws-sdk-cloudformation/client.rb +1 -1
- data/lib/aws-sdk-cloudformation/event.rb +105 -10
- data/lib/aws-sdk-cloudformation/stack.rb +111 -16
- data/lib/aws-sdk-cloudformation/stack_resource.rb +103 -8
- data/lib/aws-sdk-cloudformation/stack_resource_summary.rb +100 -5
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002d893fc2c977f2d7750ad13111bc530072310a
|
4
|
+
data.tar.gz: 046dd6819b7db08e45900e2db4a3b96260985ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f262c161decee207e2c683d749eda6b70e41aad372f61c2c0239175da975a3f19edd7ba452c2952a6a2948b0b5b83d823aa3227a0a18da60f1a7db22ad3b580
|
7
|
+
data.tar.gz: f86d200de56fc44573b16fa074971d1a721fc71775af0f1dcb0115c2f9bfb6f89b8742fb6ea7ce2d7e5827b281081ccead91e8905d4a940ac92cb0cb7ab3ba28
|
@@ -3203,7 +3203,7 @@ module Aws::CloudFormation
|
|
3203
3203
|
params: params,
|
3204
3204
|
config: config)
|
3205
3205
|
context[:gem_name] = 'aws-sdk-cloudformation'
|
3206
|
-
context[:gem_version] = '1.
|
3206
|
+
context[:gem_version] = '1.1.0'
|
3207
3207
|
Seahorse::Client::Request.new(handlers, context)
|
3208
3208
|
end
|
3209
3209
|
|
@@ -34,26 +34,26 @@ module Aws::CloudFormation
|
|
34
34
|
# The unique ID name of the instance of the stack.
|
35
35
|
# @return [String]
|
36
36
|
def stack_id
|
37
|
-
data
|
37
|
+
data[:stack_id]
|
38
38
|
end
|
39
39
|
|
40
40
|
# The name associated with a stack.
|
41
41
|
# @return [String]
|
42
42
|
def stack_name
|
43
|
-
data
|
43
|
+
data[:stack_name]
|
44
44
|
end
|
45
45
|
|
46
46
|
# The logical name of the resource specified in the template.
|
47
47
|
# @return [String]
|
48
48
|
def logical_resource_id
|
49
|
-
data
|
49
|
+
data[:logical_resource_id]
|
50
50
|
end
|
51
51
|
|
52
52
|
# The name or unique identifier associated with the physical instance of
|
53
53
|
# the resource.
|
54
54
|
# @return [String]
|
55
55
|
def physical_resource_id
|
56
|
-
data
|
56
|
+
data[:physical_resource_id]
|
57
57
|
end
|
58
58
|
|
59
59
|
# Type of resource. (For more information, go to [ AWS Resource Types
|
@@ -64,31 +64,31 @@ module Aws::CloudFormation
|
|
64
64
|
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
|
65
65
|
# @return [String]
|
66
66
|
def resource_type
|
67
|
-
data
|
67
|
+
data[:resource_type]
|
68
68
|
end
|
69
69
|
|
70
70
|
# Time the status was updated.
|
71
71
|
# @return [Time]
|
72
72
|
def timestamp
|
73
|
-
data
|
73
|
+
data[:timestamp]
|
74
74
|
end
|
75
75
|
|
76
76
|
# Current status of the resource.
|
77
77
|
# @return [String]
|
78
78
|
def resource_status
|
79
|
-
data
|
79
|
+
data[:resource_status]
|
80
80
|
end
|
81
81
|
|
82
82
|
# Success/failure message associated with the resource.
|
83
83
|
# @return [String]
|
84
84
|
def resource_status_reason
|
85
|
-
data
|
85
|
+
data[:resource_status_reason]
|
86
86
|
end
|
87
87
|
|
88
88
|
# BLOB of the properties used to create the resource.
|
89
89
|
# @return [String]
|
90
90
|
def resource_properties
|
91
|
-
data
|
91
|
+
data[:resource_properties]
|
92
92
|
end
|
93
93
|
|
94
94
|
# The token passed to the operation that generated this event.
|
@@ -108,7 +108,7 @@ module Aws::CloudFormation
|
|
108
108
|
# `Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`.
|
109
109
|
# @return [String]
|
110
110
|
def client_request_token
|
111
|
-
data
|
111
|
+
data[:client_request_token]
|
112
112
|
end
|
113
113
|
|
114
114
|
# @!endgroup
|
@@ -141,6 +141,101 @@ module Aws::CloudFormation
|
|
141
141
|
!!@data
|
142
142
|
end
|
143
143
|
|
144
|
+
# @deprecated Use [Aws::CloudFormation::Client] #wait_until instead
|
145
|
+
#
|
146
|
+
# Waiter polls an API operation until a resource enters a desired
|
147
|
+
# state.
|
148
|
+
#
|
149
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
150
|
+
#
|
151
|
+
# ## Basic Usage
|
152
|
+
#
|
153
|
+
# Waiter will polls until it is successful, it fails by
|
154
|
+
# entering a terminal state, or until a maximum number of attempts
|
155
|
+
# are made.
|
156
|
+
#
|
157
|
+
# # polls in a loop until condition is true
|
158
|
+
# resource.wait_until(options) {|resource| condition}
|
159
|
+
#
|
160
|
+
# ## Example
|
161
|
+
#
|
162
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
163
|
+
#
|
164
|
+
# ## Configuration
|
165
|
+
#
|
166
|
+
# You can configure the maximum number of polling attempts, and the
|
167
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
168
|
+
# by passing a block to {#wait_until}:
|
169
|
+
#
|
170
|
+
# # poll for ~25 seconds
|
171
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
172
|
+
#
|
173
|
+
# ## Callbacks
|
174
|
+
#
|
175
|
+
# You can be notified before each polling attempt and before each
|
176
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
177
|
+
# it will terminate the waiter.
|
178
|
+
#
|
179
|
+
# started_at = Time.now
|
180
|
+
# # poll for 1 hour, instead of a number of attempts
|
181
|
+
# proc = Proc.new do |attempts, response|
|
182
|
+
# throw :failure if Time.now - started_at > 3600
|
183
|
+
# end
|
184
|
+
#
|
185
|
+
# # disable max attempts
|
186
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
187
|
+
#
|
188
|
+
# ## Handling Errors
|
189
|
+
#
|
190
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
191
|
+
# fails, it raises an error.
|
192
|
+
#
|
193
|
+
# begin
|
194
|
+
# resource.wait_until(...)
|
195
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
196
|
+
# # resource did not enter the desired state in time
|
197
|
+
# end
|
198
|
+
#
|
199
|
+
#
|
200
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
201
|
+
#
|
202
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
203
|
+
# because the waiter has entered a state that it will not transition
|
204
|
+
# out of, preventing success.
|
205
|
+
#
|
206
|
+
# yet successful.
|
207
|
+
#
|
208
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
209
|
+
# while polling for a resource that is not expected.
|
210
|
+
#
|
211
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
212
|
+
#
|
213
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
214
|
+
# attempts
|
215
|
+
# @option options [Integer] :delay (10) Delay between each
|
216
|
+
# attempt in seconds
|
217
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
218
|
+
# invoked before each attempt
|
219
|
+
# @option options [Proc] :before_wait (nil) Callback
|
220
|
+
# invoked before each wait
|
221
|
+
# @return [Resource] if the waiter was successful
|
222
|
+
def wait_until(options = {}, &block)
|
223
|
+
self_copy = self.dup
|
224
|
+
attempts = 0
|
225
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
226
|
+
options[:delay] ||= 10
|
227
|
+
options[:poller] = Proc.new do
|
228
|
+
attempts += 1
|
229
|
+
if block.call(self_copy)
|
230
|
+
[:success, self_copy]
|
231
|
+
else
|
232
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
233
|
+
:retry
|
234
|
+
end
|
235
|
+
end
|
236
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
237
|
+
end
|
238
|
+
|
144
239
|
# @deprecated
|
145
240
|
# @api private
|
146
241
|
def identifiers
|
@@ -34,38 +34,38 @@ module Aws::CloudFormation
|
|
34
34
|
# Unique identifier of the stack.
|
35
35
|
# @return [String]
|
36
36
|
def stack_id
|
37
|
-
data
|
37
|
+
data[:stack_id]
|
38
38
|
end
|
39
39
|
|
40
40
|
# The unique ID of the change set.
|
41
41
|
# @return [String]
|
42
42
|
def change_set_id
|
43
|
-
data
|
43
|
+
data[:change_set_id]
|
44
44
|
end
|
45
45
|
|
46
46
|
# A user-defined description associated with the stack.
|
47
47
|
# @return [String]
|
48
48
|
def description
|
49
|
-
data
|
49
|
+
data[:description]
|
50
50
|
end
|
51
51
|
|
52
52
|
# A list of `Parameter` structures.
|
53
53
|
# @return [Array<Types::Parameter>]
|
54
54
|
def parameters
|
55
|
-
data
|
55
|
+
data[:parameters]
|
56
56
|
end
|
57
57
|
|
58
58
|
# The time at which the stack was created.
|
59
59
|
# @return [Time]
|
60
60
|
def creation_time
|
61
|
-
data
|
61
|
+
data[:creation_time]
|
62
62
|
end
|
63
63
|
|
64
64
|
# The time the stack was last updated. This field will only be returned
|
65
65
|
# if the stack has been updated at least once.
|
66
66
|
# @return [Time]
|
67
67
|
def last_updated_time
|
68
|
-
data
|
68
|
+
data[:last_updated_time]
|
69
69
|
end
|
70
70
|
|
71
71
|
# The rollback triggers for AWS CloudFormation to monitor during stack
|
@@ -73,19 +73,19 @@ module Aws::CloudFormation
|
|
73
73
|
# period afterwards.
|
74
74
|
# @return [Types::RollbackConfiguration]
|
75
75
|
def rollback_configuration
|
76
|
-
data
|
76
|
+
data[:rollback_configuration]
|
77
77
|
end
|
78
78
|
|
79
79
|
# Current status of the stack.
|
80
80
|
# @return [String]
|
81
81
|
def stack_status
|
82
|
-
data
|
82
|
+
data[:stack_status]
|
83
83
|
end
|
84
84
|
|
85
85
|
# Success/failure message associated with the stack status.
|
86
86
|
# @return [String]
|
87
87
|
def stack_status_reason
|
88
|
-
data
|
88
|
+
data[:stack_status_reason]
|
89
89
|
end
|
90
90
|
|
91
91
|
# Boolean to enable or disable rollback on stack creation failures:
|
@@ -95,31 +95,31 @@ module Aws::CloudFormation
|
|
95
95
|
# * `false`\: enable rollback
|
96
96
|
# @return [Boolean]
|
97
97
|
def disable_rollback
|
98
|
-
data
|
98
|
+
data[:disable_rollback]
|
99
99
|
end
|
100
100
|
|
101
101
|
# SNS topic ARNs to which stack related events are published.
|
102
102
|
# @return [Array<String>]
|
103
103
|
def notification_arns
|
104
|
-
data
|
104
|
+
data[:notification_arns]
|
105
105
|
end
|
106
106
|
|
107
107
|
# The amount of time within which stack creation should complete.
|
108
108
|
# @return [Integer]
|
109
109
|
def timeout_in_minutes
|
110
|
-
data
|
110
|
+
data[:timeout_in_minutes]
|
111
111
|
end
|
112
112
|
|
113
113
|
# The capabilities allowed in the stack.
|
114
114
|
# @return [Array<String>]
|
115
115
|
def capabilities
|
116
|
-
data
|
116
|
+
data[:capabilities]
|
117
117
|
end
|
118
118
|
|
119
119
|
# A list of output structures.
|
120
120
|
# @return [Array<Types::Output>]
|
121
121
|
def outputs
|
122
|
-
data
|
122
|
+
data[:outputs]
|
123
123
|
end
|
124
124
|
|
125
125
|
# The Amazon Resource Name (ARN) of an AWS Identity and Access
|
@@ -128,13 +128,13 @@ module Aws::CloudFormation
|
|
128
128
|
# make calls on your behalf.
|
129
129
|
# @return [String]
|
130
130
|
def role_arn
|
131
|
-
data
|
131
|
+
data[:role_arn]
|
132
132
|
end
|
133
133
|
|
134
134
|
# A list of `Tag`s that specify information about the stack.
|
135
135
|
# @return [Array<Types::Tag>]
|
136
136
|
def tags
|
137
|
-
data
|
137
|
+
data[:tags]
|
138
138
|
end
|
139
139
|
|
140
140
|
# @!endgroup
|
@@ -203,6 +203,101 @@ module Aws::CloudFormation
|
|
203
203
|
})
|
204
204
|
end
|
205
205
|
|
206
|
+
# @deprecated Use [Aws::CloudFormation::Client] #wait_until instead
|
207
|
+
#
|
208
|
+
# Waiter polls an API operation until a resource enters a desired
|
209
|
+
# state.
|
210
|
+
#
|
211
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
212
|
+
#
|
213
|
+
# ## Basic Usage
|
214
|
+
#
|
215
|
+
# Waiter will polls until it is successful, it fails by
|
216
|
+
# entering a terminal state, or until a maximum number of attempts
|
217
|
+
# are made.
|
218
|
+
#
|
219
|
+
# # polls in a loop until condition is true
|
220
|
+
# resource.wait_until(options) {|resource| condition}
|
221
|
+
#
|
222
|
+
# ## Example
|
223
|
+
#
|
224
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
225
|
+
#
|
226
|
+
# ## Configuration
|
227
|
+
#
|
228
|
+
# You can configure the maximum number of polling attempts, and the
|
229
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
230
|
+
# by passing a block to {#wait_until}:
|
231
|
+
#
|
232
|
+
# # poll for ~25 seconds
|
233
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
234
|
+
#
|
235
|
+
# ## Callbacks
|
236
|
+
#
|
237
|
+
# You can be notified before each polling attempt and before each
|
238
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
239
|
+
# it will terminate the waiter.
|
240
|
+
#
|
241
|
+
# started_at = Time.now
|
242
|
+
# # poll for 1 hour, instead of a number of attempts
|
243
|
+
# proc = Proc.new do |attempts, response|
|
244
|
+
# throw :failure if Time.now - started_at > 3600
|
245
|
+
# end
|
246
|
+
#
|
247
|
+
# # disable max attempts
|
248
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
249
|
+
#
|
250
|
+
# ## Handling Errors
|
251
|
+
#
|
252
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
253
|
+
# fails, it raises an error.
|
254
|
+
#
|
255
|
+
# begin
|
256
|
+
# resource.wait_until(...)
|
257
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
258
|
+
# # resource did not enter the desired state in time
|
259
|
+
# end
|
260
|
+
#
|
261
|
+
#
|
262
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
263
|
+
#
|
264
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
265
|
+
# because the waiter has entered a state that it will not transition
|
266
|
+
# out of, preventing success.
|
267
|
+
#
|
268
|
+
# yet successful.
|
269
|
+
#
|
270
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
271
|
+
# while polling for a resource that is not expected.
|
272
|
+
#
|
273
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
274
|
+
#
|
275
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
276
|
+
# attempts
|
277
|
+
# @option options [Integer] :delay (10) Delay between each
|
278
|
+
# attempt in seconds
|
279
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
280
|
+
# invoked before each attempt
|
281
|
+
# @option options [Proc] :before_wait (nil) Callback
|
282
|
+
# invoked before each wait
|
283
|
+
# @return [Resource] if the waiter was successful
|
284
|
+
def wait_until(options = {}, &block)
|
285
|
+
self_copy = self.dup
|
286
|
+
attempts = 0
|
287
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
288
|
+
options[:delay] ||= 10
|
289
|
+
options[:poller] = Proc.new do
|
290
|
+
attempts += 1
|
291
|
+
if block.call(self_copy)
|
292
|
+
[:success, self_copy]
|
293
|
+
else
|
294
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
295
|
+
:retry
|
296
|
+
end
|
297
|
+
end
|
298
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
299
|
+
end
|
300
|
+
|
206
301
|
# @!group Actions
|
207
302
|
|
208
303
|
# @example Request syntax with placeholder values
|
@@ -42,14 +42,14 @@ module Aws::CloudFormation
|
|
42
42
|
# Unique identifier of the stack.
|
43
43
|
# @return [String]
|
44
44
|
def stack_id
|
45
|
-
data
|
45
|
+
data[:stack_id]
|
46
46
|
end
|
47
47
|
|
48
48
|
# The name or unique identifier that corresponds to a physical instance
|
49
49
|
# ID of a resource supported by AWS CloudFormation.
|
50
50
|
# @return [String]
|
51
51
|
def physical_resource_id
|
52
|
-
data
|
52
|
+
data[:physical_resource_id]
|
53
53
|
end
|
54
54
|
|
55
55
|
# Type of resource. ((For more information, go to [ AWS Resource Types
|
@@ -60,31 +60,31 @@ module Aws::CloudFormation
|
|
60
60
|
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
|
61
61
|
# @return [String]
|
62
62
|
def resource_type
|
63
|
-
data
|
63
|
+
data[:resource_type]
|
64
64
|
end
|
65
65
|
|
66
66
|
# Time the status was updated.
|
67
67
|
# @return [Time]
|
68
68
|
def last_updated_timestamp
|
69
|
-
data
|
69
|
+
data[:last_updated_timestamp]
|
70
70
|
end
|
71
71
|
|
72
72
|
# Current status of the resource.
|
73
73
|
# @return [String]
|
74
74
|
def resource_status
|
75
|
-
data
|
75
|
+
data[:resource_status]
|
76
76
|
end
|
77
77
|
|
78
78
|
# Success/failure message associated with the resource.
|
79
79
|
# @return [String]
|
80
80
|
def resource_status_reason
|
81
|
-
data
|
81
|
+
data[:resource_status_reason]
|
82
82
|
end
|
83
83
|
|
84
84
|
# User defined description associated with the resource.
|
85
85
|
# @return [String]
|
86
86
|
def description
|
87
|
-
data
|
87
|
+
data[:description]
|
88
88
|
end
|
89
89
|
|
90
90
|
# The content of the `Metadata` attribute declared for the resource. For
|
@@ -96,7 +96,7 @@ module Aws::CloudFormation
|
|
96
96
|
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
|
97
97
|
# @return [String]
|
98
98
|
def metadata
|
99
|
-
data
|
99
|
+
data[:metadata]
|
100
100
|
end
|
101
101
|
|
102
102
|
# @!endgroup
|
@@ -137,6 +137,101 @@ module Aws::CloudFormation
|
|
137
137
|
!!@data
|
138
138
|
end
|
139
139
|
|
140
|
+
# @deprecated Use [Aws::CloudFormation::Client] #wait_until instead
|
141
|
+
#
|
142
|
+
# Waiter polls an API operation until a resource enters a desired
|
143
|
+
# state.
|
144
|
+
#
|
145
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
146
|
+
#
|
147
|
+
# ## Basic Usage
|
148
|
+
#
|
149
|
+
# Waiter will polls until it is successful, it fails by
|
150
|
+
# entering a terminal state, or until a maximum number of attempts
|
151
|
+
# are made.
|
152
|
+
#
|
153
|
+
# # polls in a loop until condition is true
|
154
|
+
# resource.wait_until(options) {|resource| condition}
|
155
|
+
#
|
156
|
+
# ## Example
|
157
|
+
#
|
158
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
159
|
+
#
|
160
|
+
# ## Configuration
|
161
|
+
#
|
162
|
+
# You can configure the maximum number of polling attempts, and the
|
163
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
164
|
+
# by passing a block to {#wait_until}:
|
165
|
+
#
|
166
|
+
# # poll for ~25 seconds
|
167
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
168
|
+
#
|
169
|
+
# ## Callbacks
|
170
|
+
#
|
171
|
+
# You can be notified before each polling attempt and before each
|
172
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
173
|
+
# it will terminate the waiter.
|
174
|
+
#
|
175
|
+
# started_at = Time.now
|
176
|
+
# # poll for 1 hour, instead of a number of attempts
|
177
|
+
# proc = Proc.new do |attempts, response|
|
178
|
+
# throw :failure if Time.now - started_at > 3600
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# # disable max attempts
|
182
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
183
|
+
#
|
184
|
+
# ## Handling Errors
|
185
|
+
#
|
186
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
187
|
+
# fails, it raises an error.
|
188
|
+
#
|
189
|
+
# begin
|
190
|
+
# resource.wait_until(...)
|
191
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
192
|
+
# # resource did not enter the desired state in time
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
#
|
196
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
197
|
+
#
|
198
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
199
|
+
# because the waiter has entered a state that it will not transition
|
200
|
+
# out of, preventing success.
|
201
|
+
#
|
202
|
+
# yet successful.
|
203
|
+
#
|
204
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
205
|
+
# while polling for a resource that is not expected.
|
206
|
+
#
|
207
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
208
|
+
#
|
209
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
210
|
+
# attempts
|
211
|
+
# @option options [Integer] :delay (10) Delay between each
|
212
|
+
# attempt in seconds
|
213
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
214
|
+
# invoked before each attempt
|
215
|
+
# @option options [Proc] :before_wait (nil) Callback
|
216
|
+
# invoked before each wait
|
217
|
+
# @return [Resource] if the waiter was successful
|
218
|
+
def wait_until(options = {}, &block)
|
219
|
+
self_copy = self.dup
|
220
|
+
attempts = 0
|
221
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
222
|
+
options[:delay] ||= 10
|
223
|
+
options[:poller] = Proc.new do
|
224
|
+
attempts += 1
|
225
|
+
if block.call(self_copy)
|
226
|
+
[:success, self_copy]
|
227
|
+
else
|
228
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
229
|
+
:retry
|
230
|
+
end
|
231
|
+
end
|
232
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
233
|
+
end
|
234
|
+
|
140
235
|
# @!group Associations
|
141
236
|
|
142
237
|
# @return [Stack]
|
@@ -43,7 +43,7 @@ module Aws::CloudFormation
|
|
43
43
|
# ID of the resource.
|
44
44
|
# @return [String]
|
45
45
|
def physical_resource_id
|
46
|
-
data
|
46
|
+
data[:physical_resource_id]
|
47
47
|
end
|
48
48
|
|
49
49
|
# Type of resource. (For more information, go to [ AWS Resource Types
|
@@ -54,25 +54,25 @@ module Aws::CloudFormation
|
|
54
54
|
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
|
55
55
|
# @return [String]
|
56
56
|
def resource_type
|
57
|
-
data
|
57
|
+
data[:resource_type]
|
58
58
|
end
|
59
59
|
|
60
60
|
# Time the status was updated.
|
61
61
|
# @return [Time]
|
62
62
|
def last_updated_timestamp
|
63
|
-
data
|
63
|
+
data[:last_updated_timestamp]
|
64
64
|
end
|
65
65
|
|
66
66
|
# Current status of the resource.
|
67
67
|
# @return [String]
|
68
68
|
def resource_status
|
69
|
-
data
|
69
|
+
data[:resource_status]
|
70
70
|
end
|
71
71
|
|
72
72
|
# Success/failure message associated with the resource.
|
73
73
|
# @return [String]
|
74
74
|
def resource_status_reason
|
75
|
-
data
|
75
|
+
data[:resource_status_reason]
|
76
76
|
end
|
77
77
|
|
78
78
|
# @!endgroup
|
@@ -105,6 +105,101 @@ module Aws::CloudFormation
|
|
105
105
|
!!@data
|
106
106
|
end
|
107
107
|
|
108
|
+
# @deprecated Use [Aws::CloudFormation::Client] #wait_until instead
|
109
|
+
#
|
110
|
+
# Waiter polls an API operation until a resource enters a desired
|
111
|
+
# state.
|
112
|
+
#
|
113
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
114
|
+
#
|
115
|
+
# ## Basic Usage
|
116
|
+
#
|
117
|
+
# Waiter will polls until it is successful, it fails by
|
118
|
+
# entering a terminal state, or until a maximum number of attempts
|
119
|
+
# are made.
|
120
|
+
#
|
121
|
+
# # polls in a loop until condition is true
|
122
|
+
# resource.wait_until(options) {|resource| condition}
|
123
|
+
#
|
124
|
+
# ## Example
|
125
|
+
#
|
126
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
127
|
+
#
|
128
|
+
# ## Configuration
|
129
|
+
#
|
130
|
+
# You can configure the maximum number of polling attempts, and the
|
131
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
132
|
+
# by passing a block to {#wait_until}:
|
133
|
+
#
|
134
|
+
# # poll for ~25 seconds
|
135
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
136
|
+
#
|
137
|
+
# ## Callbacks
|
138
|
+
#
|
139
|
+
# You can be notified before each polling attempt and before each
|
140
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
141
|
+
# it will terminate the waiter.
|
142
|
+
#
|
143
|
+
# started_at = Time.now
|
144
|
+
# # poll for 1 hour, instead of a number of attempts
|
145
|
+
# proc = Proc.new do |attempts, response|
|
146
|
+
# throw :failure if Time.now - started_at > 3600
|
147
|
+
# end
|
148
|
+
#
|
149
|
+
# # disable max attempts
|
150
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
151
|
+
#
|
152
|
+
# ## Handling Errors
|
153
|
+
#
|
154
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
155
|
+
# fails, it raises an error.
|
156
|
+
#
|
157
|
+
# begin
|
158
|
+
# resource.wait_until(...)
|
159
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
160
|
+
# # resource did not enter the desired state in time
|
161
|
+
# end
|
162
|
+
#
|
163
|
+
#
|
164
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
165
|
+
#
|
166
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
167
|
+
# because the waiter has entered a state that it will not transition
|
168
|
+
# out of, preventing success.
|
169
|
+
#
|
170
|
+
# yet successful.
|
171
|
+
#
|
172
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
173
|
+
# while polling for a resource that is not expected.
|
174
|
+
#
|
175
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
176
|
+
#
|
177
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
178
|
+
# attempts
|
179
|
+
# @option options [Integer] :delay (10) Delay between each
|
180
|
+
# attempt in seconds
|
181
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
182
|
+
# invoked before each attempt
|
183
|
+
# @option options [Proc] :before_wait (nil) Callback
|
184
|
+
# invoked before each wait
|
185
|
+
# @return [Resource] if the waiter was successful
|
186
|
+
def wait_until(options = {}, &block)
|
187
|
+
self_copy = self.dup
|
188
|
+
attempts = 0
|
189
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
190
|
+
options[:delay] ||= 10
|
191
|
+
options[:poller] = Proc.new do
|
192
|
+
attempts += 1
|
193
|
+
if block.call(self_copy)
|
194
|
+
[:success, self_copy]
|
195
|
+
else
|
196
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
197
|
+
:retry
|
198
|
+
end
|
199
|
+
end
|
200
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
201
|
+
end
|
202
|
+
|
108
203
|
# @!group Associations
|
109
204
|
|
110
205
|
# @return [StackResource]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-cloudformation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -61,7 +61,9 @@ files:
|
|
61
61
|
homepage: http://github.com/aws/aws-sdk-ruby
|
62
62
|
licenses:
|
63
63
|
- Apache-2.0
|
64
|
-
metadata:
|
64
|
+
metadata:
|
65
|
+
source_code_uri: https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-cloudformation
|
66
|
+
changelog_uri: https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-cloudformation/CHANGELOG.md
|
65
67
|
post_install_message:
|
66
68
|
rdoc_options: []
|
67
69
|
require_paths:
|