2009-09-06 13:48:12 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
class Snapshot < Fog::Model
|
|
|
|
|
2009-10-24 01:23:55 -04:00
|
|
|
identity :snapshot_id, 'snapshotId'
|
|
|
|
|
2009-09-06 13:48:12 -04:00
|
|
|
attribute :progress
|
|
|
|
attribute :start_time, 'startTime'
|
|
|
|
attribute :status
|
2009-09-18 11:56:27 -04:00
|
|
|
attribute :volume_id, 'volumeId'
|
2009-09-06 13:48:12 -04:00
|
|
|
|
2009-09-20 12:21:03 -04:00
|
|
|
def destroy
|
2009-09-06 13:48:12 -04:00
|
|
|
connection.delete_snapshot(@snapshot_id)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
2009-09-24 22:18:41 -04:00
|
|
|
data = connection.create_snapshot(volume_id).body
|
2009-09-06 13:48:12 -04:00
|
|
|
new_attributes = data.reject {|key,value| key == 'requestId'}
|
2009-09-30 01:02:33 -04:00
|
|
|
merge_attributes(new_attributes)
|
2009-09-06 13:48:12 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def volume
|
2009-09-18 11:56:27 -04:00
|
|
|
connection.describe_volumes(@volume_id)
|
2009-09-06 13:48:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def volume=(new_volume)
|
2009-09-18 11:56:27 -04:00
|
|
|
@volume_id = new_volume.volume_id
|
2009-09-06 13:48:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|