diff --git a/api/api.go b/api/api.go index 232fa5453..833db1d68 100644 --- a/api/api.go +++ b/api/api.go @@ -857,6 +857,29 @@ func CloudBackupStatusTypeToSdkCloudBackupStatusType( } } +func SdkCloudBackupStatusTypeToCloudBackupStatusString( + t SdkCloudBackupStatusType, +) string { + switch t { + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeNotStarted: + return string(CloudBackupStatusNotStarted) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeDone: + return string(CloudBackupStatusDone) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeAborted: + return string(CloudBackupStatusAborted) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypePaused: + return string(CloudBackupStatusPaused) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeStopped: + return string(CloudBackupStatusStopped) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeActive: + return string(CloudBackupStatusActive) + case SdkCloudBackupStatusType_SdkCloudBackupStatusTypeFailed: + return string(CloudBackupStatusFailed) + default: + return string(CloudBackupStatusFailed) + } +} + func StringToSdkCloudBackupStatusType(s string) SdkCloudBackupStatusType { return CloudBackupStatusTypeToSdkCloudBackupStatusType(CloudBackupStatusType(s)) } diff --git a/api/server/backup.go b/api/server/backup.go index 169f040ba..f8d492acd 100644 --- a/api/server/backup.go +++ b/api/server/backup.go @@ -203,7 +203,7 @@ func (vd *volAPI) cloudBackupEnumerate(w http.ResponseWriter, r *http.Request) { SrcVolumeName: v.SrcVolumeName, Timestamp: prototime.TimestampToTime(v.Timestamp), Metadata: v.Metadata, - Status: v.Status.String(), + Status: api.SdkCloudBackupStatusTypeToCloudBackupStatusString(v.Status), } enumerateResp.Backups = append(enumerateResp.Backups, item) }