Class: AwsDump::Instance

Inherits:
Hash
  • Object
show all
Defined in:
lib/aws_dump/instance.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, instance) ⇒ Instance

Returns a new instance of Instance.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/aws_dump/instance.rb', line 5

def initialize(parent, instance)
  @parent = parent
  @instance = instance
  self[:name] = instance.tags["Name"] || instance.id
  self[:public_ip] = instance.public_ip_address
  self[:private_ip] = instance.private_ip_address
  self[:instance_type] = instance.instance_type
  self[:id] = instance.id
  self[:image_id] = instance.image_id
  self[:root_device_type] = instance.root_device_type
  self[:security_groups] = security_groups
end

Instance Method Details

#<=>(other) ⇒ Object



29
30
31
# File 'lib/aws_dump/instance.rb', line 29

def <=>(other)
  self[:name] <=> other[:name]
end

#security_groupsObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/aws_dump/instance.rb', line 18

def security_groups
  list = []
  @instance.security_groups.each do |security_group|
    list << {
      :name => security_group.name,
      :id => security_group.id
    }
  end
  list
end