Module: Lono::Template::Dsl::Builder::Fn
- Extended by:
- Fn
- Included in:
- Lono::Template::Dsl::Builder, Base, Fn
- Defined in:
- lib/lono/template/dsl/builder/fn.rb
Constant Summary collapse
- FUNCTIONS =
Also act as documentation on the method signatures Also used in Coder crafting so should always list all the functions here even if they are overriden with specific implementations below
{ base64: :simple, cidr: :array, find_in_map: :array, get_att: :array, # special case # get_azs: :simple, # special map to GetAZs, and default region='' import_value: :simple, # join: :array, # special case select: :array, split: :array, # sub: :array, # special case transform: :simple, # Conditional methods # Most of the condition methods need to be accessed via the modulde # since they are Ruby keywords. So Fn::if , also builder has an fn method # so they can also be called via fn::if and: :array, equals: :array, if: :array, # special case, if is a Ruby keyword , we'll use fn_if instead not: :array, or: :array, ref: :simple, }
Class Method Summary collapse
Instance Method Summary collapse
-
#fn ⇒ Object
for fn::if and fn.if to work.
- #fn_id(name) ⇒ Object
-
#get_att(*item) ⇒ Object
Examples: get_attr(“logical_id.attribute”) get_attr(“logical_id”, “attribute”) get_attr([“logical_id”, “attribute”]).
- #get_azs(region = '') ⇒ Object
- #join(delimiter, *list) ⇒ Object
-
#ref(name) ⇒ Object
special cases.
- #sub(str, vals = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
110 111 112 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 110 def self.included(base) base.extend(Fn) end |
Instance Method Details
#fn ⇒ Object
for fn::if and fn.if to work
105 106 107 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 105 def fn Fn end |
#fn_id(name) ⇒ Object
63 64 65 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 63 def fn_id(name) "Fn::#{CfnCamelizer.camelize(name)}" end |
#get_att(*item) ⇒ Object
Examples:
get_attr("logical_id.attribute")
get_attr("logical_id", "attribute")
get_attr(["logical_id", "attribute"])
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 77 def get_att(*item) item = item.flatten = item.last.is_a?(Hash) ? item.pop : {} # list is an Array list = if item.size == 1 item.first.split('.') else item end list.map!(&:camelize) unless [:autoformat] == false { "Fn::GetAtt" => list } end |
#get_azs(region = '') ⇒ Object
96 97 98 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 96 def get_azs(region='') { "Fn::GetAZs" => region } end |
#join(delimiter, *list) ⇒ Object
91 92 93 94 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 91 def join(delimiter, *list) list = list.flatten { "Fn::Join" => [delimiter, list] } end |
#ref(name) ⇒ Object
special cases
68 69 70 71 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 68 def ref(name) name = CfnCamelizer.camelize(name) { "Ref" => name } end |
#sub(str, vals = {}) ⇒ Object
100 101 102 |
# File 'lib/lono/template/dsl/builder/fn.rb', line 100 def sub(str, vals={}) { "Fn::Sub" => [str, vals] } end |