heat.engine.cfn.functions module

class heat.engine.cfn.functions.And(stack, fn_name, args)[source]

Bases: And

A function that acts as an AND operator on conditions.

Takes the form:

{ "Fn::And" : [ "<condition_1>", "<condition_2>", ... ] }

Returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false. The minimum number of conditions that you can include is 2.

class heat.engine.cfn.functions.Base64(stack, fn_name, args)[source]

Bases: Function

A placeholder function for converting to base64.

Takes the form:

{ "Fn::Base64" : "<string>" }

This function actually performs no conversion. It is included for the benefit of templates that convert UserData to Base64. Heat accepts UserData in plain text.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.cfn.functions.Equals(stack, fn_name, args)[source]

Bases: Equals

A function for comparing whether two values are equal.

Takes the form:

{ "Fn::Equals" : [ "<value_1>", "<value_2>" ] }

The value can be any type that you want to compare. Returns true if the two values are equal or false if they aren’t.

class heat.engine.cfn.functions.FindInMap(stack, fn_name, args)[source]

Bases: Function

A function for resolving keys in the template mappings.

Takes the form:

{ "Fn::FindInMap" : [ "mapping",
                      "key",
                      "value" ] }
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.cfn.functions.GetAZs(stack, fn_name, args)[source]

Bases: Function

A function for retrieving the availability zones.

Takes the form:

{ "Fn::GetAZs" : "<region>" }
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.cfn.functions.GetAtt(stack, fn_name, args)[source]

Bases: GetAttThenSelect

A function for resolving resource attributes.

Takes the form:

{ "Fn::GetAtt" : [ "<resource_name>",
                   "<attribute_name>" ] }
class heat.engine.cfn.functions.If(stack, fn_name, raw_args, parse_func, template)[source]

Bases: If

A function to return corresponding value based on condition evaluation.

Takes the form:

{ "Fn::If" : [ "<condition_name>",
               "<value_if_true>",
               "<value_if_false>" ] }

The value_if_true to be returned if the specified condition evaluates to true, the value_if_false to be returned if the specified condition evaluates to false.

class heat.engine.cfn.functions.Join(stack, fn_name, args)[source]

Bases: Join

A function for joining strings.

Takes the form:

{ "Fn::Join" : [ "<delim>", [ "<string_1>", "<string_2>", ... ] ] }

And resolves to:

"<string_1><delim><string_2><delim>..."
class heat.engine.cfn.functions.MemberListToMap(stack, fn_name, args)[source]

Bases: Function

A function to convert lists with enumerated keys and values to mapping.

Takes the form:

{ 'Fn::MemberListToMap' : [ 'Name',
                            'Value',
                            [ '.member.0.Name=<key_0>',
                              '.member.0.Value=<value_0>',
                              ... ] ] }

And resolves to:

{ "<key_0>" : "<value_0>", ... }

The first two arguments are the names of the key and value.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.cfn.functions.Not(stack, fn_name, args)[source]

Bases: Not

A function that acts as a NOT operator on a condition.

Takes the form:

{ "Fn::Not" : [ "<condition>" ] }

Returns true for a condition that evaluates to false or returns false for a condition that evaluates to true.

class heat.engine.cfn.functions.Or(stack, fn_name, args)[source]

Bases: Or

A function that acts as an OR operator on conditions.

Takes the form:

{ "Fn::Or" : [ "<condition_1>", "<condition_2>", ... ] }

Returns true if any one of the specified conditions evaluate to true, or returns false if all of the conditions evaluates to false. The minimum number of conditions that you can include is 2.

class heat.engine.cfn.functions.ParamRef(stack, fn_name, args)[source]

Bases: Function

A function for resolving parameter references.

Takes the form:

{ "Ref" : "<param_name>" }
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

heat.engine.cfn.functions.Ref(stack, fn_name, args)[source]

A function for resolving parameters or resource references.

Takes the form:

{ "Ref" : "<param_name>" }

or:

{ "Ref" : "<resource_name>" }
class heat.engine.cfn.functions.Replace(stack, fn_name, args)[source]

Bases: Replace

A function for performing string substitutions.

Takes the form:

{ "Fn::Replace" : [
    { "<key_1>": "<value_1>", "<key_2>": "<value_2>", ... },
    "<key_1> <key_2>"
  ] }

And resolves to:

"<value_1> <value_2>"

When keys overlap in the template, longer matches are preferred. For keys of equal length, lexicographically smaller keys are preferred.

class heat.engine.cfn.functions.ResourceFacade(stack, fn_name, args)[source]

Bases: ResourceFacade

A function for retrieving data in a parent provider template.

A function for obtaining data from the facade resource from within the corresponding provider template.

Takes the form:

{ "Fn::ResourceFacade": "<attribute_type>" }

where the valid attribute types are “Metadata”, “DeletionPolicy” and “UpdatePolicy”.

DELETION_POLICY = 'DeletionPolicy'
METADATA = 'Metadata'
UPDATE_POLICY = 'UpdatePolicy'
class heat.engine.cfn.functions.Select(stack, fn_name, args)[source]

Bases: Function

A function for selecting an item from a list or map.

Takes the form (for a list lookup):

{ "Fn::Select" : [ "<index>", [ "<value_1>", "<value_2>", ... ] ] }

or (for a map lookup):

{ "Fn::Select" : [ "<index>", { "<key_1>": "<value_1>", ... } ] }

If the selected index is not found, this function resolves to an empty string.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.cfn.functions.Split(stack, fn_name, args)[source]

Bases: Function

A function for splitting strings.

Takes the form:

{ "Fn::Split" : [ "<delim>", "<string_1><delim><string_2>..." ] }

And resolves to:

[ "<string_1>", "<string_2>", ... ]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.