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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Constructor Details

#initialize(context, load_balancer, protocol_ports, &block) ⇒ Listener

Returns a new instance of Listener.



10
11
12
13
14
15
16
17
18
19
# File 'lib/kelbim/dsl/listener.rb', line 10

def initialize(context, load_balancer, protocol_ports, &block)
  @error_identifier = "LoadBalancer `#{load_balancer}`: #{protocol_ports}"
  @context = context.merge(:protocol_ports => protocol_ports)

  @result = OpenStruct.new({
    :policies => []
  })

  instance_eval(&block)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



21
22
23
# File 'lib/kelbim/dsl/listener.rb', line 21

def result
  @result
end

Instance Method Details

#policies(value) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kelbim/dsl/listener.rb', line 33

def policies(value)
  call_once(:policies)
  expected_type(value, Hash)

  unless value.kind_of?(Hash)
    raise "LoadBalancer `#{@load_balancer}`: #{@protocol_ports}: Invalid policies: #{value}"
  end

  value = value.map do |policy, name_or_attrs|
    expected_type(name_or_attrs, String, Hash)
    policy = PolicyTypes.symbol_to_string(policy)
    [policy, name_or_attrs]
  end

  @result.policies = value
end

#server_certificate(value) ⇒ Object



23
24
25
26
# File 'lib/kelbim/dsl/listener.rb', line 23

def server_certificate(value)
  call_once(:server_certificate)
  @result.server_certificate = value
end

#ssl_certificate_id(value) ⇒ Object



28
29
30
31
# File 'lib/kelbim/dsl/listener.rb', line 28

def ssl_certificate_id(value)
  call_once(:ssl_certificate_id)
  @result.ssl_certificate_id = value
end