soteria/internal/api/types.go

95 lines
3.3 KiB
Go

package api
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"`
}
type BackupResponse struct {
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"`
}
type RestoreTestRequest struct {
Namespace string `json:"namespace"`
PVC string `json:"pvc,omitempty"`
Snapshot string `json:"snapshot,omitempty"`
BackupURL string `json:"backup_url,omitempty"`
TargetNamespace string `json:"target_namespace,omitempty"`
TargetPVC string `json:"target_pvc,omitempty"`
DryRun bool `json:"dry_run"`
}
type RestoreTestResponse struct {
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"`
}
type InventoryResponse struct {
GeneratedAt string `json:"generated_at"`
Namespaces []NamespaceInventory `json:"namespaces"`
}
type NamespaceInventory struct {
Name string `json:"name"`
PVCs []PVCInventory `json:"pvcs"`
}
type PVCInventory struct {
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"`
Healthy bool `json:"healthy"`
HealthReason string `json:"health_reason,omitempty"`
Error string `json:"error,omitempty"`
}
type BackupListResponse struct {
Namespace string `json:"namespace"`
PVC string `json:"pvc"`
Volume string `json:"volume"`
Backups []BackupRecord `json:"backups"`
}
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"`
}
type AuthInfoResponse struct {
Authenticated bool `json:"authenticated"`
User string `json:"user,omitempty"`
Email string `json:"email,omitempty"`
Groups []string `json:"groups,omitempty"`
}