2026-01-31 03:34:34 -03:00
|
|
|
package api
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupRequest is the request payload for a namespace or PVC backup.
|
2026-01-31 03:34:34 -03:00
|
|
|
type BackupRequest struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc"`
|
|
|
|
|
Tags []string `json:"tags,omitempty"`
|
|
|
|
|
Snapshot bool `json:"snapshot"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe *bool `json:"dedupe,omitempty"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast *int `json:"keep_last,omitempty"`
|
2026-01-31 03:34:34 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupResponse is the response payload returned after a backup request.
|
2026-01-31 03:34:34 -03:00
|
|
|
type BackupResponse struct {
|
2026-04-12 11:09:49 -03:00
|
|
|
Driver string `json:"driver,omitempty"`
|
|
|
|
|
Volume string `json:"volume,omitempty"`
|
|
|
|
|
Backup string `json:"backup,omitempty"`
|
|
|
|
|
JobName string `json:"job_name,omitempty"`
|
|
|
|
|
Namespace string `json:"namespace,omitempty"`
|
|
|
|
|
Secret string `json:"secret,omitempty"`
|
|
|
|
|
RequestedBy string `json:"requested_by,omitempty"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe bool `json:"dedupe"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast int `json:"keep_last"`
|
2026-01-31 03:34:34 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// RestoreTestRequest is the request payload for a restore test.
|
2026-01-31 03:34:34 -03:00
|
|
|
type RestoreTestRequest struct {
|
2026-04-12 11:09:49 -03:00
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc,omitempty"`
|
|
|
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
|
|
|
BackupURL string `json:"backup_url,omitempty"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Repository string `json:"repository,omitempty"`
|
2026-04-12 11:09:49 -03:00
|
|
|
TargetNamespace string `json:"target_namespace,omitempty"`
|
|
|
|
|
TargetPVC string `json:"target_pvc,omitempty"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
2026-01-31 03:34:34 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// RestoreTestResponse is the response payload returned after a restore test.
|
2026-01-31 03:34:34 -03:00
|
|
|
type RestoreTestResponse struct {
|
2026-04-12 11:09:49 -03:00
|
|
|
Driver string `json:"driver,omitempty"`
|
|
|
|
|
Volume string `json:"volume,omitempty"`
|
|
|
|
|
TargetNamespace string `json:"target_namespace,omitempty"`
|
|
|
|
|
TargetPVC string `json:"target_pvc,omitempty"`
|
|
|
|
|
BackupURL string `json:"backup_url,omitempty"`
|
|
|
|
|
JobName string `json:"job_name,omitempty"`
|
|
|
|
|
Namespace string `json:"namespace,omitempty"`
|
|
|
|
|
Secret string `json:"secret,omitempty"`
|
|
|
|
|
RequestedBy string `json:"requested_by,omitempty"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// InventoryResponse wraps the full backup inventory view returned to the UI.
|
2026-04-12 11:09:49 -03:00
|
|
|
type InventoryResponse struct {
|
|
|
|
|
GeneratedAt string `json:"generated_at"`
|
|
|
|
|
Namespaces []NamespaceInventory `json:"namespaces"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceInventory groups PVC inventory for a single namespace.
|
2026-04-12 11:09:49 -03:00
|
|
|
type NamespaceInventory struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
PVCs []PVCInventory `json:"pvcs"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// PVCInventory captures the backup health snapshot for one PVC.
|
2026-04-12 11:09:49 -03:00
|
|
|
type PVCInventory struct {
|
2026-04-12 19:45:23 -03:00
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc"`
|
|
|
|
|
Volume string `json:"volume,omitempty"`
|
|
|
|
|
Phase string `json:"phase,omitempty"`
|
|
|
|
|
StorageClass string `json:"storage_class,omitempty"`
|
|
|
|
|
Capacity string `json:"capacity,omitempty"`
|
|
|
|
|
AccessModes []string `json:"access_modes,omitempty"`
|
|
|
|
|
Driver string `json:"driver,omitempty"`
|
|
|
|
|
LastBackupAt string `json:"last_backup_at,omitempty"`
|
|
|
|
|
LastBackupAgeHours float64 `json:"last_backup_age_hours,omitempty"`
|
|
|
|
|
BackupCount int `json:"backup_count"`
|
|
|
|
|
CompletedBackups int `json:"completed_backups"`
|
2026-04-13 03:46:38 -03:00
|
|
|
ActiveBackups int `json:"active_backups"`
|
|
|
|
|
LastJobName string `json:"last_job_name,omitempty"`
|
|
|
|
|
LastJobState string `json:"last_job_state,omitempty"`
|
|
|
|
|
LastJobStartedAt string `json:"last_job_started_at,omitempty"`
|
|
|
|
|
LastJobProgressPct int `json:"last_job_progress_pct"`
|
2026-04-13 16:48:30 -03:00
|
|
|
LastBackupSizeBytes float64 `json:"last_backup_size_bytes"`
|
|
|
|
|
TotalBackupSizeBytes float64 `json:"total_backup_size_bytes"`
|
2026-04-12 19:45:23 -03:00
|
|
|
Healthy bool `json:"healthy"`
|
|
|
|
|
HealthReason string `json:"health_reason,omitempty"`
|
|
|
|
|
Error string `json:"error,omitempty"`
|
2026-04-12 11:09:49 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupListResponse returns the backup history for a PVC.
|
2026-04-12 11:09:49 -03:00
|
|
|
type BackupListResponse struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc"`
|
|
|
|
|
Volume string `json:"volume"`
|
|
|
|
|
Backups []BackupRecord `json:"backups"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupRecord summarizes one backup entry in a history list.
|
2026-04-12 11:09:49 -03:00
|
|
|
type BackupRecord struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
SnapshotName string `json:"snapshot_name,omitempty"`
|
|
|
|
|
Created string `json:"created,omitempty"`
|
|
|
|
|
State string `json:"state,omitempty"`
|
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
|
Size string `json:"size,omitempty"`
|
|
|
|
|
Latest bool `json:"latest,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// AuthInfoResponse reports the authenticated user and the allowed groups.
|
2026-04-12 11:09:49 -03:00
|
|
|
type AuthInfoResponse struct {
|
|
|
|
|
Authenticated bool `json:"authenticated"`
|
|
|
|
|
User string `json:"user,omitempty"`
|
|
|
|
|
Email string `json:"email,omitempty"`
|
|
|
|
|
Groups []string `json:"groups,omitempty"`
|
2026-04-13 12:03:14 -03:00
|
|
|
AllowedGroups []string `json:"allowed_groups,omitempty"`
|
2026-01-31 03:34:34 -03:00
|
|
|
}
|
2026-04-12 14:32:39 -03:00
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupPolicy stores the scheduling policy for a namespace or PVC.
|
2026-04-12 14:32:39 -03:00
|
|
|
type BackupPolicy struct {
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc,omitempty"`
|
|
|
|
|
IntervalHours float64 `json:"interval_hours"`
|
|
|
|
|
Enabled bool `json:"enabled"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe bool `json:"dedupe"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast int `json:"keep_last"`
|
2026-04-12 14:32:39 -03:00
|
|
|
CreatedAt string `json:"created_at,omitempty"`
|
|
|
|
|
UpdatedAt string `json:"updated_at,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupPolicyUpsertRequest updates the stored backup policy for a scope.
|
2026-04-12 14:32:39 -03:00
|
|
|
type BackupPolicyUpsertRequest struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc,omitempty"`
|
|
|
|
|
IntervalHours float64 `json:"interval_hours"`
|
|
|
|
|
Enabled *bool `json:"enabled,omitempty"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe *bool `json:"dedupe,omitempty"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast *int `json:"keep_last,omitempty"`
|
2026-04-12 14:32:39 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// BackupPolicyListResponse returns the configured backup policies.
|
2026-04-12 14:32:39 -03:00
|
|
|
type BackupPolicyListResponse struct {
|
|
|
|
|
Policies []BackupPolicy `json:"policies"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceBackupRequest requests a backup sweep across a namespace.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceBackupRequest struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe *bool `json:"dedupe,omitempty"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast *int `json:"keep_last,omitempty"`
|
2026-04-12 14:32:39 -03:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceBackupResult reports the outcome for a single PVC backup.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceBackupResult struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc"`
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
Volume string `json:"volume,omitempty"`
|
|
|
|
|
Backup string `json:"backup,omitempty"`
|
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceBackupResponse summarizes the namespace backup sweep results.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceBackupResponse struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
RequestedBy string `json:"requested_by,omitempty"`
|
|
|
|
|
Driver string `json:"driver"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
2026-04-13 12:51:19 -03:00
|
|
|
Dedupe bool `json:"dedupe"`
|
2026-04-13 13:55:17 -03:00
|
|
|
KeepLast int `json:"keep_last"`
|
2026-04-12 14:32:39 -03:00
|
|
|
Total int `json:"total"`
|
|
|
|
|
Succeeded int `json:"succeeded"`
|
|
|
|
|
Failed int `json:"failed"`
|
|
|
|
|
Results []NamespaceBackupResult `json:"results"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceRestoreRequest requests a restore sweep across a namespace.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceRestoreRequest struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
TargetNamespace string `json:"target_namespace,omitempty"`
|
|
|
|
|
TargetPrefix string `json:"target_prefix,omitempty"`
|
|
|
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceRestoreResult reports the outcome for a single PVC restore.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceRestoreResult struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
PVC string `json:"pvc"`
|
|
|
|
|
TargetNamespace string `json:"target_namespace"`
|
|
|
|
|
TargetPVC string `json:"target_pvc"`
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
Volume string `json:"volume,omitempty"`
|
|
|
|
|
BackupURL string `json:"backup_url,omitempty"`
|
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// NamespaceRestoreResponse summarizes the namespace restore sweep results.
|
2026-04-12 14:32:39 -03:00
|
|
|
type NamespaceRestoreResponse struct {
|
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
|
TargetNamespace string `json:"target_namespace"`
|
|
|
|
|
RequestedBy string `json:"requested_by,omitempty"`
|
|
|
|
|
Driver string `json:"driver"`
|
|
|
|
|
DryRun bool `json:"dry_run"`
|
|
|
|
|
Total int `json:"total"`
|
|
|
|
|
Succeeded int `json:"succeeded"`
|
|
|
|
|
Failed int `json:"failed"`
|
|
|
|
|
Results []NamespaceRestoreResult `json:"results"`
|
|
|
|
|
}
|
2026-04-12 19:45:23 -03:00
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// B2UsageResponse reports account and per-bucket Backblaze B2 usage.
|
2026-04-12 19:45:23 -03:00
|
|
|
type B2UsageResponse struct {
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
Available bool `json:"available"`
|
|
|
|
|
Endpoint string `json:"endpoint,omitempty"`
|
|
|
|
|
Region string `json:"region,omitempty"`
|
|
|
|
|
ScannedAt string `json:"scanned_at,omitempty"`
|
|
|
|
|
ScanDurationMS int64 `json:"scan_duration_ms,omitempty"`
|
|
|
|
|
TotalObjects int64 `json:"total_objects"`
|
|
|
|
|
TotalBytes int64 `json:"total_bytes"`
|
|
|
|
|
RecentObjects24h int64 `json:"recent_objects_24h"`
|
|
|
|
|
RecentBytes24h int64 `json:"recent_bytes_24h"`
|
|
|
|
|
Buckets []B2BucketUsage `json:"buckets,omitempty"`
|
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 06:45:04 -03:00
|
|
|
// B2BucketUsage captures the usage metrics for one Backblaze B2 bucket.
|
2026-04-12 19:45:23 -03:00
|
|
|
type B2BucketUsage struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
ObjectCount int64 `json:"object_count"`
|
|
|
|
|
TotalBytes int64 `json:"total_bytes"`
|
|
|
|
|
RecentObjects24h int64 `json:"recent_objects_24h"`
|
|
|
|
|
RecentBytes24h int64 `json:"recent_bytes_24h"`
|
|
|
|
|
LastModifiedAt string `json:"last_modified_at,omitempty"`
|
|
|
|
|
}
|