Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for JSON output to stdout #129

Closed
scottslowe opened this issue Sep 28, 2022 · 7 comments · Fixed by #147
Closed

Add support for JSON output to stdout #129

scottslowe opened this issue Sep 28, 2022 · 7 comments · Fixed by #147
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@scottslowe
Copy link

scottslowe commented Sep 28, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction
    to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do
    not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

It would be useful to have a flag or command-line parameter that would allow the gke-policy tool to stream JSON to STDOUT. Currently the only JSON support is writing to a JSON file. Streaming to STDOUT would allow for integration with other command-line tools such as jq.

References

  • No relevant/known issues or PRs
@danielmarzini
Copy link
Collaborator

Thanks @scottslowe, super useful! I'm pretty sure we can work on this in a short time. I'll keep this issue updated

@danielmarzini danielmarzini self-assigned this Sep 29, 2022
@danielmarzini danielmarzini added enhancement New feature or request good first issue Good for newcomers labels Sep 29, 2022
@mikouaj
Copy link
Member

mikouaj commented Oct 7, 2022

I was thinking about adding -json flag to achieve that.
Sth like ./gke-policy check --discovery -p gke-policy-demo -json would produce only JSON to stdout (without our fancy info messages)

@rickygodoy
Copy link
Collaborator

@danielmarzini Are you working on this or I can assign to myself?

@danielmarzini
Copy link
Collaborator

Hey @rickygodoy thanks for asking, I'm blocked onto another task, ff to take this one. Thanks!

@rickygodoy
Copy link
Collaborator

Hello @scottslowe, it's implemented and can be used with -json flag:

Like so:
./gke-policy check --project my-nice-project --location us-central1-c --name gke-1 -json

@scottslowe
Copy link
Author

@rickygodoy Awesome, thanks! Do I need to download a new version of the binary to take advantage of this new flag?

@mikouaj
Copy link
Member

mikouaj commented Nov 8, 2022

@scottslowe we have created v1.2.2 release for you.
You can download the new version of a binary from the v1.2.2 release page.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants