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/volume.rb

48 lines
1.3 KiB
Ruby
Raw Normal View History

2009-08-14 12:19:40 -04:00
module Fog
module AWS
class EC2
class Volume < Fog::Model
attr_accessor :attachment_time,
2009-08-19 12:11:26 -04:00
:availability_zone,
:device,
:instance_id
:size,
:snapshot_id,
:status,
:volume_id
2009-08-14 12:19:40 -04:00
def initialize(attributes = {})
if attributes['attachmentSet']
attributes.merge!(attributes.delete('attachmentSet'))
end
remap_attributes(attributes, {
'attachmentTime' => :attachment_time,
'availabilityZone' => :availability_zone,
'createTime' => :create_time,
'instanceId' => :instance_id,
'snapshotId' => :snapshot_id,
'status' => :status
'volumeId' => :volume_id
})
super
end
def delete
connection.delete_volume(@volume_id)
end
def save
data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
new_attributes = data.reject {|key,value| key == 'requestId'}
update_attributes(new_attributes)
data
end
end
end
end
end