aws-sdk-opsworks 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0b4c8f89bac70ac8b5bde563d35769636aff433
4
- data.tar.gz: 378340bd8cba9a2c18fb03a9771af7986af4197c
3
+ metadata.gz: 576d6dec49f2a5077e5f37881c4b52edd8c6dc2c
4
+ data.tar.gz: 78d88ba1dd819e41f280b77baa3e9cb77c003f75
5
5
  SHA512:
6
- metadata.gz: 2ecd7f7f8f4d3ea83886608350dea5b0c773a5bf624dd381cd6b67cc042760e4c7656f5eca6ef277a1518be5a3ce8f4898298d156cdacbcd12485bffb9ec82f6
7
- data.tar.gz: 9b33becec4c774264a180f17cc0cc3eb505574a82479195711729a119d152766dfa9511ef97abed058b9caa2c4e858804d393a12dfd8d111fc5c595a8a1dd65d
6
+ metadata.gz: cae59d415a3c3ee1b0e5ea523c1776c3e6eec8da9371587d3f8e700870b236018c6b1d41cdaded941f66893f89e60a325b04e4ed2900a8225b78a986e6ec32ba
7
+ data.tar.gz: dbee5a35410eb037f27f04b678a750950742cb3fa4d267a7331f7223dd18e0514eee7295421af30c2c85cbb6632058afdc10623440ba865ce1cfd4c765525abc
@@ -46,6 +46,6 @@ require_relative 'aws-sdk-opsworks/customizations'
46
46
  # @service
47
47
  module Aws::OpsWorks
48
48
 
49
- GEM_VERSION = '1.0.0'
49
+ GEM_VERSION = '1.1.0'
50
50
 
51
51
  end
@@ -5360,7 +5360,7 @@ module Aws::OpsWorks
5360
5360
  params: params,
5361
5361
  config: config)
5362
5362
  context[:gem_name] = 'aws-sdk-opsworks'
5363
- context[:gem_version] = '1.0.0'
5363
+ context[:gem_version] = '1.1.0'
5364
5364
  Seahorse::Client::Request.new(handlers, context)
5365
5365
  end
5366
5366
 
@@ -32,37 +32,37 @@ module Aws::OpsWorks
32
32
 
33
33
  # @return [String]
34
34
  def arn
35
- data.arn
35
+ data[:arn]
36
36
  end
37
37
 
38
38
  # The layer stack ID.
39
39
  # @return [String]
40
40
  def stack_id
41
- data.stack_id
41
+ data[:stack_id]
42
42
  end
43
43
 
44
44
  # The layer ID.
45
45
  # @return [String]
46
46
  def layer_id
47
- data.layer_id
47
+ data[:layer_id]
48
48
  end
49
49
 
50
50
  # The layer type.
51
51
  # @return [String]
52
52
  def type
53
- data.type
53
+ data[:type]
54
54
  end
55
55
 
56
56
  # The layer name.
57
57
  # @return [String]
58
58
  def name
59
- data.name
59
+ data[:name]
60
60
  end
61
61
 
62
62
  # The layer short name.
63
63
  # @return [String]
64
64
  def shortname
65
- data.shortname
65
+ data[:shortname]
66
66
  end
67
67
 
68
68
  # The layer attributes.
@@ -75,13 +75,13 @@ module Aws::OpsWorks
75
75
  # attribute is set to the cluster's ARN.
76
76
  # @return [Hash<String,String>]
77
77
  def attributes
78
- data.attributes
78
+ data[:attributes]
79
79
  end
80
80
 
81
81
  # The Amazon CloudWatch Logs configuration settings for the layer.
82
82
  # @return [Types::CloudWatchLogsConfiguration]
83
83
  def cloud_watch_logs_configuration
84
- data.cloud_watch_logs_configuration
84
+ data[:cloud_watch_logs_configuration]
85
85
  end
86
86
 
87
87
  # The ARN of the default IAM profile to be used for the layer's EC2
@@ -93,45 +93,45 @@ module Aws::OpsWorks
93
93
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
94
94
  # @return [String]
95
95
  def custom_instance_profile_arn
96
- data.custom_instance_profile_arn
96
+ data[:custom_instance_profile_arn]
97
97
  end
98
98
 
99
99
  # A JSON formatted string containing the layer's custom stack
100
100
  # configuration and deployment attributes.
101
101
  # @return [String]
102
102
  def custom_json
103
- data.custom_json
103
+ data[:custom_json]
104
104
  end
