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.
@@ -59,7 +59,7 @@ module Aws::AutoScaling
59
59
  # load balancer.
60
60
  # @return [String]
61
61
  def state
62
- data.state
62
+ data[:state]
63
63
  end
64
64
 
65
65
  # @!endgroup
@@ -92,6 +92,101 @@ module Aws::AutoScaling
92
92
  !!@data
93
93
  end
94
94
 
95
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
96
+ #
97
+ # Waiter polls an API operation until a resource enters a desired
98
+ # state.
99
+ #
100
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
101
+ #
102
+ # ## Basic Usage
103
+ #
104
+ # Waiter will polls until it is successful, it fails by
105
+ # entering a terminal state, or until a maximum number of attempts
106
+ # are made.
107
+ #
108
+ # # polls in a loop until condition is true
109
+ # resource.wait_until(options) {|resource| condition}
110
+ #
111
+ # ## Example
112
+ #
113
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
114
+ #
115
+ # ## Configuration
116
+ #
117
+ # You can configure the maximum number of polling attempts, and the
118
+ # delay (in seconds) between each polling attempt. The waiting condition is set
119
+ # by passing a block to {#wait_until}:
120
+ #
121
+ # # poll for ~25 seconds
122
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
123
+ #
124
+ # ## Callbacks
125
+ #
126
+ # You can be notified before each polling attempt and before each
127
+ # delay. If you throw `:success` or `:failure` from these callbacks,
128
+ # it will terminate the waiter.
129
+ #
130
+ # started_at = Time.now
131
+ # # poll for 1 hour, instead of a number of attempts
132
+ # proc = Proc.new do |attempts, response|
133
+ # throw :failure if Time.now - started_at > 3600
134
+ # end
135
+ #
136
+ # # disable max attempts
137
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
138
+ #
139
+ # ## Handling Errors
140
+ #
141
+ # When a waiter is successful, it returns the Resource. When a waiter
142
+ # fails, it raises an error.
143
+ #
144
+ # begin
145
+ # resource.wait_until(...)
146
+ # rescue Aws::Waiters::Errors::WaiterFailed
147
+ # # resource did not enter the desired state in time
148
+ # end
149
+ #
150
+ #
151
+ # @yield param [Resource] resource to be used in the waiting condition
152
+ #
153
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
154
+ # because the waiter has entered a state that it will not transition
155
+ # out of, preventing success.
156
+ #
157
+ # yet successful.
158
+ #
159
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
160
+ # while polling for a resource that is not expected.
161
+ #
162
+ # @raise [NotImplementedError] Raised when the resource does not
163
+ #
164
+ # @option options [Integer] :max_attempts (10) Maximum number of
165
+ # attempts
166
+ # @option options [Integer] :delay (10) Delay between each
167
+ # attempt in seconds
168
+ # @option options [Proc] :before_attempt (nil) Callback
169
+ # invoked before each attempt
170
+ # @option options [Proc] :before_wait (nil) Callback
171
+ # invoked before each wait
172
+ # @return [Resource] if the waiter was successful
173
+ def wait_until(options = {}, &block)
174
+ self_copy = self.dup
175
+ attempts = 0
176
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
177
+ options[:delay] ||= 10
178
+ options[:poller] = Proc.new do
179
+ attempts += 1
180
+ if block.call(self_copy)
181
+ [:success, self_copy]
182
+ else
183
+ self_copy.reload unless attempts == options[:max_attempts]
184
+ :retry
185
+ end
186
+ end
187
+ Aws::Waiters::Waiter.new(options).wait({})
188
+ end
189
+
95
190
  # @!group Actions
96
191
 
97
192
  # @example Request syntax with placeholder values
@@ -78,6 +78,101 @@ module Aws::AutoScaling
78
78
  !!@data
79
79
  end
80
80
 
