Class: Topo::Provision::AwsLoadBalancerGenerator

Inherits:
LoadBalancerGenerator show all
Defined in:
lib/topo/provision/aws/generators/load_balancer.rb

Instance Attribute Summary

Attributes inherited from ResourceGenerator

#name, #resource_attributes, #resource_type, #undeploy_action

Instance Method Summary collapse

Methods included from Topo::ParseGen

#convert_keys_to_sym, #convert_keys_to_sym_deep, #expand_ref, #lazy_attribute_to_s, #topo_refs, #value_from_path

Methods inherited from ResourceGenerator

#default_action, #default_resource_template, #deploy, #do_action, #template, #template_root_dir, #undeploy

Constructor Details

#initialize(data) ⇒ AwsLoadBalancerGenerator

Returns a new instance of AwsLoadBalancerGenerator.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/topo/provision/aws/generators/load_balancer.rb', line 26

def initialize(data)
  super
  @undeploy_action = "destroy"
  %w[machines].each do |key|
    @resource_attributes[key] = data['provisioning'][key] if data['provisioning'].key? key
  end
  
  lbopts =  (data['provisioning']|| {})['load_balancer_options'] 
  if(lbopts)
    lbopts = convert_keys_to_sym_deep(lbopts)
    if (lbopts[:listeners])
       lbopts[:listeners].each_with_index do |listener, index|
        lbopts[:listeners][index] = convert_keys_to_sym(listener)
       end
    end
    @resource_attributes['load_balancer_options'] = lbopts
  end
end