4e3a4b4602
带 Web 操作界面的备份系统,支持: - 数据源:MySQL 数据库(mysqldump)、服务器目录(tar.gz) - 存储目标:本地目录、S3 兼容对象存储(MinIO/Ceph/AWS S3) - 触发方式:手动 + Cron 定时调度(APScheduler) - 备份还原:MySQL 库、目录 - JWT 登录认证 + Fernet 字段加密 - 保留策略:按数量 + 按天数双重清理 技术栈:FastAPI + SQLAlchemy 2 + APScheduler + aioboto3; 前端 Vite + React 18 + TypeScript + Ant Design 5 + Zustand。 Docker Compose 一键起。 Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
954 B
Python
34 lines
954 B
Python
from datetime import datetime
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class RestoreTargetsResponse(BaseModel):
|
|
"""列出某个 run 可恢复的目标元信息。"""
|
|
|
|
run_id: int
|
|
job_type: str # 'mysql' / 'directory'
|
|
artifact_size: Optional[int]
|
|
artifact_checksum: Optional[str]
|
|
suggested_targets: list[str]
|
|
|
|
|
|
class RestoreRequest(BaseModel):
|
|
run_id: int
|
|
target_type: Literal["mysql_db", "directory_path"]
|
|
target: str = Field(..., min_length=1, description="MySQL 库名 或 目录路径")
|
|
options: dict = Field(default_factory=dict, description="额外选项,如 {'drop_existing': true}")
|
|
|
|
|
|
class RestoreOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
run_id: int
|
|
target: str
|
|
status: str
|
|
started_at: Optional[datetime]
|
|
finished_at: Optional[datetime]
|
|
error_message: Optional[str]
|
|
created_at: datetime
|