81
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
82
+ #
83
+ # Waiter polls an API operation until a resource enters a desired
84
+ # state.
85
+ #
86
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
87
+ #
88
+ # ## Basic Usage
89
+ #
90
+ # Waiter will polls until it is successful, it fails by
91
+ # entering a terminal state, or until a maximum number of attempts
92
+ # are made.
93
+ #
94
+ # # polls in a loop until condition is true
95
+ # resource.wait_until(options) {|resource| condition}
96
+ #
97
+ # ## Example
98
+ #
99
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
100
+ #
101
+ # ## Configuration
102
+ #
103
+ # You can configure the maximum number of polling attempts, and the
104
+ # delay (in seconds) between each polling attempt. The waiting condition is set
105
+ # by passing a block to {#wait_until}:
106
+ #
107
+ # # poll for ~25 seconds
108
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
109
+ #
110
+ # ## Callbacks
111
+ #
112
+ # You can be notified before each polling attempt and before each
113
+ # delay. If you throw `:success` or `:failure` from these callbacks,
114
+ # it will terminate the waiter.
115
+ #
116
+ # started_at = Time.now
117
+ # # poll for 1 hour, instead of a number of attempts
118
+ # proc = Proc.new do |attempts, response|
119
+ # throw :failure if Time.now - started_at > 3600
120
+ # end
121
+ #
122
+ # # disable max attempts
123
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
124
+ #
125
+ # ## Handling Errors
126
+ #
127
+ # When a waiter is successful, it returns the Resource. When a waiter
128
+ # fails, it raises an error.
129
+ #
130
+ # begin
131
+ # resource.wait_until(...)
132
+ # rescue Aws::Waiters::Errors::WaiterFailed
133
+ # # resource did not enter the desired state in time
134
+ # end
135
+ #
136
+ #
137
+ # @yield param [Resource] resource to be used in the waiting condition
138
+ #
139
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
140
+ # because the waiter has entered a state that it will not transition
141
+ # out of, preventing success.
142
+ #
143
+ # yet successful.
144
+ #
145
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
146
+ # while polling for a resource that is not expected.
147
+ #
148
+ # @raise [NotImplementedError] Raised when the resource does not
149
+ #
150
+ # @option options [Integer] :max_attempts (10) Maximum number of
151
+ # attempts
152
+ # @option options [Integer] :delay (10) Delay between each
153
+ # attempt in seconds
154
+ # @option options [Proc] :before_attempt (nil) Callback
155
+ # invoked before each attempt
156
+ # @option options [Proc] :before_wait (nil) Callback
157
+ # invoked before each wait
158
+ # @return [Resource] if the waiter was successful
159
+ def wait_until(options = {}, &block)
160
+ self_copy = self.dup
161
+ attempts = 0
162
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
163
+ options[:delay] ||= 10
164
+ options[:poller] = Proc.new do
165
+ attempts += 1
166
+ if block.call(self_copy)
167
+ [:success, self_copy]
168
+ else
169
+ self_copy.reload unless attempts == options[:max_attempts]
170
+ :retry
171
+ end
172
+ end
173
+ Aws::Waiters::Waiter.new(options).wait({})
174
+ end
175
+
81
176
  # @!group Actions
82
177
 
83
178
  # @example Request syntax with placeholder values
@@ -35,19 +35,19 @@ module Aws::AutoScaling
35
35
  # policy.
36
36
  # @return [String]
37
37
  def auto_scaling_group_name
38
- data.auto_scaling_group_name
38
+ data[:auto_scaling_group_name]
39
39
  end
40
40
 
41
41
  # The Amazon Resource Name (ARN) of the policy.
42
42
  # @return [String]
43
43
  def policy_arn
44
- data.policy_arn
44
+ data[:policy_arn]
45
45
  end
46
46
 
47
47
  # The policy type. Valid values are `SimpleScaling` and `StepScaling`.
48
48
  # @return [String]
49
49
  def policy_type
50
- data.policy_type
50
+ data[:policy_type]
51
51
  end
52
52
 
53
53
  # The adjustment type, which specifies how `ScalingAdjustment` is
@@ -55,14 +55,14 @@ module Aws::AutoScaling
55
55
  # `PercentChangeInCapacity`.
56
56
  # @return [String]
57
57
  def adjustment_type
58
- data.adjustment_type
58
+ data[:adjustment_type]
59
59
  end
60
60
 
61
61
  # Available for backward compatibility. Use `MinAdjustmentMagnitude`
