Skip to content

Commit

Permalink
Add organizations CRUD [CLI-189] (#325)
Browse files Browse the repository at this point in the history
* Initial implementation of orgs CRUD

* Update color example

* Fix cerate and update commands

* Add integration test

* Fix tests

* Add docs

* Use makeOrganization

* Remove unused mockgen comments
  • Loading branch information
Widcket authored Jul 6, 2021
1 parent 85d22b7 commit daf7e30
Show file tree
Hide file tree
Showing 26 changed files with 925 additions and 22 deletions.
5 changes: 4 additions & 1 deletion commander.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ tests:
auth0 actions list:
exit-code: 0

auth0 orgs list:
exit-code: 0

auth0 branding domains list:
exit-code: 0

Expand Down Expand Up @@ -498,4 +501,4 @@ tests:
stdout:
json:
Description: betterDescription
exit-code: 0
exit-code: 0
38 changes: 38 additions & 0 deletions docs/auth0_orgs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: default
---
## auth0 orgs

Manage resources for organizations

### Synopsis

Manage resources for organizations.

### Options

```
-h, --help help for orgs
```

### Options 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](/auth0-cli/) - Supercharge your development workflow.
* [auth0 orgs create](auth0_orgs_create.md) - Create a new organization
* [auth0 orgs delete](auth0_orgs_delete.md) - Delete an organization
* [auth0 orgs list](auth0_orgs_list.md) - List your organizations
* [auth0 orgs open](auth0_orgs_open.md) - Open organization settings page in the Auth0 Dashboard
* [auth0 orgs show](auth0_orgs_show.md) - Show an organization
* [auth0 orgs update](auth0_orgs_update.md) - Update an organization

52 changes: 52 additions & 0 deletions docs/auth0_orgs_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
layout: default
---
## auth0 orgs create

Create a new organization

### Synopsis

Create a new organization.

```
auth0 orgs create [flags]
```

### Examples

```
auth0 orgs create
auth0 orgs create --name myorganization
auth0 orgs create --n myorganization --display "My Organization"
auth0 orgs create --n myorganization -d "My Organization" -l "https://example.com/logo.png" -a "#635DFF" -b "#2A2E35"
auth0 orgs create --n myorganization -d "My Organization" -m "KEY=value" -m "OTHER_KEY=other_value"
```

### Options

```
-a, --accent string Accent color used to customize the login pages.
-b, --background string Background color used to customize the login pages.
-d, --display string Friendly name of the organization.
-h, --help help for create
-l, --logo string URL of the logo to be displayed on the login page.
-m, --metadata stringToString Metadata associated with the organization (max 255 chars). Maximum of 10 metadata properties allowed. (default [])
-n, --name string Name of the organization.
```

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

43 changes: 43 additions & 0 deletions docs/auth0_orgs_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: default
---
## auth0 orgs delete

Delete an organization

### Synopsis

Delete an organization.

```
auth0 orgs delete [flags]
```

### Examples

```
auth0 orgs delete
auth0 orgs delete <id>
```

### Options

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

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

44 changes: 44 additions & 0 deletions docs/auth0_orgs_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: default
---
## auth0 orgs list

List your organizations

### Synopsis

List your existing organizations. To create one try:
auth0 orgs create

```
auth0 orgs list [flags]
```

### Examples

```
auth0 orgs list
auth0 orgs ls
```

### Options

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

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

42 changes: 42 additions & 0 deletions docs/auth0_orgs_open.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: default
---
## auth0 orgs open

Open organization settings page in the Auth0 Dashboard

### Synopsis

Open organization settings page in the Auth0 Dashboard.

```
auth0 orgs open [flags]
```

### Examples

```
auth0 orgs open <id>
```

### Options

```
-h, --help help for open
```

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

43 changes: 43 additions & 0 deletions docs/auth0_orgs_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: default
---
## auth0 orgs show

Show an organization

### Synopsis

Show an organization.

```
auth0 orgs show [flags]
```

### Examples

```
auth0 orgs show
auth0 orgs show <id>
```

### Options

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

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

50 changes: 50 additions & 0 deletions docs/auth0_orgs_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
layout: default
---
## auth0 orgs update

Update an organization

### Synopsis

Update an organization.

```
auth0 orgs update [flags]
```

### Examples

```
auth0 orgs update <id>
auth0 orgs update <id> --display "My Organization"
auth0 orgs update <id> -d "My Organization" -l "https://example.com/logo.png" -a "#635DFF" -b "#2A2E35"
auth0 orgs update <id> -d "My Organization" -m "KEY=value" -m "OTHER_KEY=other_value"
```

### Options

```
-a, --accent string Accent color used to customize the login pages.
-b, --background string Background color used to customize the login pages.
-d, --display string Friendly name of the organization.
-h, --help help for update
-l, --logo string URL of the logo to be displayed on the login page.
-m, --metadata stringToString Metadata associated with the organization (max 255 chars). Maximum of 10 metadata properties allowed. (default [])
```

### Options 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 orgs](auth0_orgs.md) - Manage resources for organizations

1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Supercharge your development workflow.
* [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
* [auth0 orgs](auth0_orgs.md) - Manage resources for organizations
* [auth0 quickstarts](auth0_quickstarts.md) - Quickstart support for getting bootstrapped
* [auth0 roles](auth0_roles.md) - Manage resources for roles
* [auth0 rules](auth0_rules.md) - Manage resources for rules
Expand Down
1 change: 1 addition & 0 deletions internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var requiredScopes = []string{
"read:anomaly_blocks", "delete:anomaly_blocks",
"create:log_streams", "delete:log_streams", "read:log_streams", "update:log_streams",
"create:actions", "delete:actions", "read:actions", "update:actions",
"create:organizations", "delete:organizations", "read:organizations", "update:organizations",
}

type Authenticator struct {
Expand Down
2 changes: 0 additions & 2 deletions internal/auth0/action.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:generate mockgen -source=action.go -destination=action_mock.go -package=auth0

package auth0

import "gopkg.in/auth0.v5/management"
Expand Down
2 changes: 0 additions & 2 deletions internal/auth0/anomaly.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:generate mockgen -source=anomaly.go -destination=anomaly_mock.go -package=auth0

package auth0

import "gopkg.in/auth0.v5/management"
Expand Down
4 changes: 3 additions & 1 deletion internal/auth0/auth0.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type API struct {
EmailTemplate EmailTemplateAPI
Log LogAPI
LogStream LogStreamAPI
Organization OrganizationAPI
ResourceServer ResourceServerAPI
Role RoleAPI
Rule RuleAPI
Expand All @@ -30,16 +31,17 @@ func NewAPI(m *management.Management) *API {
Anomaly: m.Anomaly,
Branding: m.Branding,
Client: m.Client,
Connection: m.Connection,
CustomDomain: m.CustomDomain,
EmailTemplate: m.EmailTemplate,
Log: m.Log,
LogStream: m.LogStream,
Organization: m.Organization,
ResourceServer: m.ResourceServer,
Role: m.Role,
Rule: m.Rule,
Tenant: m.Tenant,
User: m.User,
Connection: m.Connection,
}
}

Expand Down
1 change: 0 additions & 1 deletion internal/auth0/branding.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:generate mockgen -source=branding.go -destination=branding_mock.go -package=auth0
package auth0

import "gopkg.in/auth0.v5/management"
Expand Down
Loading

0 comments on commit daf7e30

Please sign in to comment.