The heat.engine.constraints ModuleΒΆ
-
class
heat.engine.constraints.AllowedPattern(pattern, description=None)[source] Bases:
heat.engine.constraints.ConstraintConstrain values to a predefined regular expression pattern.
Serialises to JSON as:
{ 'allowed_pattern': <pattern>, 'description': <description> }-
valid_types= ('STRING',)
-
-
class
heat.engine.constraints.AllowedValues(allowed, description=None)[source] Bases:
heat.engine.constraints.ConstraintConstrain values to a predefined set.
Serialises to JSON as:
{ 'allowed_values': [<allowed1>, <allowed2>, ...], 'description': <description> }-
valid_types= ('STRING', 'INTEGER', 'NUMBER', 'BOOLEAN', 'LIST')
-
-
class
heat.engine.constraints.AnyIndexDict(value)[source] Bases:
_abcoll.MappingA 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 ‘*’.
-
ANYTHING= '*'
-
-
class
heat.engine.constraints.BaseCustomConstraint[source] Bases:
objectA base class for validation using API clients.
It will provide a better error message, and reduce a bit of duplication. Subclass must provide expected_exceptions and implement validate_with_client.
-
error(value)[source]
-
expected_exceptions= ()
-
validate(value, context)[source]
-
-
class
heat.engine.constraints.Constraint(description=None)[source] Bases:
_abcoll.MappingParent class for constraints on allowable values for a Property.
Constraints are serialisable to dictionaries following the HOT input Parameter constraints schema using dict().
-
DESCRIPTION= 'description'
-
validate(value, schema=None, context=None)[source]
-
-
class
heat.engine.constraints.CustomConstraint(name, description=None, environment=None)[source] Bases:
heat.engine.constraints.ConstraintA constraint delegating validation to an external class.
-
custom_constraint
-
valid_types= ('STRING', 'INTEGER', 'NUMBER', 'BOOLEAN', 'LIST')
-
-
class
heat.engine.constraints.Length(min=None, max=None, description=None)[source] Bases:
heat.engine.constraints.RangeConstrain the length of values within a range.
Serialises to JSON as:
{ 'length': {'min': <min>, 'max': <max>}, 'description': <description> }-
valid_types= ('STRING', 'LIST', 'MAP')
-
-
class
heat.engine.constraints.Range(min=None, max=None, description=None)[source] Bases:
heat.engine.constraints.ConstraintConstrain values within a range.
Serialises to JSON as:
{ 'range': {'min': <min>, 'max': <max>}, 'description': <description> }-
MAX= 'max'
-
MIN= 'min'
-
valid_types= ('INTEGER', 'NUMBER')
-
-
class
heat.engine.constraints.Schema(data_type, description=None, default=None, schema=None, required=False, constraints=None, label=None)[source] Bases:
_abcoll.MappingSchema 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.' }-
BOOLEAN= 'Boolean'
-
BOOLEAN_TYPE= 'BOOLEAN'
-
CONSTRAINTS= 'constraints'
-
DEFAULT= 'default'
-
DESCRIPTION= 'description'
-
INTEGER= 'Integer'
-
INTEGER_TYPE= 'INTEGER'
-
KEYS= ('type', 'description', 'default', 'schema', 'required', 'constraints')
-
LIST= 'List'
-
LIST_TYPE= 'LIST'
-
MAP= 'Map'
-
MAP_TYPE= 'MAP'
-
NUMBER= 'Number'
-
NUMBER_TYPE= 'NUMBER'
-
REQUIRED= 'required'
-
SCHEMA= 'schema'
-
STRING= 'String'
-
STRING_TYPE= 'STRING'
-
TYPE= 'type'
-
TYPES= ('Integer', 'String', 'Number', 'Boolean', 'Map', 'List')
-
TYPE_KEYS= ('INTEGER', 'STRING', 'NUMBER', 'BOOLEAN', 'MAP', 'LIST')
-
set_default(default=None)[source] Set the default value for this Schema object.
-
static
str_to_num(value)[source] Convert a string representation of a number into a numeric type.
-
to_schema_type(value)[source] Returns the value in the schema’s data type.
-
validate(context=None)[source] Validates the schema.
This method checks if the schema itself is valid, and if the default value - if present - complies to the schema’s constraints.
-
validate_constraints(value, context=None, skipped=None)[source]
-