Class: Swa::EC2::Image

Inherits:
Resource show all
Includes:
TaggedResource
Defined in:
lib/swa/ec2/image.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

#deleteObject



30
31
32
33
34
35
36
37
38
# File 'lib/swa/ec2/image.rb', line 30

def delete
  ebs_snapshot_ids = ami.block_device_mappings.map do |mapping|
    mapping.ebs.snapshot_id if mapping.ebs
  end.compact
  deregister
  ebs_snapshot_ids.each do |snapshot_id|
    ami.client.delete_snapshot(:snapshot_id => snapshot_id)
  end
end

#idObject



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

def id
  ami.image_id
end

#nameObject



23
24
25
# File 'lib/swa/ec2/image.rb', line 23

def name
  ami.name
end

#summaryObject



15
16
17
18
19
20
21
# File 'lib/swa/ec2/image.rb', line 15

def summary
  [
    field(ami, :image_id),
    ami.creation_date.sub(".000Z", "Z"),
    quoted(name)
  ].join("  ")
end