62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
|
|
export type TBackupStatus = 'pending' | 'running' | 'ready' | 'failed' | 'restoring' | 'restored';
|
||
|
|
|
||
|
|
export type TBackupTrigger = 'manual' | 'scheduled';
|
||
|
|
|
||
|
|
export type TBackupResourceType = 'volume' | 'database' | 'objectstorage';
|
||
|
|
|
||
|
|
export interface IBackupSnapshotBase {
|
||
|
|
type: TBackupResourceType;
|
||
|
|
snapshotId: string;
|
||
|
|
snapshotName?: string;
|
||
|
|
originalSize: number;
|
||
|
|
storedSize: number;
|
||
|
|
createdAt: number;
|
||
|
|
tags?: Record<string, string>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBackupVolumeSnapshot extends IBackupSnapshotBase {
|
||
|
|
type: 'volume';
|
||
|
|
volumeName: string;
|
||
|
|
mountPath: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBackupDatabaseSnapshot extends IBackupSnapshotBase {
|
||
|
|
type: 'database';
|
||
|
|
resourceName: string;
|
||
|
|
databaseName: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBackupObjectStorageSnapshot extends IBackupSnapshotBase {
|
||
|
|
type: 'objectstorage';
|
||
|
|
resourceName: string;
|
||
|
|
bucketName: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export type TBackupSnapshot =
|
||
|
|
| IBackupVolumeSnapshot
|
||
|
|
| IBackupDatabaseSnapshot
|
||
|
|
| IBackupObjectStorageSnapshot;
|
||
|
|
|
||
|
|
export interface IBackupRestoreEvent {
|
||
|
|
restoredAt: number;
|
||
|
|
status: 'restored' | 'failed';
|
||
|
|
errorText?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBackupRecord {
|
||
|
|
id: string;
|
||
|
|
serviceId: string;
|
||
|
|
serviceName?: string;
|
||
|
|
clusterId?: string;
|
||
|
|
status: TBackupStatus;
|
||
|
|
trigger: TBackupTrigger;
|
||
|
|
snapshots: TBackupSnapshot[];
|
||
|
|
createdAt: number;
|
||
|
|
updatedAt: number;
|
||
|
|
completedAt?: number;
|
||
|
|
requestedBy?: string;
|
||
|
|
errorText?: string;
|
||
|
|
restoreHistory?: IBackupRestoreEvent[];
|
||
|
|
tags?: Record<string, string>;
|
||
|
|
}
|