diff --git a/deevirt_schema/api/stats.py b/deevirt_schema/api/stats.py index 5a00b3a..eeb58b5 100644 --- a/deevirt_schema/api/stats.py +++ b/deevirt_schema/api/stats.py @@ -1,5 +1,6 @@ +import datetime from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field from ..libvirt.dom.stats import Stats class MemorySwap(BaseModel): @@ -10,4 +11,9 @@ class Memory(BaseModel): swap:MemorySwap = Field() class Stats(Stats): - memory:Memory = Field() \ No newline at end of file + memory:Memory = Field() + +class MongoStats(Stats): + model_config = ConfigDict(arbitrary_types_allowed=True) + + created_at: datetime = Field(default=datetime.datetime.now(datetime.timezone.utc), alias='send_at') \ No newline at end of file diff --git a/deevirt_schema/libvirt/dom/stats.py b/deevirt_schema/libvirt/dom/stats.py index 442883e..0bc3d79 100644 --- a/deevirt_schema/libvirt/dom/stats.py +++ b/deevirt_schema/libvirt/dom/stats.py @@ -1,3 +1,4 @@ +import datetime from typing import List, Optional from pydantic import UUID4, BaseModel, ConfigDict, Field from time import time_ns diff --git a/setup.py b/setup.py index a0cf6d7..f0ea7ea 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import find_packages, setup setup( name='deevirt_schema', - version='0.1.6', + version='0.1.7', description='Deevirt Schema', url='https://git.celeonet.fr/Deevirt/deevirt_schema.git', author='Celeonet',