soteria/web/src/soteria-types.ts

115 lines
2.3 KiB
TypeScript

export interface AuthInfo {
authenticated: boolean;
user?: string;
email?: string;
groups?: string[];
allowed_groups?: string[];
}
export interface BackupRecord {
name: string;
snapshot_name?: string;
created?: string;
state?: string;
url?: string;
size?: string;
latest?: boolean;
}
export interface BackupListResponse {
namespace: string;
pvc: string;
volume: string;
backups: BackupRecord[];
}
export interface PVCInventory {
namespace: string;
pvc: string;
volume?: string;
phase?: string;
storage_class?: string;
capacity?: string;
access_modes?: string[];
driver?: string;
last_backup_at?: string;
last_backup_age_hours?: number;
backup_count: number;
completed_backups: number;
active_backups: number;
last_job_name?: string;
last_job_state?: string;
last_job_started_at?: string;
last_job_progress_pct: number;
last_backup_size_bytes?: number;
total_backup_size_bytes?: number;
healthy: boolean;
health_reason?: string;
error?: string;
}
export interface NamespaceInventory {
name: string;
pvcs: PVCInventory[];
}
export interface InventoryResponse {
generated_at: string;
namespaces: NamespaceInventory[];
}
export interface BackupPolicy {
id: string;
namespace: string;
pvc?: string;
interval_hours: number;
enabled: boolean;
dedupe?: boolean;
keep_last?: number;
created_at?: string;
updated_at?: string;
}
export interface BackupPolicyListResponse {
policies: BackupPolicy[];
}
export interface B2BucketUsage {
name: string;
object_count: number;
total_bytes: number;
recent_objects_24h: number;
recent_bytes_24h: number;
last_modified_at?: string;
}
export interface B2UsageResponse {
enabled: boolean;
available: boolean;
endpoint?: string;
region?: string;
scanned_at?: string;
scan_duration_ms?: number;
total_objects: number;
total_bytes: number;
recent_objects_24h: number;
recent_bytes_24h: number;
buckets?: B2BucketUsage[];
error?: string;
}
export type RestoreSelection =
| { kind: 'none' }
| { kind: 'pvc'; namespace: string; pvc: string; volume: string; backups: BackupRecord[] }
| { kind: 'namespace'; namespace: string };
export const EMPTY_B2: B2UsageResponse = {
enabled: false,
available: false,
total_objects: 0,
total_bytes: 0,
recent_objects_24h: 0,
recent_bytes_24h: 0,
buckets: []
};