segmentio / topicctl

Tool for declarative management of Kafka topics
MIT License
590 stars 55 forks source link

feat(notifier): add PoC JSON output option for topicctl diff #199

Closed bmckerry closed 3 months ago

bmckerry commented 3 months ago

Description

This adds the --json-output flag to topicctl, which prints a json blob of changes maded during a topicctl apply to stdout at the end of an apply run. Currently this only works for creating a topic and updating that topic's settings.

Right now the flag only controls whether the json blob is printed, all of the logic for producing the json blob still happens in the backend regardless of whether the flag is passed or not. This can be improved in the future.

Running this yourself

To test this for yourself, checkout the branch, run make install in repo root, edit the topics in topic-default.yaml, and run:

topicctl apply examples/local-cluster/topics/topic-default.yaml  --json-output --dry-run

Make sure you have a kafka container running (you can get one by running sentry devservices up in the sentry repo).

Sample Output

bmckerry commented 3 months ago

accidental PR, sorry