Class: Kelbim::DSL::EC2::LoadBalancer::Listeners

Inherits:
Object
  • Object
show all
Includes:
Checker, TemplateHelper
Defined in:
lib/kelbim/dsl/listener.rb,
lib/kelbim/dsl/listeners.rb

Defined Under Namespace

Classes: Listener

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Constructor Details

#initialize(context, load_balancer, &block) ⇒ Listeners

Returns a new instance of Listeners.



9
10
11
12
13
14
# File 'lib/kelbim/dsl/listeners.rb', line 9

def initialize(context, load_balancer, &block)
  @error_identifier = "LoadBalancer `#{load_balancer}`"
  @context = context.dup
  @result = {}
  instance_eval(&block)
end

Instance Method Details

#resultObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kelbim/dsl/listeners.rb', line 16

def result
  required(:listener, @result)

  @result.map do |protocol_ports, listener|
    protocol, port, instance_protocol, instance_port = protocol_ports.first.flatten

    OpenStruct.new({
      :protocol           => protocol,
      :port               => port,
      :instance_protocol  => instance_protocol,
      :instance_port      => instance_port,
      :server_certificate => listener.server_certificate,
      :policies           => listener.policies,
      :ssl_certificate_id => listener.ssl_certificate_id,
    })
  end
end