Add owner in json output for backup list (#2575)

## Description

This adds information about owner of the backup to `--json` output of backup list. Previously we were showing owner in the normal backup list command, but not when asked to as json.

## Does this PR need a docs update or release note?

- [x]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ]  No 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-02-20 20:20:28 +05:30 committed by GitHub
parent 8096025c55
commit a86453f138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] (beta) ## [Unreleased] (beta)
### Added
- Show owner information when doing backup list in json format
## [v0.4.0] (alpha) - 2023-2-20 ## [v0.4.0] (alpha) - 2023-2-20
### Fixed ### Fixed

View File

@ -108,6 +108,7 @@ type Printable struct {
Version string `json:"version"` Version string `json:"version"`
BytesRead int64 `json:"bytesRead"` BytesRead int64 `json:"bytesRead"`
BytesUploaded int64 `json:"bytesUploaded"` BytesUploaded int64 `json:"bytesUploaded"`
Owner string `json:"owner"`
} }
// MinimumPrintable reduces the Backup to its minimally printable details. // MinimumPrintable reduces the Backup to its minimally printable details.
@ -120,6 +121,7 @@ func (b Backup) MinimumPrintable() any {
Version: "0", Version: "0",
BytesRead: b.BytesRead, BytesRead: b.BytesRead,
BytesUploaded: b.BytesUploaded, BytesUploaded: b.BytesUploaded,
Owner: b.Selector.DiscreteOwner,
} }
} }

View File

@ -102,4 +102,5 @@ func (suite *BackupSuite) TestBackup_MinimumPrintable() {
assert.Equal(t, b.Status, result.Status, "status") assert.Equal(t, b.Status, result.Status, "status")
assert.Equal(t, b.BytesRead, result.BytesRead, "size") assert.Equal(t, b.BytesRead, result.BytesRead, "size")
assert.Equal(t, b.BytesUploaded, result.BytesUploaded, "stored size") assert.Equal(t, b.BytesUploaded, result.BytesUploaded, "stored size")
assert.Equal(t, b.Selector.DiscreteOwner, result.Owner, "owner")
} }