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

Included in:
Fog::Volume::OpenStack::V1::Volumes, Fog::Volume::OpenStack::V2::Volumes
Defined in:
lib/fog/volume/openstack/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/volume/openstack/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/volume/openstack/models/volumes.rb', line 25

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

#summary(options = {}) ⇒ Object



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

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