Skip to content

Commit

Permalink
fix(kubernetes): show full API response in marshaled outputs (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta authored Oct 17, 2023
1 parent 104f8bc commit 6dbe19d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **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.
- **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.
- **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`
- In JSON and YAML output of `kubernetes list`: display full API response.
- In human readable output of `kubernetes show` command, show node-groups as table. Node-group details are available with `kubernetes nodegroup show` command.

## Removed
Expand Down
21 changes: 12 additions & 9 deletions internal/commands/kubernetes/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou
})
}

return output.Table{
Columns: []output.TableColumn{
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
{Key: "name", Header: "Name"},
{Key: "network", Header: "Network UUID", Colour: ui.DefaultUUUIDColours},
{Key: "network_cidr", Header: "Network CIDR", Colour: ui.DefaultAddressColours},
{Key: "zone", Header: "Zone"},
{Key: "state", Header: "Operational state", Format: format.KubernetesClusterState},
return output.MarshaledWithHumanOutput{
Value: clusters,
Output: output.Table{
Columns: []output.TableColumn{
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
{Key: "name", Header: "Name"},
{Key: "network", Header: "Network UUID", Colour: ui.DefaultUUUIDColours},
{Key: "network_cidr", Header: "Network CIDR", Colour: ui.DefaultAddressColours},
{Key: "zone", Header: "Zone"},
{Key: "state", Header: "Operational state", Format: format.KubernetesClusterState},
},
Rows: rows,
},
Rows: rows,
}, nil
}
11 changes: 7 additions & 4 deletions internal/commands/kubernetes/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ func (s *versionsCommand) ExecuteWithoutArguments(exec commands.Executor) (outpu
})
}

return output.Table{
Columns: []output.TableColumn{
{Key: "version", Header: "Version"},
return output.MarshaledWithHumanOutput{
Value: versions,
Output: output.Table{
Columns: []output.TableColumn{
{Key: "version", Header: "Version"},
},
Rows: rows,
},
Rows: rows,
}, nil
}

0 comments on commit 6dbe19d

Please sign in to comment.