Skip to content

fix: improve provisioner key cli usability #14834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions codersdk/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/http/cookiejar"
"strings"
"time"

"github.com/google/uuid"
Expand Down Expand Up @@ -274,12 +275,22 @@ func (c *Client) ServeProvisionerDaemon(ctx context.Context, req ServeProvisione
return proto.NewDRPCProvisionerDaemonClient(drpc.MultiplexedConn(session)), nil
}

type ProvisionerKeyTags map[string]string

func (p ProvisionerKeyTags) String() string {
tags := []string{}
for key, value := range p {
tags = append(tags, fmt.Sprintf("%s=%s", key, value))
}
return strings.Join(tags, " ")
}

type ProvisionerKey struct {
ID uuid.UUID `json:"id" table:"-" format:"uuid"`
CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"`
OrganizationID uuid.UUID `json:"organization" table:"organization id" format:"uuid"`
Name string `json:"name" table:"name,default_sort"`
Tags map[string]string `json:"tags" table:"tags"`
ID uuid.UUID `json:"id" table:"-" format:"uuid"`
CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"`
OrganizationID uuid.UUID `json:"organization" table:"-" format:"uuid"`
Name string `json:"name" table:"name,default_sort"`
Tags ProvisionerKeyTags `json:"tags" table:"tags"`
// HashedSecret - never include the access token in the API response
}

Expand Down
6 changes: 3 additions & 3 deletions docs/admin/provisioners.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For example, running 30 provisioner containers will allow 30 users to start
workspaces at the same time.

Provisioners are started with the
[coder provisionerd start](../reference/cli/provisionerd_start.md) command.
[coder provisionerd start](../reference/cli/provisioner_start.md) command.

## Authentication

Expand All @@ -49,7 +49,7 @@ the [Helm example](#example-running-an-external-provisioner-with-helm) below.

Provisioners can broadly be categorized by scope: `organization` or `user`. The
scope of a provisioner can be specified with
[`-tag=scope=<scope>`](../reference/cli/provisionerd_start.md#t---tag) when
[`-tag=scope=<scope>`](../reference/cli/provisioner_start.md#t---tag) when
starting the provisioner daemon. Only users with at least the
[Template Admin](../admin/users.md#roles) role or higher may create
organization-scoped provisioner daemons.
Expand All @@ -59,7 +59,7 @@ There are two exceptions:
- [Built-in provisioners](../reference/cli/server.md#provisioner-daemons) are
always organization-scoped.
- External provisioners started using a
[pre-shared key (PSK)](../reference/cli/provisionerd_start.md#psk) are always
[pre-shared key (PSK)](../reference/cli/provisioner_start.md#psk) are always
organization-scoped.

### Organization-Scoped Provisioners
Expand Down
24 changes: 12 additions & 12 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -916,34 +916,34 @@
"path": "reference/cli/port-forward.md"
},
{
"title": "provisionerd",
"title": "provisioner",
"description": "Manage provisioner daemons",
"path": "reference/cli/provisionerd.md"
"path": "reference/cli/provisioner.md"
},
{
"title": "provisionerd keys",
"title": "provisioner keys",
"description": "Manage provisioner keys",
"path": "reference/cli/provisionerd_keys.md"
"path": "reference/cli/provisioner_keys.md"
},
{
"title": "provisionerd keys create",
"title": "provisioner keys create",
"description": "Create a new provisioner key",
"path": "reference/cli/provisionerd_keys_create.md"
"path": "reference/cli/provisioner_keys_create.md"
},
{
"title": "provisionerd keys delete",
"title": "provisioner keys delete",
"description": "Delete a provisioner key",
"path": "reference/cli/provisionerd_keys_delete.md"
"path": "reference/cli/provisioner_keys_delete.md"
},
{
"title": "provisionerd keys list",
"title": "provisioner keys list",
"description": "List provisioner keys in an organization",
"path": "reference/cli/provisionerd_keys_list.md"
"path": "reference/cli/provisioner_keys_list.md"
},
{
"title": "provisionerd start",
"title": "provisioner start",
"description": "Run a provisioner daemon",
"path": "reference/cli/provisionerd_start.md"
"path": "reference/cli/provisioner_start.md"
},
{
"title": "publickey",
Expand Down
62 changes: 31 additions & 31 deletions docs/reference/api/enterprise.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 22 additions & 8 deletions docs/reference/api/schemas.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/cli/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions docs/reference/cli/provisioner.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions docs/reference/cli/provisioner_keys.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading