Module: Convection::DSL::IntrinsicFunctions

Included in:
Helpers, Model::Template
Defined in:
lib/convection/dsl/intrinsic_functions.rb

Overview

Formatting helpers for Intrinsic Functions

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/convection/dsl/intrinsic_functions.rb', line 8

def self.included(base)
  mixers << base

  super
end

.mixersObject



14
15
16
# File 'lib/convection/dsl/intrinsic_functions.rb', line 14

def self.mixers
  @mixers ||= Set.new
end

Instance Method Details

#base64(content) ⇒ Object



18
19
20
21
22
# File 'lib/convection/dsl/intrinsic_functions.rb', line 18

def base64(content)
  {
    'Fn::Base64' => content
  }
end

#find_in_map(map_name, key_1, key_2) ⇒ Object



72
73
74
75
76
# File 'lib/convection/dsl/intrinsic_functions.rb', line 72

def find_in_map(map_name, key_1, key_2)
  {
    'Fn::FindInMap' => [map_name, key_1, key_2]
  }
end

#fn_and(*conditions) ⇒ Object



24
25
26
27
28
# File 'lib/convection/dsl/intrinsic_functions.rb', line 24

def fn_and(*conditions)
  {
    'Fn::And' => conditions
  }
end

#fn_equals(value_1, value_2) ⇒ Object



30
31
32
33
34
# File 'lib/convection/dsl/intrinsic_functions.rb', line 30

def fn_equals(value_1, value_2)
  {
    'Fn::Equals' => [value_1, value_2]
  }
end

#fn_if(condition, value_true, value_false) ⇒ Object



36
37
38
39
40
# File 'lib/convection/dsl/intrinsic_functions.rb', line 36

def fn_if(condition, value_true, value_false)
  {
    'Fn::If' => [condition, value_true, value_false]
  }
end

#fn_import_value(value) ⇒ Object



42
43
44
45
46
# File 'lib/convection/dsl/intrinsic_functions.rb', line 42

def fn_import_value(value)
  {
    'Fn::ImportValue' => value
  }
end

#fn_not(condition) ⇒ Object



48
49
50
51
52
# File 'lib/convection/dsl/intrinsic_functions.rb', line 48

def fn_not(condition)
  {
    'Fn::Not' => [condition]
  }
end

#fn_or(*conditions) ⇒ Object



54
55
56
57
58
# File 'lib/convection/dsl/intrinsic_functions.rb', line 54

def fn_or(*conditions)
  {
    'Fn::Or' => conditions
  }
end

#fn_ref(resource) ⇒ Object



102
103
104
105
106
# File 'lib/convection/dsl/intrinsic_functions.rb', line 102

def fn_ref(resource)
  {
    'Ref' => resource
  }
end

#fn_sub(str, *vars) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/convection/dsl/intrinsic_functions.rb', line 60

def fn_sub(str, *vars)
  if vars && !vars.empty?
    {
      'Fn::Sub' => [str, vars]
    }
  else
    {
      'Fn::Sub' => str
    }
  end
end

#get_att(resource, attr_name) ⇒ Object



78
79
80
81
82
# File 'lib/convection/dsl/intrinsic_functions.rb', line 78

def get_att(resource, attr_name)
  {
    'Fn::GetAtt' => [resource, attr_name]
  }
end

#get_azs(region) ⇒ Object



84
85
86
87
88
# File 'lib/convection/dsl/intrinsic_functions.rb', line 84

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

#join(delimiter, *values) ⇒ Object



90
91
92
93
94
# File 'lib/convection/dsl/intrinsic_functions.rb', line 90

def join(delimiter, *values)
  {
    'Fn::Join' => [delimiter, values]
  }
end

#select(index, *objects) ⇒ Object



96
97
98
99
100
# File 'lib/convection/dsl/intrinsic_functions.rb', line 96

def select(index, *objects)
  {
    'Fn::Select' => [index, objects]
  }
end