Class: Fog::Compute::OpenStack::Snapshot

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/models/compute/snapshot.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#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 Fog::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

#initialize(attributes) ⇒ Snapshot

Returns a new instance of Snapshot.



20
21
22
23
24
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 20

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#destroyObject



33
34
35
36
37
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 33

def destroy
  requires :id
  service.delete_snapshot(id)
  true
end

#save(force = false) ⇒ Object



26
27
28
29
30
31
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 26

def save(force=false)
  requires :volume_id, :name, :description
  data = service.create_volume_snapshot(volume_id, name, description, force)
  merge_attributes(data.body['snapshot'])
  true
end