Class: Piculet::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/piculet/exporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ec2) ⇒ Exporter

of class methods



11
12
13
# File 'lib/piculet/exporter.rb', line 11

def initialize(ec2)
  @ec2 = ec2
end

Class Method Details

.export(ec2) ⇒ Object



6
7
8
# File 'lib/piculet/exporter.rb', line 6

def export(ec2)
  self.new(ec2).export
end

Instance Method Details

#exportObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/piculet/exporter.rb', line 15

def export
  result = {}

  @ec2.security_groups.each do |sg|
    vpc = sg.vpc
    vpc = vpc.id if vpc
    result[vpc] ||= {}
    result[vpc][sg.id] = export_security_group(sg)
  end

  return result
end