aws-sdk-iam 1.1.0 → 1.2.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.
@@ -38,7 +38,7 @@ module Aws::IAM
38
38
  # [1]: https://tools.ietf.org/html/rfc3548.txt
39
39
  # @return [String]
40
40
  def base_32_string_seed
41
- data.base_32_string_seed
41
+ data[:base_32_string_seed]
42
42
  end
43
43
 
44
44
  # A QR code PNG image that encodes
@@ -49,13 +49,13 @@ module Aws::IAM
49
49
  # `Base32String` value is Base64-encoded.
50
50
  # @return [String]
51
51
  def qr_code_png
52
- data.qr_code_png
52
+ data[:qr_code_png]
53
53
  end
54
54
 
55
55
  # The date and time on which the virtual MFA device was enabled.
56
56
  # @return [Time]
57
57
  def enable_date
58
- data.enable_date
58
+ data[:enable_date]
59
59
  end
60
60
 
61
61
  # @!endgroup
@@ -88,6 +88,101 @@ module Aws::IAM
88
88
  !!@data
89
89
  end
90
90
 
91
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
92
+ #
93
+ # Waiter polls an API operation until a resource enters a desired
94
+ # state.
95
+ #
96
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
97
+ #
98
+ # ## Basic Usage
99
+ #
100
+ # Waiter will polls until it is successful, it fails by
101
+ # entering a terminal state, or until a maximum number of attempts
102
+ # are made.
103
+ #
104
+ # # polls in a loop until condition is true
105
+ # resource.wait_until(options) {|resource| condition}
106
+ #
107
+ # ## Example
108
+ #
109
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
110
+ #
111
+ # ## Configuration
112
+ #
113
+ # You can configure the maximum number of polling attempts, and the
114
+ # delay (in seconds) between each polling attempt. The waiting condition is set
115
+ # by passing a block to {#wait_until}:
116
+ #
117
+ # # poll for ~25 seconds
118
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
119
+ #
120
+ # ## Callbacks
121
+ #
122
+ # You can be notified before each polling attempt and before each
123
+ # delay. If you throw `:success` or `:failure` from these callbacks,
124
+ # it will terminate the waiter.
125
+ #
126
+ # started_at = Time.now
127
+ # # poll for 1 hour, instead of a number of attempts
128
+ # proc = Proc.new do |attempts, response|
129
+ # throw :failure if Time.now - started_at > 3600
130
+ # end
131
+ #
132
+ # # disable max attempts
133
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
134
+ #
135
+ # ## Handling Errors
136
+ #
137
+ # When a waiter is successful, it returns the Resource. When a waiter
138
+ # fails, it raises an error.
139
+ #
140
+ # begin
141
+ # resource.wait_until(...)
142
+ # rescue Aws::Waiters::Errors::WaiterFailed
143
+ # # resource did not enter the desired state in time
144
+ # end
145
+ #
146
+ #
147
+ # @yield param [Resource] resource to be used in the waiting condition
148
+ #
149
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
150
+ # because the waiter has entered a state that it will not transition
151
+ # out of, preventing success.
152
+ #
153
+ # yet successful.
154
+ #
155
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
156
+ # while polling for a resource that is not expected.
157
+ #
158
+ # @raise [NotImplementedError] Raised when the resource does not
159
+ #
160
+ # @option options [Integer] :max_attempts (10) Maximum number of
161
+ # attempts
162
+ # @option options [Integer] :delay (10) Delay between each
163
+ # attempt in seconds
164
+ # @option options [Proc] :before_attempt (nil) Callback
165
+ # invoked before each attempt
166
+ # @option options [Proc] :before_wait (nil) Callback
167
+ # invoked before each wait
168
+ # @return [Resource] if the waiter was successful
169
+ def wait_until(options = {}, &block)
170
+ self_copy = self.dup
171
+ attempts = 0
172
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
173
+ options[:delay] ||= 10
174
+ options[:poller] = Proc.new do
175
+ attempts += 1
176
+ if block.call(self_copy)
177
+ [:success, self_copy]
178
+ else
179
+ self_copy.reload unless attempts == options[:max_attempts]
180
+ :retry
181
+ end
182
+ end
183
+ Aws::Waiters::Waiter.new(options).wait({})
184
+ end
185
+
91
186
  # @!group Actions
92
187
 
93
188
  # @example Request syntax with placeholder values
@@ -105,9 +200,9 @@ module Aws::IAM
105
200
 
106
201
  # @return [User, nil]
107
202
  def user
108
- if data.user.user_name
203
+ if data[:user][:user_name]
109
204
  User.new(
110
- name: data.user.user_name,
205
+ name: data[:user][:user_name],
111
206
  client: @client
112
207
  )
113
208
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-iam
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.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