From ca1484fc15a47c5bd88e5dd7743a9f0a2dd09e86 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Thu, 23 May 2024 13:28:54 -0700 Subject: [PATCH] fix: fix event create flags --- README.md | 9 +++++++-- cli/cmd/event/create.go | 2 +- docs/reference/FAQ.md | 2 +- docs/reference/standards.md | 2 +- docs/tutorials/quickstart/README.md | 27 +++++++++++++++------------ docs/tutorials/watcher/README.md | 8 ++++++-- 6 files changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7d7fd39..66ef655 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,8 @@ Flags: ### Running the Server -See [the docs](docs/how-to/start-server/README.md) for how to start EPR -and its dependencies. +See [the docs](docs/how-to/start-server/README.md) for how to start EPR and its +dependencies. ### Interacting with the Server @@ -178,6 +178,11 @@ curl -X POST -H "content-type:application/json" -d '{"query":"query FindEventRec curl -X POST -H "content-type:application/json" -d '{"query":"query FindEventReceiverGroups($id: ID!){event_receiver_groups(id: $id) {id,name,type,version,description,enabled,event_receiver_ids,created_at,updated_at}}","variables":{"id":"01HKX90FKWQZ49F6H5V5NQT95Z"}}' http://localhost:8042/api/v1/graphql/query ``` +## Links + +- [EPR Python Client](https://github.com/xbcsmith/epr-python) +- [EPR Workshop](https://github.com/xbcsmith/epr-workshop) + ## Contributing We welcome your contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) diff --git a/cli/cmd/event/create.go b/cli/cmd/event/create.go index fc3ce24..8cc89ec 100644 --- a/cli/cmd/event/create.go +++ b/cli/cmd/event/create.go @@ -37,7 +37,7 @@ func runCreateEvent(_ *cobra.Command, _ []string) error { platform := viper.GetString("platform-id") pkg := viper.GetString("package") success := viper.GetBool("success") - eventReceiverID := viper.GetString("receiver-id") + eventReceiverID := viper.GetString("event-receiver-id") payload := viper.GetString("payload") dryrun := viper.GetBool("dry-run") noindent := viper.GetBool("no-indent") diff --git a/docs/reference/FAQ.md b/docs/reference/FAQ.md index 32cce90..4514b4c 100644 --- a/docs/reference/FAQ.md +++ b/docs/reference/FAQ.md @@ -1 +1 @@ -# FAQ \ No newline at end of file +# FAQ diff --git a/docs/reference/standards.md b/docs/reference/standards.md index bbb8abe..7d3a4d5 100644 --- a/docs/reference/standards.md +++ b/docs/reference/standards.md @@ -1 +1 @@ - # Standards \ No newline at end of file +# Standards diff --git a/docs/tutorials/quickstart/README.md b/docs/tutorials/quickstart/README.md index ce96f50..1ea033e 100644 --- a/docs/tutorials/quickstart/README.md +++ b/docs/tutorials/quickstart/README.md @@ -3,7 +3,8 @@ ## Overview In this tutorial we will run the Event Provenance Registry (EPR) Server with -Redpanda Message broker and PostgreSQL database. We will create an event receiver, an event receiver group, and a few events. +Redpanda Message broker and PostgreSQL database. We will create an event +receiver, an event receiver group, and a few events. ## Requirements @@ -378,8 +379,8 @@ mutation { In the graphql window create a query with the following: ```graphql -query{ - events(event: {name: "foo", version: "1.0.0"}) { +query { + events(event: { name: "foo", version: "1.0.0" }) { id name version @@ -460,8 +461,7 @@ In the graphql window create a query with the following: ```graphql query { - event_receivers(event_receiver: {name: "the_clash", version: "1.0.0"}) - { + event_receivers(event_receiver: { name: "the_clash", version: "1.0.0" }) { id name version @@ -503,7 +503,8 @@ As follows: ### Query using the GraphQL with Curl -We need to craft a GraphQL query. First thing we need is an event receiver. The event receiver acts as a classification and gate for events. +We need to craft a GraphQL query. First thing we need is an event receiver. The +event receiver acts as a classification and gate for events. We can find and event receiver by id using the following graphql query: @@ -518,7 +519,8 @@ We can find and event receiver by id using the following graphql query: } ``` -We can query the event receiver information using a POST on the graphql endpoint as follows: +We can query the event receiver information using a POST on the graphql endpoint +as follows: ```bash curl -X POST -H "content-type:application/json" -d '{"query":"query ($er: FindEventReceiverInput!){event_receivers(event_receiver: $er) {id,name,type,version,description}}","variables":{"er":{"id":"01HPW652DSJBHR5K4KCZQ97GJP"}}}' http://localhost:8042/api/v1/graphql/query @@ -538,7 +540,8 @@ We can query for an event by name and version using the following graphql query: } ``` -We can query the event receiver information using a POST on the graphql endpoint as follows: +We can query the event receiver information using a POST on the graphql endpoint +as follows: ```bash curl -X POST -H "content-type:application/json" -d '{"query":"query ($e : FindEventInput!){events(event: $e) {id,name,version,release,platform_id,package,description,success,event_receiver_id}}","variables":{"e": {"name":"foo","version":"1.0.0"}}}' http://localhost:8042/api/v1/graphql/query @@ -548,7 +551,8 @@ curl -X POST -H "content-type:application/json" -d '{"query":"query ($e : FindEv curl -X POST -H "content-type:application/json" -d '{"query":"query {events(event: {name: \"foo\", version: \"1.0.0\"}) {id,name,version,release,platform_id,package,description,success,event_receiver_id}}}' http://localhost:8042/api/v1/graphql/query ``` -We can query for an event receiver group by name and version using the following graphql query: +We can query for an event receiver group by name and version using the following +graphql query: ```json { @@ -562,10 +566,9 @@ We can query for an event receiver group by name and version using the following } ``` -We can query the event receiver information using a POST on the graphql endpoint as follows: +We can query the event receiver information using a POST on the graphql endpoint +as follows: ```bash curl -X POST -H "content-type:application/json" -d '{"query":"query ($erg: FindEventReceiverGroupInput!){event_receiver_groups(event_receiver_group: $erg) {id,name,type,version,description}}","variables":{"erg": {"name":"foobar","version":"1.0.0"}}}' http://localhost:8042/api/v1/graphql/query ``` - - diff --git a/docs/tutorials/watcher/README.md b/docs/tutorials/watcher/README.md index 54fff8a..795bf66 100644 --- a/docs/tutorials/watcher/README.md +++ b/docs/tutorials/watcher/README.md @@ -2,7 +2,11 @@ ## Overview -In this tutorial we will delve into the utilization of the EPR watcher SDK to craft a watcher, which actively listens for events originating from the EPR server. Watchers serve the purpose of monitoring messages within Redpanda, initiating actions based on these messages, and subsequently dispatching event notifications to the EPR Server. +In this tutorial we will delve into the utilization of the EPR watcher SDK to +craft a watcher, which actively listens for events originating from the EPR +server. Watchers serve the purpose of monitoring messages within Redpanda, +initiating actions based on these messages, and subsequently dispatching event +notifications to the EPR Server. This tutorial depends on the [Quickstart](../quickstart/README.md) being completed. @@ -48,7 +52,7 @@ func main() { watcher.ConsumeRecords(customMatcher) } -ffunc customMatcher(msg *message.Message) bool { +func customMatcher(msg *message.Message) bool { return msg.Type == "foo.bar" }