2012-08-09 16:51:19 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/hp/models/block_storage/snapshot'
|
|
|
|
|
|
|
|
module Fog
|
2013-01-14 17:51:41 -05:00
|
|
|
module HP
|
|
|
|
class BlockStorage
|
2012-08-09 16:51:19 -04:00
|
|
|
class Snapshots < Fog::Collection
|
2013-01-14 17:51:41 -05:00
|
|
|
model Fog::HP::BlockStorage::Snapshot
|
2012-08-09 16:51:19 -04:00
|
|
|
|
|
|
|
def all
|
2013-01-18 15:08:27 -05:00
|
|
|
data = service.list_snapshots.body['snapshots']
|
2012-08-09 16:51:19 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(snapshot_id)
|
2013-01-18 15:08:27 -05:00
|
|
|
if snapshot = service.get_snapshot_details(snapshot_id).body['snapshot']
|
2012-08-09 16:51:19 -04:00
|
|
|
new(snapshot)
|
|
|
|
end
|
2013-01-14 17:51:41 -05:00
|
|
|
rescue Fog::HP::BlockStorage::NotFound
|
2012-08-09 16:51:19 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|