1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[ec2] add ready? to snapshot model and owner/restorable_by to snapshots

This commit is contained in:
geemus 2010-04-23 14:07:49 -07:00
parent 49f5a09e0d
commit ec090bf12c
2 changed files with 13 additions and 2 deletions

View file

@ -20,6 +20,10 @@ module Fog
true
end
def ready?
@status == 'completed'
end
def save
requires :volume_id

View file

@ -23,6 +23,8 @@ module Fog
class Snapshots < Fog::Collection
attribute :owner, 'Owner'
attribute :restorable_by, 'RestorableBy'
attribute :snapshot_id
attribute :volume
@ -33,8 +35,13 @@ module Fog
super
end
def all(snapshot_id = @snapshot_id)
@snapshot_id = snapshot_id
def all(snapshot_id = @snapshot_id, options = {})
options = {
'Owner' => @owner || 'self',
'RestorableBy' => @restorable_by
}
options = options.reject {|key,value| value.nil? || value.to_s.empty?}
merge_attributes(options)
data = connection.describe_snapshots(snapshot_id).body
load(data['snapshotSet'])
if volume