aws-sdk-iam 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,6 +58,101 @@ module Aws::IAM
58
58
  !!@data
59
59
  end
60
60
 
61
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
62
+ #
63
+ # Waiter polls an API operation until a resource enters a desired
64
+ # state.
65
+ #
66
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
67
+ #
68
+ # ## Basic Usage
69
+ #
70
+ # Waiter will polls until it is successful, it fails by
71
+ # entering a terminal state, or until a maximum number of attempts
72
+ # are made.
73
+ #
74
+ # # polls in a loop until condition is true
75
+ # resource.wait_until(options) {|resource| condition}
76
+ #
77
+ # ## Example
78
+ #
79
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
80
+ #
81
+ # ## Configuration
82
+ #
83
+ # You can configure the maximum number of polling attempts, and the
84
+ # delay (in seconds) between each polling attempt. The waiting condition is set
85
+ # by passing a block to {#wait_until}:
86
+ #
87
+ # # poll for ~25 seconds
88
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
89
+ #
90
+ # ## Callbacks
91
+ #
92
+ # You can be notified before each polling attempt and before each
93
+ # delay. If you throw `:success` or `:failure` from these callbacks,
94
+ # it will terminate the waiter.
95
+ #
96
+ # started_at = Time.now
97
+ # # poll for 1 hour, instead of a number of attempts
98
+ # proc = Proc.new do |attempts, response|
99
+ # throw :failure if Time.now - started_at > 3600
100
+ # end
101
+ #
102
+ # # disable max attempts
103
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
104
+ #
105
+ # ## Handling Errors
106
+ #
107
+ # When a waiter is successful, it returns the Resource. When a waiter
108
+ # fails, it raises an error.
109
+ #
110
+ # begin
111
+ # resource.wait_until(...)
112
+ # rescue Aws::Waiters::Errors::WaiterFailed
113
+ # # resource did not enter the desired state in time
114
+ # end
115
+ #
116
+ #
117
+ # @yield param [Resource] resource to be used in the waiting condition
118
+ #
119
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
120
+ # because the waiter has entered a state that it will not transition
121
+ # out of, preventing success.
122
+ #
123
+ # yet successful.
124
+ #
125
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
126
+ # while polling for a resource that is not expected.
127
+ #
128
+ # @raise [NotImplementedError] Raised when the resource does not
129
+ #
130
+ # @option options [Integer] :max_attempts (10) Maximum number of
131
+ # attempts
132
+ # @option options [Integer] :delay (10) Delay between each
133
+ # attempt in seconds
134
+ # @option options [Proc] :before_attempt (nil) Callback
135
+ # invoked before each attempt
136
+ # @option options [Proc] :before_wait (nil) Callback
137
+ # invoked before each wait
138
+ # @return [Resource] if the waiter was successful
139
+ def wait_until(options = {}, &block)
140
+ self_copy = self.dup
141
+ attempts = 0
142
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
143
+ options[:delay] ||= 10
144
+ options[:poller] = Proc.new do
145
+ attempts += 1
146
+ if block.call(self_copy)
147
+ [:success, self_copy]
148
+ else
149
+ self_copy.reload unless attempts == options[:max_attempts]
150
+ :retry
151
+ end
152
+ end
153
+ Aws::Waiters::Waiter.new(options).wait({})
154
+ end
155
+
61
156
  # @!group Actions
62
157
 
63
158
  # @example Request syntax with placeholder values
@@ -9110,7 +9110,7 @@ module Aws::IAM
9110
9110
  params: params,
9111
9111
  config: config)
9112
9112
  context[:gem_name] = 'aws-sdk-iam'
9113
- context[:gem_version] = '1.1.0'
9113
+ context[:gem_version] = '1.2.0'
9114
9114
  Seahorse::Client::Request.new(handlers, context)
9115
9115
  end
9116
9116
 
@@ -28,13 +28,13 @@ module Aws::IAM
28
28
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
29
29
  # @return [String]
30
30
  def path
31
- data.path
31
+ data[:path]
32
32
  end
33
33
 
34
34
  # The friendly name identifying the user.
35
35
  # @return [String]
36
36
  def user_name
37
- data.user_name
37
+ data[:user_name]
38
38
  end
39
39
 
40
40
  # The stable and unique string identifying the user. For more
@@ -46,7 +46,7 @@ module Aws::IAM
46
46
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
47
47
  # @return [String]
