WechatOnCloud/bridge/woc_bridge/models/diagnostic.py

40 lines
983 B
Python
Raw Normal View History

"""诊断域模型:连通性 / 诊断项 / 诊断执行结果。"""
from __future__ import annotations
from typing import Optional
from pydantic import BaseModel, Field
# ---------------------------------------------------------------------------
# 诊断接口
# ---------------------------------------------------------------------------
class ConnectivityResponse(BaseModel):
"""连通性检查响应。"""
reachable: bool = False
latency_ms: int = 0
error: Optional[str] = None
class DiagnosticItem(BaseModel):
"""诊断项定义。"""
check_id: str
name: str
severity: str = Field(default="info", description="info / warning / critical")
description: str = ""
auto_repairable: bool = False
class DiagnosticRunResult(BaseModel):
"""诊断执行结果。"""
check_id: str
passed: bool = False
severity: str = "info"
message: str = ""
auto_repairable: bool = False
repair_plan: Optional[str] = None