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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b343191eabd9f2d7ba70613a565a16bc1f1839a
4
- data.tar.gz: 669591f0e61fddd337987ac4158986338766b8b2
3
+ metadata.gz: c3866d10256da0a4bb8f5fe1d17410802f5a2294
4
+ data.tar.gz: 979828c93d1c5be1bcc655c9e0a7183539745c0b
5
5
  SHA512:
6
- metadata.gz: a70e3e249324c03ea9e2a5963eb023ecddc068ca2e42665f67465e2e47317b9a689432877328a597c0927b0b1978da7ca4982917aa599c32f34d6ff1a38b9022
7
- data.tar.gz: 1e3645ead5a3987fbc866942dc0acb2e1c5711bb409e6f02d06f898271de77c674d85ff70e168a8c0b87b44721dc59d292dcea39f8ceec9aca55a72d01cb5714
6
+ metadata.gz: 0edf212977bb0579bd5dc457aadd4bcdbff60c400becead9fee5748ffc3690f0a9bb0bddcc73916947eb0d8ea7d4c2c766ed37c3cf77ae24737566b6a69c681f
7
+ data.tar.gz: b422e041107199c3f80ae4251f5417d19311051e7566d8f0b2e512379eb3315bde1fba032dc8c4ccd3e722be3bcd5140ed9c78a19f410f2eb42d99f1cfd9d01d
@@ -53,6 +53,6 @@ require_relative 'aws-sdk-autoscaling/customizations'
53
53
  # @service
54
54
  module Aws::AutoScaling
55
55
 
56
- GEM_VERSION = '1.2.0'
56
+ GEM_VERSION = '1.3.0'
57
57
 
58
58
  end
@@ -34,55 +34,55 @@ module Aws::AutoScaling
34
34
  # The name of the Auto Scaling group.
35
35
  # @return [String]
36
36
  def auto_scaling_group_name
37
- data.auto_scaling_group_name
37
+ data[:auto_scaling_group_name]
38
38
  end
39
39
 
40
40
  # A friendly, more verbose description of the activity.
41
41
  # @return [String]
42
42
  def description
43
- data.description
43
+ data[:description]
44
44
  end
45
45
 
46
46
  # The reason the activity began.
47
47
  # @return [String]
48
48
  def cause
49
- data.cause
49
+ data[:cause]
50
50
  end
51
51
 
52
52
  # The start time of the activity.
53
53
  # @return [Time]
54
54
  def start_time
55
- data.start_time
55
+ data[:start_time]
56
56
  end
57
57
 
58
58
  # The end time of the activity.
59
59
  # @return [Time]
60
60
  def end_time
61
- data.end_time
61
+ data[:end_time]
62
62
  end
63
63
 
64
64
  # The current status of the activity.
65
65
  # @return [String]
66
66
  def status_code
67
- data.status_code
67
+ data[:status_code]
68
68
  end
69
69
 
70
70
  # A friendly, more verbose description of the activity status.
71
71
  # @return [String]
72
72
  def status_message
73
- data.status_message
73
+ data[:status_message]
74
74
  end
75
75
 
76
76
  # A value between 0 and 100 that indicates the progress of the activity.
77
77
  # @return [Integer]
78
78
  def progress
79
- data.progress
79
+ data[:progress]
80
80
  end
81
81
 
82
82
  # The details about the activity.
83
83
  # @return [String]
84
84
  def details
85
- data.details
85
+ data[:details]
86
86
  end
87
87
 
88
88
  # @!endgroup
@@ -120,13 +120,108 @@ module Aws::AutoScaling
120
120
  !!@data
121
121
  end
122
122
 
