-
Notifications
You must be signed in to change notification settings - Fork 522
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
Add 'apiclient get' for simple API retrieval #1836
Conversation
fa3306d
to
a9ed71c
Compare
^ This push fixes the inconsistent capitalization in error messages, per @zmrow. |
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.
🧦
Any idea why the checks didn't run for this PR? |
I'm pretty sure it's because this is based on a branch other than develop, since I had to stack this on #1835. We should see results when I merge that and change this base branch. |
a9ed71c
to
2e49159
Compare
^ This push is just a rebase on develop, because I couldn't figure out any other way to get GitHub to start Checks. |
Description of changes:
This adds an
apiclient get
subcommand for simpler retrieval of settings, without having to understand the URIs or query parameters involved (for simple cases). You can specify any number of prefixes, likeget settings
orget settings.motd settings.host-containers
, or you can specify a URI to reach non-model parts of the API, likeget /updates/status
.I think there's an opportunity to add filtering, as well, so you could say something like "show me only enabled host containers." I looked into a few options but they didn't work out for now. (In short, I couldn't figure out JSONPath or JMESPath queries that accomplished that example, wasn't sure about statically linking jq, and didn't want to go with a homebrew or less common language. Maybe later!)
Note: this is stacked on a branch representing #1835 because it needs the
/?prefix=
functionality. I'll need to change the base branch of this PR todevelop
after that's merged.Testing done:
Here's an empty response if a prefix doesn't match:
Here's a prefix match for settings:
Here's the usage information:
Ok, with that minor trolling out of the way, I also tested all the
get
commands in the updated docs, testedget services
,get services.motd
,get os
,get os.arch
, etc. and they all prefix correctly.The default shows os and settings, which seems useful:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.