The heat.engine.constraints ModuleΒΆ

class heat.engine.constraints.AllowedPattern(pattern, description=None)[source]

Bases: heat.engine.constraints.Constraint

Constrain values to a predefined regular expression pattern.

Serialises to JSON as:

{
    'allowed_pattern': <pattern>,
    'description': <description>
}
AllowedPattern.valid_types = ('STRING',)
class heat.engine.constraints.AllowedValues(allowed, description=None)[source]

Bases: heat.engine.constraints.Constraint

Constrain values to a predefined set.

Serialises to JSON as:

{
    'allowed_values': [<allowed1>, <allowed2>, ...],
    'description': <description>
}
AllowedValues.valid_types = ('STRING', 'INTEGER', 'NUMBER', 'BOOLEAN', 'LIST')
class heat.engine.constraints.AnyIndexDict(value)[source]

Bases: _abcoll.Mapping

A Mapping that returns the same value for any integer index.

Used for storing the schema for a list. When converted to a dictionary, it contains a single item with the key ‘*’.

AnyIndexDict.ANYTHING = '*'
class heat.engine.constraints.Constraint(description=None)[source]

Bases: _abcoll.Mapping

Parent class for constraints on allowable values for a Property.

Constraints are serialisable to dictionaries following the HOT input Parameter constraints schema using dict().

Constraint.DESCRIPTION = 'description'
Constraint.validate(value, context=None)[source]
class heat.engine.constraints.CustomConstraint(name, description=None, environment=None)[source]

Bases: heat.engine.constraints.Constraint

A constraint delegating validation to an external class.

CustomConstraint.custom_constraint[source]
CustomConstraint.valid_types = ('STRING', 'INTEGER', 'NUMBER', 'BOOLEAN', 'LIST')
exception heat.engine.constraints.InvalidSchemaError[source]

Bases: exceptions.Exception

class heat.engine.constraints.Length(min=None, max=None, description=None)[source]

Bases: heat.engine.constraints.Range

Constrain the length of values within a range.

Serialises to JSON as:

{
    'length': {'min': <min>, 'max': <max>},
    'description': <description>
}
Length.valid_types = ('STRING', 'LIST', 'MAP')
class heat.engine.constraints.Range(min=None, max=None, description=None)[source]

Bases: heat.engine.constraints.Constraint

Constrain values within a range.

Serialises to JSON as:

{
    'range': {'min': <min>, 'max': <max>},
    'description': <description>
}
Range.MAX = 'max'
Range.MIN = 'min'
Range.valid_types = ('INTEGER', 'NUMBER')
class heat.engine.constraints.Schema(data_type, description=None, default=None, schema=None, required=False, constraints=[], label=None)[source]

Bases: _abcoll.Mapping

Schema base class for validating properties or parameters.

Schema objects are serialisable to dictionaries following a superset of the HOT input Parameter schema using dict().

Serialises to JSON in the form:

{
    'type': 'list',
    'required': False
    'constraints': [
        {
            'length': {'min': 1},
            'description': 'List must not be empty'
        }
    ],
    'schema': {
        '*': {
            'type': 'string'
        }
    },
    'description': 'An example list property.'
}
Schema.BOOLEAN = 'Boolean'
Schema.BOOLEAN_TYPE = 'BOOLEAN'
Schema.CONSTRAINTS = 'constraints'
Schema.DEFAULT = 'default'
Schema.DESCRIPTION = 'description'
Schema.INTEGER = 'Integer'
Schema.INTEGER_TYPE = 'INTEGER'
Schema.KEYS = ('type', 'description', 'default', 'schema', 'required', 'constraints')
Schema.LIST = 'List'
Schema.LIST_TYPE = 'LIST'
Schema.MAP = 'Map'
Schema.MAP_TYPE = 'MAP'
Schema.NUMBER = 'Number'
Schema.NUMBER_TYPE = 'NUMBER'
Schema.REQUIRED = 'required'
Schema.SCHEMA = 'schema'
Schema.STRING = 'String'
Schema.STRING_TYPE = 'STRING'
Schema.TYPE = 'type'
Schema.TYPES = ('Integer', 'String', 'Number', 'Boolean', 'Map', 'List')
Schema.TYPE_KEYS = ('INTEGER', 'STRING', 'NUMBER', 'BOOLEAN', 'MAP', 'LIST')
Schema.set_default(default=None)[source]

Set the default value for this Schema object.

static Schema.str_to_num(value)[source]

Convert a string representation of a number into a numeric type.

Schema.validate_constraints(value, context=None)[source]

Previous topic

The heat.engine.signal_responder Module

Next topic

The heat.engine.plugin_manager Module

This Page