62
62
  # instead.
63
63
  # @return [Integer]
64
64
  def min_adjustment_step
65
- data.min_adjustment_step
65
+ data[:min_adjustment_step]
66
66
  end
67
67
 
68
68
  # The minimum number of instances to scale. If the value of
@@ -71,7 +71,7 @@ module Aws::AutoScaling
71
71
  # this many instances. Otherwise, the error is `ValidationError`.
72
72
  # @return [Integer]
73
73
  def min_adjustment_magnitude
74
- data.min_adjustment_magnitude
74
+ data[:min_adjustment_magnitude]
75
75
  end
76
76
 
77
77
  # The amount by which to scale, based on the specified adjustment type.
@@ -79,47 +79,47 @@ module Aws::AutoScaling
79
79
  # removes from the current capacity.
80
80
  # @return [Integer]
81
81
  def scaling_adjustment
82
- data.scaling_adjustment
82
+ data[:scaling_adjustment]
83
83
  end
84
84
 
85
85
  # The amount of time, in seconds, after a scaling activity completes
86
86
  # before any further dynamic scaling activities can start.
87
87
  # @return [Integer]
88
88
  def cooldown
89
- data.cooldown
89
+ data[:cooldown]
90
90
  end
91
91
 
92
92
  # A set of adjustments that enable you to scale based on the size of the
93
93
  # alarm breach.
94
94
  # @return [Array<Types::StepAdjustment>]
95
95
  def step_adjustments
96
- data.step_adjustments
96
+ data[:step_adjustments]
97
97
  end
98
98
 
99
99
  # The aggregation type for the CloudWatch metrics. Valid values are
100
100
  # `Minimum`, `Maximum`, and `Average`.
101
101
  # @return [String]
102
102
  def metric_aggregation_type
103
- data.metric_aggregation_type
103
+ data[:metric_aggregation_type]
104
104
  end
105
105
 
106
106
  # The estimated time, in seconds, until a newly launched instance can
107
107
  # contribute to the CloudWatch metrics.
108
108
  # @return [Integer]
109
109
  def estimated_instance_warmup
110
- data.estimated_instance_warmup
110
+ data[:estimated_instance_warmup]
111
111
  end
112
112
 
113
113
  # The CloudWatch alarms related to the policy.
114
114
  # @return [Array<Types::Alarm>]
115
115
  def alarms
116
- data.alarms
116
+ data[:alarms]
117
117
  end
118
118
 
119
119
  # A target tracking policy.
120
120
  # @return [Types::TargetTrackingConfiguration]
121
121
  def target_tracking_configuration
122
- data.target_tracking_configuration
122
+ data[:target_tracking_configuration]
123
123
  end
124
124
 
125
125
  # @!endgroup
@@ -157,6 +157,101 @@ module Aws::AutoScaling
157
157
  !!@data
158
158
  end
159
159
 