105
105
 
106
106
  # An array containing the layer's custom security group IDs.
107
107
  # @return [Array<String>]
108
108
  def custom_security_group_ids
109
- data.custom_security_group_ids
109
+ data[:custom_security_group_ids]
110
110
  end
111
111
 
112
112
  # An array containing the layer's security group names.
113
113
  # @return [Array<String>]
114
114
  def default_security_group_names
115
- data.default_security_group_names
115
+ data[:default_security_group_names]
116
116
  end
117
117
 
118
118
  # An array of `Package` objects that describe the layer's packages.
119
119
  # @return [Array<String>]
120
120
  def packages
121
- data.packages
121
+ data[:packages]
122
122
  end
123
123
 
124
124
  # A `VolumeConfigurations` object that describes the layer's Amazon EBS
125
125
  # volumes.
126
126
  # @return [Array<Types::VolumeConfiguration>]
127
127
  def volume_configurations
128
- data.volume_configurations
128
+ data[:volume_configurations]
129
129
  end
130
130
 
131
131
  # Whether auto healing is disabled for the layer.
132
132
  # @return [Boolean]
133
133
  def enable_auto_healing
134
- data.enable_auto_healing
134
+ data[:enable_auto_healing]
135
135
  end
136
136
 
137
137
  # Whether to automatically assign an [Elastic IP address][1] to the
@@ -144,7 +144,7 @@ module Aws::OpsWorks
144
144
  # [2]: http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html
145
145
  # @return [Boolean]
146
146
  def auto_assign_elastic_ips
147
- data.auto_assign_elastic_ips
147
+ data[:auto_assign_elastic_ips]
148
148
  end
149
149
 
150
150
  # For stacks that are running in a VPC, whether to automatically assign
@@ -156,7 +156,7 @@ module Aws::OpsWorks
156
156
  # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html
157
157
  # @return [Boolean]
158
158
  def auto_assign_public_ips
159
- data.auto_assign_public_ips
159
+ data[:auto_assign_public_ips]
160
160
  end
161
161
 
162
162
  # AWS OpsWorks Stacks supports five lifecycle events: **setup**,
@@ -175,20 +175,20 @@ module Aws::OpsWorks
175
175
  # phpapp2 folder.
176
176
  # @return [Types::Recipes]
177
177
  def default_recipes
178
- data.default_recipes
178
+ data[:default_recipes]
179
179
  end
180
180
 
181
181
  # A `LayerCustomRecipes` object that specifies the layer's custom
182
182
  # recipes.
183
183
  # @return [Types::Recipes]
184
184
  def custom_recipes
185
- data.custom_recipes
185
+ data[:custom_recipes]
186
186
  end
187
187
 
188
188
  # Date when the layer was created.
189
189
  # @return [String]
190
190
  def created_at
191
- data.created_at
191
+ data[:created_at]
192
192
  end
193
193
 
194
194
  # Whether to install operating system and package updates when the
@@ -204,20 +204,20 @@ module Aws::OpsWorks
204
204
  # </note>
205
205
  # @return [Boolean]
206
206
  def install_updates_on_boot
207
- data.install_updates_on_boot
207
+ data[:install_updates_on_boot]
208
208
  end
209
209
 
210
210
  # Whether the layer uses Amazon EBS-optimized instances.
211
211
  # @return [Boolean]
212
212
  def use_ebs_optimized_instances
213
- data.use_ebs_optimized_instances
213
+ data[:use_ebs_optimized_instances]
214
214
  end
215
215
 
216
216
  # A `LifeCycleEventConfiguration` object that specifies the Shutdown
217
217
  # event configuration.
218
218
  # @return [Types::LifecycleEventConfiguration]
219
219
  def lifecycle_event_configuration
220
- data.lifecycle_event_configuration
220
+ data[:lifecycle_event_configuration]
221
221
  end
222
222
 
223
223
  # @!endgroup
@@ -255,6 +255,101 @@ module Aws::OpsWorks
255
255
  !!@data
256
256
  end
257
257
 
