diff --git a/CHANGELOG.md b/CHANGELOG.md index 4991326f1..a678607b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - **Breaking**: In JSON and YAML output of `loadbalancer list`: display full API response. This changes `state` field to `operational_state`. +- **Breaking**: `storage list` and `storage show` JSON and YAML outputs to return full API response. This changes `servers` field to contain `server` field, which in turn contains the servers. `labels` field will not be outputted if empty. - In human readable output of `kubernetes show` command, show node-groups as table. Node-group datails are available with `kubernetes nodegroup show` command. ## Removed diff --git a/internal/commands/storage/list.go b/internal/commands/storage/list.go index f311b6130..6a3f7e81d 100644 --- a/internal/commands/storage/list.go +++ b/internal/commands/storage/list.go @@ -59,7 +59,7 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou } CachedStorages = storageList.Storages - var filtered []upcloud.Storage + filtered := make([]upcloud.Storage, 0) for _, v := range storageList.Storages { if s.all.Value() { filtered = append(filtered, v) @@ -109,18 +109,21 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou }) } - return output.Table{ - Columns: []output.TableColumn{ - {Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours}, - {Key: "title", Header: "Title"}, - {Key: "type", Header: "Type"}, - {Key: "size", Header: "Size"}, - {Key: "state", Header: "State", Format: format.StorageState}, - {Key: "tier", Header: "Tier"}, - {Key: "zone", Header: "Zone"}, - {Key: "access", Header: "Access"}, - {Key: "created", Header: "Created"}, + return output.MarshaledWithHumanOutput{ + Value: filtered, + Output: output.Table{ + Columns: []output.TableColumn{ + {Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours}, + {Key: "title", Header: "Title"}, + {Key: "type", Header: "Type"}, + {Key: "size", Header: "Size"}, + {Key: "state", Header: "State", Format: format.StorageState}, + {Key: "tier", Header: "Tier"}, + {Key: "zone", Header: "Zone"}, + {Key: "access", Header: "Access"}, + {Key: "created", Header: "Created"}, + }, + Rows: rows, }, - Rows: rows, }, nil } diff --git a/internal/commands/storage/show.go b/internal/commands/storage/show.go index 2a17bd722..29e056d2b 100644 --- a/internal/commands/storage/show.go +++ b/internal/commands/storage/show.go @@ -113,7 +113,10 @@ func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Outpu }) } - return combined, nil + return output.MarshaledWithHumanOutput{ + Value: storage, + Output: combined, + }, nil } func formatShowServers(val interface{}) (text.Colors, string, error) {