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/compute/snapshots.rb
2012-04-30 10:35:00 +08:00

26 lines
590 B
Ruby

require 'fog/core/collection'
require 'fog/openstack/models/compute/snapshot'
module Fog
module Compute
class OpenStack
class Snapshots < Fog::Collection
model Fog::Compute::OpenStack::Snapshot
def all(detailed=true)
load(connection.list_snapshots(detailed).body['snapshots'])
end
def get(snapshot_id)
if snapshot = connection.get_snapshot_details(snapshot_id).body['snapshot']
new(snapshot)
end
rescue Fog::Compute::OpenStack::NotFound
nil
end
end
end
end
end