Class: Fog::Rackspace::BlockStorage::Snapshot

Inherits:
Model
  • Object
show all
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

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

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 Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



38
39
40
41
42
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 38

def destroy
  requires :identity
  connection.delete_snapshot(identity)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 23

def ready?
  state == AVAILABLE
end

#save(force = false) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/rackspace/models/block_storage/snapshot.rb', line 27

def save(force = false)
  requires :volume_id
  data = connection.create_snapshot(volume_id, {
    :display_name => display_name,
    :display_description => display_description,
    :force => force
  })
  merge_attributes(data.body['snapshot'])
  true
end