Module: Cfer::Core::Functions

Included in:
AWS, Fn, Stack
Defined in:
lib/cfer/core/functions.rb

Overview

Utility methods to make CloudFormation functions feel more like Ruby

Defined Under Namespace

Modules: AWS, Fn

Instance Method Summary collapse

Instance Method Details

#and(*conds) ⇒ Object



23
24
25
# File 'lib/cfer/core/functions.rb', line 23

def and(*conds)
  {"Fn::And" => conds}
end

#equals(a, b) ⇒ Object



31
32
33
# File 'lib/cfer/core/functions.rb', line 31

def equals(a, b)
  {"Fn::Equals" => [a, b]}
end

#find_in_map(map_name, key1, key2) ⇒ Object



15
16
17
# File 'lib/cfer/core/functions.rb', line 15

def find_in_map(map_name, key1, key2)
  {"Fn::FindInMap" => [map_name, key1, key2]}
end

#get_att(r, att) ⇒ Object



11
12
13
# File 'lib/cfer/core/functions.rb', line 11

def get_att(r, att)
  {"Fn::GetAtt" => [r, att]}
end

#get_azs(region) ⇒ Object



43
44
45
# File 'lib/cfer/core/functions.rb', line 43

def get_azs(region)
  {"Fn::GetAZs" => region}
end

#if(cond, t, f) ⇒ Object



35
36
37
# File 'lib/cfer/core/functions.rb', line 35

def if(cond, t, f)
  {"Fn::If" => [cond, t, f]}
end

#join(sep, *args) ⇒ Object



3
4
5
# File 'lib/cfer/core/functions.rb', line 3

def join(sep, *args)
  {"Fn::Join" => [sep, [ *args ].flatten ]}
end

#not(cond) ⇒ Object



39
40
41
# File 'lib/cfer/core/functions.rb', line 39

def not(cond)
  {"Fn::Not" => [cond]}
end

#notification_arnsObject



51
52
53
# File 'lib/cfer/core/functions.rb', line 51

def notification_arns
  ref 'AWS::NotificationARNs'
end

#or(*conds) ⇒ Object



27
28
29
# File 'lib/cfer/core/functions.rb', line 27

def or(*conds)
  {"Fn::Or" => conds}
end

#ref(r) ⇒ Object



7
8
9
# File 'lib/cfer/core/functions.rb', line 7

def ref(r)
  {"Ref" => r}
end

#select(i, o) ⇒ Object



19
20
21
# File 'lib/cfer/core/functions.rb', line 19

def select(i, o)
  {"Fn::Select" => [i, o]}
end

#sub(str, vals = {}) ⇒ Object



47
48
49
# File 'lib/cfer/core/functions.rb', line 47

def sub(str, vals = {})
  {"Fn::Sub" => [str, vals]}
end