Class: Fog::HP::BlockStorageV2::VolumeBackup

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/hp/models/block_storage_v2/volume_backup.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



39
40
41
42
43
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 39

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

#ready?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 25

def ready?
  self.status == 'available'
end

#restore(volume_id = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 29

def restore(volume_id=nil)
  requires :id
  if volume_id
    service.restore_volume_backup(id, :volume_id => volume_id)
  else
    service.restore_volume_backup(id)
  end
  true
end

#restoring?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 21

def restoring?
  self.status == 'restoring'
end

#saveObject

Raises:

  • (Fog::Errors::Error)


45
46
47
48
49
50
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 45

def save
  requires :volume_id
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
  merge_attributes(service.create_volume_backup(volume_id, attributes).body['backup'])
  true
end