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/google/models/compute/snapshots.rb
Akshay Moghe 5c3517a9b8 Add ability to get/list snapshots in GCE.
This patch...
1. Adds the Snapshot collection and model
2. Adds the get/list requests
3. adds some examples
2013-08-12 18:16:48 -07:00

28 lines
580 B
Ruby

require 'fog/core/collection'
require 'fog/google/models/compute/snapshot'
module Fog
module Compute
class Google
class Snapshots < Fog::Collection
model Fog::Compute::Google::Snapshot
def all
data = service.list_snapshots(self.service.project)
snapshots = data.body['items'] || []
load(snapshots)
end
def get(snap_id)
response = service.get_snapshot(snap_id, self.service.project)
return nil if response.nil?
new(response.body)
end
end
end
end
end