Class: ParameterSubstitution

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn-model/parser/parameter_substitution.rb

Constant Summary collapse

PARAMETER_KEY =
'ParameterKey'
PARAMETER_VALUE =
'ParameterValue'
PARAMETERS =
'Parameters'

Instance Method Summary collapse

Instance Method Details

#apply_parameter_values(cfn_model, parameter_values_json) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cfn-model/parser/parameter_substitution.rb', line 10

def apply_parameter_values(cfn_model, parameter_values_json)
  unless parameter_values_json.nil?
    parameter_values = JSON.load parameter_values_json
    if is_aws_format?(parameter_values)
      parameter_values = convert_aws_to_legacy_format(parameter_values)
    elsif !is_legacy_format?(parameter_values)
      format_error = "JSON parameters must be a dictionary with key \"#{PARAMETERS}\" "\
                     "or an array of ParameterKey/ParameterValue dictionaries"
      raise JSON::ParserError.new(format_error)
    end
    apply_parameter_values_impl cfn_model, parameter_values
  end
end