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

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

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json

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

#initialize(attributes) ⇒ VolumeBackups

Returns a new instance of VolumeBackups.



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

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

Instance Method Details

#all(filters = filters) ⇒ Object



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

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



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

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