Module: CfnDsl::Functions
Instance Method Summary collapse
- #FnBase64(value) ⇒ Object
- #FnFindInMap(map, key, value) ⇒ Object
- #FnFormat(string, *arguments) ⇒ Object
- #FnGetAtt(logicalResource, attribute) ⇒ Object
- #FnGetAZs(region) ⇒ Object
- #FnJoin(string, array) ⇒ Object
- #Ref(value) ⇒ Object
Instance Method Details
#FnBase64(value) ⇒ Object
133 134 135 136 137 |
# File 'lib/cfndsl.rb', line 133 def FnBase64( value ) ## # Equivalent to the CloudFormation template built in function Fn::Base64 Fn.new("Base64", value); end |
#FnFindInMap(map, key, value) ⇒ Object
139 140 141 142 143 |
# File 'lib/cfndsl.rb', line 139 def FnFindInMap( map, key, value) ## # Equivalent to the CloudFormation template built in function Fn::FindInMap Fn.new("FindInMap", [map,key,value] ) end |
#FnFormat(string, *arguments) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/cfndsl.rb', line 163 def FnFormat(string, *arguments) ## # Usage # FnFormat( "This is a %0. It is 100%% %1","test", "effective") # # This will generate a call to Fn::Join that when evaluated will produce # the string "This is a test. It is 100% effective." # # Think of this as %0,%1, etc in the format string being replaced by the # corresponding arguments given after the format string. '%%' is replaced # by the '%' character. # # The actual Fn::Join call corresponding to the above FnFormat call would be # {"Fn::Join": ["",["This is a ","test",". It is 100","%"," ","effective"]]} array = []; string.scan( /(.*?)(%(%|\d+)|\Z)/m ) do |x,y| array.push $1 if $1 && $1 != "" if( $3 == '%' ) then array.push '%' elsif( $3 ) then array.push arguments[ $3.to_i ] end end Fn.new("Join", ["", array]) end |
#FnGetAtt(logicalResource, attribute) ⇒ Object
145 146 147 148 149 |
# File 'lib/cfndsl.rb', line 145 def FnGetAtt(logicalResource, attribute) ## # Equivalent to the CloudFormation template built in function Fn::GetAtt Fn.new( "GetAtt", [logicalResource, attribute], [logicalResource] ) end |
#FnGetAZs(region) ⇒ Object
151 152 153 154 155 |
# File 'lib/cfndsl.rb', line 151 def FnGetAZs(region) ## # Equivalent to the CloudFormation template built in function Fn::GetAZs Fn.new("GetAZs", region) end |
#FnJoin(string, array) ⇒ Object
157 158 159 160 161 |
# File 'lib/cfndsl.rb', line 157 def FnJoin(string, array) ## # Equivalent to the CloudFormation template built in function Fn::Join Fn.new("Join", [ string, array] ) end |
#Ref(value) ⇒ Object
127 128 129 130 131 |
# File 'lib/cfndsl.rb', line 127 def Ref(value) ## # Equivalent to the CloudFormation template built in function Ref RefDefinition.new(value) end |