Module: Fog::OpenStack::Volume::Volumes

Included in:
Fog::OpenStack::Volume::V1::Volumes, Fog::OpenStack::Volume::V2::Volumes
Defined in:
lib/fog/openstack/volume/models/volumes.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/volume/models/volumes.rb', line 7

def all(options = {})
  # the parameter has been "detailed = true" before. Make sure we are
  # backwards compatible
  detailed = options.kind_of?(Hash) ? options.delete(:detailed) : options
  if detailed.nil? || detailed
    # This method gives details by default, unless false or {:detailed => false} is passed
    load_response(service.list_volumes_detailed(options), 'volumes')
  else
    Fog::Logger.deprecation('Calling OpenStack[:volume].volumes.all(false) or volumes.all(:detailed => false) '\
                            ' is deprecated, call .volumes.summary instead')
    load_response(service.list_volumes(options), 'volumes')
  end
end

#get(volume_id) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fog/openstack/volume/models/volumes.rb', line 25

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

#summary(options = {}) ⇒ Object



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

def summary(options = {})
  load_response(service.list_volumes(options), 'volumes')
end