Class: AWS::RDS::DBSnapshot
- Inherits:
-
Core::Resource
- Object
- Core::Resource
- AWS::RDS::DBSnapshot
- Defined in:
- lib/aws/rds/db_snapshot.rb
Instance Attribute Summary collapse
-
#allocated_storage ⇒ Integer
readonly
The current value of allocated_storage.
-
#availability_zone_name ⇒ String
readonly
The current value of availability_zone_name.
-
#created_at ⇒ Time
readonly
The current value of created_at.
-
#db_instance_id ⇒ String
readonly
The current value of db_instance_id.
- #db_snapshot_identifier ⇒ String (also: #id, #db_snapshot_id) readonly
-
#engine ⇒ String
readonly
The current value of engine.
-
#engine_version ⇒ String
readonly
The current value of engine_version.
-
#instance_create_time ⇒ Time
readonly
The current value of instance_create_time.
-
#license_model ⇒ String
readonly
The current value of license_model.
-
#master_username ⇒ String
readonly
The current value of master_username.
-
#port ⇒ String
readonly
The current value of port.
-
#snapshot_type ⇒ String
readonly
The current value of snapshot_type.
-
#status ⇒ String
readonly
The current value of status.
-
#vpc_id ⇒ Integer
readonly
The current value of vpc_id.
Instance Method Summary collapse
-
#copy(new_snapshot_id) ⇒ DBSnapshot
Copies this database snapshot.
- #db_instance ⇒ DBInstance
-
#delete ⇒ nil
Deletes this database snapshot.
-
#exists? ⇒ Boolean
Returns
true
if the db snapshot exists. -
#initialize(db_snapshot_id, options = {}) ⇒ DBSnapshot
constructor
A new instance of DBSnapshot.
-
#restore_instance(options = {}) ⇒ Object
Restores the database instance from this snapshot.
Constructor Details
#initialize(db_snapshot_id, options = {}) ⇒ DBSnapshot
Returns a new instance of DBSnapshot.
47 48 49 50 |
# File 'lib/aws/rds/db_snapshot.rb', line 47 def initialize db_snapshot_id, = {} @db_snapshot_identifier = db_snapshot_id super end |
Instance Attribute Details
#allocated_storage ⇒ Integer (readonly)
Returns the current value of allocated_storage.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def allocated_storage @allocated_storage end |
#availability_zone_name ⇒ String (readonly)
Returns the current value of availability_zone_name.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def availability_zone_name @availability_zone_name end |
#created_at ⇒ Time (readonly)
Returns the current value of created_at.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def created_at @created_at end |
#db_instance_id ⇒ String (readonly)
Returns the current value of db_instance_id.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def db_instance_id @db_instance_id end |
#db_snapshot_identifier ⇒ String (readonly) Also known as: id, db_snapshot_id
53 54 55 |
# File 'lib/aws/rds/db_snapshot.rb', line 53 def db_snapshot_identifier @db_snapshot_identifier end |
#engine ⇒ String (readonly)
Returns the current value of engine.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def engine @engine end |
#engine_version ⇒ String (readonly)
Returns the current value of engine_version.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def engine_version @engine_version end |
#instance_create_time ⇒ Time (readonly)
Returns the current value of instance_create_time.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def instance_create_time @instance_create_time end |
#license_model ⇒ String (readonly)
Returns the current value of license_model.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def license_model @license_model end |
#master_username ⇒ String (readonly)
Returns the current value of master_username.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def master_username @master_username end |
#port ⇒ String (readonly)
Returns the current value of port.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def port @port end |
#snapshot_type ⇒ String (readonly)
Returns the current value of snapshot_type.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def snapshot_type @snapshot_type end |
#status ⇒ String (readonly)
Returns the current value of status.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def status @status end |
#vpc_id ⇒ Integer (readonly)
Returns the current value of vpc_id.
43 44 45 |
# File 'lib/aws/rds/db_snapshot.rb', line 43 def vpc_id @vpc_id end |
Instance Method Details
#copy(new_snapshot_id) ⇒ DBSnapshot
Copies this database snapshot.
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/aws/rds/db_snapshot.rb', line 108 def copy new_snapshot_id = {} [:source_db_snapshot_identifier] = id [:target_db_snapshot_identifier] = new_snapshot_id resp = client.copy_db_snapshot() DBSnapshot.new_from(:copy_db_snapshot, resp, resp[:db_snapshot_identifier], :config => config) end |
#db_instance ⇒ DBInstance
101 102 103 |
# File 'lib/aws/rds/db_snapshot.rb', line 101 def db_instance DBInstance.new(db_instance_id, :config => config) end |
#delete ⇒ nil
Deletes this database snapshot.
122 123 124 125 |
# File 'lib/aws/rds/db_snapshot.rb', line 122 def delete client.delete_db_snapshot(:db_snapshot_identifier => db_snapshot_identifier) nil end |
#exists? ⇒ Boolean
Returns true
if the db snapshot exists.
140 141 142 143 144 145 146 147 |
# 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 = {}) ⇒ Object
Restores the database instance from this snapshot. You may optionally specify the db instance id if you wish to restore to a different db.
132 133 134 135 136 137 |
# File 'lib/aws/rds/db_snapshot.rb', line 132 def restore_instance = {} [:db_snapshot_identifier] = db_snapshot_identifier [:db_instance_identifier] ||= db_instance_id client.restore_db_instance_from_db_snapshot() nil end |