diff --git a/src/pkg/backup/identity/identity.go b/src/pkg/backup/identity/identity.go index de08107f3..2bdeea7ff 100644 --- a/src/pkg/backup/identity/identity.go +++ b/src/pkg/backup/identity/identity.go @@ -17,6 +17,8 @@ type Reasoner interface { // SubtreePath returns the path prefix for data in existing backups that have // parameters (tenant, protected resourced, etc) that match this Reasoner. SubtreePath() (path.Path, error) + // ToMetadata returns the corresponding metadata reason for this reason. + ToMetadata() Reasoner } func NewReason( @@ -67,3 +69,11 @@ func (r reason) SubtreePath() (path.Path, error) { return p, clues.Wrap(err, "building path").OrNil() } + +func (r reason) ToMetadata() Reasoner { + return NewReason( + r.Tenant(), + r.ProtectedResource(), + r.Service().ToMetadata(), + r.Category()) +}