1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/models/volume/volumes.rb

29 lines
598 B
Ruby
Raw Normal View History

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)
load(service.list_volumes(detailed).body['volumes'])
2012-05-14 02:38:27 -04:00
end
def get(volume_id)
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
alias_method :find_by_id, :get
2012-05-14 02:38:27 -04:00
end
end
end
end