heat.objects.fields module

class heat.objects.fields.Json[source]

Bases: FieldType

coerce(obj, attr, value)[source]

This is called to coerce (if possible) a value on assignment.

This method should convert the value given into the designated type, or throw an exception if this is not possible.

Parameters:
  • obj – The VersionedObject on which an attribute is being set

  • attr – The name of the attribute being set

  • value – The value being set

Returns:

A properly-typed value

from_primitive(obj, attr, value)[source]

This is called to deserialize a value.

This method should deserialize a value from the form given by to_primitive() to the designated type.

Parameters:
  • obj – The VersionedObject on which the value is to be set

  • attr – The name of the attribute which will hold the value

  • value – The serialized form of the value

Returns:

The natural form of the value

to_primitive(obj, attr, value)[source]

This is called to serialize a value.

This method should serialize a value to the form expected by from_primitive().

Parameters:
  • obj – The VersionedObject on which the value is set

  • attr – The name of the attribute holding the value

  • value – The natural form of the value

Returns:

The serialized form of the value

class heat.objects.fields.JsonField(nullable: bool = False, default: T | type[UnspecifiedDefault] = <class 'oslo_versionedobjects.fields.UnspecifiedDefault'>, read_only: bool = False)[source]

Bases: AutoTypedField

AUTO_TYPE: FieldType[T] = <heat.objects.fields.Json object>
class heat.objects.fields.ListField(nullable: bool = False, default: T | type[UnspecifiedDefault] = <class 'oslo_versionedobjects.fields.UnspecifiedDefault'>, read_only: bool = False)[source]

Bases: AutoTypedField

AUTO_TYPE: FieldType[T] = <oslo_versionedobjects.fields.List object>