Skip to content

Commit

Permalink
fix(dbaas): show full API response in marshaled outputs (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta authored Oct 17, 2023
1 parent 6dbe19d commit 2c16021
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **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.
- **Breaking**: In JSON and YAML output of `database list`: display the full API response. Value of `title` is not replaced with value from `name`, if `title` is empty.
- **Breaking**: In JSON and YAML output of `database types`: display the full API response. This changes the top level datatype from list to object, where keys are the available database type, e.g., `pg` and `mysql`.
- In human readable output of `kubernetes show` command, show node-groups as table. Node-group details are available with `kubernetes nodegroup show` command.

## Removed
- **Breaking**: Remove `database connection list` and `database connection cancel` commands in favor of `database session` counterparts
- **Breaking**: In JSON and YAML output of `database properties * show`: pass-through the API response. This removes `key` field from the output.

## [2.10.0] - 2023-07-17
### Added
Expand Down
21 changes: 12 additions & 9 deletions internal/commands/database/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@ 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: "plan", Header: "Plan"},
{Key: "zone", Header: "Zone"},
{Key: "state", Header: "State", Format: format.DatabaseState},
return output.MarshaledWithHumanOutput{
Value: databases,
Output: output.Table{
Columns: []output.TableColumn{
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
{Key: "title", Header: "Title"},
{Key: "type", Header: "Type"},
{Key: "plan", Header: "Plan"},
{Key: "zone", Header: "Zone"},
{Key: "state", Header: "State", Format: format.DatabaseState},
},
Rows: rows,
},
Rows: rows,
}, nil
}
11 changes: 7 additions & 4 deletions internal/commands/database/properties/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ func (s *showCommand) Execute(exec commands.Executor, key string) (output.Output
{Title: "Min length:", Key: "minLength", Value: details.MinLength},
}

return output.Details{
Sections: []output.DetailSection{
{
Rows: filterOutEmptyRows(rows),
return output.MarshaledWithHumanOutput{
Value: details,
Output: output.Details{
Sections: []output.DetailSection{
{
Rows: filterOutEmptyRows(rows),
},
},
},
}, nil
Expand Down
15 changes: 9 additions & 6 deletions internal/commands/database/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ func (s *typesCommand) ExecuteWithoutArguments(exec commands.Executor) (output.O
})
}

return output.Table{
Columns: []output.TableColumn{
{Key: "name", Header: "Name"},
{Key: "description", Header: "Description"},
{Key: "latest_available_version", Header: "Latest Available Version"},
return output.MarshaledWithHumanOutput{
Value: dbTypes,
Output: output.Table{
Columns: []output.TableColumn{
{Key: "name", Header: "Name"},
{Key: "description", Header: "Description"},
{Key: "latest_available_version", Header: "Latest Available Version"},
},
Rows: rows,
},
Rows: rows,
}, nil
}

0 comments on commit 2c16021

Please sign in to comment.