The heat.engine.translation Module

class heat.engine.translation.TranslationRule(properties, rule, translation_path, value=None, value_name=None, value_path=None, client_plugin=None, finder=None, entity=None, custom_value_path=None)[source]

Bases: object

Translating mechanism one properties to another.

Mechanism uses list of rules, each defines by this class, and can be executed. Working principe: during resource creating after properties defining resource take list of rules, specified by method translation_rules, which should be overloaded for each resource, if it’s needed, and execute each rule using translate_properties method. Next operations are allowed:

  • ADD. This rule allows to add some value to list-type properties. Only

    list-type values can be added to such properties. Using for other cases is prohibited and will be returned with error.

  • REPLACE. This rule allows to replace some property value to another. Used

    for all types of properties. Note, that if property has list type, then value will be replaced for all elements of list, where it needed. If element in such property must be replaced by value of another element of this property, value_name must be defined.

  • DELETE. This rule allows to delete some property. If property has list

    type, then deleting affects value in all list elements.

  • RESOLVE. This rule allows to resolve some property using client and

    the finder function. Finders may require an additional entity key.

ADD = 'Add'
DELETE = 'Delete'
REPLACE = 'Replace'
RESOLVE = 'Resolve'
RULE_KEYS = ('Add', 'Replace', 'Delete', 'Resolve')
execute_rule(client_resolve=True, ignore_resolve_error=False)[source]
resolve_custom_value_path(translation_data, translation_key)[source]
translate_property(path, data, return_value=False, value=None, value_data=None, value_key=None, client_resolve=True, ignore_resolve_error=False)[source]
validate()[source]