diff --git a/src/pkg/backup/backup.go b/src/pkg/backup/backup.go index fe741d798..b061d2988 100644 --- a/src/pkg/backup/backup.go +++ b/src/pkg/backup/backup.go @@ -36,10 +36,12 @@ type Backup struct { // Selector used in this operation Selector selectors.Selector `json:"selectors"` - // TODO: in process of gaining support, most cases will still use - // ResourceOwner and ResourceOwnerName. - ProtectedResourceID string `json:"protectedResourceID,omitempty"` - ProtectedResourceName string `json:"protectedResourceName,omitempty"` + // ** DO NOT CHANGE JSON TAG NAMES ** + // These are in-memory only variable renames of previously persisted fields. + // ** CHANGING THE JSON TAGS WILL BREAK THINGS BECAUSE THE MODEL WON'T ** + // ** DESERIALIZE PROPERLY ** + ProtectedResourceID string `json:"resourceOwnerID,omitempty"` + ProtectedResourceName string `json:"resourceOwnerName,omitempty"` // Version represents the version of the backup format Version int `json:"version"` @@ -61,10 +63,6 @@ type Backup struct { // Reference to the backup details storage location. // Used to read backup.Details from the streamstore. DetailsID string `json:"detailsID"` - - // prefer protectedResource - ResourceOwnerID string `json:"resourceOwnerID,omitempty"` - ResourceOwnerName string `json:"resourceOwnerName,omitempty"` } // interface compliance checks @@ -115,8 +113,8 @@ func New( Tags: tags, }, - ResourceOwnerID: ownerID, - ResourceOwnerName: ownerName, + ProtectedResourceID: ownerID, + ProtectedResourceName: ownerName, Version: version, SnapshotID: snapshotID, @@ -253,9 +251,7 @@ func (b Backup) Values() []string { name := str.First( b.ProtectedResourceName, - b.ResourceOwnerName, b.ProtectedResourceID, - b.ResourceOwnerID, b.Selector.Name()) bs := b.toStats() diff --git a/src/pkg/backup/backup_test.go b/src/pkg/backup/backup_test.go index c1ce6f1cf..27324cfd8 100644 --- a/src/pkg/backup/backup_test.go +++ b/src/pkg/backup/backup_test.go @@ -40,10 +40,8 @@ func stubBackup(t time.Time, ownerID, ownerName string) backup.Backup { CreationTime: t, SnapshotID: "snapshot", DetailsID: "details", - ProtectedResourceID: ownerID + "-pr", - ProtectedResourceName: ownerName + "-pr", - ResourceOwnerID: ownerID + "-ro", - ResourceOwnerName: ownerName + "-ro", + ProtectedResourceID: ownerID + "-ro", + ProtectedResourceName: ownerName + "-ro", Status: "status", Selector: sel.Selector, ErrorCount: 2, @@ -86,7 +84,7 @@ func (suite *BackupUnitSuite) TestBackup_HeadersValues() { nowFmt, "1m0s", "status (2 errors, 1 skipped: 1 malware)", - "name-pr", + "name-ro", } ) @@ -123,9 +121,6 @@ func (suite *BackupUnitSuite) TestBackup_HeadersValues_onlyResourceOwners() { } ) - b.ProtectedResourceID = "" - b.ProtectedResourceName = "" - b.StartAndEndTime.CompletedAt = later // single skipped malware