Skip to content

Commit 2c16021

Browse files
authored
fix(dbaas): show full API response in marshaled outputs (#261)
1 parent 6dbe19d commit 2c16021

4 files changed

Lines changed: 31 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
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`
2424
- In JSON and YAML output of `kubernetes list`: display full API response.
25+
- **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.
26+
- **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`.
2527
- In human readable output of `kubernetes show` command, show node-groups as table. Node-group details are available with `kubernetes nodegroup show` command.
2628

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

3033
## [2.10.0] - 2023-07-17
3134
### Added

internal/commands/database/list.go

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

47-
return output.Table{
48-
Columns: []output.TableColumn{
49-
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
50-
{Key: "title", Header: "Title"},
51-
{Key: "type", Header: "Type"},
52-
{Key: "plan", Header: "Plan"},
53-
{Key: "zone", Header: "Zone"},
54-
{Key: "state", Header: "State", Format: format.DatabaseState},
47+
return output.MarshaledWithHumanOutput{
48+
Value: databases,
49+
Output: output.Table{
50+
Columns: []output.TableColumn{
51+
{Key: "uuid", Header: "UUID", Colour: ui.DefaultUUUIDColours},
52+
{Key: "title", Header: "Title"},
53+
{Key: "type", Header: "Type"},
54+
{Key: "plan", Header: "Plan"},
55+
{Key: "zone", Header: "Zone"},
56+
{Key: "state", Header: "State", Format: format.DatabaseState},
57+
},
58+
Rows: rows,
5559
},
56-
Rows: rows,
5760
}, nil
5861
}

internal/commands/database/properties/show.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ func (s *showCommand) Execute(exec commands.Executor, key string) (output.Output
5252
{Title: "Min length:", Key: "minLength", Value: details.MinLength},
5353
}
5454

55-
return output.Details{
56-
Sections: []output.DetailSection{
57-
{
58-
Rows: filterOutEmptyRows(rows),
55+
return output.MarshaledWithHumanOutput{
56+
Value: details,
57+
Output: output.Details{
58+
Sections: []output.DetailSection{
59+
{
60+
Rows: filterOutEmptyRows(rows),
61+
},
5962
},
6063
},
6164
}, nil

internal/commands/database/types.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ func (s *typesCommand) ExecuteWithoutArguments(exec commands.Executor) (output.O
3434
})
3535
}
3636

37-
return output.Table{
38-
Columns: []output.TableColumn{
39-
{Key: "name", Header: "Name"},
40-
{Key: "description", Header: "Description"},
41-
{Key: "latest_available_version", Header: "Latest Available Version"},
37+
return output.MarshaledWithHumanOutput{
38+
Value: dbTypes,
39+
Output: output.Table{
40+
Columns: []output.TableColumn{
41+
{Key: "name", Header: "Name"},
42+
{Key: "description", Header: "Description"},
43+
{Key: "latest_available_version", Header: "Latest Available Version"},
44+
},
45+
Rows: rows,
4246
},
43-
Rows: rows,
4447
}, nil
4548
}

0 commit comments

Comments
 (0)