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.
@@ -46,14 +46,14 @@ module Aws::IAM
46
46
  # ListPolicyVersions operations.
47
47
  # @return [String]
48
48
  def document
49
- data.document
49
+ data[:document]
50
50
  end
51
51
 
52
52
  # Specifies whether the policy version is set as the policy's default
53
53
  # version.
54
54
  # @return [Boolean]
55
55
  def is_default_version
56
- data.is_default_version
56
+ data[:is_default_version]
57
57
  end
58
58
 
59
59
  # The date and time, in [ISO 8601 date-time format][1], when the policy
@@ -64,7 +64,7 @@ module Aws::IAM
64
64
  # [1]: http://www.iso.org/iso/iso8601
65
65
  # @return [Time]
66
66
  def create_date
67
- data.create_date
67
+ data[:create_date]
68
68
  end
69
69
 
70
70
  # @!endgroup
@@ -105,6 +105,101 @@ module Aws::IAM
105
105
  !!@data
106
106
  end
107
107
 
108
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
109
+ #
110
+ # Waiter polls an API operation until a resource enters a desired
111
+ # state.
112
+ #
113
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
114
+ #
115
+ # ## Basic Usage
116
+ #
117
+ # Waiter will polls until it is successful, it fails by
118
+ # entering a terminal state, or until a maximum number of attempts
119
+ # are made.
120
+ #
121
+ # # polls in a loop until condition is true
122
+ # resource.wait_until(options) {|resource| condition}
123
+ #
124
+ # ## Example
125
+ #
126
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
127
+ #
128
+ # ## Configuration
129
+ #
130
+ # You can configure the maximum number of polling attempts, and the
131
+ # delay (in seconds) between each polling attempt. The waiting condition is set
132
+ # by passing a block to {#wait_until}:
133
+ #
134
+ # # poll for ~25 seconds
135
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
136
+ #
137
+ # ## Callbacks
138
+ #
139
+ # You can be notified before each polling attempt and before each
140
+ # delay. If you throw `:success` or `:failure` from these callbacks,
141
+ # it will terminate the waiter.
142
+ #
143
+ # started_at = Time.now
144
+ # # poll for 1 hour, instead of a number of attempts
145
+ # proc = Proc.new do |attempts, response|
146
+ # throw :failure if Time.now - started_at > 3600
147
+ # end
148
+ #
149
+ # # disable max attempts
150
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
151
+ #
152
+ # ## Handling Errors
153
+ #
154
+ # When a waiter is successful, it returns the Resource. When a waiter
155
+ # fails, it raises an error.
156
+ #
157
+ # begin
158
+ # resource.wait_until(...)
159
+ # rescue Aws::Waiters::Errors::WaiterFailed
160
+ # # resource did not enter the desired state in time
161
+ # end
162
+ #
163
+ #
164
+ # @yield param [Resource] resource to be used in the waiting condition
165
+ #
166
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
167
+ # because the waiter has entered a state that it will not transition
168
+ # out of, preventing success.
169
+ #
170
+ # yet successful.
171
+ #
172
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
173
+ # while polling for a resource that is not expected.
174
+ #
175
+ # @raise [NotImplementedError] Raised when the resource does not
176
+ #
177
+ # @option options [Integer] :max_attempts (10) Maximum number of
178
+ # attempts
179
+ # @option options [Integer] :delay (10) Delay between each
180
+ # attempt in seconds
181
+ # @option options [Proc] :before_attempt (nil) Callback
182
+ # invoked before each attempt
183
+ # @option options [Proc] :before_wait (nil) Callback
184
+ # invoked before each wait
185
+ # @return [Resource] if the waiter was successful
186
+ def wait_until(options = {}, &block)
187
+ self_copy = self.dup
188
+ attempts = 0
189
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
190
+ options[:delay] ||= 10
191
+ options[:poller] = Proc.new do
192
+ attempts += 1
193
+ if block.call(self_copy)
194
+ [:success, self_copy]
195
+ else
196
+ self_copy.reload unless attempts == options[:max_attempts]
197
+ :retry
198
+ end
199
+ end
200
+ Aws::Waiters::Waiter.new(options).wait({})
201
+ end
202
+
108
203
  # @!group Actions
109
204
 
110
205
  # @example Request syntax with placeholder values
@@ -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 role. 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 role_id
54
- data.role_id
54
+ data[:role_id]
55
55
  end
56
56
 
57
57
  # The Amazon Resource Name (ARN) specifying the role. 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 role
@@ -74,19 +74,19 @@ 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
  # The policy that grants an entity permission to assume the role.
81
81
  # @return [String]
82
82
  def assume_role_policy_document
83
- data.assume_role_policy_document
83
+ data[:assume_role_policy_document]
84
84
  end
85
85
 
86
86
  # A description of the role that you provide.
87
87
  # @return [String]
88
88
  def description
89
- data.description
89
+ data[:description]
90
90
  end
91
91
 
92
92
  # @!endgroup
@@ -124,6 +124,101 @@ module Aws::IAM
124
124
  !!@data
125
125
  end
126
126
 
127
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
128
+ #
129
+ # Waiter polls an API operation until a resource enters a desired
130
+ # state.
131
+ #
132
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
133
+ #
134
+ # ## Basic Usage
135
+ #
136
+ # Waiter will polls until it is successful, it fails by
137
+ # entering a terminal state, or until a maximum number of attempts
138
+ # are made.
139
+ #
140
+ # # polls in a loop until condition is true
141
+ # resource.wait_until(options) {|resource| condition}
142
+ #
143
+ # ## Example
144
+ #
145
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
146
+ #
147
+ # ## Configuration
148
+ #
149
+ # You can configure the maximum number of polling attempts, and the
150
+ # delay (in seconds) between each polling attempt. The waiting condition is set
151
+ # by passing a block to {#wait_until}:
152
+ #
153
+ # # poll for ~25 seconds
154
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
155
+ #
156
+ # ## Callbacks
157
+ #
158
+ # You can be notified before each polling attempt and before each
159
+ # delay. If you throw `:success` or `:failure` from these callbacks,
160
+ # it will terminate the waiter.
161
+ #
162
+ # started_at = Time.now
163
+ # # poll for 1 hour, instead of a number of attempts
164
+ # proc = Proc.new do |attempts, response|
165
+ # throw :failure if Time.now - started_at > 3600
166
+ # end
167
+ #
168
+ # # disable max attempts
169
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
170
+ #
171
+ # ## Handling Errors
172
+ #
173
+ # When a waiter is successful, it returns the Resource. When a waiter
174
+ # fails, it raises an error.
175
+ #
176
+ # begin
177
+ # resource.wait_until(...)
178
+ # rescue Aws::Waiters::Errors::WaiterFailed
179
+ # # resource did not enter the desired state in time
180
+ # end
181
+ #
182
+ #
183
+ # @yield param [Resource] resource to be used in the waiting condition
184
+ #
185
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
186
+ # because the waiter has entered a state that it will not transition
187
+ # out of, preventing success.
188
+ #
189
+ # yet successful.
190
+ #
191
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
192
+ # while polling for a resource that is not expected.
193
+ #
194
+ # @raise [NotImplementedError] Raised when the resource does not
195
+ #
196
+ # @option options [Integer] :max_attempts (10) Maximum number of
197
+ # attempts
198
+ # @option options [Integer] :delay (10) Delay between each
199
+ # attempt in seconds
200
+ # @option options [Proc] :before_attempt (nil) Callback
201
+ # invoked before each attempt
202
+ # @option options [Proc] :before_wait (nil) Callback
203
+ # invoked before each wait
204
+ # @return [Resource] if the waiter was successful
205
+ def wait_until(options = {}, &block)
206
+ self_copy = self.dup
207
+ attempts = 0
208
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
209
+ options[:delay] ||= 10
210
+ options[:poller] = Proc.new do
211
+ attempts += 1
212
+ if block.call(self_copy)
213
+ [:success, self_copy]
214
+ else
215
+ self_copy.reload unless attempts == options[:max_attempts]
216
+ :retry
217
+ end
218
+ end
219
+ Aws::Waiters::Waiter.new(options).wait({})
220
+ end
221
+
127
222
  # @!group Actions
128
223
 
129
224
  # @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