160
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
161
+ #
162
+ # Waiter polls an API operation until a resource enters a desired
163
+ # state.
164
+ #
165
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
166
+ #
167
+ # ## Basic Usage
168
+ #
169
+ # Waiter will polls until it is successful, it fails by
170
+ # entering a terminal state, or until a maximum number of attempts
171
+ # are made.
172
+ #
173
+ # # polls in a loop until condition is true
174
+ # resource.wait_until(options) {|resource| condition}
175
+ #
176
+ # ## Example
177
+ #
178
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
179
+ #
180
+ # ## Configuration
181
+ #
182
+ # You can configure the maximum number of polling attempts, and the
183
+ # delay (in seconds) between each polling attempt. The waiting condition is set
184
+ # by passing a block to {#wait_until}:
185
+ #
186
+ # # poll for ~25 seconds
187
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
188
+ #
189
+ # ## Callbacks
190
+ #
191
+ # You can be notified before each polling attempt and before each
192
+ # delay. If you throw `:success` or `:failure` from these callbacks,
193
+ # it will terminate the waiter.
194
+ #
195
+ # started_at = Time.now
196
+ # # poll for 1 hour, instead of a number of attempts
197
+ # proc = Proc.new do |attempts, response|
198
+ # throw :failure if Time.now - started_at > 3600
199
+ # end
200
+ #
201
+ # # disable max attempts
202
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
203
+ #
204
+ # ## Handling Errors
205
+ #
206
+ # When a waiter is successful, it returns the Resource. When a waiter
207
+ # fails, it raises an error.
208
+ #
209
+ # begin
210
+ # resource.wait_until(...)
211
+ # rescue Aws::Waiters::Errors::WaiterFailed
212
+ # # resource did not enter the desired state in time
213
+ # end
214
+ #
215
+ #
216
+ # @yield param [Resource] resource to be used in the waiting condition
217
+ #
218
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
219
+ # because the waiter has entered a state that it will not transition
220
+ # out of, preventing success.
221
+ #
222
+ # yet successful.
223
+ #
224
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
225
+ # while polling for a resource that is not expected.
226
+ #
227
+ # @raise [NotImplementedError] Raised when the resource does not
228
+ #
229
+ # @option options [Integer] :max_attempts (10) Maximum number of
230
+ # attempts
231
+ # @option options [Integer] :delay (10) Delay between each
232
+ # attempt in seconds
233
+ # @option options [Proc] :before_attempt (nil) Callback
234
+ # invoked before each attempt
235
+ # @option options [Proc] :before_wait (nil) Callback
236
+ # invoked before each wait
237
+ # @return [Resource] if the waiter was successful
238
+ def wait_until(options = {}, &block)
239
+ self_copy = self.dup
240
+ attempts = 0
241
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
242
+ options[:delay] ||= 10
243
+ options[:poller] = Proc.new do
244
+ attempts += 1
245
+ if block.call(self_copy)
246
+ [:success, self_copy]
247
+ else
248
+ self_copy.reload unless attempts == options[:max_attempts]
249
+ :retry
250
+ end
251
+ end
252
+ Aws::Waiters::Waiter.new(options).wait({})
253
+ end
254
+
160
255
  # @!group Actions
161
256
 
162
257
  # @example Request syntax with placeholder values
@@ -227,9 +322,9 @@ module Aws::AutoScaling
227
322
 
228
323
  # @return [AutoScalingGroup, nil]
229
324
  def group
230
- if data.auto_scaling_group_name
325
+ if data[:auto_scaling_group_name]
231
326
  AutoScalingGroup.new(
232
- name: data.auto_scaling_group_name,
327
+ name: data[:auto_scaling_group_name],
233
328
  client: @client
234
329
  )
235
330
  else
@@ -34,19 +34,19 @@ module Aws::AutoScaling
34
34
  # The name of the 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
  # The Amazon Resource Name (ARN) of the scheduled action.
41
41
  # @return [String]
42
42
  def scheduled_action_arn
43
- data.scheduled_action_arn
43
+ data[:scheduled_action_arn]
44
44
  end
45
45
 
46
46
  # This parameter is deprecated.
47
47
  # @return [Time]
48
48
  def time
49
- data.time
49
+ data[:time]
50
50
  end
51
51
 
52
52
  # The date and time that the action is scheduled to begin. This date and
@@ -56,38 +56,38 @@ module Aws::AutoScaling
56
56
  # form the boundaries of when the recurring action will start and stop.
57
57
  # @return [Time]
58
58
  def start_time
59
- data.start_time
59
+ data[:start_time]
60
60
  end
61
61
 
62
62
  # The date and time that the action is scheduled to end. This date and
63
63
  # time can be up to one month in the future.
64
64
  # @return [Time]
65
65
  def end_time
66
- data.end_time
66
+ data[:end_time]
67
67
  end
68
68
 
69
69
  # The recurring schedule for the action.
70
70
  # @return [String]
71
71
  def recurrence
72
- data.recurrence
72
+ data[:recurrence]
73
73
  end
74
74
 
75
75
  # The minimum size of the group.
76
76
  # @return [Integer]
77
77
  def min_size
78
- data.min_size
78
+ data[:min_size]
79
79
  end
80
80
 
81
81
  # The maximum size of the group.
82
82
  # @return [Integer]
83
83
  def max_size
84
- data.max_size
84
+ data[:max_size]
85
85
  end
