Class: Eipmap::Client
- Inherits:
-
Object
- Object
- Eipmap::Client
- Includes:
- Logger::Helper
- Defined in:
- lib/eipmap/client.rb
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Logger::Helper
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 |
# File 'lib/eipmap/client.rb', line 4 def initialize( = {}) = aws_config = .delete(:aws_config) || {} @ec2 = Aws::EC2::Client.new(aws_config) @driver = Eipmap::Driver.new(@ec2, ) end |
Instance Method Details
#apply(file) ⇒ Object
22 23 24 |
# File 'lib/eipmap/client.rb', line 22 def apply(file) walk(file) end |
#export ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/eipmap/client.rb', line 11 def export exported = Eipmap::Exporter.export(@ec2, ) instance_ids = exported.map {|domain, ips| ips.map {|ip, attrs| attrs[:instance_id] } }.flatten.select {|i| i } instance_names = @driver.describe_instance_names(instance_ids) Eipmap::DSL.convert(exported, .merge(:instance_names => instance_names)) end |