Skip to content

feat: add provisioner key cli commands #13875

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 9 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
pr comments
  • Loading branch information
f0ssel committed Jul 18, 2024
commit 90412c7aa2c37c49e7028448259d12d6a31f2fa8
8 changes: 4 additions & 4 deletions codersdk/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ func (c *Client) ServeProvisionerDaemon(ctx context.Context, req ServeProvisione
}

type ProvisionerKey struct {
ID uuid.UUID `json:"id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
OrganizationID uuid.UUID `json:"organization" format:"uuid"`
Name string `json:"name"`
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"`
// HashedSecret - never include the access token in the API response
}

Expand Down
9 changes: 7 additions & 2 deletions enterprise/cli/provisionerkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ func (r *RootCmd) provisionerKeysCreate() *serpent.Command {
return xerrors.Errorf("create provisioner key: %w", err)
}

_, _ = fmt.Fprintf(inv.Stdout, "Successfully created provisioner key %s!\n\n%s\n", pretty.Sprint(cliui.DefaultStyles.Keyword, strings.ToLower(inv.Args[0])), pretty.Sprint(cliui.DefaultStyles.Keyword, res.Key))
_, _ = fmt.Fprintf(
inv.Stdout,
"Successfully created provisioner key %s! Save this authentication token, it will not be shown again.\n\n%s\n",
pretty.Sprint(cliui.DefaultStyles.Keyword, strings.ToLower(inv.Args[0])),
pretty.Sprint(cliui.DefaultStyles.Keyword, res.Key),
)

return nil
},
Expand Down Expand Up @@ -107,7 +112,7 @@ func (r *RootCmd) provisionerKeysList() *serpent.Command {
client := new(codersdk.Client)
cmd := &serpent.Command{
Use: "list",
Short: "List provisioner keys",
Short: "List provisioner keys in an organization",
Aliases: []string{"ls"},
Middleware: serpent.Chain(
serpent.RequireNArgs(0),
Expand Down
Loading