- class heat.engine.translation.Translation(properties=None)¶
Mechanism for translating one properties to other.
Mechanism allows to handle properties - update deprecated/hidden properties to new, resolve values, remove unnecessary. It uses list of TranslationRule objects as rules for translation.
- add(key, add_rule, prop_value=None, prop_data=None, validate=False)¶
- replace(key, replace_rule, prop_value=None, prop_data=None, validate=False)¶
- set_rules(rules, client_resolve=True, ignore_resolve_error=False)¶
- translate(key, prop_value=None, prop_data=None, validate=False)¶
- 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)¶
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')¶
- heat.engine.translation.get_value(path, props, validate=False)¶
- heat.engine.translation.resolve_and_find(value, cplugin, finder, entity=None, ignore_resolve_error=False)¶