Class: Awsum::Ec2::Volume
Instance Attribute Summary collapse
-
#attach_time ⇒ Object
readonly
Returns the value of attribute attach_time.
-
#attachment_status ⇒ Object
readonly
Returns the value of attribute attachment_status.
-
#availability_zone ⇒ Object
readonly
Returns the value of attribute availability_zone.
-
#create_time ⇒ Object
readonly
Returns the value of attribute create_time.
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#instance_id ⇒ Object
readonly
Returns the value of attribute instance_id.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#snapshot_id ⇒ Object
readonly
Returns the value of attribute snapshot_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#create_snapshot(options = {}) ⇒ Object
Creates a Snapshot of this Volume.
-
#delete ⇒ Object
Delete this volume.
-
#delete! ⇒ Object
Force delete this volume will detach it first.
-
#detach(force = false) ⇒ Object
Detach this volume.
-
#initialize(ec2, id, instance_id, size, status, create_time, snapshot_id, device, attach_time, availability_zone, attachment_status) ⇒ Volume
constructor
:nodoc:.
-
#reload ⇒ Object
Will reload the information about this Volume.
-
#snapshots ⇒ Object
Lists the Snapshot(s) of this Volume.
Constructor Details
#initialize(ec2, id, instance_id, size, status, create_time, snapshot_id, device, attach_time, availability_zone, attachment_status) ⇒ Volume
:nodoc:
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/awsum/ec2/volume.rb', line 8 def initialize(ec2, id, instance_id, size, status, create_time, snapshot_id, device, attach_time, availability_zone, ) #:nodoc: @ec2 = ec2 @id = id @instance_id = instance_id @size = size @status = status @create_time = create_time @snapshot_id = snapshot_id @device = device @attach_time = attach_time @availability_zone = availability_zone @attachment_status = end |
Instance Attribute Details
#attach_time ⇒ Object (readonly)
Returns the value of attribute attach_time.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def attach_time @attach_time end |
#attachment_status ⇒ Object (readonly)
Returns the value of attribute attachment_status.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def @attachment_status end |
#availability_zone ⇒ Object (readonly)
Returns the value of attribute availability_zone.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def availability_zone @availability_zone end |
#create_time ⇒ Object (readonly)
Returns the value of attribute create_time.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def create_time @create_time end |
#device ⇒ Object (readonly)
Returns the value of attribute device.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def device @device end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def id @id end |
#instance_id ⇒ Object (readonly)
Returns the value of attribute instance_id.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def instance_id @instance_id end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def size @size end |
#snapshot_id ⇒ Object (readonly)
Returns the value of attribute snapshot_id.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def snapshot_id @snapshot_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/awsum/ec2/volume.rb', line 6 def status @status end |
Instance Method Details
#create_snapshot(options = {}) ⇒ Object
Creates a Snapshot of this Volume
64 65 66 |
# File 'lib/awsum/ec2/volume.rb', line 64 def create_snapshot( = {}) @ec2.create_snapshot id, end |
#delete ⇒ Object
Delete this volume
49 50 51 |
# File 'lib/awsum/ec2/volume.rb', line 49 def delete @ec2.delete_volume id end |
#delete! ⇒ Object
Force delete this volume will detach it first
55 56 57 58 59 60 61 |
# File 'lib/awsum/ec2/volume.rb', line 55 def delete! detach true while status != 'available' reload end @ec2.delete_volume id end |
#detach(force = false) ⇒ Object
Detach this volume
44 45 46 |
# File 'lib/awsum/ec2/volume.rb', line 44 def detach(force = false) @ec2.detach_volume id, :force => force end |
#reload ⇒ Object
Will reload the information about this Volume
Useful for when a volume has just been created but is not yet available
while volume.status != 'available'
volume.reload
end
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/awsum/ec2/volume.rb', line 28 def reload reloaded_volume = @ec2.volume id @id = id @instance_id = reloaded_volume.instance_id @size = reloaded_volume.size @status = reloaded_volume.status @create_time = reloaded_volume.create_time @snapshot_id = reloaded_volume.snapshot_id @device = reloaded_volume.device @attach_time = reloaded_volume.attach_time @availability_zone = reloaded_volume.availability_zone @attachment_status = reloaded_volume. end |
#snapshots ⇒ Object
Lists the Snapshot(s) of this Volume
69 70 71 72 |
# File 'lib/awsum/ec2/volume.rb', line 69 def snapshots snapshots = @ec2.snapshots snapshots.delete_if {|s| s.volume_id != id} end |