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.
- checksums.yaml +4 -4
- data/lib/aws-sdk-iam.rb +1 -1
- data/lib/aws-sdk-iam/access_key.rb +97 -2
- data/lib/aws-sdk-iam/access_key_pair.rb +97 -2
- data/lib/aws-sdk-iam/account_password_policy.rb +105 -10
- data/lib/aws-sdk-iam/account_summary.rb +96 -1
- data/lib/aws-sdk-iam/assume_role_policy.rb +95 -0
- data/lib/aws-sdk-iam/client.rb +1 -1
- data/lib/aws-sdk-iam/current_user.rb +103 -8
- data/lib/aws-sdk-iam/group.rb +99 -4
- data/lib/aws-sdk-iam/group_policy.rb +96 -1
- data/lib/aws-sdk-iam/instance_profile.rb +102 -7
- data/lib/aws-sdk-iam/login_profile.rb +97 -2
- data/lib/aws-sdk-iam/mfa_device.rb +96 -1
- data/lib/aws-sdk-iam/policy.rb +106 -11
- data/lib/aws-sdk-iam/policy_version.rb +98 -3
- data/lib/aws-sdk-iam/role.rb +101 -6
- data/lib/aws-sdk-iam/role_policy.rb +96 -1
- data/lib/aws-sdk-iam/saml_provider.rb +98 -3
- data/lib/aws-sdk-iam/server_certificate.rb +98 -3
- data/lib/aws-sdk-iam/signing_certificate.rb +98 -3
- data/lib/aws-sdk-iam/user.rb +100 -5
- data/lib/aws-sdk-iam/user_policy.rb +96 -1
- data/lib/aws-sdk-iam/virtual_mfa_device.rb +100 -5
- metadata +2 -2
@@ -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
|
42
|
+
data[:path]
|
43
43
|
end
|
44
44
|
|
45
45
|
# The stable and unique string identifying the instance profile. For
|
@@ -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 instance_profile_id
|
54
|
-
data
|
54
|
+
data[:instance_profile_id]
|
55
55
|
end
|
56
56
|
|
57
57
|
# The Amazon Resource Name (ARN) specifying the instance profile. For
|
@@ -63,13 +63,13 @@ 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
|
66
|
+
data[:arn]
|
67
67
|
end
|
68
68
|
|
69
69
|
# The date when the instance profile was created.
|
70
70
|
# @return [Time]
|
71
71
|
def create_date
|
72
|
-
data
|
72
|
+
data[:create_date]
|
73
73
|
end
|
74
74
|
|
75
75
|
# @!endgroup
|
@@ -138,6 +138,101 @@ module Aws::IAM
|
|
138
138
|
})
|
139
139
|
end
|
140
140
|
|
141
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
142
|
+
#
|
143
|
+
# Waiter polls an API operation until a resource enters a desired
|
144
|
+
# state.
|
145
|
+
#
|
146
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
147
|
+
#
|
148
|
+
# ## Basic Usage
|
149
|
+
#
|
150
|
+
# Waiter will polls until it is successful, it fails by
|
151
|
+
# entering a terminal state, or until a maximum number of attempts
|
152
|
+
# are made.
|
153
|
+
#
|
154
|
+
# # polls in a loop until condition is true
|
155
|
+
# resource.wait_until(options) {|resource| condition}
|
156
|
+
#
|
157
|
+
# ## Example
|
158
|
+
#
|
159
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
160
|
+
#
|
161
|
+
# ## Configuration
|
162
|
+
#
|
163
|
+
# You can configure the maximum number of polling attempts, and the
|
164
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
165
|
+
# by passing a block to {#wait_until}:
|
166
|
+
#
|
167
|
+
# # poll for ~25 seconds
|
168
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
169
|
+
#
|
170
|
+
# ## Callbacks
|
171
|
+
#
|
172
|
+
# You can be notified before each polling attempt and before each
|
173
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
174
|
+
# it will terminate the waiter.
|
175
|
+
#
|
176
|
+
# started_at = Time.now
|
177
|
+
# # poll for 1 hour, instead of a number of attempts
|
178
|
+
# proc = Proc.new do |attempts, response|
|
179
|
+
# throw :failure if Time.now - started_at > 3600
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# # disable max attempts
|
183
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
184
|
+
#
|
185
|
+
# ## Handling Errors
|
186
|
+
#
|
187
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
188
|
+
# fails, it raises an error.
|
189
|
+
#
|
190
|
+
# begin
|
191
|
+
# resource.wait_until(...)
|
192
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
193
|
+
# # resource did not enter the desired state in time
|
194
|
+
# end
|
195
|
+
#
|
196
|
+
#
|
197
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
198
|
+
#
|
199
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
200
|
+
# because the waiter has entered a state that it will not transition
|
201
|
+
# out of, preventing success.
|
202
|
+
#
|
203
|
+
# yet successful.
|
204
|
+
#
|
205
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
206
|
+
# while polling for a resource that is not expected.
|
207
|
+
#
|
208
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
209
|
+
#
|
210
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
211
|
+
# attempts
|
212
|
+
# @option options [Integer] :delay (10) Delay between each
|
213
|
+
# attempt in seconds
|
214
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
215
|
+
# invoked before each attempt
|
216
|
+
# @option options [Proc] :before_wait (nil) Callback
|
217
|
+
# invoked before each wait
|
218
|
+
# @return [Resource] if the waiter was successful
|
219
|
+
def wait_until(options = {}, &block)
|
220
|
+
self_copy = self.dup
|
221
|
+
attempts = 0
|
222
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
223
|
+
options[:delay] ||= 10
|
224
|
+
options[:poller] = Proc.new do
|
225
|
+
attempts += 1
|
226
|
+
if block.call(self_copy)
|
227
|
+
[:success, self_copy]
|
228
|
+
else
|
229
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
230
|
+
:retry
|
231
|
+
end
|
232
|
+
end
|
233
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
234
|
+
end
|
235
|
+
|
141
236
|
# @!group Actions
|
142
237
|
|
143
238
|
# @example Request syntax with placeholder values
|
@@ -204,10 +299,10 @@ module Aws::IAM
|
|
204
299
|
# @return [Role::Collection]
|
205
300
|
def roles
|
206
301
|
batch = []
|
207
|
-
data
|
302
|
+
data[:roles].each do |d|
|
208
303
|
batch << Role.new(
|
209
|
-
name:
|
210
|
-
data:
|
304
|
+
name: d[:role_name],
|
305
|
+
data: d,
|
211
306
|
client: @client
|
212
307
|
)
|
213
308
|
end
|
@@ -33,14 +33,14 @@ module Aws::IAM
|
|
33
33
|
# The date when the password for the user was created.
|
34
34
|
# @return [Time]
|
35
35
|
def create_date
|
36
|
-
data
|
36
|
+
data[:create_date]
|
37
37
|
end
|
38
38
|
|
39
39
|
# Specifies whether the user is required to set a new password on next
|
40
40
|
# sign-in.
|
41
41
|
# @return [Boolean]
|
42
42
|
def password_reset_required
|
43
|
-
data
|
43
|
+
data[:password_reset_required]
|
44
44
|
end
|
45
45
|
|
46
46
|
# @!endgroup
|
@@ -78,6 +78,101 @@ module Aws::IAM
|
|
78
78
|
!!@data
|
79
79
|
end
|
80
80
|
|
81
|
+
# @deprecated Use [Aws::IAM::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
|
@@ -41,7 +41,7 @@ module Aws::IAM
|
|
41
41
|
# The date when the MFA device was enabled for the user.
|
42
42
|
# @return [Time]
|
43
43
|
def enable_date
|
44
|
-
data
|
44
|
+
data[:enable_date]
|
45
45
|
end
|
46
46
|
|
47
47
|
# @!endgroup
|
@@ -74,6 +74,101 @@ module Aws::IAM
|
|
74
74
|
!!@data
|
75
75
|
end
|
76
76
|
|
77
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
78
|
+
#
|
79
|
+
# Waiter polls an API operation until a resource enters a desired
|
80
|
+
# state.
|
81
|
+
#
|
82
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
83
|
+
#
|
84
|
+
# ## Basic Usage
|
85
|
+
#
|
86
|
+
# Waiter will polls until it is successful, it fails by
|
87
|
+
# entering a terminal state, or until a maximum number of attempts
|
88
|
+
# are made.
|
89
|
+
#
|
90
|
+
# # polls in a loop until condition is true
|
91
|
+
# resource.wait_until(options) {|resource| condition}
|
92
|
+
#
|
93
|
+
# ## Example
|
94
|
+
#
|
95
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
96
|
+
#
|
97
|
+
# ## Configuration
|
98
|
+
#
|
99
|
+
# You can configure the maximum number of polling attempts, and the
|
100
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
101
|
+
# by passing a block to {#wait_until}:
|
102
|
+
#
|
103
|
+
# # poll for ~25 seconds
|
104
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
105
|
+
#
|
106
|
+
# ## Callbacks
|
107
|
+
#
|
108
|
+
# You can be notified before each polling attempt and before each
|
109
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
110
|
+
# it will terminate the waiter.
|
111
|
+
#
|
112
|
+
# started_at = Time.now
|
113
|
+
# # poll for 1 hour, instead of a number of attempts
|
114
|
+
# proc = Proc.new do |attempts, response|
|
115
|
+
# throw :failure if Time.now - started_at > 3600
|
116
|
+
# end
|
117
|
+
#
|
118
|
+
# # disable max attempts
|
119
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
120
|
+
#
|
121
|
+
# ## Handling Errors
|
122
|
+
#
|
123
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
124
|
+
# fails, it raises an error.
|
125
|
+
#
|
126
|
+
# begin
|
127
|
+
# resource.wait_until(...)
|
128
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
129
|
+
# # resource did not enter the desired state in time
|
130
|
+
# end
|
131
|
+
#
|
132
|
+
#
|
133
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
134
|
+
#
|
135
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
136
|
+
# because the waiter has entered a state that it will not transition
|
137
|
+
# out of, preventing success.
|
138
|
+
#
|
139
|
+
# yet successful.
|
140
|
+
#
|
141
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
142
|
+
# while polling for a resource that is not expected.
|
143
|
+
#
|
144
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
145
|
+
#
|
146
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
147
|
+
# attempts
|
148
|
+
# @option options [Integer] :delay (10) Delay between each
|
149
|
+
# attempt in seconds
|
150
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
151
|
+
# invoked before each attempt
|
152
|
+
# @option options [Proc] :before_wait (nil) Callback
|
153
|
+
# invoked before each wait
|
154
|
+
# @return [Resource] if the waiter was successful
|
155
|
+
def wait_until(options = {}, &block)
|
156
|
+
self_copy = self.dup
|
157
|
+
attempts = 0
|
158
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
159
|
+
options[:delay] ||= 10
|
160
|
+
options[:poller] = Proc.new do
|
161
|
+
attempts += 1
|
162
|
+
if block.call(self_copy)
|
163
|
+
[:success, self_copy]
|
164
|
+
else
|
165
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
166
|
+
:retry
|
167
|
+
end
|
168
|
+
end
|
169
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
170
|
+
end
|
171
|
+
|
77
172
|
# @!group Actions
|
78
173
|
|
79
174
|
# @example Request syntax with placeholder values
|
data/lib/aws-sdk-iam/policy.rb
CHANGED
@@ -33,7 +33,7 @@ module Aws::IAM
|
|
33
33
|
# The friendly name (not ARN) identifying the policy.
|
34
34
|
# @return [String]
|
35
35
|
def policy_name
|
36
|
-
data
|
36
|
+
data[:policy_name]
|
37
37
|
end
|
38
38
|
|
39
39
|
# The stable and unique string identifying the policy.
|
@@ -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 policy_id
|
49
|
-
data
|
49
|
+
data[:policy_id]
|
50
50
|
end
|
51
51
|
|
52
52
|
# The path to the policy.
|
@@ -59,28 +59,28 @@ module Aws::IAM
|
|
59
59
|
# [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
|
60
60
|
# @return [String]
|
61
61
|
def path
|
62
|
-
data
|
62
|
+
data[:path]
|
63
63
|
end
|
64
64
|
|
65
65
|
# The identifier for the version of the policy that is set as the
|
66
66
|
# default version.
|
67
67
|
# @return [String]
|
68
68
|
def default_version_id
|
69
|
-
data
|
69
|
+
data[:default_version_id]
|
70
70
|
end
|
71
71
|
|
72
72
|
# The number of entities (users, groups, and roles) that the policy is
|
73
73
|
# attached to.
|
74
74
|
# @return [Integer]
|
75
75
|
def attachment_count
|
76
|
-
data
|
76
|
+
data[:attachment_count]
|
77
77
|
end
|
78
78
|
|
79
79
|
# Specifies whether the policy can be attached to an IAM user, group, or
|
80
80
|
# role.
|
81
81
|
# @return [Boolean]
|
82
82
|
def is_attachable
|
83
|
-
data
|
83
|
+
data[:is_attachable]
|
84
84
|
end
|
85
85
|
|
86
86
|
# A friendly description of the policy.
|
@@ -89,7 +89,7 @@ module Aws::IAM
|
|
89
89
|
# It is not included in the response to the ListPolicies operation.
|
90
90
|
# @return [String]
|
91
91
|
def description
|
92
|
-
data
|
92
|
+
data[:description]
|
93
93
|
end
|
94
94
|
|
95
95
|
# The date and time, in [ISO 8601 date-time format][1], when the policy
|
@@ -100,7 +100,7 @@ module Aws::IAM
|
|
100
100
|
# [1]: http://www.iso.org/iso/iso8601
|
101
101
|
# @return [Time]
|
102
102
|
def create_date
|
103
|
-
data
|
103
|
+
data[:create_date]
|
104
104
|
end
|
105
105
|
|
106
106
|
# The date and time, in [ISO 8601 date-time format][1], when the policy
|
@@ -116,7 +116,7 @@ module Aws::IAM
|
|
116
116
|
# [1]: http://www.iso.org/iso/iso8601
|
117
117
|
# @return [Time]
|
118
118
|
def update_date
|
119
|
-
data
|
119
|
+
data[:update_date]
|
120
120
|
end
|
121
121
|
|
122
122
|
# @!endgroup
|
@@ -154,6 +154,101 @@ module Aws::IAM
|
|
154
154
|
!!@data
|
155
155
|
end
|
156
156
|
|
157
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
158
|
+
#
|
159
|
+
# Waiter polls an API operation until a resource enters a desired
|
160
|
+
# state.
|
161
|
+
#
|
162
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
163
|
+
#
|
164
|
+
# ## Basic Usage
|
165
|
+
#
|
166
|
+
# Waiter will polls until it is successful, it fails by
|
167
|
+
# entering a terminal state, or until a maximum number of attempts
|
168
|
+
# are made.
|
169
|
+
#
|
170
|
+
# # polls in a loop until condition is true
|
171
|
+
# resource.wait_until(options) {|resource| condition}
|
172
|
+
#
|
173
|
+
# ## Example
|
174
|
+
#
|
175
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
176
|
+
#
|
177
|
+
# ## Configuration
|
178
|
+
#
|
179
|
+
# You can configure the maximum number of polling attempts, and the
|
180
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
181
|
+
# by passing a block to {#wait_until}:
|
182
|
+
#
|
183
|
+
# # poll for ~25 seconds
|
184
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
185
|
+
#
|
186
|
+
# ## Callbacks
|
187
|
+
#
|
188
|
+
# You can be notified before each polling attempt and before each
|
189
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
190
|
+
# it will terminate the waiter.
|
191
|
+
#
|
192
|
+
# started_at = Time.now
|
193
|
+
# # poll for 1 hour, instead of a number of attempts
|
194
|
+
# proc = Proc.new do |attempts, response|
|
195
|
+
# throw :failure if Time.now - started_at > 3600
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# # disable max attempts
|
199
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
200
|
+
#
|
201
|
+
# ## Handling Errors
|
202
|
+
#
|
203
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
204
|
+
# fails, it raises an error.
|
205
|
+
#
|
206
|
+
# begin
|
207
|
+
# resource.wait_until(...)
|
208
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
209
|
+
# # resource did not enter the desired state in time
|
210
|
+
# end
|
211
|
+
#
|
212
|
+
#
|
213
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
214
|
+
#
|
215
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
216
|
+
# because the waiter has entered a state that it will not transition
|
217
|
+
# out of, preventing success.
|
218
|
+
#
|
219
|
+
# yet successful.
|
220
|
+
#
|
221
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
222
|
+
# while polling for a resource that is not expected.
|
223
|
+
#
|
224
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
225
|
+
#
|
226
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
227
|
+
# attempts
|
228
|
+
# @option options [Integer] :delay (10) Delay between each
|
229
|
+
# attempt in seconds
|
230
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
231
|
+
# invoked before each attempt
|
232
|
+
# @option options [Proc] :before_wait (nil) Callback
|
233
|
+
# invoked before each wait
|
234
|
+
# @return [Resource] if the waiter was successful
|
235
|
+
def wait_until(options = {}, &block)
|
236
|
+
self_copy = self.dup
|
237
|
+
attempts = 0
|
238
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
239
|
+
options[:delay] ||= 10
|
240
|
+
options[:poller] = Proc.new do
|
241
|
+
attempts += 1
|
242
|
+
if block.call(self_copy)
|
243
|
+
[:success, self_copy]
|
244
|
+
else
|
245
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
246
|
+
:retry
|
247
|
+
end
|
248
|
+
end
|
249
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
250
|
+
end
|
251
|
+
|
157
252
|
# @!group Actions
|
158
253
|
|
159
254
|
# @example Request syntax with placeholder values
|
@@ -499,10 +594,10 @@ module Aws::IAM
|
|
499
594
|
|
500
595
|
# @return [PolicyVersion, nil]
|
501
596
|
def default_version
|
502
|
-
if data
|
597
|
+
if data[:default_version_id]
|
503
598
|
PolicyVersion.new(
|
504
599
|
arn: @arn,
|
505
|
-
version_id: data
|
600
|
+
version_id: data[:default_version_id],
|
506
601
|
client: @client
|
507
602
|
)
|
508
603
|
else
|