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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

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 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

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



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

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

#ready?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 27

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

#restore(volume_id = nil) ⇒ Object



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

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)


23
24
25
# File 'lib/fog/hp/models/block_storage_v2/volume_backup.rb', line 23

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

#saveObject

Raises:



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

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