86
86
 
87
87
  # The number of instances you prefer to maintain in the group.
88
88
  # @return [Integer]
89
89
  def desired_capacity
90
- data.desired_capacity
90
+ data[:desired_capacity]
91
91
  end
92
92
 
93
93
  # @!endgroup
@@ -125,6 +125,101 @@ module Aws::AutoScaling
125
125
  !!@data
126
126
  end
127
127
 
128
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
129
+ #
130
+ # Waiter polls an API operation until a resource enters a desired
131
+ # state.
132
+ #
133
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
134
+ #
135
+ # ## Basic Usage
136
+ #
137
+ # Waiter will polls until it is successful, it fails by
138
+ # entering a terminal state, or until a maximum number of attempts
139
+ # are made.
140
+ #
141
+ # # polls in a loop until condition is true
142
+ # resource.wait_until(options) {|resource| condition}
143
+ #
144
+ # ## Example
145
+ #
146
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
147
+ #
148
+ # ## Configuration
149
+ #
150
+ # You can configure the maximum number of polling attempts, and the
151
+ # delay (in seconds) between each polling attempt. The waiting condition is set
152
+ # by passing a block to {#wait_until}:
153
+ #
154
+ # # poll for ~25 seconds
155
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
156
+ #
157
+ # ## Callbacks
158
+ #
159
+ # You can be notified before each polling attempt and before each
160
+ # delay. If you throw `:success` or `:failure` from these callbacks,
161
+ # it will terminate the waiter.
162
+ #
163
+ # started_at = Time.now
164
+ # # poll for 1 hour, instead of a number of attempts
165
+ # proc = Proc.new do |attempts, response|
166
+ # throw :failure if Time.now - started_at > 3600
167
+ # end
168
+ #
169
+ # # disable max attempts
170
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
171
+ #
172
+ # ## Handling Errors
173
+ #
174
+ # When a waiter is successful, it returns the Resource. When a waiter
175
+ # fails, it raises an error.
176
+ #
177
+ # begin
178
+ # resource.wait_until(...)
179
+ # rescue Aws::Waiters::Errors::WaiterFailed
180
+ # # resource did not enter the desired state in time
181
+ # end
182
+ #
183
+ #
184
+ # @yield param [Resource] resource to be used in the waiting condition
185
+ #
186
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
187
+ # because the waiter has entered a state that it will not transition
188
+ # out of, preventing success.
189
+ #
190
+ # yet successful.
191
+ #
192
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
193
+ # while polling for a resource that is not expected.
194
+ #
195
+ # @raise [NotImplementedError] Raised when the resource does not
196
+ #
197
+ # @option options [Integer] :max_attempts (10) Maximum number of
198
+ # attempts
199
+ # @option options [Integer] :delay (10) Delay between each
200
+ # attempt in seconds
201
+ # @option options [Proc] :before_attempt (nil) Callback
202
+ # invoked before each attempt
203
+ # @option options [Proc] :before_wait (nil) Callback
204
+ # invoked before each wait
205
+ # @return [Resource] if the waiter was successful
206
+ def wait_until(options = {}, &block)
207
+ self_copy = self.dup
208
+ attempts = 0
209
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
210
+ options[:delay] ||= 10
211
+ options[:poller] = Proc.new do
212
+ attempts += 1
213
+ if block.call(self_copy)
214
+ [:success, self_copy]
215
+ else
216
+ self_copy.reload unless attempts == options[:max_attempts]
217
+ :retry
218
+ end
219
+ end
220
+ Aws::Waiters::Waiter.new(options).wait({})
221
+ end
222
+
128
223
  # @!group Actions
129
224
 
130
225
  # @example Request syntax with placeholder values
@@ -146,9 +241,9 @@ module Aws::AutoScaling
146
241
 
147
242
  # @return [AutoScalingGroup, nil]
148
243
  def group
149
- if data.auto_scaling_group_name
244
+ if data[:auto_scaling_group_name]
150
245
  AutoScalingGroup.new(
151
- name: data.auto_scaling_group_name,
246
+ name: data[:auto_scaling_group_name],
152
247
  client: @client
153
248
  )
154
249
  else