Class: CfnParser
- Inherits:
-
Object
- Object
- CfnParser
- Defined in:
- lib/cfn-model/parser/cfn_parser.rb
Overview
This class is the heart of the matter. It will take a CloudFormation template and return a CfnModel object to represent the underlying document in a way that is hopefully more convenient for (cfn-nag rule) developers to work with
Instance Method Summary collapse
-
#parse(cloudformation_yml, parameter_values_json = nil) ⇒ Object
Given raw json/yml CloudFormation template, returns a CfnModel object or raise ParserErrors if something is amiss with the format.
Instance Method Details
#parse(cloudformation_yml, parameter_values_json = nil) ⇒ Object
Given raw json/yml CloudFormation template, returns a CfnModel object or raise ParserErrors if something is amiss with the format
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cfn-model/parser/cfn_parser.rb', line 33 def parse(cloudformation_yml, parameter_values_json=nil) cfn_hash = pre_validate_model cloudformation_yml cfn_model = CfnModel.new cfn_model.raw_model = cfn_hash # pass 1: wire properties into ModelElement objects transform_hash_into_model_elements cfn_hash, cfn_model transform_hash_into_parameters cfn_hash, cfn_model # pass 2: tie together separate resources only where necessary to make life easier for rule logic post_process_resource_model_elements cfn_model apply_parameter_values(cfn_model, parameter_values_json) cfn_model end |