mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
starting to flesh out instance model associations
This commit is contained in:
parent
0f3cccc566
commit
be24d254ec
2 changed files with 18 additions and 1 deletions
|
@ -23,6 +23,14 @@ module Fog
|
|||
attribute :reason
|
||||
attribute :user_data
|
||||
|
||||
def address
|
||||
connection.addresses.select {|address| address.instance_id == @instance_id}.first
|
||||
end
|
||||
|
||||
def address=(new_address)
|
||||
connection.associate_address(@instance_id, new_address.public_ip)
|
||||
end
|
||||
|
||||
def delete
|
||||
connection.terminate_instances(@instance_id)
|
||||
true
|
||||
|
@ -44,6 +52,14 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def volumes
|
||||
connection.volumes.all.select {|volume| volume.instance_id == @instance_id}
|
||||
end
|
||||
|
||||
def volume=(new_volume)
|
||||
connection.attach_volume(@instance_id, new_volume.volume_id, new_volume.device)
|
||||
end
|
||||
|
||||
def save
|
||||
options = {}
|
||||
if @availability_zone
|
||||
|
|
|
@ -6,7 +6,8 @@ module Fog
|
|||
|
||||
attribute :attachment_time, 'attachmentTime'
|
||||
attribute :availability_zone, 'availabilityZone'
|
||||
attribute :device, 'createTime'
|
||||
attribute :create_time, 'createTime'
|
||||
attribute :device
|
||||
attribute :instance_id, 'instanceId'
|
||||
attribute :size
|
||||
attribute :snapshot_id, 'snapshotId'
|
||||
|
|
Loading…
Add table
Reference in a new issue