Skip to content

Commit 6dbe19d

Browse files
authored
fix(kubernetes): show full API response in marshaled outputs (#258)
1 parent 104f8bc commit 6dbe19d

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- **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.
2222
- **Breaking**: `server list` and `server show` JSON and YAML outputs to return full API response. This changes field `host_id` to `host`. `nics` is replaced with `networking` subfield `interfaces`. `storage` is replaced with `storage_devices`. `labels` contain subfield `label` which in turn contains the labels.
2323
- **Breaking**: `server firewall show` JSON and YAML outputs to return full API response. This removes fields `destination` and `source` fields in favor of `[destination|source]_address_start`, `[destination|source]_address_end`, `[destination|source]_port_start` and `[destination|source]_port_end`
24+
- In JSON and YAML output of `kubernetes list`: display full API response.
2425
- In human readable output of `kubernetes show` command, show node-groups as table. Node-group details are available with `kubernetes nodegroup show` command.
2526

2627
## Removed

internal/commands/kubernetes/list.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou
4040
})
4141
}
4242

43-
return output.Table{
44-
Columns: []output.TableColumn{
45-
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
46-
{Key: "name", Header: "Name"},
47-
{Key: "network", Header: "Network UUID", Colour: ui.DefaultUUUIDColours},
48-
{Key: "network_cidr", Header: "Network CIDR", Colour: ui.DefaultAddressColours},
49-
{Key: "zone", Header: "Zone"},
50-
{Key: "state", Header: "Operational state", Format: format.KubernetesClusterState},
43+
return output.MarshaledWithHumanOutput{
44+
Value: clusters,
45+
Output: output.Table{
46+
Columns: []output.TableColumn{
47+
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
48+
{Key: "name", Header: "Name"},
49+
{Key: "network", Header: "Network UUID", Colour: ui.DefaultUUUIDColours},
50+
{Key: "network_cidr", Header: "Network CIDR", Colour: ui.DefaultAddressColours},
51+
{Key: "zone", Header: "Zone"},
52+
{Key: "state", Header: "Operational state", Format: format.KubernetesClusterState},
53+
},
54+
Rows: rows,
5155
},
52-
Rows: rows,
5356
}, nil
5457
}

internal/commands/kubernetes/versions.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ func (s *versionsCommand) ExecuteWithoutArguments(exec commands.Executor) (outpu
3333
})
3434
}
3535

36-
return output.Table{
37-
Columns: []output.TableColumn{
38-
{Key: "version", Header: "Version"},
36+
return output.MarshaledWithHumanOutput{
37+
Value: versions,
38+
Output: output.Table{
39+
Columns: []output.TableColumn{
40+
{Key: "version", Header: "Version"},
41+
},
42+
Rows: rows,
3943
},
40-
Rows: rows,
4144
}, nil
4245
}

0 commit comments

Comments
 (0)