Skip to content

Commit 553b348

Browse files
authored
Add support to manage Event Streams (#1134)
* 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
1 parent 779a1f6 commit 553b348

20 files changed

+1192
-9
lines changed

Diff for: docs/auth0_events.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: default
3+
has_toc: false
4+
has_children: true
5+
---
6+
# auth0 events
7+
8+
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.
9+
10+
## Commands
11+
12+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
13+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
14+
- [auth0 events list](auth0_events_list.md) - List your event streams
15+
- [auth0 events show](auth0_events_show.md) - Show an event stream
16+
- [auth0 events update](auth0_events_update.md) - Update an event
17+

Diff for: docs/auth0_events_create.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
layout: default
3+
parent: auth0 events
4+
has_toc: false
5+
---
6+
# auth0 events create
7+
8+
Create a new event stream.
9+
10+
To create interactively, use `auth0 events create` with no flags.
11+
12+
To create non-interactively, supply the event stream name, type, subscriptions and configuration through the flags.
13+
14+
## Usage
15+
```
16+
auth0 events create [flags]
17+
```
18+
19+
## Examples
20+
21+
```
22+
auth0 events create
23+
auth0 events create --name my-event-stream --type eventbridge --subscriptions "user.created,user.updated" --configuration '{"aws_account_id":"325235643634","aws_region":"us-east-2"}'
24+
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"}}'
25+
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"}}'
26+
```
27+
28+
29+
## Flags
30+
31+
```
32+
-c, --configuration string Configuration of the Event Stream. Formatted as JSON.
33+
Webhook Example: {"webhook_endpoint":"https://my-webhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}
34+
Eventbridge Example: {"aws_account_id":"7832467231933","aws_region":"us-east-2"}
35+
--json Output in json format.
36+
-n, --name string Name of the Event Stream.
37+
-s, --subscriptions strings Subscriptions of the Event Stream. Formatted as comma separated string. Eg. user.created,user.updated
38+
-t, --type string Type of the Event Stream. Eg: webhook, eventbridge etc
39+
```
40+
41+
42+
## Inherited Flags
43+
44+
```
45+
--debug Enable debug mode.
46+
--no-color Disable colors.
47+
--no-input Disable interactivity.
48+
--tenant string Specific tenant to use.
49+
```
50+
51+
52+
## Related Commands
53+
54+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
55+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
56+
- [auth0 events list](auth0_events_list.md) - List your event streams
57+
- [auth0 events show](auth0_events_show.md) - Show an event stream
58+
- [auth0 events update](auth0_events_update.md) - Update an event
59+
60+

Diff for: docs/auth0_events_delete.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: default
3+
parent: auth0 events
4+
has_toc: false
5+
---
6+
# auth0 events delete
7+
8+
Delete an event stream.
9+
10+
To delete interactively, use `auth0 events delete` with no arguments.
11+
12+
To delete non-interactively, supply the event id and the `--force` flag to skip confirmation.
13+
14+
## Usage
15+
```
16+
auth0 events delete [flags]
17+
```
18+
19+
## Examples
20+
21+
```
22+
auth0 events delete
23+
auth0 events rm
24+
auth0 events delete <event-id>
25+
auth0 events delete <event-id> --force
26+
auth0 events delete <event-id> <event-id2> <event-idn>
27+
auth0 events delete <event-id> <event-id2> <event-idn> --force
28+
```
29+
30+
31+
## Flags
32+
33+
```
34+
--force Skip confirmation.
35+
```
36+
37+
38+
## Inherited Flags
39+
40+
```
41+
--debug Enable debug mode.
42+
--no-color Disable colors.
43+
--no-input Disable interactivity.
44+
--tenant string Specific tenant to use.
45+
```
46+
47+
48+
## Related Commands
49+
50+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
51+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
52+
- [auth0 events list](auth0_events_list.md) - List your event streams
53+
- [auth0 events show](auth0_events_show.md) - Show an event stream
54+
- [auth0 events update](auth0_events_update.md) - Update an event
55+
56+

Diff for: docs/auth0_events_list.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
layout: default
3+
parent: auth0 events
4+
has_toc: false
5+
---
6+
# auth0 events list
7+
8+
List your existing event streams. To create one, run: `auth0 events create`.
9+
10+
## Usage
11+
```
12+
auth0 events list [flags]
13+
```
14+
15+
## Examples
16+
17+
```
18+
auth0 events list
19+
auth0 events ls
20+
auth0 events ls --json
21+
auth0 events ls --csv
22+
```
23+
24+
25+
## Flags
26+
27+
```
28+
--csv Output in csv format.
29+
--json Output in json format.
30+
```
31+
32+
33+
## Inherited Flags
34+
35+
```
36+
--debug Enable debug mode.
37+
--no-color Disable colors.
38+
--no-input Disable interactivity.
39+
--tenant string Specific tenant to use.
40+
```
41+
42+
43+
## Related Commands
44+
45+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
46+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
47+
- [auth0 events list](auth0_events_list.md) - List your event streams
48+
- [auth0 events show](auth0_events_show.md) - Show an event stream
49+
- [auth0 events update](auth0_events_update.md) - Update an event
50+
51+

Diff for: docs/auth0_events_show.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
layout: default
3+
parent: auth0 events
4+
has_toc: false
5+
---
6+
# auth0 events show
7+
8+
Display the name, type, status, subscriptions and other information about an event stream
9+
10+
## Usage
11+
```
12+
auth0 events show [flags]
13+
```
14+
15+
## Examples
16+
17+
```
18+
auth0 events show
19+
auth0 events show <event-id>
20+
auth0 events show <event-id> --json
21+
```
22+
23+
24+
## Flags
25+
26+
```
27+
--json Output in json format.
28+
```
29+
30+
31+
## Inherited Flags
32+
33+
```
34+
--debug Enable debug mode.
35+
--no-color Disable colors.
36+
--no-input Disable interactivity.
37+
--tenant string Specific tenant to use.
38+
```
39+
40+
41+
## Related Commands
42+
43+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
44+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
45+
- [auth0 events list](auth0_events_list.md) - List your event streams
46+
- [auth0 events show](auth0_events_show.md) - Show an event stream
47+
- [auth0 events update](auth0_events_update.md) - Update an event
48+
49+

Diff for: docs/auth0_events_update.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
layout: default
3+
parent: auth0 events
4+
has_toc: false
5+
---
6+
# auth0 events update
7+
8+
Update an event.
9+
10+
To update interactively, use `auth0 events update` with no arguments.
11+
12+
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
13+
14+
## Usage
15+
```
16+
auth0 events update [flags]
17+
```
18+
19+
## Examples
20+
21+
```
22+
auth0 events update <event-id>
23+
auth0 events update <event-id> --name my-event-stream
24+
auth0 events update <event-id> --name my-event-stream --status enabled
25+
auth0 events update <event-id> --name my-event-stream --status enabled --subscriptions "user.created,user.updated"
26+
auth0 events update <event-id> --name my-event-stream --status disabled --subscriptions "user.deleted" --configuration '{"aws_account_id":"325235643634","aws_region":"us-east-2"}'
27+
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"}}
28+
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"}}
29+
```
30+
31+
32+
## Flags
33+
34+
```
35+
-c, --configuration string Configuration of the Event Stream. Formatted as JSON.
36+
Webhook Example: {"webhook_endpoint":"https://my-webhook.net","webhook_authorization":{"method":"bearer","token":"123456789"}}
37+
Eventbridge Example: {"aws_account_id":"7832467231933","aws_region":"us-east-2"}
38+
--json Output in json format.
39+
-n, --name string Name of the Event Stream.
40+
--status string Status of the Event Stream. (enabled/disabled)
41+
-s, --subscriptions strings Subscriptions of the Event Stream. Formatted as comma separated string. Eg. user.created,user.updated
42+
```
43+
44+
45+
## Inherited Flags
46+
47+
```
48+
--debug Enable debug mode.
49+
--no-color Disable colors.
50+
--no-input Disable interactivity.
51+
--tenant string Specific tenant to use.
52+
```
53+
54+
55+
## Related Commands
56+
57+
- [auth0 events create](auth0_events_create.md) - Create a new event stream
58+
- [auth0 events delete](auth0_events_delete.md) - Delete an event stream
59+
- [auth0 events list](auth0_events_list.md) - List your event streams
60+
- [auth0 events show](auth0_events_show.md) - Show an event stream
61+
- [auth0 events update](auth0_events_update.md) - Update an event
62+
63+

Diff for: docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Authenticating as a user is not supported for **private cloud** tenants. Instead
8686
- [auth0 completion](auth0_completion.md) - Setup autocomplete features for this CLI on your terminal
8787
- [auth0 domains](auth0_domains.md) - Manage custom domains
8888
- [auth0 email](auth0_email.md) - Manage email settings
89+
- [auth0 events](auth0_events.md) - Manage Event Stream
8990
- [auth0 login](auth0_login.md) - Authenticate the Auth0 CLI
9091
- [auth0 logout](auth0_logout.md) - Log out of a tenant's session
9192
- [auth0 logs](auth0_logs.md) - View tenant logs

Diff for: go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ replace github.com/mholt/archiver/v3 => github.com/anchore/archiver/v3 v3.5.2
88
require (
99
github.com/AlecAivazis/survey/v2 v2.3.7
1010
github.com/PuerkitoBio/rehttp v1.4.0
11-
github.com/auth0/go-auth0 v1.14.0
11+
github.com/auth0/go-auth0 v1.16.0
1212
github.com/briandowns/spinner v1.23.1
1313
github.com/charmbracelet/glamour v0.8.0
1414
github.com/fsnotify/fsnotify v1.7.0
@@ -35,8 +35,8 @@ require (
3535
github.com/tidwall/pretty v1.2.1
3636
github.com/zalando/go-keyring v0.2.5
3737
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
38-
golang.org/x/net v0.30.0
39-
golang.org/x/oauth2 v0.25.0
38+
golang.org/x/net v0.33.0
39+
golang.org/x/oauth2 v0.26.0
4040
golang.org/x/sync v0.10.0
4141
golang.org/x/sys v0.28.0
4242
golang.org/x/term v0.27.0

Diff for: go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1
2525
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
2626
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
2727
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
28-
github.com/auth0/go-auth0 v1.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4=
29-
github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc=
28+
github.com/auth0/go-auth0 v1.16.0 h1:8n6WycyRE0soCEh0gnL15wknnI9srNVP8hk+4vY/OzY=
29+
github.com/auth0/go-auth0 v1.16.0/go.mod h1:f6wP4Hov4Be5AKK55tVhAHlKNltqXQIIc3QGfBbnvdU=
3030
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48=
3131
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA=
3232
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
@@ -267,10 +267,10 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
267267
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
268268
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
269269
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
270-
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
271-
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
272-
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
273-
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
270+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
271+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
272+
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
273+
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
274274
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
275275
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
276276
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

Diff for: internal/auth/auth.go

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ var RequiredScopes = []string{
140140
"create:organizations", "delete:organizations", "read:organizations", "update:organizations", "read:organization_members", "read:organization_member_roles", "read:organization_connections",
141141
"read:prompts", "update:prompts",
142142
"read:attack_protection", "update:attack_protection",
143+
"read:event_streams", "create:event_streams", "update:event_streams", "delete:event_streams",
143144
}
144145

145146
// GetDeviceCode kicks-off the device authentication flow by requesting

Diff for: internal/auth0/auth0.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type API struct {
1919
CustomDomain CustomDomainAPI
2020
EmailTemplate EmailTemplateAPI
2121
EmailProvider EmailProviderAPI
22+
EventStream EventStreamAPI
2223
Flow FlowAPI
2324
FlowVaultConnection FlowVaultConnectionAPI
2425
Form FormAPI
@@ -49,6 +50,7 @@ func NewAPI(m *management.Management) *API {
4950
CustomDomain: m.CustomDomain,
5051
EmailTemplate: m.EmailTemplate,
5152
EmailProvider: m.EmailProvider,
53+
EventStream: m.EventStream,
5254
Flow: m.Flow,
5355
FlowVaultConnection: m.Flow.Vault,
5456
Form: m.Form,

0 commit comments

Comments
 (0)