deevirt_schema/api/datacenter.py

29 lines
696 B
Python
Raw Normal View History

2024-10-09 12:28:01 +02:00
from typing import List, Optional
import uuid
from pydantic import UUID4, BaseModel, ConfigDict, Field
class VM(BaseModel):
model_config = ConfigDict(from_attributes=True)
id:UUID4
name:str
state:str
class Datacenter(BaseModel):
model_config = ConfigDict(from_attributes=True)
company_id:UUID4
id:UUID4
name:str
cluster_id:UUID4
2024-10-15 15:46:23 +02:00
storage_pool_id:Optional[UUID4]
2024-10-09 12:28:01 +02:00
vm:List[VM] = Field(default=[])
class DatacenterCreate(BaseModel):
model_config = ConfigDict(from_attributes=True)
company_id:UUID4
id:Optional[UUID4] = Field(default_factory=lambda:uuid.uuid4())
name:str
cluster_id:UUID4
2024-10-15 15:46:23 +02:00
storage_pool_id:Optional[UUID4]