You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::RDS::DBSnapshot

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance_id, snapshot_id, options = {}) ⇒ DBSnapshot #initialize(options = {}) ⇒ DBSnapshot

Returns a new instance of DBSnapshot

Overloads:

  • #initialize(instance_id, snapshot_id, options = {}) ⇒ DBSnapshot

    Parameters:

    • instance_id (String)
    • snapshot_id (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ DBSnapshot

    Options Hash (options):

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


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

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @instance_id = extract_instance_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)


58
59
60
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 58

def allocated_storage
  data[:allocated_storage]
end

#attributes(options = {}) ⇒ DBSnapshotAttribute::Collection

Examples:

Request syntax with placeholder values


db_snapshot.attributes()

Parameters:

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

    ({})

Returns:



782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 782

def attributes(options = {})
  batches = Enumerator.new do |y|
    batch = []
    options = options.merge(db_snapshot_identifier: @snapshot_id)
    resp = @client.describe_db_snapshot_attributes(options)
    resp.data.db_snapshot_attributes_result.db_snapshot_attributes.each do |d|
      batch << DBSnapshotAttribute.new(
        snapshot_id: @snapshot_id,
        name: d.attribute_name,
        data: d,
        client: @client
      )
    end
    y.yield(batch)
  end
  DBSnapshotAttribute::Collection.new(batches)
end

#availability_zoneString

Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.

Returns:

  • (String)


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

def availability_zone
  data[:availability_zone]
end

#clientClient

Returns:



203
204
205
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 203

def client
  @client
end

#copy(options = {}) ⇒ DBSnapshot

Examples:

Request syntax with placeholder values


dbsnapshot = db_snapshot.copy({
  target_db_snapshot_identifier: "String", # required
  kms_key_id: "String",
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  copy_tags: false,
  pre_signed_url: "String",
  option_group_name: "String",
  source_region: "String",
})

Parameters:

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

    ({})

Options Hash (options):

  • :target_db_snapshot_identifier (required, String)

    The identifier for the copy of the snapshot.

    Constraints:

    • Cannot be null, empty, or blank

    • Must contain from 1 to 255 letters, numbers, or hyphens

    • First character must be a letter

    • Cannot end with a hyphen or contain two consecutive hyphens

    Example: my-db-snapshot

  • :kms_key_id (String)

    The AWS KMS key ID for an encrypted DB 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 encrypted DB snapshot from your AWS account, you can specify a value for this parameter to encrypt the copy with a new KMS encryption key. If you don't specify a value for this parameter, then the copy of the DB snapshot is encrypted with the same KMS key as the source DB snapshot.

    If you copy an encrypted DB snapshot that is shared from another AWS account, then you must specify a value for this parameter.

    If you specify this parameter when you copy an unencrypted snapshot, the copy is encrypted.

    If you copy an encrypted snapshot to a different AWS Region, then you must specify a KMS key for 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.

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

    A list of tags.

  • :copy_tags (Boolean)

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

  • :pre_signed_url (String)

    The URL that contains a Signature Version 4 signed request for the CopyDBSnapshot API action in the source AWS Region that contains the source DB snapshot to copy.

    You must specify this parameter when you copy an encrypted DB snapshot from another AWS Region by using the Amazon RDS API. You can specify the source region option instead of this parameter when you copy an encrypted DB snapshot from another AWS Region by using the AWS CLI.

    The presigned URL must be a valid request for the CopyDBSnapshot API action that can be executed in the source AWS Region that contains the encrypted DB snapshot to be copied. The presigned URL request must contain the following parameter values:

    • DestinationRegion - The AWS Region that the encrypted DB snapshot will be copied to. This AWS Region is the same one where the CopyDBSnapshot action is called that contains this presigned URL.

      For example, if you copy an encrypted DB snapshot from the us-west-2 region to the us-east-1 region, then you call the CopyDBSnapshot action in the us-east-1 region and provide a presigned URL that contains a call to the CopyDBSnapshot action in the us-west-2 region. For this example, the DestinationRegion in the presigned URL must be set to the us-east-1 region.

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

    • SourceDBSnapshotIdentifier - The DB snapshot identifier for the encrypted 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 snapshot from the us-west-2 region, then your SourceDBSnapshotIdentifier looks like the following example: arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-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.

  • :option_group_name (String)

    The name of an option group to associate with the copy of the snapshot.

    Specify this option if you are copying a snapshot from one AWS Region to another, and your DB instance uses a nondefault option group. If your source DB instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server, you must specify this option when copying across regions. For more information, see Option Group Considerations.

  • :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:



