Class: Lono::Template::Strategy::Dsl::Builder::Section::Condition

Inherits:
Base
  • Object
show all
Defined in:
lib/lono/template/strategy/dsl/builder/section/condition.rb

Constant Summary

Constants included from Fn

Fn::FUNCTIONS

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Lono::Template::Strategy::Dsl::Builder::Stringify

#stringify!

Methods included from Helpers::TagsHelper

#dimensions, #tag_list, #tags

Methods included from Helpers::S3Helper

#file_s3_key, #s3_bucket

Methods included from Helpers::LookupHelper

#lookup_output

Methods included from AwsServices

#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts

Methods included from AwsServices::Helper

#rollback_complete?, #testing_update?

Methods included from AwsServices::StackSet

#find_stack_set, #stack_set_exists?

Methods included from AwsServices::Stack

#find_stack, #stack_exists?

Methods included from Helpers::FileHelper

#content, #render_file, #render_path, #user_data, #user_data_script

Methods included from Helpers::CoreHelper

#setting, #stack_name

Methods included from Fn

#conditional_ref, define_methods, #fn, #fn_id, #get_att, #get_azs, included, #join, #ref, #sub

Constructor Details

This class inherits a constructor from Lono::Template::Strategy::Dsl::Builder::Section::Base

Instance Method Details

#standarize(definition) ⇒ Object

There are only 2 forms for condition: long and medium

Type is the only required property: amzn.to/2x8W5aD



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lono/template/strategy/dsl/builder/section/condition.rb', line 14

def standarize(definition)
  first, second, _ = definition
  if definition.size == 1 && first.is_a?(Hash) # long form
    first # pass through
  elsif definition.size == 2 && second.is_a?(Hash) # medium form
    logical_id, properties = first, second
    { logical_id => properties }
  else # I dont know what form
    raise "Invalid form provided. definition #{definition.inspect}"
  end
end

#templateObject



7
8
9
# File 'lib/lono/template/strategy/dsl/builder/section/condition.rb', line 7

def template
  camelize(standarize(@definition))
end