heat.engine.hot.functions module

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

Bases: heat.engine.hot.functions.ConditionBoolean

A function that acts as an AND operator on conditions.

Takes the form:

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.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.ConditionBoolean(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

Abstract parent class of boolean condition functions.

class heat.engine.hot.functions.Contains(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for checking whether specific value is in sequence.

Takes the form:

contains:
  - <value>
  - <sequence>

The value can be any type that you want to check. Returns true if the specific value is in the sequence, otherwise returns false.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.Digest(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for performing digest operations.

Takes the form:

digest:
  - <algorithm>
  - <value>

Valid algorithms are the ones provided by natively by hashlib (md5, sha1, sha224, sha256, sha384, and sha512) or any one provided by OpenSSL.

digest(algorithm, value)[source]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

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

Bases: heat.engine.function.Function

A function for comparing whether two values are equal.

Takes the form:

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.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.Filter(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for filtering out values from lists.

Takes the form:

filter:
  - <values>
  - <list>

Returns a new list without the values.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

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

Bases: heat.engine.hot.functions.GetAttThenSelect

A function for resolving resource attributes.

Takes the form:

get_attr:
  - <resource_name>
  - <attribute_name>
  - <path1>
  - ...
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.GetAttAllAttributes(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.GetAtt

A function for resolving resource attributes.

Takes the form:

get_attr:
  - <resource_name>
  - <attributes_name>
  - <path1>
  - ...

where <attributes_name> and <path1>, … are optional arguments. If there is no <attributes_name>, result will be dict of all resource’s attributes. Else function returns resolved resource’s attribute.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.GetAttThenSelect(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for resolving resource attributes.

Takes the form:

get_attr:
  - <resource_name>
  - <attribute_name>
  - <path1>
  - ...
all_dep_attrs()[source]

Return resource, attribute name pairs of all attributes referenced.

Return an iterator over the resource name, attribute name tuples of all attributes that this function references.

The special value heat.engine.attributes.ALL_ATTRIBUTES may be used to indicate that all attributes of the resource are required.

By default this calls the dep_attrs() method, but subclasses can override to provide a more efficient implementation.

dep_attrs(resource_name)[source]

Return the attributes of the specified resource that are referenced.

Return an iterator over any attributes of the specified resource that this function references.

The special value heat.engine.attributes.ALL_ATTRIBUTES may be used to indicate that all attributes of the resource are required.

dependencies(path)[source]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

validate()[source]

Validate arguments without resolving the function.

Function subclasses must override this method to validate their args.

class heat.engine.hot.functions.GetFile(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for including a file inline.

Takes the form:

get_file: <file_key>

And resolves to the content stored in the files dictionary under the given key.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.GetParam(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for resolving parameter references.

Takes the form:

get_param: <param_name>

or:

get_param:
  - <param_name>
  - <path1>
  - ...
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.GetResource(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for resolving resource references.

Takes the form:

get_resource: <resource_name>
dependencies(path)[source]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.If(stack, fn_name, raw_args, parse_func, template)[source]

Bases: heat.engine.function.Macro

A function to return corresponding value based on condition evaluation.

Takes the form:

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.

parse_args(parse_func)[source]

Parse the macro using the supplied parsing function.

Macro subclasses should override this method to control parsing of the arguments.

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

Bases: heat.engine.function.Function

A function for joining strings.

Takes the form:

list_join:
  - <delim>
  - - <string_1>
    - <string_2>
    - ...

And resolves to:

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

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.JoinMultiple(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for joining one or more lists of strings.

Takes the form:

list_join:
  - <delim>
  - - <string_1>
    - <string_2>
    - ...
  - - ...

And resolves to:

"<string_1><delim><string_2><delim>..."

Optionally multiple lists may be specified, which will also be joined.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.ListConcat(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for extending lists.

Takes the form:

list_concat:
  - [<value 1>, <value 2>]
  - [<value 3>, <value 4>]

And resolves to:

[<value 1>, <value 2>, <value 3>, <value 4>]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.ListConcatUnique(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.ListConcat

A function for extending lists with unique items.

list_concat_unique is identical to the list_concat function, only contains unique items in retuning list.

class heat.engine.hot.functions.MakeURL(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for performing substitutions on maps.

Takes the form:

make_url:
  scheme: <protocol>
  username: <username>
  password: <password>
  host: <hostname or IP>
  port: <port>
  path: <path>
  query:
    <key1>: <value1>
  fragment: <fragment>

And resolves to a correctly-escaped URL constructed from the various components.

FRAGMENT = 'fragment'
HOST = 'host'
PASSWORD = 'password'
PATH = 'path'
PORT = 'port'
QUERY = 'query'
SCHEME = 'scheme'
USERNAME = 'username'
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

validate()[source]

Validate arguments without resolving the function.

Function subclasses must override this method to validate their args.

class heat.engine.hot.functions.MapMerge(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for merging maps.

Takes the form:

map_merge:
  - <k1>: <v1>
    <k2>: <v2>
  - <k1>: <v3>

And resolves to:

{"<k1>": "<v3>", "<k2>": "<v2>"}
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.MapReplace(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for performing substitutions on maps.

Takes the form:

map_replace:
  - <k1>: <v1>
    <k2>: <v2>
  - keys:
      <k1>: <K1>
    values:
      <v2>: <V2>

And resolves to:

{"<K1>": "<v1>", "<k2>": "<V2>"}
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

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

Bases: heat.engine.hot.functions.ConditionBoolean

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

Takes the form:

not: <condition>

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

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

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

Bases: heat.engine.hot.functions.ConditionBoolean

A function that acts as an OR operator on conditions.

Takes the form:

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.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.Removed(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

This function existed in previous versions of HOT, but has been removed.

Check the HOT guide for an equivalent native function.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

validate()[source]

Validate arguments without resolving the function.

Function subclasses must override this method to validate their args.

class heat.engine.hot.functions.Repeat(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for iterating over a list of items.

Takes the form:

repeat:
    template:
        <body>
    for_each:
        <var>: <list>

The result is a new list of the same size as <list>, where each element is a copy of <body> with any occurrences of <var> replaced with the corresponding item of <list>.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

validate()[source]

Validate arguments without resolving the function.

Function subclasses must override this method to validate their args.

class heat.engine.hot.functions.RepeatWithMap(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.Repeat

A function for iterating over a list of items or a dict of keys.

Takes the form:

repeat:
    template:
        <body>
    for_each:
        <var>: <list> or <dict>

The result is a new list of the same size as <list> or <dict>, where each element is a copy of <body> with any occurrences of <var> replaced with the corresponding item of <list> or key of <dict>.

class heat.engine.hot.functions.RepeatWithNestedLoop(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.RepeatWithMap

A function for iterating over a list of items or a dict of keys.

Takes the form:

repeat:
    template:
        <body>
    for_each:
        <var>: <list> or <dict>

The result is a new list of the same size as <list> or <dict>, where each element is a copy of <body> with any occurrences of <var> replaced with the corresponding item of <list> or key of <dict>.

This function also allows to specify ‘permutations’ to decide whether to iterate nested the over all the permutations of the elements in the given lists.

Takes the form:

repeat:
  template:
    var: %var%
    bar: %bar%
  for_each:
    %var%: <list1>
    %bar%: <list2>
  permutations: false

If ‘permutations’ is not specified, we set the default value to true to compatible with before behavior. The args have to be lists instead of dicts if ‘permutations’ is False because keys in a dict are unordered, and the list args all have to be of the same length.

class heat.engine.hot.functions.Replace(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for performing string substitutions.

Takes the form:

str_replace:
  template: <key_1> <key_2>
  params:
    <key_1>: <value_1>
    <key_2>: <value_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.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.ReplaceJson(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.Replace

A function for performing string substitutions.

Takes the form:

str_replace:
  template: <key_1> <key_2>
  params:
    <key_1>: <value_1>
    <key_2>: <value_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.

Non-string param values (e.g maps or lists) are serialized as JSON before being substituted in.

class heat.engine.hot.functions.ReplaceJsonStrict(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.ReplaceJson

A function for performing string substitutions.

str_replace_strict is identical to the str_replace function, only a ValueError is raised if any of the params are not present in the template.

class heat.engine.hot.functions.ReplaceJsonVeryStrict(stack, fn_name, args)[source]

Bases: heat.engine.hot.functions.ReplaceJsonStrict

A function for performing string substitutions.

str_replace_vstrict is identical to the str_replace_strict function, only a ValueError is raised if any of the params are None or empty.

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

Bases: heat.engine.function.Function

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:

resource_facade: <attribute_type>

where the valid attribute types are “metadata”, “deletion_policy” and “update_policy”.

DELETION_POLICY = 'deletion_policy'
METADATA = 'metadata'
UPDATE_POLICY = 'update_policy'
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.StrSplit(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for splitting delimited strings into a list.

Optionally extracting a specific list member by index.

Takes the form:

str_split:
  - <delimiter>
  - <string>
  - <index>

If <index> is specified, the specified list item will be returned otherwise, the whole list is returned, similar to get_attr with path based attributes accessing lists.

result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

class heat.engine.hot.functions.Yaql(stack, fn_name, args)[source]

Bases: heat.engine.function.Function

A function for executing a yaql expression.

Takes the form:

yaql:
    expression:
        <body>
    data:
        <var>: <list>

Evaluates expression <body> on the given data.

classmethod get_yaql_parser()[source]
result()[source]

Return the result of resolving the function.

Function subclasses must override this method to calculate their results.

validate()[source]

Validate arguments without resolving the function.

Function subclasses must override this method to validate their args.