Class: Kitchen::Driver::Aws::StackGenerator
- Inherits:
-
Object
- Object
- Kitchen::Driver::Aws::StackGenerator
- Includes:
- Logging
- Defined in:
- lib/kitchen/driver/aws/stack_generator.rb
Overview
A class for encapsulating the stack payload logic
Instance Attribute Summary collapse
-
#cf ⇒ Object
readonly
Returns the value of attribute cf.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#cf_stack_data ⇒ Object
Transform the provided config into the hash to send to AWS.
-
#initialize(config, cf) ⇒ StackGenerator
constructor
A new instance of StackGenerator.
Constructor Details
#initialize(config, cf) ⇒ StackGenerator
Returns a new instance of StackGenerator.
32 33 34 35 |
# File 'lib/kitchen/driver/aws/stack_generator.rb', line 32 def initialize(config, cf) @config = config @cf = cf end |
Instance Attribute Details
#cf ⇒ Object (readonly)
Returns the value of attribute cf.
30 31 32 |
# File 'lib/kitchen/driver/aws/stack_generator.rb', line 30 def cf @cf end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
30 31 32 |
# File 'lib/kitchen/driver/aws/stack_generator.rb', line 30 def config @config end |
Instance Method Details
#cf_stack_data ⇒ Object
Transform the provided config into the hash to send to AWS. Some fields can be passed in null, others need to be ommitted if they are null
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/kitchen/driver/aws/stack_generator.rb', line 39 def cf_stack_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize s ={:stack_name => config[:stack_name]} s[:template_url] = config[:template_url] if config[:template_file] if config[:template_file] s[:template_body] = File.open(config[:template_file], 'rb') { |file| file.read } end s[:timeout_in_minutes] = config[:timeout_in_minutes] if config[:timeout_in_minutes] != nil and config[:timeout_in_minutes]>0 s[:disable_rollback] = config[:disable_rollback] if config[:disable_rollback] != nil and config[:disable_rollback] == true or config[:disable_rollback] == false s[:parameters] = [] config[:parameters].each do |k,v| s[:parameters].push({:parameter_key => k.to_s, :parameter_value => v.to_s}) end s end |