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.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34447b95daec77c8a33749df9cbf2815aa980b00
|
4
|
+
data.tar.gz: 504aab29c1d95c9375fd4b2a9fbce82b7a63c8e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a930126f6176cd90d1ea02c6053c98e308575c997968f7e5e45612ea7fa4ae89bc14329bd2caa42c4a2e406d9700640e8a26b1bb4c75bd2ac37416973777cc38
|
7
|
+
data.tar.gz: d19831f886d6e9023ed6a1b928f5d9cabc078a8bfc8d591d1f554f09dd50a84eee83f486020288deed0018e14935ad71a6df8ceef73ddafab2091347e5218662
|
data/lib/aws-sdk-iam.rb
CHANGED
@@ -43,13 +43,13 @@ module Aws::IAM
|
|
43
43
|
# calls; `Inactive` means it is not.
|
44
44
|
# @return [String]
|
45
45
|
def status
|
46
|
-
data
|
46
|
+
data[:status]
|
47
47
|
end
|
48
48
|
|
49
49
|
# The date when the access key was created.
|
50
50
|
# @return [Time]
|
51
51
|
def create_date
|
52
|
-
data
|
52
|
+
data[:create_date]
|
53
53
|
end
|
54
54
|
|
55
55
|
# @!endgroup
|
@@ -82,6 +82,101 @@ module Aws::IAM
|
|
82
82
|
!!@data
|
83
83
|
end
|
84
84
|
|
85
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
86
|
+
#
|
87
|
+
# Waiter polls an API operation until a resource enters a desired
|
88
|
+
# state.
|
89
|
+
#
|
90
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
91
|
+
#
|
92
|
+
# ## Basic Usage
|
93
|
+
#
|
94
|
+
# Waiter will polls until it is successful, it fails by
|
95
|
+
# entering a terminal state, or until a maximum number of attempts
|
96
|
+
# are made.
|
97
|
+
#
|
98
|
+
# # polls in a loop until condition is true
|
99
|
+
# resource.wait_until(options) {|resource| condition}
|
100
|
+
#
|
101
|
+
# ## Example
|
102
|
+
#
|
103
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
104
|
+
#
|
105
|
+
# ## Configuration
|
106
|
+
#
|
107
|
+
# You can configure the maximum number of polling attempts, and the
|
108
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
109
|
+
# by passing a block to {#wait_until}:
|
110
|
+
#
|
111
|
+
# # poll for ~25 seconds
|
112
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
113
|
+
#
|
114
|
+
# ## Callbacks
|
115
|
+
#
|
116
|
+
# You can be notified before each polling attempt and before each
|
117
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
118
|
+
# it will terminate the waiter.
|
119
|
+
#
|
120
|
+
# started_at = Time.now
|
121
|
+
# # poll for 1 hour, instead of a number of attempts
|
122
|
+
# proc = Proc.new do |attempts, response|
|
123
|
+
# throw :failure if Time.now - started_at > 3600
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# # disable max attempts
|
127
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
128
|
+
#
|
129
|
+
# ## Handling Errors
|
130
|
+
#
|
131
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
132
|
+
# fails, it raises an error.
|
133
|
+
#
|
134
|
+
# begin
|
135
|
+
# resource.wait_until(...)
|
136
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
137
|
+
# # resource did not enter the desired state in time
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
#
|
141
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
142
|
+
#
|
143
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
144
|
+
# because the waiter has entered a state that it will not transition
|
145
|
+
# out of, preventing success.
|
146
|
+
#
|
147
|
+
# yet successful.
|
148
|
+
#
|
149
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
150
|
+
# while polling for a resource that is not expected.
|
151
|
+
#
|
152
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
153
|
+
#
|
154
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
155
|
+
# attempts
|
156
|
+
# @option options [Integer] :delay (10) Delay between each
|
157
|
+
# attempt in seconds
|
158
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
159
|
+
# invoked before each attempt
|
160
|
+
# @option options [Proc] :before_wait (nil) Callback
|
161
|
+
# invoked before each wait
|
162
|
+
# @return [Resource] if the waiter was successful
|
163
|
+
def wait_until(options = {}, &block)
|
164
|
+
self_copy = self.dup
|
165
|
+
attempts = 0
|
166
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
167
|
+
options[:delay] ||= 10
|
168
|
+
options[:poller] = Proc.new do
|
169
|
+
attempts += 1
|
170
|
+
if block.call(self_copy)
|
171
|
+
[:success, self_copy]
|
172
|
+
else
|
173
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
174
|
+
:retry
|
175
|
+
end
|
176
|
+
end
|
177
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
178
|
+
end
|
179
|
+
|
85
180
|
# @!group Actions
|
86
181
|
|
87
182
|
# @example Request syntax with placeholder values
|
@@ -52,13 +52,13 @@ module Aws::IAM
|
|
52
52
|
# calls, while `Inactive` means it is not.
|
53
53
|
# @return [String]
|
54
54
|
def status
|
55
|
-
data
|
55
|
+
data[:status]
|
56
56
|
end
|
57
57
|
|
58
58
|
# The date when the access key was created.
|
59
59
|
# @return [Time]
|
60
60
|
def create_date
|
61
|
-
data
|
61
|
+
data[:create_date]
|
62
62
|
end
|
63
63
|
|
64
64
|
# @!endgroup
|
@@ -91,6 +91,101 @@ module Aws::IAM
|
|
91
91
|
!!@data
|
92
92
|
end
|
93
93
|
|
94
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
95
|
+
#
|
96
|
+
# Waiter polls an API operation until a resource enters a desired
|
97
|
+
# state.
|
98
|
+
#
|
99
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
100
|
+
#
|
101
|
+
# ## Basic Usage
|
102
|
+
#
|
103
|
+
# Waiter will polls until it is successful, it fails by
|
104
|
+
# entering a terminal state, or until a maximum number of attempts
|
105
|
+
# are made.
|
106
|
+
#
|
107
|
+
# # polls in a loop until condition is true
|
108
|
+
# resource.wait_until(options) {|resource| condition}
|
109
|
+
#
|
110
|
+
# ## Example
|
111
|
+
#
|
112
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
113
|
+
#
|
114
|
+
# ## Configuration
|
115
|
+
#
|
116
|
+
# You can configure the maximum number of polling attempts, and the
|
117
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
118
|
+
# by passing a block to {#wait_until}:
|
119
|
+
#
|
120
|
+
# # poll for ~25 seconds
|
121
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
122
|
+
#
|
123
|
+
# ## Callbacks
|
124
|
+
#
|
125
|
+
# You can be notified before each polling attempt and before each
|
126
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
127
|
+
# it will terminate the waiter.
|
128
|
+
#
|
129
|
+
# started_at = Time.now
|
130
|
+
# # poll for 1 hour, instead of a number of attempts
|
131
|
+
# proc = Proc.new do |attempts, response|
|
132
|
+
# throw :failure if Time.now - started_at > 3600
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# # disable max attempts
|
136
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
137
|
+
#
|
138
|
+
# ## Handling Errors
|
139
|
+
#
|
140
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
141
|
+
# fails, it raises an error.
|
142
|
+
#
|
143
|
+
# begin
|
144
|
+
# resource.wait_until(...)
|
145
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
146
|
+
# # resource did not enter the desired state in time
|
147
|
+
# end
|
148
|
+
#
|
149
|
+
#
|
150
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
151
|
+
#
|
152
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
153
|
+
# because the waiter has entered a state that it will not transition
|
154
|
+
# out of, preventing success.
|
155
|
+
#
|
156
|
+
# yet successful.
|
157
|
+
#
|
158
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
159
|
+
# while polling for a resource that is not expected.
|
160
|
+
#
|
161
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
162
|
+
#
|
163
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
164
|
+
# attempts
|
165
|
+
# @option options [Integer] :delay (10) Delay between each
|
166
|
+
# attempt in seconds
|
167
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
168
|
+
# invoked before each attempt
|
169
|
+
# @option options [Proc] :before_wait (nil) Callback
|
170
|
+
# invoked before each wait
|
171
|
+
# @return [Resource] if the waiter was successful
|
172
|
+
def wait_until(options = {}, &block)
|
173
|
+
self_copy = self.dup
|
174
|
+
attempts = 0
|
175
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
176
|
+
options[:delay] ||= 10
|
177
|
+
options[:poller] = Proc.new do
|
178
|
+
attempts += 1
|
179
|
+
if block.call(self_copy)
|
180
|
+
[:success, self_copy]
|
181
|
+
else
|
182
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
183
|
+
:retry
|
184
|
+
end
|
185
|
+
end
|
186
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
187
|
+
end
|
188
|
+
|
94
189
|
# @!group Actions
|
95
190
|
|
96
191
|
# @example Request syntax with placeholder values
|
@@ -23,39 +23,39 @@ module Aws::IAM
|
|
23
23
|
# Minimum length to require for IAM user passwords.
|
24
24
|
# @return [Integer]
|
25
25
|
def minimum_password_length
|
26
|
-
data
|
26
|
+
data[:minimum_password_length]
|
27
27
|
end
|
28
28
|
|
29
29
|
# Specifies whether to require symbols for IAM user passwords.
|
30
30
|
# @return [Boolean]
|
31
31
|
def require_symbols
|
32
|
-
data
|
32
|
+
data[:require_symbols]
|
33
33
|
end
|
34
34
|
|
35
35
|
# Specifies whether to require numbers for IAM user passwords.
|
36
36
|
# @return [Boolean]
|
37
37
|
def require_numbers
|
38
|
-
data
|
38
|
+
data[:require_numbers]
|
39
39
|
end
|
40
40
|
|
41
41
|
# Specifies whether to require uppercase characters for IAM user
|
42
42
|
# passwords.
|
43
43
|
# @return [Boolean]
|
44
44
|
def require_uppercase_characters
|
45
|
-
data
|
45
|
+
data[:require_uppercase_characters]
|
46
46
|
end
|
47
47
|
|
48
48
|
# Specifies whether to require lowercase characters for IAM user
|
49
49
|
# passwords.
|
50
50
|
# @return [Boolean]
|
51
51
|
def require_lowercase_characters
|
52
|
-
data
|
52
|
+
data[:require_lowercase_characters]
|
53
53
|
end
|
54
54
|
|
55
55
|
# Specifies whether IAM users are allowed to change their own password.
|
56
56
|
# @return [Boolean]
|
57
57
|
def allow_users_to_change_password
|
58
|
-
data
|
58
|
+
data[:allow_users_to_change_password]
|
59
59
|
end
|
60
60
|
|
61
61
|
# Indicates whether passwords in the account expire. Returns true if
|
@@ -63,27 +63,27 @@ module Aws::IAM
|
|
63
63
|
# MaxPasswordAge is 0 or not present.
|
64
64
|
# @return [Boolean]
|
65
65
|
def expire_passwords
|
66
|
-
data
|
66
|
+
data[:expire_passwords]
|
67
67
|
end
|
68
68
|
|
69
69
|
# The number of days that an IAM user password is valid.
|
70
70
|
# @return [Integer]
|
71
71
|
def max_password_age
|
72
|
-
data
|
72
|
+
data[:max_password_age]
|
73
73
|
end
|
74
74
|
|
75
75
|
# Specifies the number of previous passwords that IAM users are
|
76
76
|
# prevented from reusing.
|
77
77
|
# @return [Integer]
|
78
78
|
def password_reuse_prevention
|
79
|
-
data
|
79
|
+
data[:password_reuse_prevention]
|
80
80
|
end
|
81
81
|
|
82
82
|
# Specifies whether IAM users are prevented from setting a new password
|
83
83
|
# after their password has expired.
|
84
84
|
# @return [Boolean]
|
85
85
|
def hard_expiry
|
86
|
-
data
|
86
|
+
data[:hard_expiry]
|
87
87
|
end
|
88
88
|
|
89
89
|
# @!endgroup
|
@@ -121,6 +121,101 @@ module Aws::IAM
|
|
121
121
|
!!@data
|
122
122
|
end
|
123
123
|
|
124
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
125
|
+
#
|
126
|
+
# Waiter polls an API operation until a resource enters a desired
|
127
|
+
# state.
|
128
|
+
#
|
129
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
130
|
+
#
|
131
|
+
# ## Basic Usage
|
132
|
+
#
|
133
|
+
# Waiter will polls until it is successful, it fails by
|
134
|
+
# entering a terminal state, or until a maximum number of attempts
|
135
|
+
# are made.
|
136
|
+
#
|
137
|
+
# # polls in a loop until condition is true
|
138
|
+
# resource.wait_until(options) {|resource| condition}
|
139
|
+
#
|
140
|
+
# ## Example
|
141
|
+
#
|
142
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
143
|
+
#
|
144
|
+
# ## Configuration
|
145
|
+
#
|
146
|
+
# You can configure the maximum number of polling attempts, and the
|
147
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
148
|
+
# by passing a block to {#wait_until}:
|
149
|
+
#
|
150
|
+
# # poll for ~25 seconds
|
151
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
152
|
+
#
|
153
|
+
# ## Callbacks
|
154
|
+
#
|
155
|
+
# You can be notified before each polling attempt and before each
|
156
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
157
|
+
# it will terminate the waiter.
|
158
|
+
#
|
159
|
+
# started_at = Time.now
|
160
|
+
# # poll for 1 hour, instead of a number of attempts
|
161
|
+
# proc = Proc.new do |attempts, response|
|
162
|
+
# throw :failure if Time.now - started_at > 3600
|
163
|
+
# end
|
164
|
+
#
|
165
|
+
# # disable max attempts
|
166
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
167
|
+
#
|
168
|
+
# ## Handling Errors
|
169
|
+
#
|
170
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
171
|
+
# fails, it raises an error.
|
172
|
+
#
|
173
|
+
# begin
|
174
|
+
# resource.wait_until(...)
|
175
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
176
|
+
# # resource did not enter the desired state in time
|
177
|
+
# end
|
178
|
+
#
|
179
|
+
#
|
180
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
181
|
+
#
|
182
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
183
|
+
# because the waiter has entered a state that it will not transition
|
184
|
+
# out of, preventing success.
|
185
|
+
#
|
186
|
+
# yet successful.
|
187
|
+
#
|
188
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
189
|
+
# while polling for a resource that is not expected.
|
190
|
+
#
|
191
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
192
|
+
#
|
193
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
194
|
+
# attempts
|
195
|
+
# @option options [Integer] :delay (10) Delay between each
|
196
|
+
# attempt in seconds
|
197
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
198
|
+
# invoked before each attempt
|
199
|
+
# @option options [Proc] :before_wait (nil) Callback
|
200
|
+
# invoked before each wait
|
201
|
+
# @return [Resource] if the waiter was successful
|
202
|
+
def wait_until(options = {}, &block)
|
203
|
+
self_copy = self.dup
|
204
|
+
attempts = 0
|
205
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
206
|
+
options[:delay] ||= 10
|
207
|
+
options[:poller] = Proc.new do
|
208
|
+
attempts += 1
|
209
|
+
if block.call(self_copy)
|
210
|
+
[:success, self_copy]
|
211
|
+
else
|
212
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
213
|
+
:retry
|
214
|
+
end
|
215
|
+
end
|
216
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
217
|
+
end
|
218
|
+
|
124
219
|
# @!group Actions
|
125
220
|
|
126
221
|
# @example Request syntax with placeholder values
|
@@ -24,7 +24,7 @@ module Aws::IAM
|
|
24
24
|
# and IAM quotas.
|
25
25
|
# @return [Hash<String,Integer>]
|
26
26
|
def summary_map
|
27
|
-
data
|
27
|
+
data[:summary_map]
|
28
28
|
end
|
29
29
|
|
30
30
|
# @!endgroup
|
@@ -62,6 +62,101 @@ module Aws::IAM
|
|
62
62
|
!!@data
|
63
63
|
end
|
64
64
|
|
65
|
+
# @deprecated Use [Aws::IAM::Client] #wait_until instead
|
66
|
+
#
|
67
|
+
# Waiter polls an API operation until a resource enters a desired
|
68
|
+
# state.
|
69
|
+
#
|
70
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
71
|
+
#
|
72
|
+
# ## Basic Usage
|
73
|
+
#
|
74
|
+
# Waiter will polls until it is successful, it fails by
|
75
|
+
# entering a terminal state, or until a maximum number of attempts
|
76
|
+
# are made.
|
77
|
+
#
|
78
|
+
# # polls in a loop until condition is true
|
79
|
+
# resource.wait_until(options) {|resource| condition}
|
80
|
+
#
|
81
|
+
# ## Example
|
82
|
+
#
|
83
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
84
|
+
#
|
85
|
+
# ## Configuration
|
86
|
+
#
|
87
|
+
# You can configure the maximum number of polling attempts, and the
|
88
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
89
|
+
# by passing a block to {#wait_until}:
|
90
|
+
#
|
91
|
+
# # poll for ~25 seconds
|
92
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
93
|
+
#
|
94
|
+
# ## Callbacks
|
95
|
+
#
|
96
|
+
# You can be notified before each polling attempt and before each
|
97
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
98
|
+
# it will terminate the waiter.
|
99
|
+
#
|
100
|
+
# started_at = Time.now
|
101
|
+
# # poll for 1 hour, instead of a number of attempts
|
102
|
+
# proc = Proc.new do |attempts, response|
|
103
|
+
# throw :failure if Time.now - started_at > 3600
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# # disable max attempts
|
107
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
108
|
+
#
|
109
|
+
# ## Handling Errors
|
110
|
+
#
|
111
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
112
|
+
# fails, it raises an error.
|
113
|
+
#
|
114
|
+
# begin
|
115
|
+
# resource.wait_until(...)
|
116
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
117
|
+
# # resource did not enter the desired state in time
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
#
|
121
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
122
|
+
#
|
123
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
124
|
+
# because the waiter has entered a state that it will not transition
|
125
|
+
# out of, preventing success.
|
126
|
+
#
|
127
|
+
# yet successful.
|
128
|
+
#
|
129
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
130
|
+
# while polling for a resource that is not expected.
|
131
|
+
#
|
132
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
133
|
+
#
|
134
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
135
|
+
# attempts
|
136
|
+
# @option options [Integer] :delay (10) Delay between each
|
137
|
+
# attempt in seconds
|
138
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
139
|
+
# invoked before each attempt
|
140
|
+
# @option options [Proc] :before_wait (nil) Callback
|
141
|
+
# invoked before each wait
|
142
|
+
# @return [Resource] if the waiter was successful
|
143
|
+
def wait_until(options = {}, &block)
|
144
|
+
self_copy = self.dup
|
145
|
+
attempts = 0
|
146
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
147
|
+
options[:delay] ||= 10
|
148
|
+
options[:poller] = Proc.new do
|
149
|
+
attempts += 1
|
150
|
+
if block.call(self_copy)
|
151
|
+
[:success, self_copy]
|
152
|
+
else
|
153
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
154
|
+
:retry
|
155
|
+
end
|
156
|
+
end
|
157
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
158
|
+
end
|
159
|
+
|
65
160
|
# @deprecated
|
66
161
|
# @api private
|
67
162
|
def identifiers
|