-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.py
58 lines (35 loc) · 935 Bytes
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from typing import TypeVar, Generic
from fastapi import Query
from fastapi_pagination.default import Page as BasePage, Params as BaseParams
from pydantic import BaseModel
class HostBase(BaseModel):
ip: str
class Config:
orm_mode = True
class HostCreate(HostBase):
pass
class CpuDataBase(BaseModel):
host_id: int
cpu_util: int
time: str
class CpuDataDetailedOut(CpuDataBase):
class Config:
orm_mode = True
class CpuDataThresholdOut(CpuDataBase):
class Config:
orm_mode = True
class HostsRead(BaseModel):
ip: str
id: int
class Config:
orm_mode = True
class DummyCreate(BaseModel):
entries_num: int
hosts_num: int
class Config:
orm_mode = True
T = TypeVar("T")
class Params(BaseParams):
size: int = Query(100, ge=1, le=100, description="Page size")
class Page(BasePage[T], Generic[T]):
__params_type__ = Params