The heat.engine.translation Module

The heat.engine.translation Module

class heat.engine.translation.Translation(properties=None)[source]

Bases: object

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, template=None)[source]
cast_key_to_rule(key)[source]
has_translation(key)[source]
is_deleted(key)[source]
is_replaced(key)[source]
replace(key, replace_rule, prop_value=None, prop_data=None, validate=False, template=None)[source]
set_rules(rules, client_resolve=True)[source]
translate(key, prop_value=None, prop_data=None, validate=False, template=None)[source]
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')
get_value_absolute_path(full_value_name=False)[source]
validate()[source]
heat.engine.translation.get_value(path, props, validate=False, template=None)[source]
heat.engine.translation.resolve_and_find(value, cplugin, finder, entity=None)[source]
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.