update schema

This commit is contained in:
Jonathan Gohier 2024-10-09 15:55:25 +02:00
parent bb7b58e072
commit b491e69fde
1 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ from uuid import uuid4
from pydantic import UUID4, Field, ConfigDict from pydantic import UUID4, Field, ConfigDict
from pydantic import BaseModel as _BaseModel from pydantic import BaseModel as _BaseModel
from deevirt_schema.libvirt.dom import config as configDom from ..libvirt.dom import config as configDom
class BaseModel(_BaseModel): class BaseModel(_BaseModel):
class Config: class Config:
@ -64,8 +64,8 @@ class Event(BaseModel):
class DevicesDisk(BaseModel): class DevicesDisk(BaseModel):
model_config = ConfigDict(from_attributes=True) model_config = ConfigDict(from_attributes=True)
pool_id:UUID4 = Field() pool_id:Optional[UUID4] = Field(default=None)
id:UUID4 = Field() id:UUID4 = Field(default_factory=uuid4)
size:int = Field() size:int = Field()
unit:configDom.UnitEnum = Field(default=configDom.UnitEnum.GiB) unit:configDom.UnitEnum = Field(default=configDom.UnitEnum.GiB)
bus:configDom.DevicesDiskTarget.busEnum = Field(default=configDom.DevicesDiskTarget.busEnum.scsi) bus:configDom.DevicesDiskTarget.busEnum = Field(default=configDom.DevicesDiskTarget.busEnum.scsi)
@ -89,8 +89,8 @@ class DevicesInterface(BaseModel):
model_config = ConfigDict(from_attributes=True) model_config = ConfigDict(from_attributes=True)
switch_id:UUID4 switch_id:UUID4
id:UUID4 id:UUID4 = Field(default_factory=uuid4)
mac_addr:str = Field() mac_addr:str = Field(default=None)
class Graphics(BaseModel): class Graphics(BaseModel):
port:int = Field(default=-1) port:int = Field(default=-1)
@ -106,7 +106,7 @@ class Audio(BaseModel):
class VideoModel(BaseModel): class VideoModel(BaseModel):
type:configDom.VideoModel.typeEnum = Field(default=configDom.VideoModel.typeEnum.cirrus) type:configDom.VideoModel.typeEnum = Field(default=configDom.VideoModel.typeEnum.cirrus)
vram:int = Field(default=16384) vram:int = Field(default=16384)
primary:configDom.YesNoEnum = Field(default=configDom.YesNoEnum.YES) primary:bool = Field(default=True)
class Video(BaseModel): class Video(BaseModel):
model:VideoModel = Field() model:VideoModel = Field()
@ -133,7 +133,7 @@ class VM(BaseModel):
model_config = ConfigDict(from_attributes=True) model_config = ConfigDict(from_attributes=True)
# General metadata # General metadata
id:UUID4 = Field() id:UUID4 = Field(default_factory=uuid4)
datacenter_id:Optional[UUID4] = Field(default=None) datacenter_id:Optional[UUID4] = Field(default=None)
name:str = Field() name:str = Field()
description:Optional[str] = Field(default=None) description:Optional[str] = Field(default=None)