123
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
124
+ #
125
+ # Waiter polls an API operation until a resource enters a desired
126
+ # state.
127
+ #
128
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
129
+ #
130
+ # ## Basic Usage
131
+ #
132
+ # Waiter will polls until it is successful, it fails by
133
+ # entering a terminal state, or until a maximum number of attempts
134
+ # are made.
135
+ #
136
+ # # polls in a loop until condition is true
137
+ # resource.wait_until(options) {|resource| condition}
138
+ #
139
+ # ## Example
140
+ #
141
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
142
+ #
143
+ # ## Configuration
144
+ #
145
+ # You can configure the maximum number of polling attempts, and the
146
+ # delay (in seconds) between each polling attempt. The waiting condition is set
147
+ # by passing a block to {#wait_until}:
148
+ #
149
+ # # poll for ~25 seconds
150
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
151
+ #
152
+ # ## Callbacks
153
+ #
154
+ # You can be notified before each polling attempt and before each
155
+ # delay. If you throw `:success` or `:failure` from these callbacks,
156
+ # it will terminate the waiter.
157
+ #
158
+ # started_at = Time.now
159
+ # # poll for 1 hour, instead of a number of attempts
160
+ # proc = Proc.new do |attempts, response|
161
+ # throw :failure if Time.now - started_at > 3600
162
+ # end
163
+ #
164
+ # # disable max attempts
165
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
166
+ #
167
+ # ## Handling Errors
168
+ #
169
+ # When a waiter is successful, it returns the Resource. When a waiter
170
+ # fails, it raises an error.
171
+ #
172
+ # begin
173
+ # resource.wait_until(...)
174
+ # rescue Aws::Waiters::Errors::WaiterFailed
175
+ # # resource did not enter the desired state in time
176
+ # end
177
+ #
178
+ #
179
+ # @yield param [Resource] resource to be used in the waiting condition
180
+ #
181
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
182
+ # because the waiter has entered a state that it will not transition
183
+ # out of, preventing success.
184
+ #
185
+ # yet successful.
186
+ #
187
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
188
+ # while polling for a resource that is not expected.
189
+ #
190
+ # @raise [NotImplementedError] Raised when the resource does not
191
+ #
192
+ # @option options [Integer] :max_attempts (10) Maximum number of
193
+ # attempts
194
+ # @option options [Integer] :delay (10) Delay between each
195
+ # attempt in seconds
196
+ # @option options [Proc] :before_attempt (nil) Callback
197
+ # invoked before each attempt
198
+ # @option options [Proc] :before_wait (nil) Callback
199
+ # invoked before each wait
200
+ # @return [Resource] if the waiter was successful
201
+ def wait_until(options = {}, &block)
202
+ self_copy = self.dup
203
+ attempts = 0
204
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
205
+ options[:delay] ||= 10
206
+ options[:poller] = Proc.new do
207
+ attempts += 1
208
+ if block.call(self_copy)
209
+ [:success, self_copy]
210
+ else
211
+ self_copy.reload unless attempts == options[:max_attempts]
212
+ :retry
213
+ end
214
+ end
215
+ Aws::Waiters::Waiter.new(options).wait({})
216
+ end
217
+
123
218
  # @!group Associations
124
219
 
125
220
  # @return [AutoScalingGroup, nil]
126
221
  def group
127
- if data.auto_scaling_group_name
222
+ if data[:auto_scaling_group_name]
128
223
  AutoScalingGroup.new(
129
- name: data.auto_scaling_group_name,
224
+ name: data[:auto_scaling_group_name],
130
225
  client: @client
131
226
  )
132
227
  else
@@ -34,64 +34,64 @@ module Aws::AutoScaling
34
34
  # The Amazon Resource Name (ARN) of the group.
35
35
  # @return [String]
36
36
  def auto_scaling_group_arn
37
- data.auto_scaling_group_arn
37
+ data[:auto_scaling_group_arn]
38
38
  end
39
39
 
40
40
  # The name of the associated launch configuration.
41
41
  # @return [String]
42
42
  def launch_configuration_name
43
- data.launch_configuration_name
43
+ data[:launch_configuration_name]
44
44
  end
45
45
 
46
46
  # The minimum size of the group.
47
47
  # @return [Integer]
48
48
  def min_size
49
- data.min_size
49
+ data[:min_size]
50
50
  end
51
51
 
52
52
  # The maximum size of the group.
53
53
  # @return [Integer]
54
54
  def max_size
55
- data.max_size
55
+ data[:max_size]
56
56
  end
57
57
 
58
58
  # The desired size of the group.
59
59
  # @return [Integer]
60
60
  def desired_capacity
61
- data.desired_capacity
61
+ data[:desired_capacity]
62
62
  end
63
63
 
64
64
  # The amount of time, in seconds, after a scaling activity completes
65
65
  # before another scaling activity can start.
66
66
  # @return [Integer]
67
67
  def default_cooldown
