Class: Fog::OpenStack::Volume::Backup

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

Direct Known Subclasses

V1::Backup, V2::Backup, V3::Backup

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#initialize, #save, #update

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#createObject



20
21
22
23
24
25
# File 'lib/fog/openstack/volume/models/backup.rb', line 20

def create
  requires :name, :volume_id
  data = service.create_backup(attributes)
  merge_attributes(data.body['backup'])
  true
end

#destroyObject



27
28
29
30
31
# File 'lib/fog/openstack/volume/models/backup.rb', line 27

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

#restore(volume_id = nil, name = nil) ⇒ Object



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

def restore(volume_id = nil, name = nil)
  requires :id
  service.restore_backup(id, volume_id, name)
  true
end

#volumeObject



39
40
41
42
# File 'lib/fog/openstack/volume/models/backup.rb', line 39

def volume
  requires :id
  service.get_volume_details(volume_id).body['volume']
end