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



26
27
28
29
30
31
32
33
34
# File 'lib/swa/ec2/image.rb', line 26

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

#nameObject



19
20
21
# File 'lib/swa/ec2/image.rb', line 19

def name
  ami.name
end

#summaryObject



11
12
13
14
15
16
17
# File 'lib/swa/ec2/image.rb', line 11

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