You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
api/sql_app/schemas.py

46 lines
746 B
Python

from typing import Optional
from pydantic import BaseModel
class CPUBase(BaseModel):
name: str
socket: int
class CPUCreate(CPUBase):
host_id: int
class CPU(CPUBase):
id: int
usage: Optional[float]
class Config:
from_attributes = True
class MemoryBase(BaseModel):
type: str
class MemoryCreate(MemoryBase):
host_id: int
class Memory(MemoryBase):
total: int
used: Optional[int]
usage: Optional[float]
class Config:
from_attributes = True
class HostBase(BaseModel):
hostname: str
class HostCreate(HostBase):
pass
class Host(HostBase):
id: int
cpus: Optional[list['CPU']]
memory: Optional[list['Memory']]
class Config:
from_attributes = True