aws-sdk-rds 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-rds.rb +1 -1
- data/lib/aws-sdk-rds/account_quota.rb +97 -2
- data/lib/aws-sdk-rds/certificate.rb +100 -5
- data/lib/aws-sdk-rds/client.rb +1 -1
- data/lib/aws-sdk-rds/db_cluster.rb +137 -42
- data/lib/aws-sdk-rds/db_cluster_parameter_group.rb +98 -3
- data/lib/aws-sdk-rds/db_cluster_snapshot.rb +113 -18
- data/lib/aws-sdk-rds/db_engine.rb +95 -0
- data/lib/aws-sdk-rds/db_engine_version.rb +104 -9
- data/lib/aws-sdk-rds/db_instance.rb +159 -64
- data/lib/aws-sdk-rds/db_log_file.rb +97 -2
- data/lib/aws-sdk-rds/db_parameter_group.rb +98 -3
- data/lib/aws-sdk-rds/db_parameter_group_family.rb +95 -0
- data/lib/aws-sdk-rds/db_security_group.rb +101 -6
- data/lib/aws-sdk-rds/db_snapshot.rb +121 -26
- data/lib/aws-sdk-rds/db_snapshot_attribute.rb +96 -1
- data/lib/aws-sdk-rds/db_subnet_group.rb +100 -5
- data/lib/aws-sdk-rds/event.rb +99 -4
- data/lib/aws-sdk-rds/event_category_map.rb +96 -1
- data/lib/aws-sdk-rds/event_subscription.rb +104 -9
- data/lib/aws-sdk-rds/option_group.rb +102 -7
- data/lib/aws-sdk-rds/option_group_option.rb +110 -15
- data/lib/aws-sdk-rds/parameter.rb +104 -9
- data/lib/aws-sdk-rds/pending_maintenance_action.rb +100 -5
- data/lib/aws-sdk-rds/reserved_db_instance.rb +111 -16
- data/lib/aws-sdk-rds/reserved_db_instances_offering.rb +104 -9
- data/lib/aws-sdk-rds/resource_pending_maintenance_action_list.rb +99 -4
- metadata +2 -2
data/lib/aws-sdk-rds/event.rb
CHANGED
@@ -42,25 +42,25 @@ module Aws::RDS
|
|
42
42
|
# Specifies the source type for this event.
|
43
43
|
# @return [String]
|
44
44
|
def source_type
|
45
|
-
data
|
45
|
+
data[:source_type]
|
46
46
|
end
|
47
47
|
|
48
48
|
# Provides the text of this event.
|
49
49
|
# @return [String]
|
50
50
|
def message
|
51
|
-
data
|
51
|
+
data[:message]
|
52
52
|
end
|
53
53
|
|
54
54
|
# Specifies the category for the event.
|
55
55
|
# @return [Array<String>]
|
56
56
|
def event_categories
|
57
|
-
data
|
57
|
+
data[:event_categories]
|
58
58
|
end
|
59
59
|
|
60
60
|
# The Amazon Resource Name (ARN) for the event.
|
61
61
|
# @return [String]
|
62
62
|
def source_arn
|
63
|
-
data
|
63
|
+
data[:source_arn]
|
64
64
|
end
|
65
65
|
|
66
66
|
# @!endgroup
|
@@ -93,6 +93,101 @@ module Aws::RDS
|
|
93
93
|
!!@data
|
94
94
|
end
|
95
95
|
|
96
|
+
# @deprecated Use [Aws::RDS::Client] #wait_until instead
|
97
|
+
#
|
98
|
+
# Waiter polls an API operation until a resource enters a desired
|
99
|
+
# state.
|
100
|
+
#
|
101
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
102
|
+
#
|
103
|
+
# ## Basic Usage
|
104
|
+
#
|
105
|
+
# Waiter will polls until it is successful, it fails by
|
106
|
+
# entering a terminal state, or until a maximum number of attempts
|
107
|
+
# are made.
|
108
|
+
#
|
109
|
+
# # polls in a loop until condition is true
|
110
|
+
# resource.wait_until(options) {|resource| condition}
|
111
|
+
#
|
112
|
+
# ## Example
|
113
|
+
#
|
114
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
115
|
+
#
|
116
|
+
# ## Configuration
|
117
|
+
#
|
118
|
+
# You can configure the maximum number of polling attempts, and the
|
119
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
120
|
+
# by passing a block to {#wait_until}:
|
121
|
+
#
|
122
|
+
# # poll for ~25 seconds
|
123
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
124
|
+
#
|
125
|
+
# ## Callbacks
|
126
|
+
#
|
127
|
+
# You can be notified before each polling attempt and before each
|
128
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
129
|
+
# it will terminate the waiter.
|
130
|
+
#
|
131
|
+
# started_at = Time.now
|
132
|
+
# # poll for 1 hour, instead of a number of attempts
|
133
|
+
# proc = Proc.new do |attempts, response|
|
134
|
+
# throw :failure if Time.now - started_at > 3600
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# # disable max attempts
|
138
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
139
|
+
#
|
140
|
+
# ## Handling Errors
|
141
|
+
#
|
142
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
143
|
+
# fails, it raises an error.
|
144
|
+
#
|
145
|
+
# begin
|
146
|
+
# resource.wait_until(...)
|
147
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
148
|
+
# # resource did not enter the desired state in time
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
#
|
152
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
153
|
+
#
|
154
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
155
|
+
# because the waiter has entered a state that it will not transition
|
156
|
+
# out of, preventing success.
|
157
|
+
#
|
158
|
+
# yet successful.
|
159
|
+
#
|
160
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
161
|
+
# while polling for a resource that is not expected.
|
162
|
+
#
|
163
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
164
|
+
#
|
165
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
166
|
+
# attempts
|
167
|
+
# @option options [Integer] :delay (10) Delay between each
|
168
|
+
# attempt in seconds
|
169
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
170
|
+
# invoked before each attempt
|
171
|
+
# @option options [Proc] :before_wait (nil) Callback
|
172
|
+
# invoked before each wait
|
173
|
+
# @return [Resource] if the waiter was successful
|
174
|
+
def wait_until(options = {}, &block)
|
175
|
+
self_copy = self.dup
|
176
|
+
attempts = 0
|
177
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
178
|
+
options[:delay] ||= 10
|
179
|
+
options[:poller] = Proc.new do
|
180
|
+
attempts += 1
|
181
|
+
if block.call(self_copy)
|
182
|
+
[:success, self_copy]
|
183
|
+
else
|
184
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
185
|
+
:retry
|
186
|
+
end
|
187
|
+
end
|
188
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
189
|
+
end
|
190
|
+
|
96
191
|
# @deprecated
|
97
192
|
# @api private
|
98
193
|
def identifiers
|
@@ -33,7 +33,7 @@ module Aws::RDS
|
|
33
33
|
# The event categories for the specified source type
|
34
34
|
# @return [Array<String>]
|
35
35
|
def event_categories
|
36
|
-
data
|
36
|
+
data[:event_categories]
|
37
37
|
end
|
38
38
|
|
39
39
|
# @!endgroup
|
@@ -71,6 +71,101 @@ module Aws::RDS
|
|
71
71
|
!!@data
|
72
72
|
end
|
73
73
|
|
74
|
+
# @deprecated Use [Aws::RDS::Client] #wait_until instead
|
75
|
+
#
|
76
|
+
# Waiter polls an API operation until a resource enters a desired
|
77
|
+
# state.
|
78
|
+
#
|
79
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
80
|
+
#
|
81
|
+
# ## Basic Usage
|
82
|
+
#
|
83
|
+
# Waiter will polls until it is successful, it fails by
|
84
|
+
# entering a terminal state, or until a maximum number of attempts
|
85
|
+
# are made.
|
86
|
+
#
|
87
|
+
# # polls in a loop until condition is true
|
88
|
+
# resource.wait_until(options) {|resource| condition}
|
89
|
+
#
|
90
|
+
# ## Example
|
91
|
+
#
|
92
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
93
|
+
#
|
94
|
+
# ## Configuration
|
95
|
+
#
|
96
|
+
# You can configure the maximum number of polling attempts, and the
|
97
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
98
|
+
# by passing a block to {#wait_until}:
|
99
|
+
#
|
100
|
+
# # poll for ~25 seconds
|
101
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
102
|
+
#
|
103
|
+
# ## Callbacks
|
104
|
+
#
|
105
|
+
# You can be notified before each polling attempt and before each
|
106
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
107
|
+
# it will terminate the waiter.
|
108
|
+
#
|
109
|
+
# started_at = Time.now
|
110
|
+
# # poll for 1 hour, instead of a number of attempts
|
111
|
+
# proc = Proc.new do |attempts, response|
|
112
|
+
# throw :failure if Time.now - started_at > 3600
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# # disable max attempts
|
116
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
117
|
+
#
|
118
|
+
# ## Handling Errors
|
119
|
+
#
|
120
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
121
|
+
# fails, it raises an error.
|
122
|
+
#
|
123
|
+
# begin
|
124
|
+
# resource.wait_until(...)
|
125
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
126
|
+
# # resource did not enter the desired state in time
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
#
|
130
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
131
|
+
#
|
132
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
133
|
+
# because the waiter has entered a state that it will not transition
|
134
|
+
# out of, preventing success.
|
135
|
+
#
|
136
|
+
# yet successful.
|
137
|
+
#
|
138
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
139
|
+
# while polling for a resource that is not expected.
|
140
|
+
#
|
141
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
142
|
+
#
|
143
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
144
|
+
# attempts
|
145
|
+
# @option options [Integer] :delay (10) Delay between each
|
146
|
+
# attempt in seconds
|
147
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
148
|
+
# invoked before each attempt
|
149
|
+
# @option options [Proc] :before_wait (nil) Callback
|
150
|
+
# invoked before each wait
|
151
|
+
# @return [Resource] if the waiter was successful
|
152
|
+
def wait_until(options = {}, &block)
|
153
|
+
self_copy = self.dup
|
154
|
+
attempts = 0
|
155
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
156
|
+
options[:delay] ||= 10
|
157
|
+
options[:poller] = Proc.new do
|
158
|
+
attempts += 1
|
159
|
+
if block.call(self_copy)
|
160
|
+
[:success, self_copy]
|
161
|
+
else
|
162
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
163
|
+
:retry
|
164
|
+
end
|
165
|
+
end
|
166
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
167
|
+
end
|
168
|
+
|
74
169
|
# @deprecated
|
75
170
|
# @api private
|
76
171
|
def identifiers
|
@@ -35,13 +35,13 @@ module Aws::RDS
|
|
35
35
|
# subscription.
|
36
36
|
# @return [String]
|
37
37
|
def customer_aws_id
|
38
|
-
data
|
38
|
+
data[:customer_aws_id]
|
39
39
|
end
|
40
40
|
|
41
41
|
# The topic ARN of the RDS event notification subscription.
|
42
42
|
# @return [String]
|
43
43
|
def sns_topic_arn
|
44
|
-
data
|
44
|
+
data[:sns_topic_arn]
|
45
45
|
end
|
46
46
|
|
47
47
|
# The status of the RDS event notification subscription.
|
@@ -57,45 +57,45 @@ module Aws::RDS
|
|
57
57
|
# created.
|
58
58
|
# @return [String]
|
59
59
|
def status
|
60
|
-
data
|
60
|
+
data[:status]
|
61
61
|
end
|
62
62
|
|
63
63
|
# The time the RDS event notification subscription was created.
|
64
64
|
# @return [String]
|
65
65
|
def subscription_creation_time
|
66
|
-
data
|
66
|
+
data[:subscription_creation_time]
|
67
67
|
end
|
68
68
|
|
69
69
|
# The source type for the RDS event notification subscription.
|
70
70
|
# @return [String]
|
71
71
|
def source_type
|
72
|
-
data
|
72
|
+
data[:source_type]
|
73
73
|
end
|
74
74
|
|
75
75
|
# A list of source IDs for the RDS event notification subscription.
|
76
76
|
# @return [Array<String>]
|
77
77
|
def source_ids_list
|
78
|
-
data
|
78
|
+
data[:source_ids_list]
|
79
79
|
end
|
80
80
|
|
81
81
|
# A list of event categories for the RDS event notification
|
82
82
|
# subscription.
|
83
83
|
# @return [Array<String>]
|
84
84
|
def event_categories_list
|
85
|
-
data
|
85
|
+
data[:event_categories_list]
|
86
86
|
end
|
87
87
|
|
88
88
|
# A Boolean value indicating if the subscription is enabled. True
|
89
89
|
# indicates the subscription is enabled.
|
90
90
|
# @return [Boolean]
|
91
91
|
def enabled
|
92
|
-
data
|
92
|
+
data[:enabled]
|
93
93
|
end
|
94
94
|
|
95
95
|
# The Amazon Resource Name (ARN) for the event subscription.
|
96
96
|
# @return [String]
|
97
97
|
def event_subscription_arn
|
98
|
-
data
|
98
|
+
data[:event_subscription_arn]
|
99
99
|
end
|
100
100
|
|
101
101
|
# @!endgroup
|
@@ -133,6 +133,101 @@ module Aws::RDS
|
|
133
133
|
!!@data
|
134
134
|
end
|
135
135
|
|
136
|
+
# @deprecated Use [Aws::RDS::Client] #wait_until instead
|
137
|
+
#
|
138
|
+
# Waiter polls an API operation until a resource enters a desired
|
139
|
+
# state.
|
140
|
+
#
|
141
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
142
|
+
#
|
143
|
+
# ## Basic Usage
|
144
|
+
#
|
145
|
+
# Waiter will polls until it is successful, it fails by
|
146
|
+
# entering a terminal state, or until a maximum number of attempts
|
147
|
+
# are made.
|
148
|
+
#
|
149
|
+
# # polls in a loop until condition is true
|
150
|
+
# resource.wait_until(options) {|resource| condition}
|
151
|
+
#
|
152
|
+
# ## Example
|
153
|
+
#
|
154
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
155
|
+
#
|
156
|
+
# ## Configuration
|
157
|
+
#
|
158
|
+
# You can configure the maximum number of polling attempts, and the
|
159
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
160
|
+
# by passing a block to {#wait_until}:
|
161
|
+
#
|
162
|
+
# # poll for ~25 seconds
|
163
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
164
|
+
#
|
165
|
+
# ## Callbacks
|
166
|
+
#
|
167
|
+
# You can be notified before each polling attempt and before each
|
168
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
169
|
+
# it will terminate the waiter.
|
170
|
+
#
|
171
|
+
# started_at = Time.now
|
172
|
+
# # poll for 1 hour, instead of a number of attempts
|
173
|
+
# proc = Proc.new do |attempts, response|
|
174
|
+
# throw :failure if Time.now - started_at > 3600
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# # disable max attempts
|
178
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
179
|
+
#
|
180
|
+
# ## Handling Errors
|
181
|
+
#
|
182
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
183
|
+
# fails, it raises an error.
|
184
|
+
#
|
185
|
+
# begin
|
186
|
+
# resource.wait_until(...)
|
187
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
188
|
+
# # resource did not enter the desired state in time
|
189
|
+
# end
|
190
|
+
#
|
191
|
+
#
|
192
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
193
|
+
#
|
194
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
195
|
+
# because the waiter has entered a state that it will not transition
|
196
|
+
# out of, preventing success.
|
197
|
+
#
|
198
|
+
# yet successful.
|
199
|
+
#
|
200
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
201
|
+
# while polling for a resource that is not expected.
|
202
|
+
#
|
203
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
204
|
+
#
|
205
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
206
|
+
# attempts
|
207
|
+
# @option options [Integer] :delay (10) Delay between each
|
208
|
+
# attempt in seconds
|
209
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
210
|
+
# invoked before each attempt
|
211
|
+
# @option options [Proc] :before_wait (nil) Callback
|
212
|
+
# invoked before each wait
|
213
|
+
# @return [Resource] if the waiter was successful
|
214
|
+
def wait_until(options = {}, &block)
|
215
|
+
self_copy = self.dup
|
216
|
+
attempts = 0
|
217
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
218
|
+
options[:delay] ||= 10
|
219
|
+
options[:poller] = Proc.new do
|
220
|
+
attempts += 1
|
221
|
+
if block.call(self_copy)
|
222
|
+
[:success, self_copy]
|
223
|
+
else
|
224
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
225
|
+
:retry
|
226
|
+
end
|
227
|
+
end
|
228
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
229
|
+
end
|
230
|
+
|
136
231
|
# @!group Actions
|
137
232
|
|
138
233
|
# @example Request syntax with placeholder values
|
@@ -34,26 +34,26 @@ module Aws::RDS
|
|
34
34
|
# Provides a description of the option group.
|
35
35
|
# @return [String]
|
36
36
|
def option_group_description
|
37
|
-
data
|
37
|
+
data[:option_group_description]
|
38
38
|
end
|
39
39
|
|
40
40
|
# Indicates the name of the engine that this option group can be applied
|
41
41
|
# to.
|
42
42
|
# @return [String]
|
43
43
|
def engine_name
|
44
|
-
data
|
44
|
+
data[:engine_name]
|
45
45
|
end
|
46
46
|
|
47
47
|
# Indicates the major engine version associated with this option group.
|
48
48
|
# @return [String]
|
49
49
|
def major_engine_version
|
50
|
-
data
|
50
|
+
data[:major_engine_version]
|
51
51
|
end
|
52
52
|
|
53
53
|
# Indicates what options are available in the option group.
|
54
54
|
# @return [Array<Types::Option>]
|
55
55
|
def options
|
56
|
-
data
|
56
|
+
data[:options]
|
57
57
|
end
|
58
58
|
|
59
59
|
# Indicates whether this option group can be applied to both VPC and
|
@@ -61,7 +61,7 @@ module Aws::RDS
|
|
61
61
|
# applied to both VPC and non-VPC instances.
|
62
62
|
# @return [Boolean]
|
63
63
|
def allows_vpc_and_non_vpc_instance_memberships
|
64
|
-
data
|
64
|
+
data[:allows_vpc_and_non_vpc_instance_memberships]
|
65
65
|
end
|
66
66
|
|
67
67
|
# If **AllowsVpcAndNonVpcInstanceMemberships** is `false`, this field is
|
@@ -72,13 +72,13 @@ module Aws::RDS
|
|
72
72
|
# by this field.
|
73
73
|
# @return [String]
|
74
74
|
def vpc_id
|
75
|
-
data
|
75
|
+
data[:vpc_id]
|
76
76
|
end
|
77
77
|
|
78
78
|
# The Amazon Resource Name (ARN) for the option group.
|
79
79
|
# @return [String]
|
80
80
|
def option_group_arn
|
81
|
-
data
|
81
|
+
data[:option_group_arn]
|
82
82
|
end
|
83
83
|
|
84
84
|
# @!endgroup
|
@@ -116,6 +116,101 @@ module Aws::RDS
|
|
116
116
|
!!@data
|
117
117
|
end
|
118
118
|
|
119
|
+
# @deprecated Use [Aws::RDS::Client] #wait_until instead
|
120
|
+
#
|
121
|
+
# Waiter polls an API operation until a resource enters a desired
|
122
|
+
# state.
|
123
|
+
#
|
124
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
125
|
+
#
|
126
|
+
# ## Basic Usage
|
127
|
+
#
|
128
|
+
# Waiter will polls until it is successful, it fails by
|
129
|
+
# entering a terminal state, or until a maximum number of attempts
|
130
|
+
# are made.
|
131
|
+
#
|
132
|
+
# # polls in a loop until condition is true
|
133
|
+
# resource.wait_until(options) {|resource| condition}
|
134
|
+
#
|
135
|
+
# ## Example
|
136
|
+
#
|
137
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
138
|
+
#
|
139
|
+
# ## Configuration
|
140
|
+
#
|
141
|
+
# You can configure the maximum number of polling attempts, and the
|
142
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
143
|
+
# by passing a block to {#wait_until}:
|
144
|
+
#
|
145
|
+
# # poll for ~25 seconds
|
146
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
147
|
+
#
|
148
|
+
# ## Callbacks
|
149
|
+
#
|
150
|
+
# You can be notified before each polling attempt and before each
|
151
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
152
|
+
# it will terminate the waiter.
|
153
|
+
#
|
154
|
+
# started_at = Time.now
|
155
|
+
# # poll for 1 hour, instead of a number of attempts
|
156
|
+
# proc = Proc.new do |attempts, response|
|
157
|
+
# throw :failure if Time.now - started_at > 3600
|
158
|
+
# end
|
159
|
+
#
|
160
|
+
# # disable max attempts
|
161
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
162
|
+
#
|
163
|
+
# ## Handling Errors
|
164
|
+
#
|
165
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
166
|
+
# fails, it raises an error.
|
167
|
+
#
|
168
|
+
# begin
|
169
|
+
# resource.wait_until(...)
|
170
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
171
|
+
# # resource did not enter the desired state in time
|
172
|
+
# end
|
173
|
+
#
|
174
|
+
#
|
175
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
176
|
+
#
|
177
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
178
|
+
# because the waiter has entered a state that it will not transition
|
179
|
+
# out of, preventing success.
|
180
|
+
#
|
181
|
+
# yet successful.
|
182
|
+
#
|
183
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
184
|
+
# while polling for a resource that is not expected.
|
185
|
+
#
|
186
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
187
|
+
#
|
188
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
189
|
+
# attempts
|
190
|
+
# @option options [Integer] :delay (10) Delay between each
|
191
|
+
# attempt in seconds
|
192
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
193
|
+
# invoked before each attempt
|
194
|
+
# @option options [Proc] :before_wait (nil) Callback
|
195
|
+
# invoked before each wait
|
196
|
+
# @return [Resource] if the waiter was successful
|
197
|
+
def wait_until(options = {}, &block)
|
198
|
+
self_copy = self.dup
|
199
|
+
attempts = 0
|
200
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
201
|
+
options[:delay] ||= 10
|
202
|
+
options[:poller] = Proc.new do
|
203
|
+
attempts += 1
|
204
|
+
if block.call(self_copy)
|
205
|
+
[:success, self_copy]
|
206
|
+
else
|
207
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
208
|
+
:retry
|
209
|
+
end
|
210
|
+
end
|
211
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
212
|
+
end
|
213
|
+
|
119
214
|
# @!group Actions
|
120
215
|
|
121
216
|
# @example Request syntax with placeholder values
|