Class: Description::EC2

Inherits:
Description show all
Defined in:
lib/maws/description/ec2.rb

Instance Attribute Summary

Attributes inherited from Description

#description

Instance Method Summary collapse

Methods inherited from Description

#[], create, #create_instance, #index, #logical_zone, #method_missing, #name_re, #physical_zone, #prefix, #profile, #region, #role, #zone

Constructor Details

#initialize(description) ⇒ EC2

Returns a new instance of EC2.



2
3
4
5
# File 'lib/maws/description/ec2.rb', line 2

def initialize(description)
  description[:service] ||= :ec2
  @description = description
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Description

Instance Method Details

#attached_ebs_volume_idsObject



31
32
33
# File 'lib/maws/description/ec2.rb', line 31

def attached_ebs_volume_ids
  ebs_volumes.find_all{|v| v[:ebs_status] == 'attached'}.map {|v| v[:ebs_volume_id]}
end

#aws_idObject



11
12
13
# File 'lib/maws/description/ec2.rb', line 11

def aws_id
  aws_instance_id
end

#ebs_volume_idsObject



27
28
29
# File 'lib/maws/description/ec2.rb', line 27

def ebs_volume_ids
  ebs_volumes.map {|v| v[:ebs_volume_id]}
end

#ebs_volumesObject



23
24
25
# File 'lib/maws/description/ec2.rb', line 23

def ebs_volumes
  block_device_mappings || []
end

#nameObject



7
8
9
# File 'lib/maws/description/ec2.rb', line 7

def name
  (tags && tags["Name"]) || aws_instance_id
end

#region_zoneObject



19
20
21
# File 'lib/maws/description/ec2.rb', line 19

def region_zone
  aws_availability_zone
end

#statusObject



15
16
17
# File 'lib/maws/description/ec2.rb', line 15

def status
  aws_state
end