chore: unhide multi-organization cli commands (#14693)

* chore: unhide multi-organization cli commands

Multi-org is going into GA, unhide cli commands
This commit is contained in:
Steven Masley
2024-09-17 10:22:20 -05:00
committed by GitHub
parent 370f0b9020
commit be516f9686
38 changed files with 725 additions and 7 deletions

View File

@ -18,7 +18,6 @@ func (r *RootCmd) organizations() *serpent.Command {
Use: "organizations [subcommand]", Use: "organizations [subcommand]",
Short: "Organization related commands", Short: "Organization related commands",
Aliases: []string{"organization", "org", "orgs"}, Aliases: []string{"organization", "org", "orgs"},
Hidden: true, // Hidden until these commands are complete.
Handler: func(inv *serpent.Invocation) error { Handler: func(inv *serpent.Invocation) error {
return inv.Command.HelpHandler(inv) return inv.Command.HelpHandler(inv)
}, },

View File

@ -18,8 +18,6 @@ func (r *RootCmd) createOrganization() *serpent.Command {
cmd := &serpent.Command{ cmd := &serpent.Command{
Use: "create <organization name>", Use: "create <organization name>",
Short: "Create a new organization.", Short: "Create a new organization.",
// This action is currently irreversible, so it's hidden until we have a way to delete organizations.
Hidden: true,
Middleware: serpent.Chain( Middleware: serpent.Chain(
r.InitClient(client), r.InitClient(client),
serpent.RequireNArgs(1), serpent.RequireNArgs(1),

View File

@ -24,7 +24,6 @@ func (r *RootCmd) organizationRoles(orgContext *OrganizationContext) *serpent.Co
Handler: func(inv *serpent.Invocation) error { Handler: func(inv *serpent.Invocation) error {
return inv.Command.HelpHandler(inv) return inv.Command.HelpHandler(inv)
}, },
Hidden: true,
Children: []*serpent.Command{ Children: []*serpent.Command{
r.showOrganizationRoles(orgContext), r.showOrganizationRoles(orgContext),
r.editOrganizationRole(orgContext), r.editOrganizationRole(orgContext),

View File

@ -31,6 +31,7 @@ SUBCOMMANDS:
netcheck Print network debug information for DERP and STUN netcheck Print network debug information for DERP and STUN
notifications Manage Coder notifications notifications Manage Coder notifications
open Open a workspace open Open a workspace
organizations Organization related commands
ping Ping a workspace ping Ping a workspace
port-forward Forward ports from a workspace to the local machine. For port-forward Forward ports from a workspace to the local machine. For
reverse port forwarding, use "coder ssh -R". reverse port forwarding, use "coder ssh -R".

View File

@ -0,0 +1,23 @@
coder v0.0.0-devel
USAGE:
coder organizations [flags] [subcommand]
Organization related commands
Aliases: organization, org, orgs
SUBCOMMANDS:
create Create a new organization.
members Manage organization members
roles Manage organization roles.
show Show the organization. Using "selected" will show the selected
organization from the "--org" flag. Using "me" will show all
organizations you are a member of.
OPTIONS:
-O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use.
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,13 @@
coder v0.0.0-devel
USAGE:
coder organizations create [flags] <organization name>
Create a new organization.
OPTIONS:
-y, --yes bool
Bypass prompts.
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,17 @@
coder v0.0.0-devel
USAGE:
coder organizations members
Manage organization members
Aliases: member
SUBCOMMANDS:
add Add a new member to the current organization
edit-roles Edit organization member's roles
list List all organization members
remove Remove a new member to the current organization
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,9 @@
coder v0.0.0-devel
USAGE:
coder organizations members add <username | user_id>
Add a new member to the current organization
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,11 @@
coder v0.0.0-devel
USAGE:
coder organizations members edit-roles <username | user_id> [roles...]
Edit organization member's roles
Aliases: edit-role
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,16 @@
coder v0.0.0-devel
USAGE:
coder organizations members list [flags]
List all organization members
OPTIONS:
-c, --column [username|name|user id|organization id|created at|updated at|organization roles] (default: username,organization roles)
Columns to display in table output.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,11 @@
coder v0.0.0-devel
USAGE:
coder organizations members remove <username | user_id>
Remove a new member to the current organization
Aliases: rm
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,15 @@
coder v0.0.0-devel
USAGE:
coder organizations roles
Manage organization roles.
Aliases: role
SUBCOMMANDS:
edit Edit an organization custom role
show Show role(s)
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,29 @@
coder v0.0.0-devel
USAGE:
coder organizations roles edit [flags] <role_name>
Edit an organization custom role
- Run with an input.json file:
$ coder roles edit --stdin < role.json
OPTIONS:
-c, --column [name|display name|organization id|site permissions|organization permissions|user permissions] (default: name,display name,site permissions,organization permissions,user permissions)
Columns to display in table output.
--dry-run bool
Does all the work, but does not submit the final updated role.
-o, --output table|json (default: table)
Output format.
--stdin bool
Reads stdin for the json role definition to upload.
-y, --yes bool
Bypass prompts.
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,16 @@
coder v0.0.0-devel
USAGE:
coder organizations roles show [flags] [role_names ...]
Show role(s)
OPTIONS:
-c, --column [name|display name|organization id|site permissions|organization permissions|user permissions] (default: name,display name,site permissions,organization permissions,user permissions)
Columns to display in table output.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.

View File

@ -0,0 +1,38 @@
coder v0.0.0-devel
USAGE:
coder organizations show [flags] ["selected"|"me"|uuid|org_name]
Show the organization. Using "selected" will show the selected organization
from the "--org" flag. Using "me" will show all organizations you are a member
of.
- coder org show selected:
$ Shows the organizations selected with '--org=<org_name>'. This
organization is the organization used by the cli.
- coder org show me:
$ List of all organizations you are a member of.
- coder org show developers:
$ Show organization with name 'developers'
- coder org show 90ee1875-3db5-43b3-828e-af3687522e43:
$ Show organization with the given ID.
OPTIONS:
-c, --column [id|name|display name|icon|description|created at|updated at|default] (default: id,name,default)
Columns to display in table output.
--only-id bool
Only print the organization ID.
-o, --output text|table|json (default: text)
Output format.
———
Run `coder --help` for a list of global options.

View File

@ -807,6 +807,61 @@
"description": "Open a workspace in VS Code Desktop", "description": "Open a workspace in VS Code Desktop",
"path": "reference/cli/open_vscode.md" "path": "reference/cli/open_vscode.md"
}, },
{
"title": "organizations",
"description": "Organization related commands",
"path": "reference/cli/organizations.md"
},
{
"title": "organizations create",
"description": "Create a new organization.",
"path": "reference/cli/organizations_create.md"
},
{
"title": "organizations members",
"description": "Manage organization members",
"path": "reference/cli/organizations_members.md"
},
{
"title": "organizations members add",
"description": "Add a new member to the current organization",
"path": "reference/cli/organizations_members_add.md"
},
{
"title": "organizations members edit-roles",
"description": "Edit organization member's roles",
"path": "reference/cli/organizations_members_edit-roles.md"
},
{
"title": "organizations members list",
"description": "List all organization members",
"path": "reference/cli/organizations_members_list.md"
},
{
"title": "organizations members remove",
"description": "Remove a new member to the current organization",
"path": "reference/cli/organizations_members_remove.md"
},
{
"title": "organizations roles",
"description": "Manage organization roles.",
"path": "reference/cli/organizations_roles.md"
},
{
"title": "organizations roles edit",
"description": "Edit an organization custom role",
"path": "reference/cli/organizations_roles_edit.md"
},
{
"title": "organizations roles show",
"description": "Show role(s)",
"path": "reference/cli/organizations_roles_show.md"
},
{
"title": "organizations show",
"description": "Show the organization. Using \"selected\" will show the selected organization from the \"--org\" flag. Using \"me\" will show all organizations you are a member of.",
"path": "reference/cli/organizations_show.md"
},
{ {
"title": "ping", "title": "ping",
"description": "Ping a workspace", "description": "Ping a workspace",
@ -822,6 +877,26 @@
"description": "Manage provisioner daemons", "description": "Manage provisioner daemons",
"path": "reference/cli/provisionerd.md" "path": "reference/cli/provisionerd.md"
}, },
{
"title": "provisionerd keys",
"description": "Manage provisioner keys",
"path": "reference/cli/provisionerd_keys.md"
},
{
"title": "provisionerd keys create",
"description": "Create a new provisioner key",
"path": "reference/cli/provisionerd_keys_create.md"
},
{
"title": "provisionerd keys delete",
"description": "Delete a provisioner key",
"path": "reference/cli/provisionerd_keys_delete.md"
},
{
"title": "provisionerd keys list",
"description": "List provisioner keys in an organization",
"path": "reference/cli/provisionerd_keys_list.md"
},
{ {
"title": "provisionerd start", "title": "provisionerd start",
"description": "Run a provisioner daemon", "description": "Run a provisioner daemon",

View File

@ -32,6 +32,7 @@ Coder — A tool for provisioning self-hosted development environments with Terr
| [<code>logout</code>](./logout.md) | Unauthenticate your local session | | [<code>logout</code>](./logout.md) | Unauthenticate your local session |
| [<code>netcheck</code>](./netcheck.md) | Print network debug information for DERP and STUN | | [<code>netcheck</code>](./netcheck.md) | Print network debug information for DERP and STUN |
| [<code>notifications</code>](./notifications.md) | Manage Coder notifications | | [<code>notifications</code>](./notifications.md) | Manage Coder notifications |
| [<code>organizations</code>](./organizations.md) | Organization related commands |
| [<code>port-forward</code>](./port-forward.md) | Forward ports from a workspace to the local machine. For reverse port forwarding, use "coder ssh -R". | | [<code>port-forward</code>](./port-forward.md) | Forward ports from a workspace to the local machine. For reverse port forwarding, use "coder ssh -R". |
| [<code>publickey</code>](./publickey.md) | Output your Coder public key used for Git operations | | [<code>publickey</code>](./publickey.md) | Output your Coder public key used for Git operations |
| [<code>reset-password</code>](./reset-password.md) | Directly connect to the database to reset a user's password | | [<code>reset-password</code>](./reset-password.md) | Directly connect to the database to reset a user's password |

37
docs/reference/cli/organizations.md generated Normal file
View File

@ -0,0 +1,37 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations
Organization related commands
Aliases:
- organization
- org
- orgs
## Usage
```console
coder organizations [flags] [subcommand]
```
## Subcommands
| Name | Purpose |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<code>show</code>](./organizations_show.md) | Show the organization. Using "selected" will show the selected organization from the "--org" flag. Using "me" will show all organizations you are a member of. |
| [<code>create</code>](./organizations_create.md) | Create a new organization. |
| [<code>members</code>](./organizations_members.md) | Manage organization members |
| [<code>roles</code>](./organizations_roles.md) | Manage organization roles. |
## Options
### -O, --org
| | |
| ----------- | -------------------------------- |
| Type | <code>string</code> |
| Environment | <code>$CODER_ORGANIZATION</code> |
Select which organization (uuid or name) to use.

View File

@ -0,0 +1,21 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations create
Create a new organization.
## Usage
```console
coder organizations create [flags] <organization name>
```
## Options
### -y, --yes
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Bypass prompts.

View File

@ -0,0 +1,24 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations members
Manage organization members
Aliases:
- member
## Usage
```console
coder organizations members
```
## Subcommands
| Name | Purpose |
| ---------------------------------------------------------------- | ----------------------------------------------- |
| [<code>list</code>](./organizations_members_list.md) | List all organization members |
| [<code>edit-roles</code>](./organizations_members_edit-roles.md) | Edit organization member's roles |
| [<code>add</code>](./organizations_members_add.md) | Add a new member to the current organization |
| [<code>remove</code>](./organizations_members_remove.md) | Remove a new member to the current organization |

View File

@ -0,0 +1,11 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations members add
Add a new member to the current organization
## Usage
```console
coder organizations members add <username | user_id>
```

View File

@ -0,0 +1,15 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations members edit-roles
Edit organization member's roles
Aliases:
- edit-role
## Usage
```console
coder organizations members edit-roles <username | user_id> [roles...]
```

View File

@ -0,0 +1,31 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations members list
List all organization members
## Usage
```console
coder organizations members list [flags]
```
## Options
### -c, --column
| | |
| ------- | --------------------------------------------------------------------------------------------------- |
| Type | <code>[username\|name\|user id\|organization id\|created at\|updated at\|organization roles]</code> |
| Default | <code>username,organization roles</code> |
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format.

View File

@ -0,0 +1,15 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations members remove
Remove a new member to the current organization
Aliases:
- rm
## Usage
```console
coder organizations members remove <username | user_id>
```

View File

@ -0,0 +1,22 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations roles
Manage organization roles.
Aliases:
- role
## Usage
```console
coder organizations roles
```
## Subcommands
| Name | Purpose |
| -------------------------------------------------- | -------------------------------- |
| [<code>show</code>](./organizations_roles_show.md) | Show role(s) |
| [<code>edit</code>](./organizations_roles_edit.md) | Edit an organization custom role |

View File

@ -0,0 +1,63 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations roles edit
Edit an organization custom role
## Usage
```console
coder organizations roles edit [flags] <role_name>
```
## Description
```console
- Run with an input.json file:
$ coder roles edit --stdin < role.json
```
## Options
### -y, --yes
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Bypass prompts.
### --dry-run
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Does all the work, but does not submit the final updated role.
### --stdin
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Reads stdin for the json role definition to upload.
### -c, --column
| | |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| Type | <code>[name\|display name\|organization id\|site permissions\|organization permissions\|user permissions]</code> |
| Default | <code>name,display name,site permissions,organization permissions,user permissions</code> |
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format.

View File

@ -0,0 +1,31 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations roles show
Show role(s)
## Usage
```console
coder organizations roles show [flags] [role_names ...]
```
## Options
### -c, --column
| | |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| Type | <code>[name\|display name\|organization id\|site permissions\|organization permissions\|user permissions]</code> |
| Default | <code>name,display name,site permissions,organization permissions,user permissions</code> |
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format.

59
docs/reference/cli/organizations_show.md generated Normal file
View File

@ -0,0 +1,59 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# organizations show
Show the organization. Using "selected" will show the selected organization from the "--org" flag. Using "me" will show all organizations you are a member of.
## Usage
```console
coder organizations show [flags] ["selected"|"me"|uuid|org_name]
```
## Description
```console
- coder org show selected:
$ Shows the organizations selected with '--org=<org_name>'. This organization is the organization used by the cli.
- coder org show me:
$ List of all organizations you are a member of.
- coder org show developers:
$ Show organization with name 'developers'
- coder org show 90ee1875-3db5-43b3-828e-af3687522e43:
$ Show organization with the given ID.
```
## Options
### --only-id
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Only print the organization ID.
### -c, --column
| | |
| ------- | ----------------------------------------------------------------------------------------- |
| Type | <code>[id\|name\|display name\|icon\|description\|created at\|updated at\|default]</code> |
| Default | <code>id,name,default</code> |
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------------------ |
| Type | <code>text\|table\|json</code> |
| Default | <code>text</code> |
Output format.

View File

@ -19,3 +19,4 @@ coder provisionerd
| Name | Purpose | | Name | Purpose |
| --------------------------------------------- | ------------------------ | | --------------------------------------------- | ------------------------ |
| [<code>start</code>](./provisionerd_start.md) | Run a provisioner daemon | | [<code>start</code>](./provisionerd_start.md) | Run a provisioner daemon |
| [<code>keys</code>](./provisionerd_keys.md) | Manage provisioner keys |

23
docs/reference/cli/provisionerd_keys.md generated Normal file
View File

@ -0,0 +1,23 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# provisionerd keys
Manage provisioner keys
Aliases:
- key
## Usage
```console
coder provisionerd keys
```
## Subcommands
| Name | Purpose |
| ---------------------------------------------------- | ---------------------------------------- |
| [<code>create</code>](./provisionerd_keys_create.md) | Create a new provisioner key |
| [<code>list</code>](./provisionerd_keys_list.md) | List provisioner keys in an organization |
| [<code>delete</code>](./provisionerd_keys_delete.md) | Delete a provisioner key |

View File

@ -0,0 +1,31 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# provisionerd keys create
Create a new provisioner key
## Usage
```console
coder provisionerd keys create [flags] <name>
```
## Options
### -t, --tag
| | |
| ----------- | ------------------------------------- |
| Type | <code>string-array</code> |
| Environment | <code>$CODER_PROVISIONERD_TAGS</code> |
Tags to filter provisioner jobs by.
### -O, --org
| | |
| ----------- | -------------------------------- |
| Type | <code>string</code> |
| Environment | <code>$CODER_ORGANIZATION</code> |
Select which organization (uuid or name) to use.

View File

@ -0,0 +1,34 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# provisionerd keys delete
Delete a provisioner key
Aliases:
- rm
## Usage
```console
coder provisionerd keys delete [flags] <name>
```
## Options
### -y, --yes
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Bypass prompts.
### -O, --org
| | |
| ----------- | -------------------------------- |
| Type | <code>string</code> |
| Environment | <code>$CODER_ORGANIZATION</code> |
Select which organization (uuid or name) to use.

View File

@ -0,0 +1,26 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# provisionerd keys list
List provisioner keys in an organization
Aliases:
- ls
## Usage
```console
coder provisionerd keys list [flags]
```
## Options
### -O, --org
| | |
| ----------- | -------------------------------- |
| Type | <code>string</code> |
| Environment | <code>$CODER_ORGANIZATION</code> |
Select which organization (uuid or name) to use.

View File

@ -20,7 +20,6 @@ func (r *RootCmd) provisionerKeys() *serpent.Command {
Handler: func(inv *serpent.Invocation) error { Handler: func(inv *serpent.Invocation) error {
return inv.Command.HelpHandler(inv) return inv.Command.HelpHandler(inv)
}, },
Hidden: true,
Aliases: []string{"key"}, Aliases: []string{"key"},
Children: []*serpent.Command{ Children: []*serpent.Command{
r.provisionerKeysCreate(), r.provisionerKeysCreate(),

View File

@ -8,6 +8,7 @@ USAGE:
Aliases: provisioner Aliases: provisioner
SUBCOMMANDS: SUBCOMMANDS:
keys Manage provisioner keys
start Run a provisioner daemon start Run a provisioner daemon
——— ———

View File

@ -10,7 +10,7 @@ USAGE:
SUBCOMMANDS: SUBCOMMANDS:
create Create a new provisioner key create Create a new provisioner key
delete Delete a provisioner key delete Delete a provisioner key
list List provisioner keys list List provisioner keys in an organization
——— ———
Run `coder --help` for a list of global options. Run `coder --help` for a list of global options.

View File

@ -9,5 +9,8 @@ OPTIONS:
-O, --org string, $CODER_ORGANIZATION -O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use. Select which organization (uuid or name) to use.
-t, --tag string-array, $CODER_PROVISIONERD_TAGS
Tags to filter provisioner jobs by.
——— ———
Run `coder --help` for a list of global options. Run `coder --help` for a list of global options.

View File

@ -3,7 +3,7 @@ coder v0.0.0-devel
USAGE: USAGE:
coder provisionerd keys list [flags] coder provisionerd keys list [flags]
List provisioner keys List provisioner keys in an organization
Aliases: ls Aliases: ls