2012-03-01 17:37:40 +08:00
|
|
|
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)
|
2012-12-22 23:24:36 +00:00
|
|
|
load(service.list_snapshots(detailed).body['snapshots'])
|
2012-03-01 17:37:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(snapshot_id)
|
2012-12-22 23:24:36 +00:00
|
|
|
if snapshot = service.get_snapshot_details(snapshot_id).body['snapshot']
|
2012-03-01 17:37:40 +08:00
|
|
|
new(snapshot)
|
|
|
|
end
|
|
|
|
rescue Fog::Compute::OpenStack::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|