48
48
  def user_id
49
- data.user_id
49
+ data[:user_id]
50
50
  end
51
51
 
52
52
  # The Amazon Resource Name (ARN) that identifies the user. For more
@@ -58,7 +58,7 @@ module Aws::IAM
58
58
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
59
59
  # @return [String]
60
60
  def arn
61
- data.arn
61
+ data[:arn]
62
62
  end
63
63
 
64
64
  # The date and time, in [ISO 8601 date-time format][1], when the user
@@ -69,7 +69,7 @@ module Aws::IAM
69
69
  # [1]: http://www.iso.org/iso/iso8601
70
70
  # @return [Time]
71
71
  def create_date
72
- data.create_date
72
+ data[:create_date]
73
73
  end
74
74
 
75
75
  # The date and time, in [ISO 8601 date-time format][1], when the user's
@@ -94,7 +94,7 @@ module Aws::IAM
94
94
  # [2]: http://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html
95
95
  # @return [Time]
96
96
  def password_last_used
97
- data.password_last_used
97
+ data[:password_last_used]
98
98
  end
99
99
 
100
100
  # @!endgroup
@@ -132,6 +132,101 @@ module Aws::IAM
132
132
  !!@data
133
133
  end
134
134
 
135
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
136
+ #
137
+ # Waiter polls an API operation until a resource enters a desired
138
+ # state.
139
+ #
140
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
141
+ #
142
+ # ## Basic Usage
143
+ #
144
+ # Waiter will polls until it is successful, it fails by
145
+ # entering a terminal state, or until a maximum number of attempts
146
+ # are made.
147
+ #
148
+ # # polls in a loop until condition is true
149
+ # resource.wait_until(options) {|resource| condition}
150
+ #
151
+ # ## Example
152
+ #
153
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
154
+ #
155
+ # ## Configuration
156
+ #
157
+ # You can configure the maximum number of polling attempts, and the
158
+ # delay (in seconds) between each polling attempt. The waiting condition is set
159
+ # by passing a block to {#wait_until}:
160
+ #
161
+ # # poll for ~25 seconds
162
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
163
+ #
164
+ # ## Callbacks
165
+ #
166
+ # You can be notified before each polling attempt and before each
167
+ # delay. If you throw `:success` or `:failure` from these callbacks,
168
+ # it will terminate the waiter.
169
+ #
170
+ # started_at = Time.now
171
+ # # poll for 1 hour, instead of a number of attempts
172
+ # proc = Proc.new do |attempts, response|
173
+ # throw :failure if Time.now - started_at > 3600
174
+ # end
175
+ #
176
+ # # disable max attempts
177
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
178
+ #
179
+ # ## Handling Errors
180
+ #
181
+ # When a waiter is successful, it returns the Resource. When a waiter
182
+ # fails, it raises an error.
183
+ #
184
+ # begin
185
+ # resource.wait_until(...)
186
+ # rescue Aws::Waiters::Errors::WaiterFailed
187
+ # # resource did not enter the desired state in time
188
+ # end
189
+ #
190
+ #
191
+ # @yield param [Resource] resource to be used in the waiting condition
192
+ #
193
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
194
+ # because the waiter has entered a state that it will not transition
195
+ # out of, preventing success.
196
+ #
197
+ # yet successful.
198
+ #
199
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
200
+ # while polling for a resource that is not expected.
201
+ #
202
+ # @raise [NotImplementedError] Raised when the resource does not
203
+ #
204
+ # @option options [Integer] :max_attempts (10) Maximum number of
205
+ # attempts
206
+ # @option options [Integer] :delay (10) Delay between each
207
+ # attempt in seconds
208
+ # @option options [Proc] :before_attempt (nil) Callback
209
+ # invoked before each attempt
210
+ # @option options [Proc] :before_wait (nil) Callback
211
+ # invoked before each wait
212
+ # @return [Resource] if the waiter was successful
213
+ def wait_until(options = {}, &block)
214
+ self_copy = self.dup
215
+ attempts = 0
216
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
217
+ options[:delay] ||= 10
218
+ options[:poller] = Proc.new do
219
+ attempts += 1
220
+ if block.call(self_copy)
221
+ [:success, self_copy]
222
+ else
223
+ self_copy.reload unless attempts == options[:max_attempts]
224
+ :retry
225
+ end
226
+ end
227
+ Aws::Waiters::Waiter.new(options).wait({})
228
+ end
229
+
135
230
  # @!group Associations
