Class: Cfhighlander::Dsl::DslBase
- Inherits:
-
Object
- Object
- Cfhighlander::Dsl::DslBase
show all
- Defined in:
- lib/cfhighlander.dsl.base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#AWSAccountId ⇒ Object
-
#AWSNotificationARNs ⇒ Object
-
#AWSNoValue ⇒ Object
-
#AWSPartition ⇒ Object
-
#AWSStackName ⇒ Object
-
#AWSStackRegion ⇒ Object
-
#AWSURLSuffix ⇒ Object
-
#cfmap(map, key, attr) ⇒ Object
-
#cfout(resource, output = nil) ⇒ Object
-
#FindInMap(map, key, attr) ⇒ Object
-
#FnAnd(*args) ⇒ Object
-
#FnBase64(value) ⇒ Object
-
#FnCidr(ip_block, count, sizeMask) ⇒ Object
-
#FnEquals(val1, val2) ⇒ Object
-
#FnFindInMap(map, key, attr) ⇒ Object
-
#FnGetAtt(resource, property) ⇒ Object
-
#FnGetAZs(region = nil) ⇒ Object
-
#FnIf(condition, true_branch, false_branch) ⇒ Object
logic intrinsic functions.
-
#FnImportValue(value) ⇒ Object
-
#FnJoin(glue, pieces) ⇒ Object
-
#FnNot(condition) ⇒ Object
-
#FnOr(*args) ⇒ Object
-
#FnSelect(index, list) ⇒ Object
-
#FnSplit(delimiter, source) ⇒ Object
-
#FnSub(string, replacementMap = nil) ⇒ Object
-
#GetAtt(resource, property) ⇒ Object
-
#initialize(parent) ⇒ DslBase
constructor
A new instance of DslBase.
-
#method_missing(method, *args) ⇒ Object
-
#Ref(resource) ⇒ Object
Constructor Details
#initialize(parent) ⇒ DslBase
Returns a new instance of DslBase.
146
147
148
|
# File 'lib/cfhighlander.dsl.base.rb', line 146
def initialize (parent)
@config = parent.config unless parent.nil?
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
150
151
152
153
154
155
156
|
# File 'lib/cfhighlander.dsl.base.rb', line 150
def method_missing(method, *args)
if @config.nil?
raise StandardError, "#{self} no config!"
end
raise StandardError, "#{self} Unknown method or variable #{method} in Cfhighlander template"
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6
7
8
|
# File 'lib/cfhighlander.dsl.base.rb', line 6
def config
@config
end
|
Instance Method Details
#AWSAccountId ⇒ Object
70
71
72
|
# File 'lib/cfhighlander.dsl.base.rb', line 70
def AWSAccountId
return Ref('AWS::AccountId')
end
|
#AWSNotificationARNs ⇒ Object
86
87
88
|
# File 'lib/cfhighlander.dsl.base.rb', line 86
def AWSNotificationARNs
return Ref('AWS::NotificationARNs')
end
|
#AWSNoValue ⇒ Object
82
83
84
|
# File 'lib/cfhighlander.dsl.base.rb', line 82
def AWSNoValue
return Ref('AWS::NoValue')
end
|
#AWSPartition ⇒ Object
78
79
80
|
# File 'lib/cfhighlander.dsl.base.rb', line 78
def AWSPartition
return Ref('AWS::Partition')
end
|
#AWSStackName ⇒ Object
66
67
68
|
# File 'lib/cfhighlander.dsl.base.rb', line 66
def AWSStackName
return Ref('AWS::StackName')
end
|
#AWSStackRegion ⇒ Object
62
63
64
|
# File 'lib/cfhighlander.dsl.base.rb', line 62
def AWSStackRegion
return Ref('AWS::Region')
end
|
#AWSURLSuffix ⇒ Object
74
75
76
|
# File 'lib/cfhighlander.dsl.base.rb', line 74
def AWSURLSuffix
return Ref('AWS::URLSuffix')
end
|
#cfmap(map, key, attr) ⇒ Object
141
142
143
|
# File 'lib/cfhighlander.dsl.base.rb', line 141
def cfmap(map, key, attr)
return FindInMap(map, key, attr)
end
|
#cfout(resource, output = nil) ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/cfhighlander.dsl.base.rb', line 126
def cfout(resource, output = nil)
if output.nil?
parts = resource.split('.')
if parts.size() != 2
raise "cfout('#{resource}'): If cfout given single argument cfout('component.OutputName') syntax must be used"
else
resource = parts[0]
output = parts[1]
end
end
return GetAtt(resource, "Outputs.#{output}")
end
|
#FindInMap(map, key, attr) ⇒ Object
122
123
124
|
# File 'lib/cfhighlander.dsl.base.rb', line 122
def FindInMap(map, key, attr)
return FnFindInMap(map, key, attr)
end
|
#FnAnd(*args) ⇒ Object
95
96
97
|
# File 'lib/cfhighlander.dsl.base.rb', line 95
def FnAnd(*args)
return { 'Fn::And' => args }
end
|
#FnBase64(value) ⇒ Object
57
58
59
|
# File 'lib/cfhighlander.dsl.base.rb', line 57
def FnBase64(value)
return { 'Fn::Base64' => value }
end
|
#FnCidr(ip_block, count, sizeMask) ⇒ Object
53
54
55
|
# File 'lib/cfhighlander.dsl.base.rb', line 53
def FnCidr(ip_block, count, sizeMask)
return { 'Fn::Cidr' => [ip_block, count, sizeMask] }
end
|
#FnEquals(val1, val2) ⇒ Object
99
100
101
|
# File 'lib/cfhighlander.dsl.base.rb', line 99
def FnEquals(val1, val2)
return { 'Fn::Equals' => [val1, val2] }
end
|
#FnFindInMap(map, key, attr) ⇒ Object
118
119
120
|
# File 'lib/cfhighlander.dsl.base.rb', line 118
def FnFindInMap(map, key, attr)
return { 'Fn::FindInMap' => [map, key, attr] }
end
|
#FnGetAtt(resource, property) ⇒ Object
14
15
16
17
18
|
# File 'lib/cfhighlander.dsl.base.rb', line 14
def FnGetAtt(resource, property)
return {
'Fn::GetAtt' => [resource, property]
}
end
|
#FnGetAZs(region = nil) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/cfhighlander.dsl.base.rb', line 46
def FnGetAZs(region = nil)
if region.nil?
region = AWSStackRegion()
end
return { 'Fn::GetAZs' => region }
end
|
#FnIf(condition, true_branch, false_branch) ⇒ Object
logic intrinsic functions
91
92
93
|
# File 'lib/cfhighlander.dsl.base.rb', line 91
def FnIf(condition, true_branch, false_branch)
return { 'Fn::If' => [condition, true_branch, false_branch] }
end
|
#FnImportValue(value) ⇒ Object
20
21
22
23
24
|
# File 'lib/cfhighlander.dsl.base.rb', line 20
def FnImportValue(value)
return {
'Fn::ImportValue' => value
}
end
|
#FnJoin(glue, pieces) ⇒ Object
38
39
40
|
# File 'lib/cfhighlander.dsl.base.rb', line 38
def FnJoin(glue, pieces)
return { 'Fn::Join' => [glue, pieces]}
end
|
#FnNot(condition) ⇒ Object
103
104
105
|
# File 'lib/cfhighlander.dsl.base.rb', line 103
def FnNot(condition)
return { 'Fn::Not' => [condition] }
end
|
#FnOr(*args) ⇒ Object
107
108
109
|
# File 'lib/cfhighlander.dsl.base.rb', line 107
def FnOr(*args)
return { 'Fn::Or' => args }
end
|
#FnSelect(index, list) ⇒ Object
42
43
44
|
# File 'lib/cfhighlander.dsl.base.rb', line 42
def FnSelect(index, list)
return { 'Fn::Select' => [index, list] }
end
|
#FnSplit(delimiter, source) ⇒ Object
34
35
36
|
# File 'lib/cfhighlander.dsl.base.rb', line 34
def FnSplit(delimiter, source)
return { 'Fn::Split' => [delimiter, source] }
end
|
#FnSub(string, replacementMap = nil) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/cfhighlander.dsl.base.rb', line 26
def FnSub(string, replacementMap = nil)
if replacementMap.nil?
return { 'Fn::Sub' => string }
else
return { 'Fn::Sub' => [string, replacementMap] }
end
end
|
#GetAtt(resource, property) ⇒ Object
10
11
12
|
# File 'lib/cfhighlander.dsl.base.rb', line 10
def GetAtt(resource, property)
return FnGetAtt(resource, property)
end
|
#Ref(resource) ⇒ Object
112
113
114
115
116
|
# File 'lib/cfhighlander.dsl.base.rb', line 112
def Ref(resource)
return {
'Ref' => resource
}
end
|