258
+ # @deprecated Use [Aws::OpsWorks::Client] #wait_until instead
259
+ #
260
+ # Waiter polls an API operation until a resource enters a desired
261
+ # state.
262
+ #
263
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
264
+ #
265
+ # ## Basic Usage
266
+ #
267
+ # Waiter will polls until it is successful, it fails by
268
+ # entering a terminal state, or until a maximum number of attempts
269
+ # are made.
270
+ #
271
+ # # polls in a loop until condition is true
272
+ # resource.wait_until(options) {|resource| condition}
273
+ #
274
+ # ## Example
275
+ #
276
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
277
+ #
278
+ # ## Configuration
279
+ #
280
+ # You can configure the maximum number of polling attempts, and the
281
+ # delay (in seconds) between each polling attempt. The waiting condition is set
282
+ # by passing a block to {#wait_until}:
283
+ #
284
+ # # poll for ~25 seconds
285
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
286
+ #
287
+ # ## Callbacks
288
+ #
289
+ # You can be notified before each polling attempt and before each
290
+ # delay. If you throw `:success` or `:failure` from these callbacks,
291
+ # it will terminate the waiter.
292
+ #
293
+ # started_at = Time.now
294
+ # # poll for 1 hour, instead of a number of attempts
295
+ # proc = Proc.new do |attempts, response|
296
+ # throw :failure if Time.now - started_at > 3600
297
+ # end
298
+ #
299
+ # # disable max attempts
300
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
301
+ #
302
+ # ## Handling Errors
303
+ #
304
+ # When a waiter is successful, it returns the Resource. When a waiter
305
+ # fails, it raises an error.
306
+ #
307
+ # begin
308
+ # resource.wait_until(...)
309
+ # rescue Aws::Waiters::Errors::WaiterFailed
310
+ # # resource did not enter the desired state in time
311
+ # end
312
+ #
313
+ #
314
+ # @yield param [Resource] resource to be used in the waiting condition
315
+ #
316
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
317
+ # because the waiter has entered a state that it will not transition
318
+ # out of, preventing success.
319
+ #
320
+ # yet successful.
321
+ #
322
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
323
+ # while polling for a resource that is not expected.
324
+ #
325
+ # @raise [NotImplementedError] Raised when the resource does not
326
+ #
327
+ # @option options [Integer] :max_attempts (10) Maximum number of
328
+ # attempts
329
+ # @option options [Integer] :delay (10) Delay between each
330
+ # attempt in seconds
331
+ # @option options [Proc] :before_attempt (nil) Callback
332
+ # invoked before each attempt
333
+ # @option options [Proc] :before_wait (nil) Callback
334
+ # invoked before each wait
335
+ # @return [Resource] if the waiter was successful
336
+ def wait_until(options = {}, &block)
337
+ self_copy = self.dup
338
+ attempts = 0
339
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
340
+ options[:delay] ||= 10
341
+ options[:poller] = Proc.new do
342
+ attempts += 1
343
+ if block.call(self_copy)
344
+ [:success, self_copy]
345
+ else
346
+ self_copy.reload unless attempts == options[:max_attempts]
347
+ :retry
348
+ end
349
+ end
350
+ Aws::Waiters::Waiter.new(options).wait({})
351
+ end
352
+
258
353
  # @!group Actions
259
354
 
260
355
  # @example Request syntax with placeholder values
@@ -272,9 +367,9 @@ module Aws::OpsWorks
272
367
 
273
368
  # @return [Stack, nil]
274
369
  def stack
275
- if data.stack_id
370
+ if data[:stack_id]
276
371
  Stack.new(
277
- id: data.stack_id,
372
+ id: data[:stack_id],
278
373
  client: @client
279
374
  )
280
375
  else
@@ -33,19 +33,19 @@ module Aws::OpsWorks
33
33
  # The stack ID.
34
34
  # @return [String]
35
35
  def stack_id
36
- data.stack_id
36
+ data[:stack_id]
37
37
  end
38
38
 
39
39
  # The stack name.
40
40
  # @return [String]
41
41
  def name
42
- data.name
42
+ data[:name]
43
43
  end
44
44
 
45
45
  # The stack's ARN.
46
46
  # @return [String]
47
47
  def arn
48
- data.arn
48
+ data[:arn]
49
49
  end
50
50
 
51
51
  # The stack AWS region, such as "ap-northeast-2". For more information
@@ -56,25 +56,25 @@ module Aws::OpsWorks
56
56
  # [1]: http://docs.aws.amazon.com/general/latest/gr/rande.html
57
57
  # @return [String]
58
58
  def region
59
- data.region
59
+ data[:region]
60
60
  end
61
61
 
62
62
  # The VPC ID; applicable only if the stack is running in a VPC.
63
63
  # @return [String]
64
64
  def vpc_id
65
- data.vpc_id
65
+ data[:vpc_id]
66
66
  end
67
67
 
