Class: Fog::Volume::OpenStack::Volumes

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/openstack/models/volume/volumes.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {:detailed => true}) ⇒ Object



10
11
12
13
14
15
# File 'lib/fog/openstack/models/volume/volumes.rb', line 10

def all(options = {:detailed => true})
  # the parameter has been "detailed = true" before. Make sure we are
  # backwards compatible
  detailed = options.is_a?(Hash) ? options.delete(:detailed) : options
  load(service.list_volumes(detailed, options).body['volumes'])
end

#get(volume_id) ⇒ Object Also known as: find_by_id



17
18
19
20
21
22
23
# File 'lib/fog/openstack/models/volume/volumes.rb', line 17

def get(volume_id)
  if volume = service.get_volume_details(volume_id).body['volume']
    new(volume)
  end
rescue Fog::Volume::OpenStack::NotFound
  nil
end