@@ -34,19 +34,19 @@ module Aws::IAM
34
34
  # provider.
35
35
  # @return [String]
36
36
  def saml_metadata_document
37
- data.saml_metadata_document
37
+ data[:saml_metadata_document]
38
38
  end
39
39
 
40
40
  # The date and time when the SAML provider was created.
41
41
  # @return [Time]
42
42
  def create_date
43
- data.create_date
43
+ data[:create_date]
44
44
  end
45
45
 
46
46
  # The expiration date and time for the SAML provider.
47
47
  # @return [Time]
48
48
  def valid_until
49
- data.valid_until
49
+ data[:valid_until]
50
50
  end
51
51
 
52
52
  # @!endgroup
@@ -84,6 +84,101 @@ module Aws::IAM
84
84
  !!@data
85
85
  end
86
86
 
87
+ # @deprecated Use [Aws::IAM::Client] #wait_until instead
88
+ #
89
+ # Waiter polls an API operation until a resource enters a desired
90
+ # state.
91
+ #
92
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
93
+ #
94
+ # ## Basic Usage
95
+ #
96
+ # Waiter will polls until it is successful, it fails by
97
+ # entering a terminal state, or until a maximum number of attempts
98
+ # are made.
99
+ #
100
+ # # polls in a loop until condition is true
101
+ # resource.wait_until(options) {|resource| condition}
102
+ #
103
+ # ## Example
104
+ #
105
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
106
+ #
107
+ # ## Configuration
108
+ #
109
+ # You can configure the maximum number of polling attempts, and the
110
+ # delay (in seconds) between each polling attempt. The waiting condition is set
111
+ # by passing a block to {#wait_until}:
112
+ #
113
+ # # poll for ~25 seconds
114
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
115
+ #
116
+ # ## Callbacks
117
+ #
118
+ # You can be notified before each polling attempt and before each
119
+ # delay. If you throw `:success` or `:failure` from these callbacks,
120
+ # it will terminate the waiter.
121
+ #
122
+ # started_at = Time.now
123
+ # # poll for 1 hour, instead of a number of attempts
124
+ # proc = Proc.new do |attempts, response|
125
+ # throw :failure if Time.now - started_at > 3600
126
+ # end
127
+ #
128
+ # # disable max attempts
129
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
130
+ #
131
+ # ## Handling Errors
132
+ #
133
+ # When a waiter is successful, it returns the Resource. When a waiter
134
+ # fails, it raises an error.
135
+ #
136
+ # begin
137
+ # resource.wait_until(...)
138
+ # rescue Aws::Waiters::Errors::WaiterFailed
139
+ # # resource did not enter the desired state in time
140
+ # end
141
+ #
142
+ #
143
+ # @yield param [Resource] resource to be used in the waiting condition
144
+ #
145
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
146
+ # because the waiter has entered a state that it will not transition
147
+ # out of, preventing success.
148
+ #
149
+ # yet successful.
150
+ #
151
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
152
+ # while polling for a resource that is not expected.
153
+ #
154
+ # @raise [NotImplementedError] Raised when the resource does not
155
+ #
156
+ # @option options [Integer] :max_attempts (10) Maximum number of
157
+ # attempts
158
+ # @option options [Integer] :delay (10) Delay between each
159
+ # attempt in seconds
160
+ # @option options [Proc] :before_attempt (nil) Callback
161
+ # invoked before each attempt
162
+ # @option options [Proc] :before_wait (nil) Callback
163
+ # invoked before each wait
164
+ # @return [Resource] if the waiter was successful
165
+ def wait_until(options = {}, &block)
166
+ self_copy = self.dup
167
+ attempts = 0
168
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
169
+ options[:delay] ||= 10
170
+ options[:poller] = Proc.new do
171
+ attempts += 1
172
+ if block.call(self_copy)
173
+ [:success, self_copy]
174
+ else
175
+ self_copy.reload unless attempts == options[:max_attempts]
176
+ :retry
177
+ end
178
+ end
179
+ Aws::Waiters::Waiter.new(options).wait({})
180
+ end
181
+
87
182
  # @!group Actions
88
183
 
89
184
  # @example Request syntax with placeholder values