Skip to content

Commit

Permalink
fix(network): show full API response in marshaled outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta committed Oct 16, 2023
1 parent 104f8bc commit 1cc547a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 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`
- **Breaking**: In JSON and YAML output of `network list` and `network show`: display full API response. Servers list will only contain server UUID and name. `ip_networks` contains subfield `ip_network` which in turn contains the labels.
- 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
20 changes: 12 additions & 8 deletions internal/commands/network/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,18 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou
n.Zone,
})
}
return output.Table{
Columns: []output.TableColumn{
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
{Key: "name", Header: "Name"},
{Key: "router", Header: "Router", Colour: ui.DefaultUUUIDColours},
{Key: "type", Header: "Type"},
{Key: "zone", Header: "Zone"},

return output.MarshaledWithHumanOutput{
Value: filtered,
Output: output.Table{
Columns: []output.TableColumn{
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
{Key: "name", Header: "Name"},
{Key: "router", Header: "Router", Colour: ui.DefaultUUUIDColours},
{Key: "type", Header: "Type"},
{Key: "zone", Header: "Zone"},
},
Rows: rows,
},
Rows: rows,
}, nil
}
5 changes: 4 additions & 1 deletion internal/commands/network/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ func (s *showCommand) Execute(exec commands.Executor, arg string) (output.Output
})
}

return combined, nil
return output.MarshaledWithHumanOutput{
Value: network,
Output: combined,
}, nil
}

func formatShowDHCPDNS(val interface{}) (text.Colors, string, error) {
Expand Down

0 comments on commit 1cc547a

Please sign in to comment.