68
- data.default_cooldown
68
+ data[:default_cooldown]
69
69
  end
70
70
 
71
71
  # One or more Availability Zones for the group.
72
72
  # @return [Array<String>]
73
73
  def availability_zones
74
- data.availability_zones
74
+ data[:availability_zones]
75
75
  end
76
76
 
77
77
  # One or more load balancers associated with the group.
78
78
  # @return [Array<String>]
79
79
  def load_balancer_names
80
- data.load_balancer_names
80
+ data[:load_balancer_names]
81
81
  end
82
82
 
83
83
  # The Amazon Resource Names (ARN) of the target groups for your load
84
84
  # balancer.
85
85
  # @return [Array<String>]
86
86
  def target_group_arns
87
- data.target_group_arns
87
+ data[:target_group_arns]
88
88
  end
89
89
 
90
90
  # The service to use for the health checks. The valid values are `EC2`
91
91
  # and `ELB`.
92
92
  # @return [String]
93
93
  def health_check_type
94
- data.health_check_type
94
+ data[:health_check_type]
95
95
  end
96
96
 
97
97
  # The amount of time, in seconds, that Auto Scaling waits before
@@ -99,19 +99,19 @@ module Aws::AutoScaling
99
99
  # service.
100
100
  # @return [Integer]
101
101
  def health_check_grace_period
102
- data.health_check_grace_period
102
+ data[:health_check_grace_period]
103
103
  end
104
104
 
105
105
  # The date and time the group was created.
106
106
  # @return [Time]
107
107
  def created_time
108
- data.created_time
108
+ data[:created_time]
109
109
  end
110
110
 
111
111
  # The suspended processes associated with the group.
112
112
  # @return [Array<Types::SuspendedProcess>]
113
113
  def suspended_processes
114
- data.suspended_processes
114
+ data[:suspended_processes]
115
115
  end
116
116
 
117
117
  # The name of the placement group into which you'll launch your
@@ -123,7 +123,7 @@ module Aws::AutoScaling
123
123
  # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
124
124
  # @return [String]
125
125
  def placement_group
126
- data.placement_group
126
+ data[:placement_group]
127
127
  end
128
128
 
129
129
  # One or more subnet IDs, if applicable, separated by commas.
@@ -133,33 +133,33 @@ module Aws::AutoScaling
133
133
  # `AvailabilityZones`.
134
134
  # @return [String]
135
135
  def vpc_zone_identifier
136
- data.vpc_zone_identifier
136
+ data[:vpc_zone_identifier]
137
137
  end
138
138
 
139
139
  # The metrics enabled for the group.
140
140
  # @return [Array<Types::EnabledMetric>]
141
141
  def enabled_metrics
142
- data.enabled_metrics
142
+ data[:enabled_metrics]
143
143
  end
144
144
 
145
145
  # The current state of the group when DeleteAutoScalingGroup is in
146
146
  # progress.
147
147
  # @return [String]
148
148
  def status
149
- data.status
149
+ data[:status]
150
150
  end
151
151
 
152
152
  # The termination policies for the group.
153
153
  # @return [Array<String>]
154
154
  def termination_policies
155
- data.termination_policies
155
+ data[:termination_policies]
156
156
  end
157
157
 
158
158
  # Indicates whether newly launched instances are protected from
159
159
  # termination by Auto Scaling when scaling in.
160
160
  # @return [Boolean]
161
161
  def new_instances_protected_from_scale_in
162
- data.new_instances_protected_from_scale_in
162
+ data[:new_instances_protected_from_scale_in]
163
163
  end
164
164
 
165
165
  # @!endgroup
@@ -262,6 +262,101 @@ module Aws::AutoScaling
262
262
  })
263
263
  end
264
264
 