136
231
 
137
232
  # @example Request syntax with placeholder values
@@ -248,9 +343,9 @@ module Aws::IAM
248
343
 
249
344
  # @return [User, nil]
250
345
  def user
251
- if data.user_name
346
+ if data[:user_name]
252
347
  User.new(
253
- name: data.user_name,
348
+ name: data[:user_name],
254
349
  client: @client
255
350
  )
256
351
  else
@@ -39,7 +39,7 @@ module Aws::IAM
39
39
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
40
40
  # @return [String]
41
41
  def path
42
- data.path
42
+ data[:path]
43
43
  end
44
44
 
45
45
  # The stable and unique string identifying the group. For more
@@ -51,7 +51,7 @@ module Aws::IAM
51
51
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
52
52
  # @return [String]
53
53
  def group_id
54
- data.group_id
54
+ data[:group_id]
55
55
  end
56
56
 
57
57
  # The Amazon Resource Name (ARN) specifying the group. For more
@@ -63,7 +63,7 @@ module Aws::IAM
63
63
  # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
64
64
  # @return [String]
65
65
  def arn
66
- data.arn
66
+ data[:arn]
67
67
  end
68
68
 
69
69
  # The date and time, in [ISO 8601 date-time format][1], when the group
@@ -74,7 +74,7 @@ module Aws::IAM
74
74
  # [1]: http://www.iso.org/iso/iso8601
75
75
  # @return [Time]
76
76
  def create_date
77
- data.create_date
77
+ data[:create_date]
78
78
  end
79
79
 
80
80
  # @!endgroup
@@ -112,6 +112,101 @@ module Aws::IAM
112
112
  !!@data
113
113
  end
114
114
 
115
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
116
+ #
117
+ # Waiter polls an API operation until a resource enters a desired
118
+ # state.
119
+ #
120
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
121
+ #
122
+ # ## Basic Usage
123
+ #
124
+ # Waiter will polls until it is successful, it fails by
125
+ # entering a terminal state, or until a maximum number of attempts
126
+ # are made.
127
+ #
128
+ # # polls in a loop until condition is true
129
+ # resource.wait_until(options) {|resource| condition}
130
+ #
131
+ # ## Example
132
+ #
133
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
134
+ #
135
+ # ## Configuration
136
+ #
137
+ # You can configure the maximum number of polling attempts, and the
138
+ # delay (in seconds) between each polling attempt. The waiting condition is set
139
+ # by passing a block to {#wait_until}:
140
+ #
141
+ # # poll for ~25 seconds
142
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
143
+ #
144
+ # ## Callbacks
145
+ #
146
+ # You can be notified before each polling attempt and before each
147
+ # delay. If you throw `:success` or `:failure` from these callbacks,
148
+ # it will terminate the waiter.
149
+ #
150
+ # started_at = Time.now
151
+ # # poll for 1 hour, instead of a number of attempts
152
+ # proc = Proc.new do |attempts, response|
153
+ # throw :failure if Time.now - started_at > 3600
154
+ # end
155
+ #
156
+ # # disable max attempts
157
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
158
+ #
159
+ # ## Handling Errors
160
+ #
161
+ # When a waiter is successful, it returns the Resource. When a waiter
162
+ # fails, it raises an error.
163
+ #
164
+ # begin
165
+ # resource.wait_until(...)
166
+ # rescue Aws::Waiters::Errors::WaiterFailed
167
+ # # resource did not enter the desired state in time
168
+ # end
169
+ #
170
+ #
171
+ # @yield param [Resource] resource to be used in the waiting condition
172
+ #
173
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
174
+ # because the waiter has entered a state that it will not transition
175
+ # out of, preventing success.
176
+ #
177
+ # yet successful.
178
+ #
179
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
180
+ # while polling for a resource that is not expected.
181
+ #
182
+ # @raise [NotImplementedError] Raised when the resource does not
183
+ #
184
+ # @option options [Integer] :max_attempts (10) Maximum number of
185
+ # attempts
186
+ # @option options [Integer] :delay (10) Delay between each
187
+ # attempt in seconds
188
+ # @option options [Proc] :before_attempt (nil) Callback
189
+ # invoked before each attempt
190
+ # @option options [Proc] :before_wait (nil) Callback
191
+ # invoked before each wait
192
+ # @return [Resource] if the waiter was successful
193
+ def wait_until(options = {}, &block)
194
+ self_copy = self.dup
195
+ attempts = 0
196
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
197
+ options[:delay] ||= 10
198
+ options[:poller] = Proc.new do
199
+ attempts += 1
200
+ if block.call(self_copy)
201
+ [:success, self_copy]
202
+ else
203
+ self_copy.reload unless attempts == options[:max_attempts]
204
+ :retry
205
+ end
206
+ end
207
+ Aws::Waiters::Waiter.new(options).wait({})
208
+ end
209
+
115
210
  # @!group Actions