483
484
485
486
487
488
489
490
491
492
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 483

def copy(options = {})
  options = options.merge(source_db_snapshot_identifier: @snapshot_id)
  resp = @client.copy_db_snapshot(options)
  DBSnapshot.new(
    instance_id: resp.data.db_snapshot.db_instance_identifier,
    snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
    data: resp.data.db_snapshot,
    client: @client
  )
end

#create(options = {}) ⇒ DBSnapshot

Examples:

Request syntax with placeholder values


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

Parameters:

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

    ({})

Options Hash (options):

Returns:



346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 346

def create(options = {})
  options = options.merge(
    db_instance_identifier: @instance_id,
    db_snapshot_identifier: @snapshot_id
  )
  resp = @client.create_db_snapshot(options)
  DBSnapshot.new(
    instance_id: resp.data.db_snapshot.db_instance_identifier,
    snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
    data: resp.data.db_snapshot,
    client: @client
  )
end

#dataTypes::DBSnapshot

Returns the data for this Aws::RDS::DBSnapshot. Calls Client#describe_db_snapshots if #data_loaded? is false.

Returns:



223
224
225
226
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 223

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.



231
232
233
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 231

def data_loaded?
  !!@data
end

#db_snapshot_arnString

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

Returns:

  • (String)


180
181
182
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 180

def db_snapshot_arn
  data[:db_snapshot_arn]
end

#delete(options = {}) ⇒ DBSnapshot

Examples:

Request syntax with placeholder values


db_snapshot.delete()

Parameters:

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

    ({})

Returns:



499
500
501
502
503
504
505
506
507
508
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 499

def delete(options = {})
  options = options.merge(db_snapshot_identifier: @snapshot_id)
  resp = @client.delete_db_snapshot(options)
  DBSnapshot.new(
    instance_id: resp.data.db_snapshot.db_instance_identifier,
    snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
    data: resp.data.db_snapshot,
    client: @client
  )
end

#encryptedBoolean

Specifies whether the DB snapshot is encrypted.

Returns:

  • (Boolean)


167
168
169
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 167

def encrypted
  data[:encrypted]
end

#engineString

Specifies the name of the database engine.

Returns:

  • (String)


52
53
54
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 52

def engine
  data[:engine]
end

#engine_versionString

Specifies the version of the database engine.

Returns:

  • (String)


103
104
105
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 103

def engine_version
  data[:engine_version]
end

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

Examples:

Request syntax with placeholder values


events = db_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.

    Example: 2009-07-08T18:00Z

  • :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.

    Example: 2009-07-08T18:00Z

  • :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:



845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 845

