aws-sdk-autoscaling 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,14 +49,14 @@ module Aws::AutoScaling
49
49
  # The tag value.
50
50
  # @return [String]
51
51
  def value
52
- data.value
52
+ data[:value]
53
53
  end
54
54
 
55
55
  # Determines whether the tag is added to new instances as they are
56
56
  # launched in the group.
57
57
  # @return [Boolean]
58
58
  def propagate_at_launch
59
- data.propagate_at_launch
59
+ data[:propagate_at_launch]
60
60
  end
61
61
 
62
62
  # @!endgroup
@@ -103,6 +103,101 @@ module Aws::AutoScaling
103
103
  !!@data
104
104
  end
105
105
 
106
+ # @deprecated Use [Aws::AutoScaling::Client] #wait_until instead
107
+ #
108
+ # Waiter polls an API operation until a resource enters a desired
109
+ # state.
110
+ #
111
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
112
+ #
113
+ # ## Basic Usage
114
+ #
115
+ # Waiter will polls until it is successful, it fails by
116
+ # entering a terminal state, or until a maximum number of attempts
117
+ # are made.
118
+ #
119
+ # # polls in a loop until condition is true
120
+ # resource.wait_until(options) {|resource| condition}
121
+ #
122
+ # ## Example
123
+ #
124
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
125
+ #
126
+ # ## Configuration
127
+ #
128
+ # You can configure the maximum number of polling attempts, and the
129
+ # delay (in seconds) between each polling attempt. The waiting condition is set
130
+ # by passing a block to {#wait_until}:
131
+ #
132
+ # # poll for ~25 seconds
133
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
134
+ #
135
+ # ## Callbacks
136
+ #
137
+ # You can be notified before each polling attempt and before each
138
+ # delay. If you throw `:success` or `:failure` from these callbacks,
139
+ # it will terminate the waiter.
140
+ #
141
+ # started_at = Time.now
142
+ # # poll for 1 hour, instead of a number of attempts
143
+ # proc = Proc.new do |attempts, response|
144
+ # throw :failure if Time.now - started_at > 3600
145
+ # end
146
+ #
147
+ # # disable max attempts
148
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
149
+ #
150
+ # ## Handling Errors
151
+ #
152
+ # When a waiter is successful, it returns the Resource. When a waiter
153
+ # fails, it raises an error.
154
+ #
155
+ # begin
156
+ # resource.wait_until(...)
157
+ # rescue Aws::Waiters::Errors::WaiterFailed
158
+ # # resource did not enter the desired state in time
159
+ # end
160
+ #
161
+ #
162
+ # @yield param [Resource] resource to be used in the waiting condition
163
+ #
164
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
165
+ # because the waiter has entered a state that it will not transition
166
+ # out of, preventing success.
167
+ #
168
+ # yet successful.
169
+ #
170
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
171
+ # while polling for a resource that is not expected.
172
+ #
173
+ # @raise [NotImplementedError] Raised when the resource does not
174
+ #
175
+ # @option options [Integer] :max_attempts (10) Maximum number of
176
+ # attempts
177
+ # @option options [Integer] :delay (10) Delay between each
178
+ # attempt in seconds
179
+ # @option options [Proc] :before_attempt (nil) Callback
180
+ # invoked before each attempt
181
+ # @option options [Proc] :before_wait (nil) Callback
182
+ # invoked before each wait
183
+ # @return [Resource] if the waiter was successful
184
+ def wait_until(options = {}, &block)
185
+ self_copy = self.dup
186
+ attempts = 0
187
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
188
+ options[:delay] ||= 10
189
+ options[:poller] = Proc.new do
190
+ attempts += 1
191
+ if block.call(self_copy)
192
+ [:success, self_copy]
193
+ else
194
+ self_copy.reload unless attempts == options[:max_attempts]
195
+ :retry
196
+ end
197
+ end
198
+ Aws::Waiters::Waiter.new(options).wait({})
199
+ end
200
+
106
201
  # @!group Actions
107
202
 
108
203
  # @example Request syntax with placeholder values
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-autoscaling
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.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-09-13 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