2012-05-14 02:38:27 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/openstack/models/volume/volume'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Volume
|
|
|
|
class OpenStack
|
|
|
|
|
|
|
|
class Volumes < Fog::Collection
|
|
|
|
model Fog::Volume::OpenStack::Volume
|
|
|
|
|
|
|
|
def all(detailed=true)
|
2012-12-22 18:24:36 -05:00
|
|
|
load(service.list_volumes(detailed).body['volumes'])
|
2012-05-14 02:38:27 -04:00
|
|
|
end
|
|
|
|
|
2013-07-03 06:24:55 -04:00
|
|
|
def get(volume_id)
|
2012-12-22 18:24:36 -05:00
|
|
|
if volume = service.get_volume_details(volume_id).body['volume']
|
2012-05-14 02:38:27 -04:00
|
|
|
new(volume)
|
|
|
|
end
|
|
|
|
rescue Fog::Volume::OpenStack::NotFound
|
|
|
|
nil
|
|
|
|
end
|
2013-07-03 06:24:55 -04:00
|
|
|
alias_method :find_by_id, :get
|
2012-05-14 02:38:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|