68
68
  # The stack's attributes.
69
69
  # @return [Hash<String,String>]
70
70
  def attributes
71
- data.attributes
71
+ data[:attributes]
72
72
  end
73
73
 
74
74
  # The stack AWS Identity and Access Management (IAM) role.
75
75
  # @return [String]
76
76
  def service_role_arn
77
- data.service_role_arn
77
+ data[:service_role_arn]
78
78
  end
79
79
 
80
80
  # The ARN of an IAM profile that is the default profile for all of the
@@ -86,19 +86,19 @@ module Aws::OpsWorks
86
86
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
87
87
  # @return [String]
88
88
  def default_instance_profile_arn
89
- data.default_instance_profile_arn
89
+ data[:default_instance_profile_arn]
90
90
  end
91
91
 
92
92
  # The stack's default operating system.
93
93
  # @return [String]
94
94
  def default_os
95
- data.default_os
95
+ data[:default_os]
96
96
  end
97
97
 
98
98
  # The stack host name theme, with spaces replaced by underscores.
99
99
  # @return [String]
100
100
  def hostname_theme
101
- data.hostname_theme
101
+ data[:hostname_theme]
102
102
  end
103
103
 
104
104
  # The stack's default Availability Zone. For more information, see
@@ -109,14 +109,14 @@ module Aws::OpsWorks
109
109
  # [1]: http://docs.aws.amazon.com/general/latest/gr/rande.html
110
110
  # @return [String]
111
111
  def default_availability_zone
112
- data.default_availability_zone
112
+ data[:default_availability_zone]
113
113
  end
114
114
 
115
115
  # The default subnet ID; applicable only if the stack is running in a
116
116
  # VPC.
117
117
  # @return [String]
118
118
  def default_subnet_id
119
- data.default_subnet_id
119
+ data[:default_subnet_id]
120
120
  end
121
121
 
122
122
  # A JSON object that contains user-defined attributes to be added to the
@@ -135,13 +135,13 @@ module Aws::OpsWorks
135
135
  # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-json.html
136
136
  # @return [String]
137
137
  def custom_json
138
- data.custom_json
138
+ data[:custom_json]
139
139
  end
140
140
 
141
141
  # The configuration manager.
142
142
  # @return [Types::StackConfigurationManager]
143
143
  def configuration_manager
144
- data.configuration_manager
144
+ data[:configuration_manager]
145
145
  end
146
146
 
147
147
  # A `ChefConfiguration` object that specifies whether to enable
@@ -153,20 +153,20 @@ module Aws::OpsWorks
153
153
  # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-creating.html
154
154
  # @return [Types::ChefConfiguration]
155
155
  def chef_configuration
156
- data.chef_configuration
156
+ data[:chef_configuration]
157
157
  end
158
158
 
159
159
  # Whether the stack uses custom cookbooks.
160
160
  # @return [Boolean]
161
161
  def use_custom_cookbooks
162
- data.use_custom_cookbooks
162
+ data[:use_custom_cookbooks]
163
163
  end
164
164
 
165
165
  # Whether the stack automatically associates the AWS OpsWorks Stacks
166
166
  # built-in security groups with the stack's layers.
167
167
  # @return [Boolean]
168
168
  def use_opsworks_security_groups
169
- data.use_opsworks_security_groups
169
+ data[:use_opsworks_security_groups]
170
170
  end
171
171
 
172
172
  # Contains the information required to retrieve an app or cookbook from
@@ -179,20 +179,20 @@ module Aws::OpsWorks
179
179
  # [2]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook.html
180
180
  # @return [Types::Source]
181
181
  def custom_cookbooks_source
182
- data.custom_cookbooks_source
182
+ data[:custom_cookbooks_source]
183
183
  end
184
184
 
185
185
  # A default Amazon EC2 key pair for the stack's instances. You can
186
186
  # override this value when you create or update an instance.
187
187
  # @return [String]
188
188
  def default_ssh_key_name
189
- data.default_ssh_key_name
189
+ data[:default_ssh_key_name]
190
190
  end
191
191
 
192
192
  # The date when the stack was created.
193
193
  # @return [String]
194
194
  def created_at
195
- data.created_at
195
+ data[:created_at]
196
196
  end
197
197
 
198
198
  # The default root device type. This value is used by default for all
@@ -204,14 +204,14 @@ module Aws::OpsWorks
204
204
  # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html#storage-for-the-root-device
205
205
  # @return [String]
206
206
  def default_root_device_type
