diff --git a/pkg/modules/backup/v1/backup_schedule.go b/pkg/modules/backup/v1/backup_schedule.go index 47cf191..9d47c75 100644 --- a/pkg/modules/backup/v1/backup_schedule.go +++ b/pkg/modules/backup/v1/backup_schedule.go @@ -270,7 +270,7 @@ func (o *BackupPlan) hasInProgressBackup(ctx context.Context) (bool, error) { // return nil // } -func (o *BackupPlan) GetLatest(ctx context.Context, name string) (*ListBackupsDetails, error) { +func (o *BackupPlan) GetLatest(ctx context.Context, name string) (*ResponseDescribeBackup, error) { bc, err := o.manager.GetBackupConfig(ctx, name) if err != nil { return nil, err @@ -280,8 +280,9 @@ func (o *BackupPlan) GetLatest(ctx context.Context, name string) (*ListBackupsDe log.Errorf("convert time to timestamp error: %v", err) } - rs := ListBackupsDetails{ + rs := ResponseDescribeBackup{ Name: name, + BackupPolicies: bc.Spec.BackupPolicy, SnapshotFrequency: bc.Spec.BackupPolicy.SnapshotFrequency, } diff --git a/pkg/modules/backup/v1/handler.go b/pkg/modules/backup/v1/handler.go index 230da22..b1a54c6 100644 --- a/pkg/modules/backup/v1/handler.go +++ b/pkg/modules/backup/v1/handler.go @@ -87,10 +87,10 @@ func (h *Handler) list(req *restful.Request, resp *restful.Response) { return } - var res []*ListBackupsDetails + var res []*ResponseDescribeBackup for _, b := range l.Items { - var r *ListBackupsDetails + var r *ResponseDescribeBackup r, err = NewBackupPlan(owner, h.factory, h.veleroBackupManager).GetLatest(ctx, b.Name) if err != nil { log.Warnf("failed to get backup plan %q: %v", b.Name, err) diff --git a/pkg/modules/backup/v1/model.go b/pkg/modules/backup/v1/model.go index 6746dd5..c4e8587 100644 --- a/pkg/modules/backup/v1/model.go +++ b/pkg/modules/backup/v1/model.go @@ -105,6 +105,19 @@ type ResponseDescribeBackup struct { BackupPolicies *sysv1.BackupPolicy `json:"backupPolicies"` Snapshots []Snapshot `json:"snapshots,omitempty"` + + // new list api fields + SnapshotName string `json:"latestSnapshotName"` + + SnapshotFrequency string `json:"snapshotFrequency"` + + CreationTimestamp int64 `json:"creationTimestamp,omitempty"` + + NextBackupTimestamp *int64 `json:"nextBackupTimestamp,omitempty"` + + Phase string `json:"phase,omitempty"` + + FailedMessage string `json:"failedMessage,omitempty"` } type PostBackupSchedule struct {