Skip to content

Commit

Permalink
Add support to manage Event Streams (#1134)
Browse files Browse the repository at this point in the history
* Add support to manage Event Streams

* docs updates

* updated integ test

* fixed integration test

* integ

* integ

* final fix

* Fixed linting

* name update

* Added interactive input for update command

* Updated go files
  • Loading branch information
duedares-rvj authored Feb 6, 2025
1 parent 779a1f6 commit 553b348
Show file tree
Hide file tree
Showing 20 changed files with 1,192 additions and 9 deletions.
17 changes: 17 additions & 0 deletions docs/auth0_events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: default
has_toc: false
has_children: true
---
# auth0 events

Events are a way for Auth0 customers to synchronize, correlate or orchestrate changes that occur within Auth0 or 3rd-party identity providers to your app or 3rd party services.

## Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event

60 changes: 60 additions & 0 deletions docs/auth0_events_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
layout: default
parent: auth0 events
has_toc: false
---
# auth0 events create

Create a new event stream.

To create interactively, use `auth0 events create` with no flags.

To create non-interactively, supply the event stream name, type, subscriptions and configuration through the flags.

## Usage
```
auth0 events create [flags]
```

## Examples

```
auth0 events create
auth0 events create --name my-event-stream --type eventbridge --subscriptions "user.created,user.updated" --configuration '{"aws_account_id":"325235643634","aws_region":"us-east-2"}'
auth0 events create --name my-event-stream --type webhook --subscriptions "user.created,user.deleted" --configuration '{"webhook_endpoint":"https://mywebhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}'
auth0 events create -n my-event-stream -t webhook -s "user.created,user.deleted" -c '{"webhook_endpoint":"https://mywebhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}'
```


## Flags

```
-c, --configuration string Configuration of the Event Stream. Formatted as JSON.
Webhook Example: {"webhook_endpoint":"https://my-webhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}
Eventbridge Example: {"aws_account_id":"7832467231933","aws_region":"us-east-2"}
--json Output in json format.
-n, --name string Name of the Event Stream.
-s, --subscriptions strings Subscriptions of the Event Stream. Formatted as comma separated string. Eg. user.created,user.updated
-t, --type string Type of the Event Stream. Eg: webhook, eventbridge etc
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event


56 changes: 56 additions & 0 deletions docs/auth0_events_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
layout: default
parent: auth0 events
has_toc: false
---
# auth0 events delete

Delete an event stream.

To delete interactively, use `auth0 events delete` with no arguments.

To delete non-interactively, supply the event id and the `--force` flag to skip confirmation.

## Usage
```
auth0 events delete [flags]
```

## Examples

```
auth0 events delete
auth0 events rm
auth0 events delete <event-id>
auth0 events delete <event-id> --force
auth0 events delete <event-id> <event-id2> <event-idn>
auth0 events delete <event-id> <event-id2> <event-idn> --force
```


## Flags

```
--force Skip confirmation.
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event


51 changes: 51 additions & 0 deletions docs/auth0_events_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
layout: default
parent: auth0 events
has_toc: false
---
# auth0 events list

List your existing event streams. To create one, run: `auth0 events create`.

## Usage
```
auth0 events list [flags]
```

## Examples

```
auth0 events list
auth0 events ls
auth0 events ls --json
auth0 events ls --csv
```


## Flags

```
--csv Output in csv format.
--json Output in json format.
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event


49 changes: 49 additions & 0 deletions docs/auth0_events_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: default
parent: auth0 events
has_toc: false
---
# auth0 events show

Display the name, type, status, subscriptions and other information about an event stream

## Usage
```
auth0 events show [flags]
```

## Examples

```
auth0 events show
auth0 events show <event-id>
auth0 events show <event-id> --json
```


## Flags

```
--json Output in json format.
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event


63 changes: 63 additions & 0 deletions docs/auth0_events_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
layout: default
parent: auth0 events
has_toc: false
---
# auth0 events update

Update an event.

To update interactively, use `auth0 events update` with no arguments.

To update non-interactively, supply the event id, name, status, subscriptions and configuration through the flags. An event stream type CANNOT be updated hence the configuration should match the schema based on the type of event stream

## Usage
```
auth0 events update [flags]
```

## Examples

```
auth0 events update <event-id>
auth0 events update <event-id> --name my-event-stream
auth0 events update <event-id> --name my-event-stream --status enabled
auth0 events update <event-id> --name my-event-stream --status enabled --subscriptions "user.created,user.updated"
auth0 events update <event-id> --name my-event-stream --status disabled --subscriptions "user.deleted" --configuration '{"aws_account_id":"325235643634","aws_region":"us-east-2"}'
auth0 events update <event-id> --name my-event-stream --status enabled --subscriptions "user.created" --configuration '{"webhook_endpoint":"https://my-new-webhook.net","webhook_authorization":{"method":"bearer","token":"0909090909"}}
auth0 events update <event-id> -n my-event-stream --status enabled -s "user.created" -c '{"webhook_endpoint":"https://my-new-webhook.net","webhook_authorization":{"method":"bearer","token":"987654321"}}
```


## Flags

```
-c, --configuration string Configuration of the Event Stream. Formatted as JSON.
Webhook Example: {"webhook_endpoint":"https://my-webhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}
Eventbridge Example: {"aws_account_id":"7832467231933","aws_region":"us-east-2"}
--json Output in json format.
-n, --name string Name of the Event Stream.
--status string Status of the Event Stream. (enabled/disabled)
-s, --subscriptions strings Subscriptions of the Event Stream. Formatted as comma separated string. Eg. user.created,user.updated
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 events create](auth0_events_create.md) - Create a new event stream
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
- [auth0 events list](auth0_events_list.md) - List your event streams
- [auth0 events show](auth0_events_show.md) - Show an event stream
- [auth0 events update](auth0_events_update.md) - Update an event


1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Authenticating as a user is not supported for **private cloud** tenants. Instead
- [auth0 completion](auth0_completion.md) - Setup autocomplete features for this CLI on your terminal
- [auth0 domains](auth0_domains.md) - Manage custom domains
- [auth0 email](auth0_email.md) - Manage email settings
- [auth0 events](auth0_events.md) - Manage Event Stream
- [auth0 login](auth0_login.md) - Authenticate the Auth0 CLI
- [auth0 logout](auth0_logout.md) - Log out of a tenant's session
- [auth0 logs](auth0_logs.md) - View tenant logs
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/mholt/archiver/v3 => github.com/anchore/archiver/v3 v3.5.2
require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/PuerkitoBio/rehttp v1.4.0
github.com/auth0/go-auth0 v1.14.0
github.com/auth0/go-auth0 v1.16.0
github.com/briandowns/spinner v1.23.1
github.com/charmbracelet/glamour v0.8.0
github.com/fsnotify/fsnotify v1.7.0
Expand All @@ -35,8 +35,8 @@ require (
github.com/tidwall/pretty v1.2.1
github.com/zalando/go-keyring v0.2.5
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/net v0.30.0
golang.org/x/oauth2 v0.25.0
golang.org/x/net v0.33.0
golang.org/x/oauth2 v0.26.0
golang.org/x/sync v0.10.0
golang.org/x/sys v0.28.0
golang.org/x/term v0.27.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/auth0/go-auth0 v1.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4=
github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc=
github.com/auth0/go-auth0 v1.16.0 h1:8n6WycyRE0soCEh0gnL15wknnI9srNVP8hk+4vY/OzY=
github.com/auth0/go-auth0 v1.16.0/go.mod h1:f6wP4Hov4Be5AKK55tVhAHlKNltqXQIIc3QGfBbnvdU=
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48=
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
Expand Down Expand Up @@ -267,10 +267,10 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
1 change: 1 addition & 0 deletions internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ var RequiredScopes = []string{
"create:organizations", "delete:organizations", "read:organizations", "update:organizations", "read:organization_members", "read:organization_member_roles", "read:organization_connections",
"read:prompts", "update:prompts",
"read:attack_protection", "update:attack_protection",
"read:event_streams", "create:event_streams", "update:event_streams", "delete:event_streams",
}

// GetDeviceCode kicks-off the device authentication flow by requesting
Expand Down
2 changes: 2 additions & 0 deletions internal/auth0/auth0.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type API struct {
CustomDomain CustomDomainAPI
EmailTemplate EmailTemplateAPI
EmailProvider EmailProviderAPI
EventStream EventStreamAPI
Flow FlowAPI
FlowVaultConnection FlowVaultConnectionAPI
Form FormAPI
Expand Down Expand Up @@ -49,6 +50,7 @@ func NewAPI(m *management.Management) *API {
CustomDomain: m.CustomDomain,
EmailTemplate: m.EmailTemplate,
EmailProvider: m.EmailProvider,
EventStream: m.EventStream,
Flow: m.Flow,
FlowVaultConnection: m.Flow.Vault,
Form: m.Form,
Expand Down
Loading

0 comments on commit 553b348

Please sign in to comment.