Skip to content

Commit

Permalink
Add custom domains CRUD (#311)
Browse files Browse the repository at this point in the history
* Add custom domains CRUD

* Add autogenerated docs

* Address review feedback
  • Loading branch information
Widcket authored Jun 14, 2021
1 parent 54fc3f3 commit da352f4
Show file tree
Hide file tree
Showing 23 changed files with 659 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/auth0_branding.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Manage branding options.
### SEE ALSO

* [auth0](auth0.md) - Supercharge your development workflow.
* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
* [auth0 branding show](auth0_branding_show.md) - Display the custom branding settings for Universal Login
* [auth0 branding templates](auth0_branding_templates.md) - Manage custom page templates
* [auth0 branding update](auth0_branding_update.md) - Update the custom branding settings for Universal Login
29 changes: 29 additions & 0 deletions docs/auth0_branding_domains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## auth0 branding domains

Manage custom domains.

### Flags

```
-h, --help help for domains
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding](auth0_branding.md) - Manage branding options
* [auth0 branding domains create](auth0_branding_domains_create.md) - Create a custom domain
* [auth0 branding domains delete](auth0_branding_domains_delete.md) - Delete a custom domain
* [auth0 branding domains list](auth0_branding_domains_list.md) - List your custom domains
* [auth0 branding domains show](auth0_branding_domains_show.md) - Show a custom domain
* [auth0 branding domains verify](auth0_branding_domains_verify.md) - Verify a custom domain
38 changes: 38 additions & 0 deletions docs/auth0_branding_domains_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## auth0 branding domains create

Create a custom domain.

```
auth0 branding domains create [flags]
```

### Examples

```
auth0 branding domains create
auth0 branding domains create <id>
```

### Flags

```
-d, --domain string Domain name.
-h, --help help for create
-t, --type string Custom domain provisioning type. Must be 'auth0' for Auth0-managed certs or 'self' for self-managed certs.
-v, --verification string Custom domain verification method. Must be 'txt'.
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
35 changes: 35 additions & 0 deletions docs/auth0_branding_domains_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## auth0 branding domains delete

Delete a custom domain.

```
auth0 branding domains delete [flags]
```

### Examples

```
auth0 branding domains delete
auth0 branding domains delete <id>
```

### Flags

```
-h, --help help for delete
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
36 changes: 36 additions & 0 deletions docs/auth0_branding_domains_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## auth0 branding domains list

List your existing custom domains. To create one try:
auth0 branding domains create

```
auth0 branding domains list [flags]
```

### Examples

```
auth0 branding domains list
auth0 branding domains ls
```

### Flags

```
-h, --help help for list
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
35 changes: 35 additions & 0 deletions docs/auth0_branding_domains_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## auth0 branding domains show

Show a custom domain.

```
auth0 branding domains show [flags]
```

### Examples

```
auth0 branding domains show
auth0 branding domains show <id>
```

### Flags

```
-h, --help help for show
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
35 changes: 35 additions & 0 deletions docs/auth0_branding_domains_verify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## auth0 branding domains verify

Verify a custom domain.

```
auth0 branding domains verify [flags]
```

### Examples

```
auth0 branding domains verify
auth0 branding domains verify <id>
```

### Flags

```
-h, --help help for verify
```

### Flags inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 branding domains](auth0_branding_domains.md) - Manage custom domains
2 changes: 1 addition & 1 deletion docs/auth0_logs_streams_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ auth0 logs streams create -n test-splunk -t splunk --splunk-domain demo.splunk.c
-h, --help help for create
--http-auth string HTTP Authorization header.
--http-endpoint string HTTP endpoint.
--http-format string HTTP Content-Format header. Possible values: JSONLINES, JSONARRAY, JSONOBJECT.
--http-format string HTTP Content-Format header. Possible values: jsonlines, jsonarray, jsonobject.
--http-type string HTTP Content-Type header. Possible values: application/json.
-n, --name string Name of the log stream.
--splunk-domain string The domain name of the splunk instance.
Expand Down
2 changes: 1 addition & 1 deletion docs/auth0_logs_streams_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ auth0 logs streams update <id> -n myeventbridge -t eventbridge
-h, --help help for update
--http-auth string HTTP Authorization header.
--http-endpoint string HTTP endpoint.
--http-format string HTTP Content-Format header. Possible values: JSONLINES, JSONARRAY, JSONOBJECT.
--http-format string HTTP Content-Format header. Possible values: jsonlines, jsonarray, jsonobject.
--http-type string HTTP Content-Type header. Possible values: application/json.
-n, --name string Name of the log stream.
--splunk-domain string The domain name of the splunk instance.
Expand Down
3 changes: 2 additions & 1 deletion internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var requiredScopes = []string{
"create:users", "delete:users", "read:users", "update:users",
"read:branding", "update:branding",
"read:connections", "update:connections",
"read:client_keys", "read:logs", "read:tenant_settings", "read:custom_domains",
"read:client_keys", "read:logs", "read:tenant_settings",
"read:custom_domains", "create:custom_domains", "delete:custom_domains",
"read:anomaly_blocks", "delete:anomaly_blocks",
"create:log_streams", "delete:log_streams", "read:log_streams", "update:log_streams",
}
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestRequiredScopes(t *testing.T) {
list := []string{
"read:branding", "update:branding",
"read:connections", "update:connections",
"read:custom_domains",
"read:custom_domains", "create:custom_domains", "delete:custom_domains",
"read:client_keys", "read:logs", "read:tenant_settings",
"read:anomaly_blocks", "delete:anomaly_blocks",
}
Expand Down
13 changes: 13 additions & 0 deletions internal/auth0/custom_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@ package auth0
import "gopkg.in/auth0.v5/management"

type CustomDomainAPI interface {
// Create a new custom domain.
Create(c *management.CustomDomain, opts ...management.RequestOption) (err error)

// Read retrieves a custom domain by its id.
Read(id string, opts ...management.RequestOption) (c *management.CustomDomain, err error)

// Delete a custom domain.
Delete(id string, opts ...management.RequestOption) (err error)

// Verify a custom domain.
Verify(id string, opts ...management.RequestOption) (c *management.CustomDomain, err error)

// List all custom domains.
List(opts ...management.RequestOption) (c []*management.CustomDomain, err error)
}
2 changes: 1 addition & 1 deletion internal/cli/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ auth0 apis delete <id|audience>`,
_, err := cli.api.ResourceServer.Read(url.PathEscape(inputs.ID))

if err != nil {
return fmt.Errorf("Unable to delete API. The specified Id: %v doesn't exist", inputs.ID)
return fmt.Errorf("Unable to delete API: %w", err)
}

return cli.api.ResourceServer.Delete(url.PathEscape(inputs.ID))
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ auth0 apps delete <id>`,
_, err := cli.api.Client.Read(inputs.ID)

if err != nil {
return fmt.Errorf("Unable to delete application. The specified Id: %v doesn't exist", inputs.ID)
return fmt.Errorf("Unable to delete application: %w", err)
}

return cli.api.Client.Delete(inputs.ID)
Expand Down
1 change: 1 addition & 0 deletions internal/cli/branding.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func brandingCmd(cli *cli) *cobra.Command {
cmd.AddCommand(showBrandingCmd(cli))
cmd.AddCommand(updateBrandingCmd(cli))
cmd.AddCommand(templateCmd(cli))
cmd.AddCommand(customDomainsCmd(cli))
return cmd
}

Expand Down
Loading

0 comments on commit da352f4

Please sign in to comment.