Class: Fog::Rackspace::BlockStorage::Snapshot
- Defined in:
- lib/fog/rackspace/models/block_storage/snapshot.rb
Constant Summary collapse
- AVAILABLE =
'available'
- CREATING =
'creating'
- DELETING =
'deleting'
- ERROR =
'error'
- ERROR_DELETING =
'error_deleting'
Instance Attribute Summary collapse
-
#availability_zone ⇒ String
readonly
Region of the snapshot.
-
#created_at ⇒ String
readonly
Snapshot creation time.
-
#display_description ⇒ String
Display description of snapshot.
-
#display_name ⇒ String
Display name of snapshot.
-
#id ⇒ String
readonly
The snapshot id.
-
#size ⇒ String
Size of snapshot.
-
#state ⇒ String
readonly
Snapshot status.
-
#volume_id ⇒ String
The volume_id of the snapshot.
Attributes inherited from Model
Instance Method Summary collapse
-
#destroy ⇒ Boolean
Destroys snapshot.
-
#ready? ⇒ Boolean
Returns true if the snapshot is in a ready state.
-
#save(force = false) ⇒ Boolean
Creates the snapshot.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#availability_zone ⇒ String (readonly)
Returns region of the snapshot.
43 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 43 attribute :availability_zone |
#created_at ⇒ String (readonly)
Returns snapshot creation time.
19 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 19 attribute :created_at, :aliases => 'createdAt' |
#display_description ⇒ String
Returns display description of snapshot.
31 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 31 attribute :display_description |
#display_name ⇒ String
Returns display name of snapshot.
27 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 27 attribute :display_name |
#id ⇒ String (readonly)
Returns The snapshot id.
15 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 15 identity :id |
#size ⇒ String
Returns size of snapshot.
35 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 35 attribute :size |
#state ⇒ String (readonly)
Returns snapshot status.
23 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 23 attribute :state, :aliases => 'status' |
#volume_id ⇒ String
Returns the volume_id of the snapshot.
39 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 39 attribute :volume_id |
Instance Method Details
#destroy ⇒ Boolean
Destroys snapshot
81 82 83 84 85 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 81 def destroy requires :identity service.delete_snapshot(identity) true end |
#ready? ⇒ Boolean
Returns true if the snapshot is in a ready state
47 48 49 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 47 def ready? state == AVAILABLE end |
#save(force = false) ⇒ Boolean
A snapshot object cannot be updated
All writes to the volume should be flushed before creating the snapshot, either by un-mounting any file systems on the volume or by detaching the volume.
Creates the snapshot
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 62 def save(force = false) requires :volume_id raise IdentifierTaken.new('Resaving may cause a duplicate snapshot to be created') if persisted? data = service.create_snapshot(volume_id, { :display_name => display_name, :display_description => display_description, :force => force }) merge_attributes(data.body['snapshot']) true end |