207
- data.default_root_device_type
207
+ data[:default_root_device_type]
208
208
  end
209
209
 
210
210
  # The agent version. This parameter is set to `LATEST` for auto-update.
211
211
  # or a version number for a fixed agent version.
212
212
  # @return [String]
213
213
  def agent_version
214
- data.agent_version
214
+ data[:agent_version]
215
215
  end
216
216
 
217
217
  # @!endgroup
@@ -249,6 +249,101 @@ module Aws::OpsWorks
249
249
  !!@data
250
250
  end
251
251
 
252
+ # @deprecated Use [Aws::OpsWorks::Client] #wait_until instead
253
+ #
254
+ # Waiter polls an API operation until a resource enters a desired
255
+ # state.
256
+ #
257
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
258
+ #
259
+ # ## Basic Usage
260
+ #
261
+ # Waiter will polls until it is successful, it fails by
262
+ # entering a terminal state, or until a maximum number of attempts
263
+ # are made.
264
+ #
265
+ # # polls in a loop until condition is true
266
+ # resource.wait_until(options) {|resource| condition}
267
+ #
268
+ # ## Example
269
+ #
270
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
271
+ #
272
+ # ## Configuration
273
+ #
274
+ # You can configure the maximum number of polling attempts, and the
275
+ # delay (in seconds) between each polling attempt. The waiting condition is set
276
+ # by passing a block to {#wait_until}:
277
+ #
278
+ # # poll for ~25 seconds
279
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
280
+ #
281
+ # ## Callbacks
282
+ #
283
+ # You can be notified before each polling attempt and before each
284
+ # delay. If you throw `:success` or `:failure` from these callbacks,
285
+ # it will terminate the waiter.
286
+ #
287
+ # started_at = Time.now
288
+ # # poll for 1 hour, instead of a number of attempts
289
+ # proc = Proc.new do |attempts, response|
290
+ # throw :failure if Time.now - started_at > 3600
291
+ # end
292
+ #
293
+ # # disable max attempts
294
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
295
+ #
296
+ # ## Handling Errors
297
+ #
298
+ # When a waiter is successful, it returns the Resource. When a waiter
299
+ # fails, it raises an error.
300
+ #
301
+ # begin
302
+ # resource.wait_until(...)
303
+ # rescue Aws::Waiters::Errors::WaiterFailed
304
+ # # resource did not enter the desired state in time
305
+ # end
306
+ #
307
+ #
308
+ # @yield param [Resource] resource to be used in the waiting condition
309
+ #
310
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
311
+ # because the waiter has entered a state that it will not transition
312
+ # out of, preventing success.
313
+ #
314
+ # yet successful.
315
+ #
316
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
317
+ # while polling for a resource that is not expected.
318
+ #
319
+ # @raise [NotImplementedError] Raised when the resource does not
320
+ #
321
+ # @option options [Integer] :max_attempts (10) Maximum number of
322
+ # attempts
323
+ # @option options [Integer] :delay (10) Delay between each
324
+ # attempt in seconds
325
+ # @option options [Proc] :before_attempt (nil) Callback
326
+ # invoked before each attempt
327
+ # @option options [Proc] :before_wait (nil) Callback
328
+ # invoked before each wait
329
+ # @return [Resource] if the waiter was successful
330
+ def wait_until(options = {}, &block)
331
+ self_copy = self.dup
332
+ attempts = 0
333
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
334
+ options[:delay] ||= 10
335
+ options[:poller] = Proc.new do
336
+ attempts += 1
337
+ if block.call(self_copy)
338
+ [:success, self_copy]
339
+ else
340
+ self_copy.reload unless attempts == options[:max_attempts]
341
+ :retry
342
+ end
343
+ end
344
+ Aws::Waiters::Waiter.new(options).wait({})
345
+ end
346
+
252
347
  # @!group Actions
253
348
 
254
349
  # @example Request syntax with placeholder values
@@ -33,32 +33,32 @@ module Aws::OpsWorks
33
33
  # The stack name.
34
34
  # @return [String]
35
35
  def name
36
- data.name
36
+ data[:name]
37
37
  end
38
38
 
39
39
  # The stack's ARN.
40
40
  # @return [String]
41
41
  def arn
42
- data.arn
42
+ data[:arn]
43
43
  end
44
44
 
45
45
  # The number of layers.
46
46
  # @return [Integer]
47
47
  def layers_count
48
- data.layers_count
48
+ data[:layers_count]
49
49
  end
