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.
@@ -34,85 +34,85 @@ module Aws::RDS
34
34
  # The offering identifier.
35
35
  # @return [String]
36
36
  def reserved_db_instances_offering_id
37
- data.reserved_db_instances_offering_id
37
+ data[:reserved_db_instances_offering_id]
38
38
  end
39
39
 
40
40
  # The DB instance class for the reserved DB instance.
41
41
  # @return [String]
42
42
  def db_instance_class
43
- data.db_instance_class
43
+ data[:db_instance_class]
44
44
  end
45
45
 
46
46
  # The time the reservation started.
47
47
  # @return [Time]
48
48
  def start_time
49
- data.start_time
49
+ data[:start_time]
50
50
  end
51
51
 
52
52
  # The duration of the reservation in seconds.
53
53
  # @return [Integer]
54
54
  def duration
55
- data.duration
55
+ data[:duration]
56
56
  end
57
57
 
58
58
  # The fixed price charged for this reserved DB instance.
59
59
  # @return [Float]
60
60
  def fixed_price
61
- data.fixed_price
61
+ data[:fixed_price]
62
62
  end
63
63
 
64
64
  # The hourly price charged for this reserved DB instance.
65
65
  # @return [Float]
66
66
  def usage_price
67
- data.usage_price
67
+ data[:usage_price]
68
68
  end
69
69
 
70
70
  # The currency code for the reserved DB instance.
71
71
  # @return [String]
72
72
  def currency_code
73
- data.currency_code
73
+ data[:currency_code]
74
74
  end
75
75
 
76
76
  # The number of reserved DB instances.
77
77
  # @return [Integer]
78
78
  def db_instance_count
79
- data.db_instance_count
79
+ data[:db_instance_count]
80
80
  end
81
81
 
82
82
  # The description of the reserved DB instance.
83
83
  # @return [String]
84
84
  def product_description
85
- data.product_description
85
+ data[:product_description]
86
86
  end
87
87
 
88
88
  # The offering type of this reserved DB instance.
89
89
  # @return [String]
90
90
  def offering_type
91
- data.offering_type
91
+ data[:offering_type]
92
92
  end
93
93
 
94
94
  # Indicates if the reservation applies to Multi-AZ deployments.
95
95
  # @return [Boolean]
96
96
  def multi_az
97
- data.multi_az
97
+ data[:multi_az]
98
98
  end
99
99
 
100
100
  # The state of the reserved DB instance.
101
101
  # @return [String]
102
102
  def state
103
- data.state
103
+ data[:state]
104
104
  end
105
105
 
106
106
  # The recurring price charged to run this reserved DB instance.
107
107
  # @return [Array<Types::RecurringCharge>]
108
108
  def recurring_charges
109
- data.recurring_charges
109
+ data[:recurring_charges]
110
110
  end
111
111
 
112
112
  # The Amazon Resource Name (ARN) for the reserved DB instance.
113
113
  # @return [String]
114
114
  def reserved_db_instance_arn
115
- data.reserved_db_instance_arn
115
+ data[:reserved_db_instance_arn]
116
116
  end
117
117
 
118
118
  # @!endgroup
@@ -150,13 +150,108 @@ module Aws::RDS
150
150
  !!@data
151
151
  end
152
152
 
153
+ # @deprecated Use [Aws::RDS::Client] #wait_until instead
154
+ #
155
+ # Waiter polls an API operation until a resource enters a desired
156
+ # state.
157
+ #
158
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
159
+ #
160
+ # ## Basic Usage
161
+ #
162
+ # Waiter will polls until it is successful, it fails by
163
+ # entering a terminal state, or until a maximum number of attempts
164
+ # are made.
165
+ #
166
+ # # polls in a loop until condition is true
167
+ # resource.wait_until(options) {|resource| condition}
168
+ #
169
+ # ## Example
170
+ #
171
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
172
+ #
173
+ # ## Configuration
174
+ #
175
+ # You can configure the maximum number of polling attempts, and the
176
+ # delay (in seconds) between each polling attempt. The waiting condition is set
177
+ # by passing a block to {#wait_until}:
178
+ #
179
+ # # poll for ~25 seconds
180
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
181
+ #
182
+ # ## Callbacks
183
+ #
184
+ # You can be notified before each polling attempt and before each
185
+ # delay. If you throw `:success` or `:failure` from these callbacks,
186
+ # it will terminate the waiter.
187
+ #
188
+ # started_at = Time.now
189
+ # # poll for 1 hour, instead of a number of attempts
190
+ # proc = Proc.new do |attempts, response|
191
+ # throw :failure if Time.now - started_at > 3600
192
+ # end
193
+ #
194
+ # # disable max attempts
195
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
196
+ #
197
+ # ## Handling Errors
198
+ #
199
+ # When a waiter is successful, it returns the Resource. When a waiter
200
+ # fails, it raises an error.
201
+ #
202
+ # begin
203
+ # resource.wait_until(...)
204
+ # rescue Aws::Waiters::Errors::WaiterFailed
205
+ # # resource did not enter the desired state in time
206
+ # end
207
+ #
208
+ #
209
+ # @yield param [Resource] resource to be used in the waiting condition
210
+ #
211
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
212
+ # because the waiter has entered a state that it will not transition
213
+ # out of, preventing success.
214
+ #
215
+ # yet successful.
216
+ #
217
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
218
+ # while polling for a resource that is not expected.
219
+ #
220
+ # @raise [NotImplementedError] Raised when the resource does not
221
+ #
222
+ # @option options [Integer] :max_attempts (10) Maximum number of
223
+ # attempts
224
+ # @option options [Integer] :delay (10) Delay between each
225
+ # attempt in seconds
226
+ # @option options [Proc] :before_attempt (nil) Callback
227
+ # invoked before each attempt
228
+ # @option options [Proc] :before_wait (nil) Callback
229
+ # invoked before each wait
230
+ # @return [Resource] if the waiter was successful
231
+ def wait_until(options = {}, &block)
232
+ self_copy = self.dup
233
+ attempts = 0
234
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
235
+ options[:delay] ||= 10
236
+ options[:poller] = Proc.new do
237
+ attempts += 1
238
+ if block.call(self_copy)
239
+ [:success, self_copy]
240
+ else
241
+ self_copy.reload unless attempts == options[:max_attempts]
242
+ :retry
243
+ end
244
+ end
245
+ Aws::Waiters::Waiter.new(options).wait({})
246
+ end
247
+
153
248
  # @!group Associations
154
249
 
155
250
  # @return [ReservedDBInstancesOffering, nil]
156
251
  def offering
157
- if data.reserved_db_instances_offering_id
252
+ if data[:reserved_db_instances_offering_id]
158
253
  ReservedDBInstancesOffering.new(
159
- id: data.reserved_db_instances_offering_id,
254
+ id: data[:reserved_db_instances_offering_id],
160
255
  client: @client
161
256
  )
162
257
  else
@@ -34,55 +34,55 @@ module Aws::RDS
34
34
  # The DB instance class for the reserved DB instance.
35
35
  # @return [String]
36
36
  def db_instance_class
37
- data.db_instance_class
37
+ data[:db_instance_class]
38
38
  end
39
39
 
40
40
  # The duration of the offering in seconds.
41
41
  # @return [Integer]
42
42
  def duration
43
- data.duration
43
+ data[:duration]
44
44
  end
45
45
 
46
46
  # The fixed price charged for this offering.
47
47
  # @return [Float]
48
48
  def fixed_price
49
- data.fixed_price
49
+ data[:fixed_price]
50
50
  end
51
51
 
52
52
  # The hourly price charged for this offering.
53
53
  # @return [Float]
54
54
  def usage_price
55
- data.usage_price
55
+ data[:usage_price]
56
56
  end
57
57
 
58
58
  # The currency code for the reserved DB instance offering.
59
59
  # @return [String]
60
60
  def currency_code
61
- data.currency_code
61
+ data[:currency_code]
62
62
  end
63
63
 
64
64
  # The database engine used by the offering.
65
65
  # @return [String]
66
66
  def product_description
67
- data.product_description
67
+ data[:product_description]
68
68
  end
69
69
 
70
70
  # The offering type.
71
71
  # @return [String]
72
72
  def offering_type
73
- data.offering_type
73
+ data[:offering_type]
74
74
  end
75
75
 
76
76
  # Indicates if the offering applies to Multi-AZ deployments.
77
77
  # @return [Boolean]
78
78
  def multi_az
79
- data.multi_az
79
+ data[:multi_az]
80
80
  end
81
81
 
82
82
  # The recurring price charged to run this reserved DB instance.
83
83
  # @return [Array<Types::RecurringCharge>]
84
84
  def recurring_charges
85
- data.recurring_charges
85
+ data[:recurring_charges]
86
86
  end
87
87
 
88
88
  # @!endgroup
@@ -120,6 +120,101 @@ module Aws::RDS
120
120
  !!@data
121
121
  end
122
122
 
123
+ # @deprecated Use [Aws::RDS::Client] #wait_until instead
124
+ #
125
+ # Waiter polls an API operation until a resource enters a desired
126
+ # state.
127
+ #
128
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
129
+ #
130
+ # ## Basic Usage
131
+ #
132
+ # Waiter will polls until it is successful, it fails by
133
+ # entering a terminal state, or until a maximum number of attempts
134
+ # are made.
135
+ #
136
+ # # polls in a loop until condition is true
137
+ # resource.wait_until(options) {|resource| condition}
138
+ #
139
+ # ## Example
140
+ #
141
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
142
+ #
143
+ # ## Configuration
144
+ #
145
+ # You can configure the maximum number of polling attempts, and the
146
+ # delay (in seconds) between each polling attempt. The waiting condition is set
147
+ # by passing a block to {#wait_until}:
148
+ #
149
+ # # poll for ~25 seconds
150
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
151
+ #
152
+ # ## Callbacks
153
+ #
154
+ # You can be notified before each polling attempt and before each
155
+ # delay. If you throw `:success` or `:failure` from these callbacks,
156
+ # it will terminate the waiter.
157
+ #
158
+ # started_at = Time.now
159
+ # # poll for 1 hour, instead of a number of attempts
160
+ # proc = Proc.new do |attempts, response|
161
+ # throw :failure if Time.now - started_at > 3600
162
+ # end
163
+ #
164
+ # # disable max attempts
165
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
166
+ #
167
+ # ## Handling Errors
168
+ #
169
+ # When a waiter is successful, it returns the Resource. When a waiter
170
+ # fails, it raises an error.
171
+ #
172
+ # begin
173
+ # resource.wait_until(...)
174
+ # rescue Aws::Waiters::Errors::WaiterFailed
175
+ # # resource did not enter the desired state in time
176
+ # end
177
+ #
178
+ #
179
+ # @yield param [Resource] resource to be used in the waiting condition
180
+ #
181
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
182
+ # because the waiter has entered a state that it will not transition
183
+ # out of, preventing success.
184
+ #
185
+ # yet successful.
186
+ #
187
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
188
+ # while polling for a resource that is not expected.
189
+ #
190
+ # @raise [NotImplementedError] Raised when the resource does not
191
+ #
192
+ # @option options [Integer] :max_attempts (10) Maximum number of
193
+ # attempts
194
+ # @option options [Integer] :delay (10) Delay between each
195
+ # attempt in seconds
196
+ # @option options [Proc] :before_attempt (nil) Callback
197
+ # invoked before each attempt
198
+ # @option options [Proc] :before_wait (nil) Callback
199
+ # invoked before each wait
200
+ # @return [Resource] if the waiter was successful
201
+ def wait_until(options = {}, &block)
202
+ self_copy = self.dup
203
+ attempts = 0
204
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
205
+ options[:delay] ||= 10
206
+ options[:poller] = Proc.new do
207
+ attempts += 1
208
+ if block.call(self_copy)
209
+ [:success, self_copy]
210
+ else
211
+ self_copy.reload unless attempts == options[:max_attempts]
212
+ :retry
213
+ end
214
+ end
215
+ Aws::Waiters::Waiter.new(options).wait({})
216
+ end
217
+
123
218
  # @!group Actions
124
219
 
125
220
  # @example Request syntax with placeholder values
@@ -35,7 +35,7 @@ module Aws::RDS
35
35
  # the resource.
36
36
  # @return [Array<Types::PendingMaintenanceAction>]
37
37
  def pending_maintenance_action_details
38
- data.pending_maintenance_action_details
38
+ data[:pending_maintenance_action_details]
39
39
  end
40
40
 
41
41
  # @!endgroup
@@ -68,16 +68,111 @@ module Aws::RDS
68
68
  !!@data
69
69
  end
70
70
 
71
+ # @deprecated Use [Aws::RDS::Client] #wait_until instead
72
+ #
73
+ # Waiter polls an API operation until a resource enters a desired
74
+ # state.
75
+ #
76
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
77
+ #
78
+ # ## Basic Usage
79
+ #
80
+ # Waiter will polls until it is successful, it fails by
81
+ # entering a terminal state, or until a maximum number of attempts
82
+ # are made.
83
+ #
84
+ # # polls in a loop until condition is true
85
+ # resource.wait_until(options) {|resource| condition}
86
+ #
87
+ # ## Example
88
+ #
89
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
90
+ #
91
+ # ## Configuration
92
+ #
93
+ # You can configure the maximum number of polling attempts, and the
94
+ # delay (in seconds) between each polling attempt. The waiting condition is set
95
+ # by passing a block to {#wait_until}:
96
+ #
97
+ # # poll for ~25 seconds
98
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
99
+ #
100
+ # ## Callbacks
101
+ #
102
+ # You can be notified before each polling attempt and before each
103
+ # delay. If you throw `:success` or `:failure` from these callbacks,
104
+ # it will terminate the waiter.
105
+ #
106
+ # started_at = Time.now
107
+ # # poll for 1 hour, instead of a number of attempts
108
+ # proc = Proc.new do |attempts, response|
109
+ # throw :failure if Time.now - started_at > 3600
110
+ # end
111
+ #
112
+ # # disable max attempts
113
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
114
+ #
115
+ # ## Handling Errors
116
+ #
117
+ # When a waiter is successful, it returns the Resource. When a waiter
118
+ # fails, it raises an error.
119
+ #
120
+ # begin
121
+ # resource.wait_until(...)
122
+ # rescue Aws::Waiters::Errors::WaiterFailed
123
+ # # resource did not enter the desired state in time
124
+ # end
125
+ #
126
+ #
127
+ # @yield param [Resource] resource to be used in the waiting condition
128
+ #
129
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
130
+ # because the waiter has entered a state that it will not transition
131
+ # out of, preventing success.
132
+ #
133
+ # yet successful.
134
+ #
135
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
136
+ # while polling for a resource that is not expected.
137
+ #
138
+ # @raise [NotImplementedError] Raised when the resource does not
139
+ #
140
+ # @option options [Integer] :max_attempts (10) Maximum number of
141
+ # attempts
142
+ # @option options [Integer] :delay (10) Delay between each
143
+ # attempt in seconds
144
+ # @option options [Proc] :before_attempt (nil) Callback
145
+ # invoked before each attempt
146
+ # @option options [Proc] :before_wait (nil) Callback
147
+ # invoked before each wait
148
+ # @return [Resource] if the waiter was successful
149
+ def wait_until(options = {}, &block)
150
+ self_copy = self.dup
151
+ attempts = 0
152
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
153
+ options[:delay] ||= 10
154
+ options[:poller] = Proc.new do
155
+ attempts += 1
156
+ if block.call(self_copy)
157
+ [:success, self_copy]
158
+ else
159
+ self_copy.reload unless attempts == options[:max_attempts]
160
+ :retry
161
+ end
162
+ end
163
+ Aws::Waiters::Waiter.new(options).wait({})
164
+ end
165
+
71
166
  # @!group Associations
72
167
 
73
168
  # @return [PendingMaintenanceAction::Collection]
74
169
  def pending_maintenance_actions
75
170
  batch = []
76
- data.pending_maintenance_action_details.each do |p|
171
+ data[:pending_maintenance_action_details].each do |d|
77
172
  batch << PendingMaintenanceAction.new(
78
173
  target_arn: @arn,
79
- name: p.action,
80
- data: p,
174
+ name: d[:action],
175
+ data: d,
81
176
  client: @client
82
177
  )
83
178
  end