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
The allocated storage size of the DB cluster snapshot in gibibytes (GiB).
-
#availability_zones ⇒ Array<String>
The list of Availability Zones (AZs) where instances in the DB cluster snapshot can be restored.
-
#backup_retention_period ⇒ Integer
The number of days for which automatic DB snapshots are retained.
-
#cluster_create_time ⇒ Time
The time when the DB cluster was created, in Universal Coordinated Time (UTC).
-
#cluster_id ⇒ String
(also: #db_cluster_identifier)
-
#db_cluster_resource_id ⇒ String
The resource ID of the DB cluster that this DB cluster snapshot was created from.
-
#db_cluster_snapshot_arn ⇒ String
The Amazon Resource Name (ARN) for the DB cluster snapshot.
-
#db_system_id ⇒ String
Reserved for future use.
-
#engine ⇒ String
The name of the database engine for this DB cluster snapshot.
-
#engine_mode ⇒ String
The engine mode of the database engine for this DB cluster snapshot.
-
#engine_version ⇒ String
The version of the database engine for this DB cluster snapshot.
-
#iam_database_authentication_enabled ⇒ Boolean
Indicates whether mapping of Amazon Web Services Identity and Access Management (IAM) accounts to database accounts is enabled.
-
#kms_key_id ⇒ String
If
StorageEncryptedis true, the Amazon Web Services KMS key identifier for the encrypted DB cluster snapshot. -
#license_model ⇒ String
The license model information for this DB cluster snapshot.
-
#master_username ⇒ String
The master username for this DB cluster snapshot.
-
#percent_progress ⇒ Integer
The percentage of the estimated data that has been transferred.
-
#port ⇒ Integer
The port that the DB cluster was listening on at the time of the snapshot.
-
#preferred_backup_window ⇒ String
The daily time range during which automated backups are created if automated backups are enabled, as determined by the
BackupRetentionPeriod. -
#snapshot_create_time ⇒ Time
The time when the snapshot was taken, in Universal Coordinated Time (UTC).
-
#snapshot_id ⇒ String
(also: #db_cluster_snapshot_identifier)
-
#snapshot_type ⇒ String
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
The status of this DB cluster snapshot.
-
#storage_encrypted ⇒ Boolean
Indicates whether the DB cluster snapshot is encrypted.
-
#storage_encryption_type ⇒ String
The type of encryption used to protect data at rest in the DB cluster snapshot.
-
#storage_throughput ⇒ Integer
The storage throughput for the DB cluster snapshot.
-
#storage_type ⇒ String
The storage type associated with the DB cluster snapshot.
-
#tag_list ⇒ Array<Types::Tag>
A list of tags.
-
#vpc_id ⇒ String
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
trueif 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
The allocated storage size of the DB cluster snapshot in gibibytes (GiB).
76 77 78 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 76 def allocated_storage data[:allocated_storage] end |
#availability_zones ⇒ Array<String>
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 |
#backup_retention_period ⇒ Integer
The number of days for which automatic DB snapshots are retained.
166 167 168 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 166 def backup_retention_period data[:backup_retention_period] end |
#client ⇒ Client
258 259 260 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 258 def client @client end |
#cluster ⇒ DBCluster
1181 1182 1183 1184 1185 1186 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 1181 def cluster DBCluster.new( id: @cluster_id, client: @client ) end |
#cluster_create_time ⇒ Time
The time when the DB cluster was created, in Universal Coordinated Time (UTC).
109 110 111 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 109 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
550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 550 def copy( = {}) = .merge(source_db_cluster_snapshot_identifier: @snapshot_id) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.copy_db_cluster_snapshot() end 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
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 407 def create( = {}) = .merge( db_cluster_identifier: @cluster_id, db_cluster_snapshot_identifier: @snapshot_id ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_db_cluster_snapshot() end 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.
280 281 282 283 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 280 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
288 289 290 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 288 def data_loaded? !!@data end |
#db_cluster_resource_id ⇒ String
The resource ID of the DB cluster that this DB cluster snapshot was created from.
245 246 247 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 245 def db_cluster_resource_id data[:db_cluster_resource_id] end |
#db_cluster_snapshot_arn ⇒ String
The Amazon Resource Name (ARN) for the DB cluster snapshot.
190 191 192 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 190 def db_cluster_snapshot_arn data[:db_cluster_snapshot_arn] end |
#db_system_id ⇒ String
Reserved for future use.
251 252 253 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 251 def db_system_id data[:db_system_id] end |
#delete(options = {}) ⇒ DBClusterSnapshot
568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 568 def delete( = {}) = .merge(db_cluster_snapshot_identifier: @snapshot_id) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_db_cluster_snapshot() end 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
The name of the database engine for this DB cluster snapshot.
63 64 65 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 63 def engine data[:engine] end |
#engine_mode ⇒ String
The engine mode of the database engine for this DB cluster snapshot.
69 70 71 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 69 def engine_mode data[:engine_mode] end |
#engine_version ⇒ String
The version of the database engine for this DB cluster snapshot.
121 122 123 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 121 def engine_version data[:engine_version] end |
#events(options = {}) ⇒ Event::Collection
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 1233 def events( = {}) batches = Enumerator.new do |y| = .merge( source_type: "db-cluster-snapshot", source_identifier: @snapshot_id ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_events() end 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
Indicates whether mapping of Amazon Web Services Identity and Access Management (IAM) accounts to database accounts is enabled.
205 206 207 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 205 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.
184 185 186 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 184 def kms_key_id data[:kms_key_id] end |
#license_model ⇒ String
The license model information for this DB cluster snapshot.
127 128 129 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 127 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
268 269 270 271 272 273 274 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 268 def load resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_db_cluster_snapshots(db_cluster_snapshot_identifier: @snapshot_id) end @data = resp.db_cluster_snapshots[0] self end |
#master_username ⇒ String
The master username for this DB cluster snapshot.
115 116 117 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 115 def master_username data[:master_username] end |
#percent_progress ⇒ Integer
The percentage of the estimated data that has been transferred.
139 140 141 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 139 def percent_progress data[:percent_progress] end |
#port ⇒ Integer
The port that the DB cluster was listening on at the time of the snapshot.
96 97 98 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 96 def port data[:port] end |
#preferred_backup_window ⇒ String
The daily time range during which automated backups are created if
automated backups are enabled, as determined by the
BackupRetentionPeriod.
174 175 176 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 174 def preferred_backup_window data[:preferred_backup_window] end |
#restore(options = {}) ⇒ DBCluster
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 1166 def restore( = {}) = .merge(snapshot_identifier: @snapshot_id) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.restore_db_cluster_from_snapshot() end DBCluster.new( id: resp.data.db_cluster.db_cluster_identifier, data: resp.data.db_cluster, client: @client ) end |
#snapshot_create_time ⇒ Time
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
The type of the DB cluster snapshot.
133 134 135 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 133 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.
198 199 200 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 198 def source_db_cluster_snapshot_arn data[:source_db_cluster_snapshot_arn] end |
#status ⇒ String
The status of this DB cluster snapshot. Valid statuses are the following:
availablecopyingcreating
89 90 91 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 89 def status data[:status] end |
#storage_encrypted ⇒ Boolean
Indicates whether the DB cluster snapshot is encrypted.
145 146 147 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 145 def storage_encrypted data[:storage_encrypted] end |
#storage_encryption_type ⇒ String
The type of encryption used to protect data at rest in the DB cluster snapshot. Possible values:
none- The DB cluster snapshot is not encrypted.sse-rds- The DB cluster snapshot is encrypted using an Amazon Web Services owned KMS key.sse-kms- The DB cluster snapshot is encrypted using a customer managed KMS key or Amazon Web Services managed KMS key.
160 161 162 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 160 def storage_encryption_type data[:storage_encryption_type] end |
#storage_throughput ⇒ Integer
The storage throughput for the DB cluster snapshot. The throughput is automatically set based on the IOPS that you provision, and is not configurable.
This setting is only for non-Aurora Multi-AZ DB clusters.
238 239 240 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 238 def storage_throughput data[:storage_throughput] end |
#storage_type ⇒ String
The storage type associated with the DB cluster snapshot.
This setting is only for Aurora DB clusters.
228 229 230 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 228 def storage_type data[:storage_type] end |
#tag_list ⇒ Array<Types::Tag>
A list of tags.
For more information, see Tagging Amazon RDS resources in the Amazon RDS User Guide or Tagging Amazon Aurora and Amazon RDS resources in the Amazon Aurora User Guide.
220 221 222 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 220 def tag_list data[:tag_list] end |
#vpc_id ⇒ String
The VPC ID associated with the DB cluster snapshot.
102 103 104 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 102 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
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_snapshot.rb', line 372 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 |