-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the api command. #1946
Added the api command. #1946
Conversation
I expected this to work: $ ./rdctl api list-settings
Error: server error return-code 404: 404 Not Found
Usage:
rdctl api [flags]
[...] Also the usage just says Specifying an explicit API version works: $ ./rdctl api /v0/list-settings
Status: {
"version": 4,
[...]
}. But it prefixes the output with the $ ./rdctl api /v0/list-settings | jq .version
parse error: Invalid numeric literal at line 1, column 7
$ ./rdctl api /v0/list-settings | sed 's/^Status: //' | sed 's/}\.$/}/' | jq .version
4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run npm run lint
— the go files are not correctly formatted (and our CI isn't catching that correctly).
(Abandoning review because the PR was marked as draft)
5fc0462
to
7a299f2
Compare
138538c
to
72b2b68
Compare
66c3f4d
to
a8bf0a5
Compare
This is wrong: $ resources/darwin/bin/rdctl api foo; echo $?
{"error":{"message":"404 Not Found","documentation_url":null}}
Unknown command: GET /v0/foo
0 The exit code should be non-zero when the API call failed. And there is no reason to wrap the error properties with another object, this should output: $ resources/darwin/bin/rdctl api foo; echo $?
{"message":"404 Not Found","documentation_url":null}
Unknown command: GET /v0/foo
1 The HTTP status code (and exit code from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, if we're looping over test parameters we should have subtests.
Currently supports these options: -X method (default PUT when input is specified, GET otherwise) --input FILE (like the current settings.json file) --raw-field|-f NAME=VALUE - string VALUEs must be double-quoted --field|-F NAME=VALUE - double quotes added where needed Signed-off-by: Eric Promislow <[email protected]>
- Start with list-settings and set subcommands. Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
- Change /list-settings and /set endpoints to /settings - Remove the --field and --rawField options until we have parameters Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Also tabify the go code. Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Makes it easier to determine which output from an `rdctl api` call is a server error. Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
6ab5271
to
7dec9e2
Compare
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
2615da3
to
2d45a4e
Compare
Signed-off-by: Eric Promislow <[email protected]>
- Use nested categories. - Use nested tests for looping over options with feedback. Signed-off-by: Eric Promislow <[email protected]>
Signed-off-by: Eric Promislow <[email protected]>
ec188c3
to
6ca56f5
Compare
Signed-off-by: Eric Promislow <[email protected]>
Fixes #1903
Currently supports these options:
And these endpoints:
Signed-off-by: Eric Promislow [email protected]