116
211
 
117
212
  # @example Request syntax with placeholder values
@@ -42,7 +42,7 @@ module Aws::IAM
42
42
  # The policy document.
43
43
  # @return [String]
44
44
  def policy_document
45
- data.policy_document
45
+ data[:policy_document]
46
46
  end
47
47
 
48
48
  # @!endgroup
@@ -83,6 +83,101 @@ module Aws::IAM
83
83
  !!@data
84
84
  end
85
85
 
86
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
87
+ #
88
+ # Waiter polls an API operation until a resource enters a desired
89
+ # state.
90
+ #
91
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
92
+ #
93
+ # ## Basic Usage
94
+ #
95
+ # Waiter will polls until it is successful, it fails by
96
+ # entering a terminal state, or until a maximum number of attempts
97
+ # are made.
98
+ #
99
+ # # polls in a loop until condition is true
100
+ # resource.wait_until(options) {|resource| condition}
101
+ #
102
+ # ## Example
103
+ #
104
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
105
+ #
106
+ # ## Configuration
107
+ #
108
+ # You can configure the maximum number of polling attempts, and the
109
+ # delay (in seconds) between each polling attempt. The waiting condition is set
110
+ # by passing a block to {#wait_until}:
111
+ #
112
+ # # poll for ~25 seconds
113
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
114
+ #
115
+ # ## Callbacks
116
+ #
117
+ # You can be notified before each polling attempt and before each
118
+ # delay. If you throw `:success` or `:failure` from these callbacks,
119
+ # it will terminate the waiter.
120
+ #
121
+ # started_at = Time.now
122
+ # # poll for 1 hour, instead of a number of attempts
123
+ # proc = Proc.new do |attempts, response|
124
+ # throw :failure if Time.now - started_at > 3600
125
+ # end
126
+ #
127
+ # # disable max attempts
128
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
129
+ #
130
+ # ## Handling Errors
131
+ #
132
+ # When a waiter is successful, it returns the Resource. When a waiter
133
+ # fails, it raises an error.
134
+ #
135
+ # begin
136
+ # resource.wait_until(...)
137
+ # rescue Aws::Waiters::Errors::WaiterFailed
138
+ # # resource did not enter the desired state in time
139
+ # end
140
+ #
141
+ #
142
+ # @yield param [Resource] resource to be used in the waiting condition
143
+ #
144
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
145
+ # because the waiter has entered a state that it will not transition
146
+ # out of, preventing success.
147
+ #
148
+ # yet successful.
149
+ #
150
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
151
+ # while polling for a resource that is not expected.
152
+ #
153
+ # @raise [NotImplementedError] Raised when the resource does not
154
+ #
155
+ # @option options [Integer] :max_attempts (10) Maximum number of
156
+ # attempts
157
+ # @option options [Integer] :delay (10) Delay between each
158
+ # attempt in seconds
159
+ # @option options [Proc] :before_attempt (nil) Callback
160
+ # invoked before each attempt
161
+ # @option options [Proc] :before_wait (nil) Callback
162
+ # invoked before each wait
163
+ # @return [Resource] if the waiter was successful
164
+ def wait_until(options = {}, &block)
165
+ self_copy = self.dup
166
+ attempts = 0
167
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
168
+ options[:delay] ||= 10
169
+ options[:poller] = Proc.new do
170
+ attempts += 1
171
+ if block.call(self_copy)
172
+ [:success, self_copy]
173
+ else
174
+ self_copy.reload unless attempts == options[:max_attempts]
175
+ :retry
176
+ end
177
+ end
178
+ Aws::Waiters::Waiter.new(options).wait({})
179
+ end
180
+
86
181
  # @!group Actions
87
182
 
88
183
  # @example Request syntax with placeholder values