2012-08-23 15:03:28 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/rackspace/models/block_storage/snapshot'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Rackspace
|
|
|
|
class BlockStorage
|
|
|
|
class Snapshots < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Rackspace::BlockStorage::Snapshot
|
|
|
|
|
|
|
|
def all
|
2012-12-22 18:24:03 -05:00
|
|
|
data = service.list_snapshots.body['snapshots']
|
2012-08-23 15:03:28 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(snapshot_id)
|
2012-12-22 18:24:03 -05:00
|
|
|
data = service.get_snapshot(snapshot_id).body['snapshot']
|
2012-08-23 15:03:28 -04:00
|
|
|
new(data)
|
|
|
|
rescue Fog::Rackspace::BlockStorage::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|