Class: CfFactory::CfEbConfigurationTemplate

Inherits:
Object
  • Object
show all
Includes:
CfEbSolutionStack, CfInner
Defined in:
lib/cf_factory/eb/cf_eb_configuration_template.rb

Constant Summary

Constants included from CfEbSolutionStack

CfEbSolutionStack::SUPPORTED_STACK_NAMES

Instance Method Summary collapse

Methods included from CfEbSolutionStack

#is_valid_stack?

Methods included from CfInner

#additional_indent, #generate, #generate_name, #hash_to_string, #set_quotes

Constructor Details

#initialize(template_name, description, option_settings, solution_stack_name) ⇒ CfEbConfigurationTemplate

Returns a new instance of CfEbConfigurationTemplate.



7
8
9
10
11
12
13
# File 'lib/cf_factory/eb/cf_eb_configuration_template.rb', line 7

def initialize(template_name, description, option_settings, solution_stack_name)
  @template_name = template_name
  @description = description
  @option_settings = option_settings
  @solution_stack_name = solution_stack_name
  validate
end

Instance Method Details

#generate_refObject



23
24
25
# File 'lib/cf_factory/eb/cf_eb_configuration_template.rb', line 23

def generate_ref
  "{ \"Ref\" : \"#{@template_name}\" }"
end

#get_cf_attributesObject



15
16
17
18
19
20
21
# File 'lib/cf_factory/eb/cf_eb_configuration_template.rb', line 15

def get_cf_attributes
  { "TemplateName" => @template_name,
    "Description" => @description,
    "OptionSettings" => "[" + (@option_settings.map {|opt| opt.generate}).join(',') + "]",
    "SolutionStackName" => SUPPORTED_STACK_NAMES[@solution_stack_name] 
  }
end

#get_template_nameObject



27
28
29
# File 'lib/cf_factory/eb/cf_eb_configuration_template.rb', line 27

def get_template_name
  @template_name
end

#validateObject

Raises:

  • (Exception)


31
32
33
# File 'lib/cf_factory/eb/cf_eb_configuration_template.rb', line 31

def validate
  raise Exception.new("stack name not supported: #{@solution_stack_name}") unless is_valid_stack?(@solution_stack_name)
end