Class: Aws::RDS::DBClusterSnapshot

Inherits:
Object
  • Object
show all
Extended by:
Deprecations
Defined in:
lib/aws-sdk-rds/db_cluster_snapshot.rb

Defined Under Namespace

Classes: Collection

Read-Only Attributes collapse

Actions collapse

Associations collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster_id, snapshot_id, options = {}) ⇒ DBClusterSnapshot #initialize(options = {}) ⇒ DBClusterSnapshot

Returns a new instance of DBClusterSnapshot.

Overloads:

  • #initialize(cluster_id, snapshot_id, options = {}) ⇒ DBClusterSnapshot

    Parameters:

    • cluster_id (String)
    • snapshot_id (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ DBClusterSnapshot

    Options Hash (options):

    • :cluster_id (required, String)
    • :snapshot_id (required, String)
    • :client (Client)


21
22
23
24
25
26
27
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 21

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @cluster_id = extract_cluster_id(args, options)
  @snapshot_id = extract_snapshot_id(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#allocated_storageInteger

Specifies the allocated storage size in gigabytes (GB).

Returns:

  • (Integer)


65
66
67
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 65

def allocated_storage
  data.allocated_storage
end

#availability_zonesArray<String>

Provides the list of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.

Returns:

  • (Array<String>)


46
47
48
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 46

def availability_zones
  data.availability_zones
end

#clientClient

Returns:



164
165
166
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 164

def client
  @client
end

#clusterDBCluster

Returns:



461
462
463
464
465
466
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 461

def cluster
  DBCluster.new(
    id: @cluster_id,
    client: @client
  )
end

#cluster_create_timeTime

Specifies the time when the DB cluster was created, in Universal Coordinated Time (UTC).

Returns:

  • (Time)


91
92
93
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 91

def cluster_create_time
  data.cluster_create_time
end

#cluster_idString Also known as: db_cluster_identifier

Returns:

  • (String)


32
33
34
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 32

def cluster_id
  @cluster_id
end

#copy(options = {}) ⇒ DBClusterSnapshot

Examples:

Request syntax with placeholder values


dbclustersnapshot = db_cluster_snapshot.copy({
  target_db_cluster_snapshot_identifier: "String", # required
  kms_key_id: "String",
  pre_signed_url: "String",
  copy_tags: false,
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  source_region: "String",
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :target_db_cluster_snapshot_identifier (required, String)

    The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This parameter is not case-sensitive.

    Constraints:

    • Must contain from 1 to 63 alphanumeric characters or hyphens.

    • First character must be a letter.

    • Cannot end with a hyphen or contain two consecutive hyphens.

    Example: ‘my-cluster-snapshot2`

  • :kms_key_id (String)

    The AWS KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.

    If you copy an unencrypted DB cluster snapshot and specify a value for the ‘KmsKeyId` parameter, Amazon RDS encrypts the target DB cluster snapshot using the specified KMS encryption key.

    If you copy an encrypted DB cluster snapshot from your AWS account, you can specify a value for ‘KmsKeyId` to encrypt the copy with a new KMS encryption key. If you don’t specify a value for ‘KmsKeyId`, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the source DB cluster snapshot.

    If you copy an encrypted DB cluster snapshot that is shared from another AWS account, then you must specify a value for ‘KmsKeyId`.

    To copy an encrypted DB cluster snapshot to another AWS Region, you must set ‘KmsKeyId` to the KMS key ID you want to use to encrypt the copy of the DB cluster snapshot in the destination AWS Region. KMS encryption keys are specific to the AWS Region that they are created in, and you cannot use encryption keys from one AWS Region in another AWS Region.

  • :pre_signed_url (String)

    The URL that contains a Signature Version 4 signed request for the ‘CopyDBClusterSnapshot` API action in the AWS Region that contains the source DB cluster snapshot to copy. The `PreSignedUrl` parameter must be used when copying an encrypted DB cluster snapshot from another AWS Region.

    The pre-signed URL must be a valid request for the ‘CopyDBSClusterSnapshot` API action that can be executed in the source AWS Region that contains the encrypted DB cluster snapshot to be copied. The pre-signed URL request must contain the following parameter values:

    • ‘KmsKeyId` - The KMS key identifier for the key to use to encrypt the copy of the DB cluster snapshot in the destination AWS Region. This is the same identifier for both the `CopyDBClusterSnapshot` action that is called in the destination AWS Region, and the action contained in the pre-signed URL.

    • ‘DestinationRegion` - The name of the AWS Region that the DB cluster snapshot will be created in.

    • ‘SourceDBClusterSnapshotIdentifier` - The DB cluster snapshot identifier for the encrypted DB cluster snapshot to be copied. This identifier must be in the Amazon Resource Name (ARN) format for the source AWS Region. For example, if you are copying an encrypted DB cluster snapshot from the us-west-2 region, then your `SourceDBClusterSnapshotIdentifier` looks like the following example: `arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115`.

    To learn how to generate a Signature Version 4 signed request, see [ Authenticating Requests: Using Query Parameters (AWS Signature Version 4)] and [ Signature Version 4 Signing Process].

    [1]: docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html [2]: docs.aws.amazon.com/general/latest/gr/signature-version-4.html

  • :copy_tags (Boolean)

    True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot; otherwise false. The default is false.

  • :tags (Array<Types::Tag>)

    A list of tags.

  • :destination_region (String)
  • :source_region (String)

    The source region of the snapshot. This is only needed when the shapshot is encrypted and in a different region.

Returns:



328
329
330
331
332
333
334
335
336
337
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 328

def copy(options = {})
  options = options.merge(source_db_cluster_snapshot_identifier: @snapshot_id)
  resp = @client.copy_db_cluster_snapshot(options)
  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

Examples:

Request syntax with placeholder values


dbclustersnapshot = db_cluster_snapshot.create({
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :tags (Array<Types::Tag>)

    The tags to be assigned to the DB cluster snapshot.

Returns:



212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 212

def create(options = {})
  options = options.merge(
    db_cluster_identifier: @cluster_id,
    db_cluster_snapshot_identifier: @snapshot_id
  )
  resp = @client.create_db_cluster_snapshot(options)
  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

#dataTypes::DBClusterSnapshot

Returns the data for this Aws::RDS::DBClusterSnapshot. Calls Client#describe_db_cluster_snapshots if #data_loaded? is ‘false`.

Returns:



184
185
186
187
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 184

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns ‘true` if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns ‘true` if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



192
193
194
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 192

def data_loaded?
  !!@data
end

#db_cluster_snapshot_arnString

The Amazon Resource Name (ARN) for the DB cluster snapshot.

Returns:

  • (String)


142
143
144
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 142

def db_cluster_snapshot_arn
  data.db_cluster_snapshot_arn
end

#delete(options = {}) ⇒ DBClusterSnapshot

Examples:

Request syntax with placeholder values


db_cluster_snapshot.delete()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



344
345
346
347
348
349
350
351
352
353
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 344

def delete(options = {})
  options = options.merge(db_cluster_snapshot_identifier: @snapshot_id)
  resp = @client.delete_db_cluster_snapshot(options)
  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

#engineString

Specifies the name of the database engine.

Returns:

  • (String)


59
60
61
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 59

def engine
  data.engine
end

#engine_versionString

Provides the version of the database engine for this DB cluster snapshot.

Returns:

  • (String)


104
105
106
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 104

def engine_version
  data.engine_version
end

#events(options = {}) ⇒ Event::Collection

Examples:

Request syntax with placeholder values


events = db_cluster_snapshot.events({
  start_time: Time.now,
  end_time: Time.now,
  duration: 1,
  event_categories: ["String"],
  filters: [
    {
      name: "String", # required
      values: ["String"], # required
    },
  ],
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :start_time (Time, DateTime, Date, Integer, String)

    The beginning of the time interval to retrieve events for, specified in ISO 8601 format. For more information about ISO 8601, go to the

    ISO8601 Wikipedia page.][1

    Example: 2009-07-08T18:00Z

    [1]: en.wikipedia.org/wiki/ISO_8601

  • :end_time (Time, DateTime, Date, Integer, String)

    The end of the time interval for which to retrieve events, specified in ISO 8601 format. For more information about ISO 8601, go to the

    ISO8601 Wikipedia page.][1

    Example: 2009-07-08T18:00Z

    [1]: en.wikipedia.org/wiki/ISO_8601

  • :duration (Integer)

    The number of minutes to retrieve events for.

    Default: 60

  • :event_categories (Array<String>)

    A list of event categories that trigger notifications for a event notification subscription.

  • :filters (Array<Types::Filter>)

    This parameter is not currently supported.

Returns:



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 513

def events(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      source_type: "db-cluster-snapshot",
      source_identifier: @snapshot_id
    )
    resp = @client.describe_events(options)
    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_enabledBoolean

True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise false.

Returns:

  • (Boolean)


157
158
159
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 157

def iam_database_authentication_enabled
  data.iam_database_authentication_enabled
end

#identifiersObject

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.

Deprecated.


538
539
540
541
542
543
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 538

def identifiers
  {
    cluster_id: @cluster_id,
    snapshot_id: @snapshot_id
  }
end

#kms_key_idString

If ‘StorageEncrypted` is true, the KMS key identifier for the encrypted DB cluster snapshot.

Returns:

  • (String)


136
137
138
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 136

def kms_key_id
  data.kms_key_id
end

#license_modelString

Provides the license model information for this DB cluster snapshot.

Returns:

  • (String)


110
111
112
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 110

def license_model
  data.license_model
end

#loadself 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

Returns:

  • (self)


174
175
176
177
178
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 174

def load
  resp = @client.describe_db_cluster_snapshots(db_cluster_snapshot_identifier: @snapshot_id)
  @data = resp.db_cluster_snapshots[0]
  self
end

#master_usernameString

Provides the master username for the DB cluster snapshot.

Returns:

  • (String)


97
98
99
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 97

def master_username
  data.master_username
end

#percent_progressInteger

Specifies the percentage of the estimated data that has been transferred.

Returns:

  • (Integer)


123
124
125
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 123

def percent_progress
  data.percent_progress
end

#portInteger

Specifies the port that the DB cluster was listening on at the time of the snapshot.

Returns:

  • (Integer)


78
79
80
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 78

def port
  data.port
end

#restore(options = {}) ⇒ DBCluster

Examples:

Request syntax with placeholder values


dbcluster = db_cluster_snapshot.restore({
  availability_zones: ["String"],
  db_cluster_identifier: "String", # required
  engine: "String", # required
  engine_version: "String",
  port: 1,
  db_subnet_group_name: "String",
  database_name: "String",
  option_group_name: "String",
  vpc_security_group_ids: ["String"],
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  kms_key_id: "String",
  enable_iam_database_authentication: false,
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :availability_zones (Array<String>)

    Provides the list of EC2 Availability Zones that instances in the restored DB cluster can be created in.

  • :db_cluster_identifier (required, String)

    The name of the DB cluster to create from the DB cluster snapshot. This parameter isn’t case-sensitive.

    Constraints:

    • Must contain from 1 to 255 alphanumeric characters or hyphens

    • First character must be a letter

    • Cannot end with a hyphen or contain two consecutive hyphens

    Example: ‘my-snapshot-id`

  • :engine (required, String)

    The database engine to use for the new DB cluster.

    Default: The same as source

    Constraint: Must be compatible with the engine of the source

  • :engine_version (String)

    The version of the database engine to use for the new DB cluster.

  • :port (Integer)

    The port number on which the new DB cluster accepts connections.

    Constraints: Value must be ‘1150-65535`

    Default: The same port as the original DB cluster.

  • :db_subnet_group_name (String)

    The name of the DB subnet group to use for the new DB cluster.

    Constraints: Must contain no more than 255 alphanumeric characters, periods, underscores, spaces, or hyphens. Must not be default.

    Example: ‘mySubnetgroup`

  • :database_name (String)

    The database name for the restored DB cluster.

  • :option_group_name (String)

    The name of the option group to use for the restored DB cluster.

  • :vpc_security_group_ids (Array<String>)

    A list of VPC security groups that the new DB cluster will belong to.

  • :tags (Array<Types::Tag>)

    The tags to be assigned to the restored DB cluster.

  • :kms_key_id (String)

    The KMS key identifier to use when restoring an encrypted DB cluster from a DB cluster snapshot.

    The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are restoring a DB cluster with the same AWS account that owns the KMS encryption key used to encrypt the new DB cluster, then you can use the KMS key alias instead of the ARN for the KMS encryption key.

    If you do not specify a value for the ‘KmsKeyId` parameter, then the following will occur:

    • If the DB cluster snapshot is encrypted, then the restored DB cluster is encrypted using the KMS key that was used to encrypt the DB cluster snapshot.

    • If the DB cluster snapshot is not encrypted, then the restored DB cluster is encrypted using the specified encryption key.

  • :enable_iam_database_authentication (Boolean)

    A Boolean value that is true to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts, and otherwise false.

    Default: ‘false`

Returns:



448
449
450
451
452
453
454
455
456
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 448

def restore(options = {})
  options = options.merge(snapshot_identifier: @snapshot_id)
  resp = @client.restore_db_cluster_from_snapshot(options)
  DBCluster.new(
    id: resp.data.db_cluster.db_cluster_identifier,
    data: resp.data.db_cluster,
    client: @client
  )
end

#snapshot_create_timeTime

Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).

Returns:

  • (Time)


53
54
55
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 53

def snapshot_create_time
  data.snapshot_create_time
end

#snapshot_idString Also known as: db_cluster_snapshot_identifier

Returns:

  • (String)


38
39
40
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 38

def snapshot_id
  @snapshot_id
end

#snapshot_typeString

Provides the type of the DB cluster snapshot.

Returns:

  • (String)


116
117
118
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 116

def snapshot_type
  data.snapshot_type
end

#source_db_cluster_snapshot_arnString

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.

Returns:

  • (String)


150
151
152
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 150

def source_db_cluster_snapshot_arn
  data.source_db_cluster_snapshot_arn
end

#statusString

Specifies the status of this DB cluster snapshot.

Returns:

  • (String)


71
72
73
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 71

def status
  data.status
end

#storage_encryptedBoolean

Specifies whether the DB cluster snapshot is encrypted.

Returns:

  • (Boolean)


129
130
131
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 129

def storage_encrypted
  data.storage_encrypted
end

#vpc_idString

Provides the VPC ID associated with the DB cluster snapshot.

Returns:

  • (String)


84
85
86
# File 'lib/aws-sdk-rds/db_cluster_snapshot.rb', line 84

def vpc_id
  data.vpc_id
end