def _create_from_draft( self, obj: types.CustomObjectDraft, id: typing.Optional[str] = None ) -> types.CustomObject: object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) return types.CustomObject( id=str(object_id), version=1, key=obj.key, container=obj.container, value=obj.value, created_at=datetime.datetime.now(datetime.timezone.utc), last_modified_at=datetime.datetime.now(datetime.timezone.utc), )
def post_load(self, data): return types.CustomObject(**data)