def events(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      source_type: "db-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)


196
197
198
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 196

def iam_database_authentication_enabled
  data[:iam_database_authentication_enabled]
end

#instanceDBInstance

Returns:



869
870
871
872
873
874
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 869

def instance
  DBInstance.new(
    id: @instance_id,
    client: @client
  )
end

#instance_create_timeTime

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

Returns:

  • (Time)


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

def instance_create_time
  data[:instance_create_time]
end

#instance_idString Also known as: db_instance_identifier

Returns:

  • (String)


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

def instance_id
  @instance_id
end

#iopsInteger

Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.

Returns:

  • (Integer)


122
123
124
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 122

def iops
  data[:iops]
end

#kms_key_idString

If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.

Returns:

  • (String)


174
175
176
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 174

def kms_key_id
  data[:kms_key_id]
end

#license_modelString

License model information for the restored DB instance.

Returns:

  • (String)


109
110
111
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 109

def license_model
  data[:license_model]
end

#loadself Also known as: reload

Loads, or reloads #data for the current Aws::RDS::DBSnapshot. Returns self making it possible to chain methods.

db_snapshot.reload.data

Returns:

  • (self)


213
214
215
216
217
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 213

def load
  resp = @client.describe_db_snapshots(db_snapshot_identifier: @snapshot_id)
  @data = resp.db_snapshots[0]
  self
end

#master_usernameString

Provides the master username for the DB snapshot.

Returns:

  • (String)


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

def master_username
  data[:master_username]
end

#option_groupOptionGroup?

Returns:



877
878
879
880
881
882
883
884
885
886
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 877

def option_group
  if data[:db_snapshot][:option_group_name]
    OptionGroup.new(
      name: data[:db_snapshot][:option_group_name],
      client: @client
    )
  else
    nil
  end
end

#option_group_nameString

Provides the option group name for the DB snapshot.

Returns:

  • (String)


128
129
130
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 128

def option_group_name
  data[:option_group_name]
end

#percent_progressInteger

The percentage of the estimated data that has been transferred.

Returns:

  • (Integer)


134
135
136
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 134

def percent_progress
  data[:percent_progress]
end

#portInteger

Specifies the port that the database engine was listening on at the time of the snapshot.

Returns:

  • (Integer)


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

def port
  data[:port]
end

#restore(options = {}) ⇒ DBInstance

Examples:

Request syntax with placeholder values


dbinstance = db_snapshot.restore({
  db_instance_identifier: "String", # required
  db_instance_class: "String",
  port: 1,
  availability_zone: "String",
  db_subnet_group_name: "String",
  multi_az: false,
  publicly_accessible: false,
  auto_minor_version_upgrade: false,
  license_model: "String",
  db_name: "String",
  engine: "String",
  iops: 1,
  option_group_name: "String",
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  storage_type: "String",
  tde_credential_arn: "String",
  tde_credential_password: "String",
  domain: "String",
  copy_tags_to_snapshot: false,
  domain_iam_role_name: "String",
  enable_iam_database_authentication: false,
})

Parameters:

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

    ({})

Options Hash (options):

  • :db_instance_identifier (required, String)

    Name of the DB instance to create from the DB snapshot. This parameter isn't case-sensitive.

    Constraints:

    • Must contain from 1 to 63 numbers, letters, or hyphens

    • First character must be a letter

    • Cannot end with a hyphen or contain two consecutive hyphens

    Example: my-snapshot-id

  • :db_instance_class (String)

    The compute and memory capacity of the Amazon RDS DB instance.

    Valid Values: db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge | db.m3.medium | db.m3.large | db.m3.xlarge | db.m3.2xlarge | db.m4.large | db.m4.xlarge | db.m4.2xlarge | db.m4.4xlarge | db.m4.10xlarge | db.r3.large | db.r3.xlarge | db.r3.2xlarge | db.r3.4xlarge | db.r3.8xlarge | db.t2.micro | db.t2.small | db.t2.medium | db.t2.large

  • :port (Integer)

    The port number on which the database accepts connections.

    Default: The same port as the original DB instance

    Constraints: Value must be 1150-65535

  • :availability_zone (String)

    The EC2 Availability Zone that the database instance will be created in.

    Default: A random, system-chosen Availability Zone.

    Constraint: You cannot specify the AvailabilityZone parameter if the MultiAZ parameter is set to true.

    Example: us-east-1a

  • :db_subnet_group_name (String)

    The DB subnet group name to use for the new instance.

    Constraints: If supplied, must match the name of an existing DBSubnetGroup.

    Example: mySubnetgroup

  • :multi_az (Boolean)

    Specifies if the DB instance is a Multi-AZ deployment.

    Constraint: You cannot specify the AvailabilityZone parameter if the MultiAZ parameter is set to true.

  • :publicly_accessible (Boolean)

    Specifies the accessibility options for the DB instance. A value of true specifies an Internet-facing instance with a publicly resolvable DNS name, which resolves to a public IP address. A value of false specifies an internal instance with a DNS name that resolves to a private IP address.

    Default: The default behavior varies depending on whether a VPC has been requested or not. The following list shows the default behavior in each case.

    • Default VPC: true

    • VPC: false

    If no DB subnet group has been specified as part of the request and the PubliclyAccessible value has not been set, the DB instance will be publicly accessible. If a specific DB subnet group has been specified as part of the request and the PubliclyAccessible value has not been set, the DB instance will be private.

  • :auto_minor_version_upgrade (Boolean)

    Indicates that minor version upgrades will be applied automatically to the DB instance during the maintenance window.

  • :license_model (String)

    License model information for the restored DB instance.

    Default: Same as source.

    Valid values: license-included | bring-your-own-license | general-public-license

  • :db_name (String)

    The database name for the restored DB instance.

    This parameter doesn't apply to the MySQL, PostgreSQL, or MariaDB engines.

  • :engine (String)

    The database engine to use for the new instance.

    Default: The same as source

    Constraint: Must be compatible with the engine of the source. You can restore a MariaDB 10.1 DB instance from a MySQL 5.6 snapshot.

    Valid Values:

    • aurora

    • mariadb

    • mysql

    • oracle-ee

    • oracle-se2

    • oracle-se1

    • oracle-se

    • postgres

    • sqlserver-ee

    • sqlserver-se

    • sqlserver-ex

    • sqlserver-web

  • :iops (Integer)

    Specifies the amount of provisioned IOPS for the DB instance, expressed in I/O operations per second. If this parameter is not specified, the IOPS value will be taken from the backup. If this parameter is set to 0, the new instance will be converted to a non-PIOPS instance, which will take additional time, though your DB instance will be available for connections before the conversion starts.

    Constraints: Must be an integer greater than 1000.

    SQL Server

    Setting the IOPS value for the SQL Server database engine is not supported.

  • :option_group_name (String)

    The name of the option group to be used for the restored DB instance.

    Permanent options, such as the TDE option for Oracle Advanced Security TDE, cannot be removed from an option group, and that option group cannot be removed from a DB instance once it is associated with a DB instance

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

    A list of tags.

  • :storage_type (String)

    Specifies the storage type to be associated with the DB instance.

    Valid values: standard | gp2 | io1

    If you specify io1, you must also include a value for the Iops parameter.

    Default: io1 if the Iops parameter is specified; otherwise standard

  • :tde_credential_arn (String)

    The ARN from the Key Store with which to associate the instance for TDE encryption.

  • :tde_credential_password (String)

    The password for the given ARN from the Key Store in order to access the device.

  • :domain (String)

    Specify the Active Directory Domain to restore the instance in.

  • :copy_tags_to_snapshot (Boolean)

    True to copy all tags from the restored DB instance to snapshots of the DB instance; otherwise false. The default is false.

  • :domain_iam_role_name (String)

    Specify the name of the IAM role to be used when making API calls to the Directory Service.

  • :enable_iam_database_authentication (Boolean)

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

    You can enable IAM database authentication for the following database engines

    • For MySQL 5.6, minor version 5.6.34 or higher

    • For MySQL 5.7, minor version 5.7.16 or higher

    • Aurora 5.6 or higher.

    Default: false

Returns:



725
726
727
728
729
730
731
732
733
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 725

def restore(options = {})
  options = options.merge(db_snapshot_identifier: @snapshot_id)
  resp = @client.restore_db_instance_from_db_snapshot(options)
  DBInstance.new(
    id: resp.data.db_instance.db_instance_identifier,
    data: resp.data.db_instance,
    client: @client
  )
end

#snapshot_create_timeTime

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

Returns:

  • (Time)


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

def snapshot_create_time
  data[:snapshot_create_time]
end

#snapshot_idString Also known as: db_snapshot_identifier

Returns:

  • (String)


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

def snapshot_id
  @snapshot_id
end

#snapshot_typeString

Provides the type of the DB snapshot.

Returns:

  • (String)


115
116
117
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 115

def snapshot_type
  data[:snapshot_type]
end

#source_db_snapshot_identifierString

The DB snapshot Amazon Resource Name (ARN) that the DB snapshot was copied from. It only has value in case of cross-customer or cross-region copy.

Returns:

  • (String)


148
149
150
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 148

def source_db_snapshot_identifier
  data[:source_db_snapshot_identifier]
end

#source_regionString

The AWS Region that the DB snapshot was created in or copied from.

Returns:

  • (String)


140
141
142
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 140

def source_region
  data[:source_region]
end

#statusString

Specifies the status of this DB snapshot.

Returns:

  • (String)


64
65
66
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 64

def status
  data[:status]
end

#storage_typeString

Specifies the storage type associated with DB snapshot.

Returns:

  • (String)


154
155
156
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 154

def storage_type
  data[:storage_type]
end

#subscribe_to(options = {}) ⇒ EventSubscription

Examples:

Request syntax with placeholder values


eventsubscription = db_snapshot.subscribe_to({
  subscription_name: "String", # required
})

Parameters:

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

    ({})

Options Hash (options):

  • :subscription_name (required, String)

    The name of the RDS event notification subscription you want to add a source identifier to.

Returns:



745
746
747
748
749
750
751
752
753
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 745

def subscribe_to(options = {})
  options = options.merge(source_identifier: @snapshot_id)
  resp = @client.add_source_identifier_to_subscription(options)
  EventSubscription.new(
    name: resp.data.event_subscription.cust_subscription_id,
    data: resp.data.event_subscription,
    client: @client
  )
end

#tde_credential_arnString

The ARN from the key store with which to associate the instance for TDE encryption.

Returns:

  • (String)


161
162
163
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 161

def tde_credential_arn
  data[:tde_credential_arn]
end

#timezoneString

The time zone of the DB snapshot. In most cases, the Timezone element is empty. Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were created with a time zone specified.

Returns:

  • (String)


189
190
191
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 189

def timezone
  data[:timezone]
end

#unsubscribe_from(options = {}) ⇒ EventSubscription

Examples:

Request syntax with placeholder values


eventsubscription = db_snapshot.unsubscribe_from({
  subscription_name: "String", # required
})

Parameters:

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

    ({})

Options Hash (options):

  • :subscription_name (required, String)

    The name of the RDS event notification subscription you want to remove a source identifier from.

Returns:



765
766
767
768
769
770
771
772
773
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 765

def unsubscribe_from(options = {})
  options = options.merge(source_identifier: @snapshot_id)
  resp = @client.remove_source_identifier_from_subscription(options)
  EventSubscription.new(
    name: resp.data.event_subscription.cust_subscription_id,
    data: resp.data.event_subscription,
    client: @client
  )
end

#vpc_idString

Provides the VPC ID associated with the DB snapshot.

Returns:

  • (String)


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

def vpc_id
  data[:vpc_id]
end

#wait_until(options = {}, &block) ⇒ Resource

Deprecated.

Use [Aws::RDS::Client] #wait_until instead

Note:

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(options) {|resource| condition}

Example

instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }

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

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :max_attempts (Integer) — default: 10

    Maximum number of

  • :delay (Integer) — default: 10

    Delay between each

  • :before_attempt (Proc) — default: nil

    Callback

  • :before_wait (Proc) — default: nil

    Callback

Returns:

  • (Resource)

    if the waiter was successful

Raises:

  • (Aws::Waiters::Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

    yet successful.

  • (Aws::Waiters::Errors::UnexpectedError)

    Raised when an error is encountered while polling for a resource that is not expected.

  • (NotImplementedError)

    Raised when the resource does not



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb', line 313

def wait_until(options = {}, &block)
  self_copy = self.dup
  attempts = 0
  options[:max_attempts] = 10 unless options.key?(:max_attempts)
  options[:delay] ||= 10
  options[:poller] = Proc.new do
    attempts += 1
    if block.call(self_copy)
      [:success, self_copy]
    else
      self_copy.reload unless attempts == options[:max_attempts]
      :retry
    end
  end
  Aws::Waiters::Waiter.new(options).wait({})
end