Class: Swa::EC2::Volume

Inherits:
Resource show all
Includes:
TaggedResource
Defined in:
lib/swa/ec2/volume.rb

Instance Attribute Summary

Attributes inherited from Resource

#aws_resource

Instance Method Summary collapse

Methods included from TaggedResource

#tags

Methods inherited from Resource

#data, delegate, #initialize, list

Constructor Details

This class inherits a constructor from Swa::Resource

Instance Method Details

#attachmentObject



31
32
33
# File 'lib/swa/ec2/volume.rb', line 31

def attachment
  v.attachments.first || OpenStruct.new
end

#idObject



11
12
13
# File 'lib/swa/ec2/volume.rb', line 11

def id
  v.volume_id
end

#nameObject



27
28
29
# File 'lib/swa/ec2/volume.rb', line 27

def name
  tags["Name"]
end

#summaryObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/swa/ec2/volume.rb', line 15

def summary
  [
    field(v, :volume_id),
    field(v, :snapshot_id),
    sprintf("%5d", v.size),
    field(v, :volume_type),
    field(attachment, :instance_id),
    pad(attachment.device, 9),
    quoted(name)
  ].join("  ")
end