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

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Snapshot

Returns a new instance of Snapshot.



17
18
19
20
21
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 17

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

Instance Method Details

#destroyObject



30
31
32
33
34
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 30

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

#save(force = false) ⇒ Object



23
24
25
26
27
28
# File 'lib/fog/openstack/models/compute/snapshot.rb', line 23

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