265
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
266
+ #
267
+ # Waiter polls an API operation until a resource enters a desired
268
+ # state.
269
+ #
270
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
271
+ #
272
+ # ## Basic Usage
273
+ #
274
+ # Waiter will polls until it is successful, it fails by
275
+ # entering a terminal state, or until a maximum number of attempts
276
+ # are made.
277
+ #
278
+ # # polls in a loop until condition is true
279
+ # resource.wait_until(options) {|resource| condition}
280
+ #
281
+ # ## Example
282
+ #
283
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
284
+ #
285
+ # ## Configuration
286
+ #
287
+ # You can configure the maximum number of polling attempts, and the
288
+ # delay (in seconds) between each polling attempt. The waiting condition is set
289
+ # by passing a block to {#wait_until}:
290
+ #
291
+ # # poll for ~25 seconds
292
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
293
+ #
294
+ # ## Callbacks
295
+ #
296
+ # You can be notified before each polling attempt and before each
297
+ # delay. If you throw `:success` or `:failure` from these callbacks,
298
+ # it will terminate the waiter.
299
+ #
300
+ # started_at = Time.now
301
+ # # poll for 1 hour, instead of a number of attempts
302
+ # proc = Proc.new do |attempts, response|
303
+ # throw :failure if Time.now - started_at > 3600
304
+ # end
305
+ #
306
+ # # disable max attempts
307
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
308
+ #
309
+ # ## Handling Errors
310
+ #
311
+ # When a waiter is successful, it returns the Resource. When a waiter
312
+ # fails, it raises an error.
313
+ #
314
+ # begin
315
+ # resource.wait_until(...)
316
+ # rescue Aws::Waiters::Errors::WaiterFailed
317
+ # # resource did not enter the desired state in time
318
+ # end
319
+ #
320
+ #
321
+ # @yield param [Resource] resource to be used in the waiting condition
322
+ #
323
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
324
+ # because the waiter has entered a state that it will not transition
325
+ # out of, preventing success.
326
+ #
327
+ # yet successful.
328
+ #
329
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
330
+ # while polling for a resource that is not expected.
331
+ #
332
+ # @raise [NotImplementedError] Raised when the resource does not
333
+ #
334
+ # @option options [Integer] :max_attempts (10) Maximum number of
335
+ # attempts
336
+ # @option options [Integer] :delay (10) Delay between each
337
+ # attempt in seconds
338
+ # @option options [Proc] :before_attempt (nil) Callback
339
+ # invoked before each attempt
340
+ # @option options [Proc] :before_wait (nil) Callback
341
+ # invoked before each wait
342
+ # @return [Resource] if the waiter was successful
343
+ def wait_until(options = {}, &block)
344
+ self_copy = self.dup
345
+ attempts = 0
346
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
347
+ options[:delay] ||= 10
348
+ options[:poller] = Proc.new do
349
+ attempts += 1
350
+ if block.call(self_copy)
351
+ [:success, self_copy]
352
+ else
353
+ self_copy.reload unless attempts == options[:max_attempts]
354
+ :retry
355
+ end
356
+ end
357
+ Aws::Waiters::Waiter.new(options).wait({})
358
+ end
359
+
265
360
  # @!group Actions
266
361
 
267
362
  # @example Request syntax with placeholder values
@@ -793,11 +888,11 @@ module Aws::AutoScaling
793
888
  # @return [Instance::Collection]
794
889
  def instances
795
890
  batch = []
796
- data.instances.each do |i|
891
+ data[:instances].each do |d|
797
892
  batch << Instance.new(
798
893
  group_name: @name,
799
- id: i.instance_id,
800
- data: i,
894
+ id: d[:instance_id],
895
+ data: d,
801
896
  client: @client
802
897
  )
803
898
  end
@@ -806,9 +901,9 @@ module Aws::AutoScaling
806
901
 
807
902
  # @return [LaunchConfiguration, nil]
808
903
  def launch_configuration
809
- if data.launch_configuration_name
904
+ if data[:launch_configuration_name]
810
905
  LaunchConfiguration.new(
811
- name: data.launch_configuration_name,
906
+ name: data[:launch_configuration_name],
812
907
  client: @client
813
908
  )
814
909
  else
@@ -1014,12 +1109,12 @@ module Aws::AutoScaling
1014
1109
  # @return [Tag::Collection]
1015
1110
  def tags
1016
1111
  batch = []
1017
- data.tags.each do |t|
1112
+ data[:tags].each do |d|
1018
1113
  batch << Tag.new(
1019
- key: t.key,
1020
- resource_id: t.resource_id,
1021
- resource_type: t.resource_type,
1022
- data: t,
1114
+ key: d[:key],
1115
+ resource_id: d[:resource_id],
1116
+ resource_type: d[:resource_type],
1117
+ data: d,
1023
1118
  client: @client
1024
1119
  )
1025
1120
  end