Initial commit: FastAPI JBOD monitor backend
This commit is contained in:
76
models/schemas.py
Normal file
76
models/schemas.py
Normal file
@@ -0,0 +1,76 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Enclosure(BaseModel):
|
||||
id: str
|
||||
sg_device: str | None = None
|
||||
vendor: str
|
||||
model: str
|
||||
revision: str
|
||||
total_slots: int
|
||||
populated_slots: int
|
||||
|
||||
|
||||
class SlotInfo(BaseModel):
|
||||
slot: int
|
||||
populated: bool
|
||||
device: str | None = None
|
||||
|
||||
|
||||
class DriveDetail(BaseModel):
|
||||
device: str
|
||||
model: str | None = None
|
||||
serial: str | None = None
|
||||
wwn: str | None = None
|
||||
firmware: str | None = None
|
||||
capacity_bytes: int | None = None
|
||||
smart_healthy: bool | None = None
|
||||
smart_supported: bool = True
|
||||
temperature_c: int | None = None
|
||||
power_on_hours: int | None = None
|
||||
reallocated_sectors: int | None = None
|
||||
pending_sectors: int | None = None
|
||||
uncorrectable_errors: int | None = None
|
||||
wear_leveling_percent: int | None = None
|
||||
smart_attributes: list[dict] = []
|
||||
|
||||
|
||||
class DriveHealthSummary(BaseModel):
|
||||
device: str
|
||||
model: str | None = None
|
||||
serial: str | None = None
|
||||
smart_healthy: bool | None = None
|
||||
smart_supported: bool = True
|
||||
temperature_c: int | None = None
|
||||
power_on_hours: int | None = None
|
||||
|
||||
|
||||
class SlotWithDrive(BaseModel):
|
||||
slot: int
|
||||
populated: bool
|
||||
device: str | None = None
|
||||
drive: DriveHealthSummary | None = None
|
||||
|
||||
|
||||
class EnclosureWithDrives(BaseModel):
|
||||
id: str
|
||||
sg_device: str | None = None
|
||||
vendor: str
|
||||
model: str
|
||||
revision: str
|
||||
total_slots: int
|
||||
populated_slots: int
|
||||
slots: list[SlotWithDrive]
|
||||
|
||||
|
||||
class Overview(BaseModel):
|
||||
healthy: bool
|
||||
drive_count: int
|
||||
warning_count: int
|
||||
error_count: int
|
||||
enclosures: list[EnclosureWithDrives]
|
||||
|
||||
|
||||
class HealthCheck(BaseModel):
|
||||
status: str
|
||||
tools: dict[str, bool]
|
||||
Reference in New Issue
Block a user