50
50
 
51
51
  # The number of apps.
52
52
  # @return [Integer]
53
53
  def apps_count
54
- data.apps_count
54
+ data[:apps_count]
55
55
  end
56
56
 
57
57
  # An `InstancesCount` object with the number of instances in each
58
58
  # status.
59
59
  # @return [Types::InstancesCount]
60
60
  def instances_count
61
- data.instances_count
61
+ data[:instances_count]
62
62
  end
63
63
 
64
64
  # @!endgroup
@@ -96,6 +96,101 @@ module Aws::OpsWorks
96
96
  !!@data
97
97
  end
98
98
 
99
+ # @deprecated Use [Aws::OpsWorks::Client] #wait_until instead
100
+ #
101
+ # Waiter polls an API operation until a resource enters a desired
102
+ # state.
103
+ #
104
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
105
+ #
106
+ # ## Basic Usage
107
+ #
108
+ # Waiter will polls until it is successful, it fails by
109
+ # entering a terminal state, or until a maximum number of attempts
110
+ # are made.
111
+ #
112
+ # # polls in a loop until condition is true
113
+ # resource.wait_until(options) {|resource| condition}
114
+ #
115
+ # ## Example
116
+ #
117
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
118
+ #
119
+ # ## Configuration
120
+ #
121
+ # You can configure the maximum number of polling attempts, and the
122
+ # delay (in seconds) between each polling attempt. The waiting condition is set
123
+ # by passing a block to {#wait_until}:
124
+ #
125
+ # # poll for ~25 seconds
126
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
127
+ #
128
+ # ## Callbacks
129
+ #
130
+ # You can be notified before each polling attempt and before each
131
+ # delay. If you throw `:success` or `:failure` from these callbacks,
132
+ # it will terminate the waiter.
133
+ #
134
+ # started_at = Time.now
135
+ # # poll for 1 hour, instead of a number of attempts
136
+ # proc = Proc.new do |attempts, response|
137
+ # throw :failure if Time.now - started_at > 3600
138
+ # end
139
+ #
140
+ # # disable max attempts
141
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
142
+ #
143
+ # ## Handling Errors
144
+ #
145
+ # When a waiter is successful, it returns the Resource. When a waiter
146
+ # fails, it raises an error.
147
+ #
148
+ # begin
149
+ # resource.wait_until(...)
150
+ # rescue Aws::Waiters::Errors::WaiterFailed
151
+ # # resource did not enter the desired state in time
152
+ # end
153
+ #
154
+ #
155
+ # @yield param [Resource] resource to be used in the waiting condition
156
+ #
157
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
158
+ # because the waiter has entered a state that it will not transition
159
+ # out of, preventing success.
160
+ #
161
+ # yet successful.
162
+ #
163
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
164
+ # while polling for a resource that is not expected.
165
+ #
166
+ # @raise [NotImplementedError] Raised when the resource does not
167
+ #
168
+ # @option options [Integer] :max_attempts (10) Maximum number of
169
+ # attempts
170
+ # @option options [Integer] :delay (10) Delay between each
171
+ # attempt in seconds
172
+ # @option options [Proc] :before_attempt (nil) Callback
173
+ # invoked before each attempt
174
+ # @option options [Proc] :before_wait (nil) Callback
175
+ # invoked before each wait
176
+ # @return [Resource] if the waiter was successful
177
+ def wait_until(options = {}, &block)
178
+ self_copy = self.dup
179
+ attempts = 0
180
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
181
+ options[:delay] ||= 10
182
+ options[:poller] = Proc.new do
183
+ attempts += 1
184
+ if block.call(self_copy)
185
+ [:success, self_copy]
186
+ else
187
+ self_copy.reload unless attempts == options[:max_attempts]
188
+ :retry
189
+ end
190
+ end
191
+ Aws::Waiters::Waiter.new(options).wait({})
192
+ end
193
+
99
194
  # @!group Associations
100
195
 
101
196
  # @return [Stack]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-opsworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
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-08-29 00:00:00.000000000 Z
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
@@ -60,7 +60,9 @@ files:
60
60
  homepage: http://github.com/aws/aws-sdk-ruby
61
61
  licenses:
62
62
  - Apache-2.0
63
- metadata: {}
63
+ metadata:
64
+ source_code_uri: https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-opsworks
65
+ changelog_uri: https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-opsworks/CHANGELOG.md
64
66
  post_install_message:
65
67
  rdoc_options: []
66
68
  require_paths: