Class: Aws::RDS::DBClusterSnapshot
- Inherits:
-
Object
- Object
- Aws::RDS::DBClusterSnapshot
- Defined in:
- gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#allocated_storage ⇒ Integer
Specifies the allocated storage size in gibibytes (GiB).
-
#availability_zones ⇒ Array<String>
Provides the list of Availability Zones (AZs) where instances in the DB cluster snapshot can be restored.
-
#cluster_create_time ⇒ Time
Specifies the time when the DB cluster was created, in Universal Coordinated Time (UTC).
-
#cluster_id ⇒ String
(also: #db_cluster_identifier)
-
#db_cluster_snapshot_arn ⇒ String
The Amazon Resource Name (ARN) for the DB cluster snapshot.
-
#engine ⇒ String
Specifies the name of the database engine for this DB cluster snapshot.
-
#engine_mode ⇒ String
Provides the engine mode of the database engine for this DB cluster snapshot.
-
#engine_version ⇒ String
Provides the version of the database engine for this DB cluster snapshot.
-
#iam_database_authentication_enabled ⇒ Boolean
True if mapping of Amazon Web Services Identity and Access Management (IAM) accounts to database accounts is enabled, and otherwise false.
-
#kms_key_id ⇒ String
If
StorageEncrypted
is true, the Amazon Web Services KMS key identifier for the encrypted DB cluster snapshot. -
#license_model ⇒ String
Provides the license model information for this DB cluster snapshot.
-
#master_username ⇒ String
Provides the master username for this DB cluster snapshot.
-
#percent_progress ⇒ Integer
Specifies the percentage of the estimated data that has been transferred.
-
#port ⇒ Integer
Specifies the port that the DB cluster was listening on at the time of the snapshot.
-
#snapshot_create_time ⇒ Time
Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
-
#snapshot_id ⇒ String
(also: #db_cluster_snapshot_identifier)
-
#snapshot_type ⇒ String
Provides the type of the DB cluster snapshot.
-
#source_db_cluster_snapshot_arn ⇒ String
If the DB cluster snapshot was copied from a source DB cluster snapshot, the Amazon Resource Name (ARN) for the source DB cluster snapshot, otherwise, a null value.
-
#status ⇒ String
Specifies the status of this DB cluster snapshot.
-
#storage_encrypted ⇒ Boolean
Specifies whether the DB cluster snapshot is encrypted.
-
#tag_list ⇒ Array<Types::Tag>
A list of tags.
-
#vpc_id ⇒ String
Provides the VPC ID associated with the DB cluster snapshot.
Actions collapse
-
#copy(options = {}) ⇒ DBClusterSnapshot
-
#create(options = {}) ⇒ DBClusterSnapshot
-
#delete(options = {}) ⇒ DBClusterSnapshot
-
#restore(options = {}) ⇒ DBCluster
Associations collapse
Instance Method Summary collapse
-
#client ⇒ Client
-
#data ⇒ Types::DBClusterSnapshot
Returns the data for this DBClusterSnapshot.
-
#data_loaded? ⇒ Boolean
Returns
true
if this resource is loaded. -
#initialize(*args) ⇒ DBClusterSnapshot
constructor
A new instance of DBClusterSnapshot.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current DBClusterSnapshot.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::RDS::Client] #wait_until instead
Constructor Details
#initialize(cluster_id, snapshot_id, options = {}) ⇒ DBClusterSnapshot #initialize(options = {}) ⇒ DBClusterSnapshot
Returns a new instance of DBClusterSnapshot.
24 25 26 27 28 29 30 31 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 24 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @cluster_id = extract_cluster_id(args, ) @snapshot_id = extract_snapshot_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#allocated_storage ⇒ Integer
Specifies the allocated storage size in gibibytes (GiB).
77 78 79 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 77 def allocated_storage data[:allocated_storage] end |
#availability_zones ⇒ Array<String>
Provides the list of Availability Zones (AZs) where instances in the DB cluster snapshot can be restored.
50 51 52 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 50 def availability_zones data[:availability_zones] end |
#client ⇒ Client
197 198 199 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 197 def client @client end |
#cluster ⇒ DBCluster
924 925 926 927 928 929 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 924 def cluster DBCluster.new( id: @cluster_id, client: @client ) end |
#cluster_create_time ⇒ Time
Specifies the time when the DB cluster was created, in Universal Coordinated Time (UTC).
110 111 112 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 110 def cluster_create_time data[:cluster_create_time] end |
#cluster_id ⇒ String Also known as: db_cluster_identifier
36 37 38 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 36 def cluster_id @cluster_id end |
#copy(options = {}) ⇒ DBClusterSnapshot
477 478 479 480 481 482 483 484 485 486 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 477 def copy( = {}) = .merge(source_db_cluster_snapshot_identifier: @snapshot_id) resp = @client.copy_db_cluster_snapshot() DBClusterSnapshot.new( cluster_id: resp.data.db_cluster_snapshot.db_cluster_identifier, snapshot_id: resp.data.db_cluster_snapshot.db_cluster_snapshot_identifier, data: resp.data.db_cluster_snapshot, client: @client ) end |
#create(options = {}) ⇒ DBClusterSnapshot
342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 342 def create( = {}) = .merge( db_cluster_identifier: @cluster_id, db_cluster_snapshot_identifier: @snapshot_id ) resp = @client.create_db_cluster_snapshot() DBClusterSnapshot.new( cluster_id: resp.data.db_cluster_snapshot.db_cluster_identifier, snapshot_id: resp.data.db_cluster_snapshot.db_cluster_snapshot_identifier, data: resp.data.db_cluster_snapshot, client: @client ) end |
#data ⇒ Types::DBClusterSnapshot
Returns the data for this Aws::RDS::DBClusterSnapshot. Calls
Client#describe_db_cluster_snapshots if #data_loaded? is false
.
217 218 219 220 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 217 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
225 226 227 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 225 def data_loaded? !!@data end |
#db_cluster_snapshot_arn ⇒ String
The Amazon Resource Name (ARN) for the DB cluster snapshot.
164 165 166 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 164 def db_cluster_snapshot_arn data[:db_cluster_snapshot_arn] end |
#delete(options = {}) ⇒ DBClusterSnapshot
493 494 495 496 497 498 499 500 501 502 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 493 def delete( = {}) = .merge(db_cluster_snapshot_identifier: @snapshot_id) resp = @client.delete_db_cluster_snapshot() DBClusterSnapshot.new( cluster_id: resp.data.db_cluster_snapshot.db_cluster_identifier, snapshot_id: resp.data.db_cluster_snapshot.db_cluster_snapshot_identifier, data: resp.data.db_cluster_snapshot, client: @client ) end |
#engine ⇒ String
Specifies the name of the database engine for this DB cluster snapshot.
64 65 66 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 64 def engine data[:engine] end |
#engine_mode ⇒ String
Provides the engine mode of the database engine for this DB cluster snapshot.
71 72 73 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 71 def engine_mode data[:engine_mode] end |
#engine_version ⇒ String
Provides the version of the database engine for this DB cluster snapshot.
123 124 125 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 123 def engine_version data[:engine_version] end |
#events(options = {}) ⇒ Event::Collection
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 976 def events( = {}) batches = Enumerator.new do |y| = .merge( source_type: "db-cluster-snapshot", source_identifier: @snapshot_id ) resp = @client.describe_events() resp.each_page do |page| batch = [] page.data.events.each do |e| batch << Event.new( source_id: e.source_identifier, date: e.date, data: e, client: @client ) end y.yield(batch) end end Event::Collection.new(batches) end |
#iam_database_authentication_enabled ⇒ Boolean
True if mapping of Amazon Web Services Identity and Access Management (IAM) accounts to database accounts is enabled, and otherwise false.
179 180 181 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 179 def iam_database_authentication_enabled data[:iam_database_authentication_enabled] end |
#kms_key_id ⇒ String
If StorageEncrypted
is true, the Amazon Web Services KMS key
identifier for the encrypted DB cluster snapshot.
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
158 159 160 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 158 def kms_key_id data[:kms_key_id] end |
#license_model ⇒ String
Provides the license model information for this DB cluster snapshot.
129 130 131 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 129 def license_model data[:license_model] end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::RDS::DBClusterSnapshot.
Returns self
making it possible to chain methods.
db_cluster_snapshot.reload.data
207 208 209 210 211 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 207 def load resp = @client.describe_db_cluster_snapshots(db_cluster_snapshot_identifier: @snapshot_id) @data = resp.db_cluster_snapshots[0] self end |
#master_username ⇒ String
Provides the master username for this DB cluster snapshot.
116 117 118 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 116 def master_username data[:master_username] end |
#percent_progress ⇒ Integer
Specifies the percentage of the estimated data that has been transferred.
142 143 144 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 142 def percent_progress data[:percent_progress] end |
#port ⇒ Integer
Specifies the port that the DB cluster was listening on at the time of the snapshot.
97 98 99 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 97 def port data[:port] end |
#restore(options = {}) ⇒ DBCluster
911 912 913 914 915 916 917 918 919 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 911 def restore( = {}) = .merge(snapshot_identifier: @snapshot_id) resp = @client.restore_db_cluster_from_snapshot() DBCluster.new( id: resp.data.db_cluster.db_cluster_identifier, data: resp.data.db_cluster, client: @client ) end |
#snapshot_create_time ⇒ Time
Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
57 58 59 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 57 def snapshot_create_time data[:snapshot_create_time] end |
#snapshot_id ⇒ String Also known as: db_cluster_snapshot_identifier
42 43 44 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 42 def snapshot_id @snapshot_id end |
#snapshot_type ⇒ String
Provides the type of the DB cluster snapshot.
135 136 137 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 135 def snapshot_type data[:snapshot_type] end |
#source_db_cluster_snapshot_arn ⇒ String
If the DB cluster snapshot was copied from a source DB cluster snapshot, the Amazon Resource Name (ARN) for the source DB cluster snapshot, otherwise, a null value.
172 173 174 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 172 def source_db_cluster_snapshot_arn data[:source_db_cluster_snapshot_arn] end |
#status ⇒ String
Specifies the status of this DB cluster snapshot. Valid statuses are the following:
available
copying
creating
90 91 92 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 90 def status data[:status] end |
#storage_encrypted ⇒ Boolean
Specifies whether the DB cluster snapshot is encrypted.
148 149 150 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 148 def storage_encrypted data[:storage_encrypted] end |
#tag_list ⇒ Array<Types::Tag>
A list of tags. For more information, see Tagging Amazon RDS Resources in the Amazon RDS User Guide.
190 191 192 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 190 def tag_list data[:tag_list] end |
#vpc_id ⇒ String
Provides the VPC ID associated with the DB cluster snapshot.
103 104 105 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 103 def vpc_id data[:vpc_id] 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
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 309 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::Waiters::Waiter.new().wait({}) end |