class BBC::Cosmos::Tools::Types::Cfndsl

Public Class Methods

new(id, options, config) click to toggle source
# File lib/bbc/cosmos/tools/types/cfndsl.rb, line 8
def initialize(id, options, config)
  @id      = id
  @options = options
  @config  = config
end

Public Instance Methods

generate_data(to_json = false) click to toggle source
# File lib/bbc/cosmos/tools/types/cfndsl.rb, line 14
def generate_data(to_json = false)
  # Because the block is evaluated in the context of another class
  # i.e. instance_eval &block
  # we need to store off the values first and *then* reference them inside the block
  component_identifier = @options[:group].nil? ? @id : @options[:group]
  config = @config
  stack = @options[:stack]

  Tools::Cloudformation::Generator.create(@id, @config, @options, to_json) do
    instance_eval config.cf_templates(component_identifier, stack)
  end
end