Class: Fog::HP::BlockStorageV2::VolumeBackups

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ VolumeBackups

Returns a new instance of VolumeBackups.



12
13
14
15
# File 'lib/fog/hp/models/block_storage_v2/volume_backups.rb', line 12

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/hp/models/block_storage_v2/volume_backups.rb', line 17

def all(filters = filters)
  details = filters.delete(:details)
  self.filters = filters
  non_aliased_filters = Fog::HP.convert_aliased_attributes_to_original(self.model, filters)
  if details
    data = service.list_volume_backups_detail(non_aliased_filters).body['backups']
  else
    data = service.list_volume_backups(non_aliased_filters).body['backups']
  end
  load(data)
end

#get(backup_id) ⇒ Object



29
30
31
32
33
34
# File 'lib/fog/hp/models/block_storage_v2/volume_backups.rb', line 29

def get(backup_id)
  backup = service.get_volume_backup_details(backup_id).body['backup']
  new(backup)
rescue Fog::HP::BlockStorageV2::NotFound
  nil
end