The karbor.objects.base Module

karbor common internal object model

karbor.objects.base.DateTimeField(**kwargs)
class karbor.objects.base.DictOfDictOfStringsField(**kwargs)

Bases: oslo_versionedobjects.fields.AutoTypedField

AUTO_TYPE = <oslo_versionedobjects.fields.Dict object>
class karbor.objects.base.KarborComparableObject

Bases: oslo_versionedobjects.base.ComparableVersionedObject

class karbor.objects.base.KarborObject(context=None, **kwargs)

Bases: oslo_versionedobjects.base.VersionedObject

OBJ_PROJECT_NAMESPACE = 'karbor'
OBJ_SERIAL_NAMESPACE = 'karbor_object'
classmethod get_by_id(context, *args, **kwargs)
karbor_obj_get_changes()

Returns a dict of changed fields with tz unaware datetimes.

Any timezone aware datetime field will be converted to UTC timezone and returned as timezone unaware datetime.

This will allow us to pass these fields directly to a db update method as they can’t have timezone information.

refresh()
class karbor.objects.base.KarborObjectDictCompat

Bases: oslo_versionedobjects.base.VersionedObjectDictCompat

Mix-in to provide dictionary key access compat.

If an object needs to support attribute access using dictionary items instead of object attributes, inherit from this class. This should only be used as a temporary measure until all callers are converted to use modern attribute access.

NOTE(berrange) This class will eventually be deleted.

get(key, value=<class 'oslo_versionedobjects.base._NotSpecifiedSentinel'>)

For backwards-compatibility with dict-based objects.

NOTE(danms): May be removed in the future.

class karbor.objects.base.KarborObjectRegistry

Bases: oslo_versionedobjects.base.VersionedObjectRegistry

registration_hook(cls, index)
class karbor.objects.base.KarborObjectSerializer

Bases: oslo_versionedobjects.base.VersionedObjectSerializer

OBJ_BASE_CLASS

alias of KarborObject

class karbor.objects.base.KarborPersistentObject

Bases: object

Mixin class for Persistent objects.

This adds the fields that we use in common for all persistent objects.

fields = {'deleted': Boolean(default=False,nullable=False), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
obj_as_admin(*args, **kwds)

Context manager to make an object call as an admin.

This temporarily modifies the context embedded in an object to be elevated() and restores it after the call completes. Example usage:

with obj.obj_as_admin():
obj.save()
class karbor.objects.base.ObjectListBase(*args, **kwargs)

Bases: oslo_versionedobjects.base.ObjectListBase