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/aws/models/ec2/snapshots.rb
2009-09-19 12:21:31 -07:00

51 lines
1.1 KiB
Ruby

module Fog
module AWS
class EC2
def snapshots
Fog::AWS::EC2::Snapshots.new(:connection => self)
end
class Snapshots < Fog::Collection
def all(snapshot_id = [])
data = connection.describe_snapshots(snapshot_id)
snapshots = Fog::AWS::EC2::Snapshots.new(:connection => connection)
data['snapshotSet'].each do |snapshot|
snapshots << Fog::AWS::EC2::Snapshot.new({
:connection => connection,
:snapshots => self
}.merge!(snapshot))
end
snapshots
end
def create(attributes = {})
snapshot = new(attributes)
snapshot.save
snapshot
end
def new(attributes = {})
Fog::AWS::S3::Snapshot.new({
:connection => connection,
:volume => @volume,
:snapshots => self
}.merge!(attributes))
end
def volume
@volume
end
private
def volume=(new_volume)
@volume = new_volume
end
end
end
end
end