class AWS::RDS::DBSnapshot

@attr_reader [Integer] allocated_storage

@attr_reader [String] availability_zone_name

@attr_reader [String] db_instance_id

@attr_reader [String] engine

@attr_reader [String] engine_version

@attr_reader [String] license_model

@attr_reader [String] master_username

@attr_reader [String] port

@attr_reader [Integer] vpc_id

@attr_reader [String] snapshot_type

@attr_reader [String] status

@attr_reader [Time] created_at

@attr_reader [Time] instance_create_time

Attributes

db_snapshot_id[R]

@return [String]

db_snapshot_identifier[R]

@return [String]

id[R]

@return [String]

Public Class Methods

new(db_snapshot_id, options = {}) click to toggle source

@param [String] #db_snapshot_id @param [Hash] options

# File lib/aws/rds/db_snapshot.rb, line 47
def initialize db_snapshot_id, options = {}
  @db_snapshot_identifier = db_snapshot_id
  super
end

Public Instance Methods

copy(new_snapshot_id) click to toggle source

Copies this database snapshot. @param [String] new_snapshot_id @return [DBSnapshot]

# File lib/aws/rds/db_snapshot.rb, line 108
def copy new_snapshot_id

  options = {}
  options[:source_db_snapshot_identifier] = id
  options[:target_db_snapshot_identifier] = new_snapshot_id
  resp = client.copy_db_snapshot(options)

  DBSnapshot.new_from(:copy_db_snapshot, resp,
    resp[:db_snapshot_identifier], :config => config)

end
db_instance() click to toggle source

@return [DBInstance]

# File lib/aws/rds/db_snapshot.rb, line 101
def db_instance
  DBInstance.new(db_instance_id, :config => config)
end
delete() click to toggle source

Deletes this database snapshot. @return [nil]

# File lib/aws/rds/db_snapshot.rb, line 122
def delete
  client.delete_db_snapshot(:db_snapshot_identifier => db_snapshot_identifier)
  nil
end
exists?() click to toggle source

@return [Boolean] Returns true if the db snapshot exists.

# File lib/aws/rds/db_snapshot.rb, line 140
def exists?
  begin
    get_resource
    true
  rescue AWS::RDS::Errors::DBSnapshotNotFound
    false
  end
end
restore_instance(options = {}) click to toggle source

Restores the database instance from this snapshot. You may optionally specify the db instance id if you wish to restore to a different db.

@param (see Client#restore_db_instance_from_db_snapshot) @option (see Client#restore_db_instance_from_db_snapshot)

# File lib/aws/rds/db_snapshot.rb, line 132
def restore_instance options = {}
  options[:db_snapshot_identifier] = db_snapshot_identifier
  options[:db_instance_identifier] ||= db_instance_id
  client.restore_db_instance_from_db_snapshot(options)
  nil
end

Protected Instance Methods

get_resource(attr = nil) click to toggle source
# File lib/aws/rds/db_snapshot.rb, line 155
def get_resource attr = nil
  options = {}
  options[:db_snapshot_identifier] = db_snapshot_identifier
  client.describe_db_snapshots(options)
end
resource_identifiers() click to toggle source
# File lib/aws/rds/db_snapshot.rb, line 151
def resource_identifiers
  [[:db_snapshot_identifier, id]]
end