Class: Aws::RDS::ReservedDBInstance
- Inherits:
-
Object
- Object
- Aws::RDS::ReservedDBInstance
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-rds/reserved_db_instance.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#currency_code ⇒ String
The currency code for the reserved DB instance.
-
#db_instance_class ⇒ String
The DB instance class for the reserved DB instance.
-
#db_instance_count ⇒ Integer
The number of reserved DB instances.
-
#duration ⇒ Integer
The duration of the reservation in seconds.
-
#fixed_price ⇒ Float
The fixed price charged for this reserved DB instance.
- #id ⇒ String (also: #reserved_db_instance_id)
-
#lease_id ⇒ String
The unique identifier for the lease associated with the reserved DB instance.
-
#multi_az ⇒ Boolean
Indicates whether the reservation applies to Multi-AZ deployments.
-
#offering_type ⇒ String
The offering type of this reserved DB instance.
-
#product_description ⇒ String
The description of the reserved DB instance.
-
#recurring_charges ⇒ Array<Types::RecurringCharge>
The recurring price charged to run this reserved DB instance.
-
#reserved_db_instance_arn ⇒ String
The Amazon Resource Name (ARN) for the reserved DB instance.
-
#reserved_db_instances_offering_id ⇒ String
The offering identifier.
-
#start_time ⇒ Time
The time the reservation started.
-
#state ⇒ String
The state of the reserved DB instance.
-
#usage_price ⇒ Float
The hourly price charged for this reserved DB instance.
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #offering ⇒ ReservedDBInstancesOffering?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::ReservedDBInstance
Returns the data for this ReservedDBInstance.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ ReservedDBInstance
constructor
A new instance of ReservedDBInstance.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current ReservedDBInstance.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::RDS::Client] #wait_until instead
Constructor Details
#initialize(id, options = {}) ⇒ ReservedDBInstance #initialize(options = {}) ⇒ ReservedDBInstance
Returns a new instance of ReservedDBInstance.
22 23 24 25 26 27 28 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 22 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#client ⇒ Client
137 138 139 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 137 def client @client end |
#currency_code ⇒ String
The currency code for the reserved DB instance.
76 77 78 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 76 def currency_code data[:currency_code] end |
#data ⇒ Types::ReservedDBInstance
Returns the data for this Aws::RDS::ReservedDBInstance. Calls Client#describe_reserved_db_instances if #data_loaded? is ‘false`.
159 160 161 162 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 159 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
167 168 169 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 167 def data_loaded? !!@data end |
#db_instance_class ⇒ String
The DB instance class for the reserved DB instance.
46 47 48 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 46 def db_instance_class data[:db_instance_class] end |
#db_instance_count ⇒ Integer
The number of reserved DB instances.
82 83 84 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 82 def db_instance_count data[:db_instance_count] end |
#duration ⇒ Integer
The duration of the reservation in seconds.
58 59 60 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 58 def duration data[:duration] end |
#fixed_price ⇒ Float
The fixed price charged for this reserved DB instance.
64 65 66 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 64 def fixed_price data[:fixed_price] end |
#id ⇒ String Also known as: reserved_db_instance_id
33 34 35 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 33 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
286 287 288 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 286 def identifiers { id: @id } end |
#lease_id ⇒ String
The unique identifier for the lease associated with the reserved DB instance.
<note markdown=“1”> Amazon Web Services Support might request the lease ID for an issue related to a reserved DB instance.
</note>
130 131 132 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 130 def lease_id data[:lease_id] end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::RDS::ReservedDBInstance. Returns ‘self` making it possible to chain methods.
reserved_db_instance.reload.data
147 148 149 150 151 152 153 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 147 def load resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_reserved_db_instances(reserved_db_instance_id: @id) end @data = resp.reserved_db_instances[0] self end |
#multi_az ⇒ Boolean
Indicates whether the reservation applies to Multi-AZ deployments.
100 101 102 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 100 def multi_az data[:multi_az] end |
#offering ⇒ ReservedDBInstancesOffering?
273 274 275 276 277 278 279 280 281 282 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 273 def offering if data[:reserved_db_instances_offering_id] ReservedDBInstancesOffering.new( id: data[:reserved_db_instances_offering_id], client: @client ) else nil end end |
#offering_type ⇒ String
The offering type of this reserved DB instance.
94 95 96 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 94 def offering_type data[:offering_type] end |
#product_description ⇒ String
The description of the reserved DB instance.
88 89 90 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 88 def product_description data[:product_description] end |
#recurring_charges ⇒ Array<Types::RecurringCharge>
The recurring price charged to run this reserved DB instance.
112 113 114 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 112 def recurring_charges data[:recurring_charges] end |
#reserved_db_instance_arn ⇒ String
The Amazon Resource Name (ARN) for the reserved DB instance.
118 119 120 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 118 def reserved_db_instance_arn data[:reserved_db_instance_arn] end |
#reserved_db_instances_offering_id ⇒ String
The offering identifier.
40 41 42 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 40 def reserved_db_instances_offering_id data[:reserved_db_instances_offering_id] end |
#start_time ⇒ Time
The time the reservation started.
52 53 54 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 52 def start_time data[:start_time] end |
#state ⇒ String
The state of the reserved DB instance.
106 107 108 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 106 def state data[:state] end |
#usage_price ⇒ Float
The hourly price charged for this reserved DB instance.
70 71 72 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 70 def usage_price data[:usage_price] end |
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::RDS::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
## Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
## Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
## Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
## Callbacks
You can be notified before each polling attempt and before each delay. If you throw ‘:success` or `:failure` from these callbacks, it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
## Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/aws-sdk-rds/reserved_db_instance.rb', line 251 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |