Class: Fog::HP::BlockStorageV2::Volumes
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::HP::BlockStorageV2::Volumes
- Defined in:
- lib/fog/hp/models/block_storage_v2/volumes.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
- #all(filters = filters) ⇒ Object
- #get(volume_id) ⇒ Object
-
#initialize(attributes) ⇒ Volumes
constructor
A new instance of Volumes.
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) ⇒ Volumes
Returns a new instance of Volumes.
14 15 16 17 |
# File 'lib/fog/hp/models/block_storage_v2/volumes.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/volumes.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_volumes_detail(non_aliased_filters).body['volumes'] else data = service.list_volumes(non_aliased_filters).body['volumes'] end load(data) end |
#get(volume_id) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/fog/hp/models/block_storage_v2/volumes.rb', line 31 def get(volume_id) volume = service.get_volume_details(volume_id).body['volume'] new(volume) rescue Fog::HP::BlockStorageV2::NotFound nil end |