Skip to content

feat(coderd): add endpoint to fetch provisioner key details #15505

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 13 commits into from
Nov 20, 2024
Prev Previous commit
Next Next commit
linter
  • Loading branch information
defelmnq committed Nov 14, 2024
commit 911a47ddb7f78a9bb45d9a1e18ab1375c9137d2c
4 changes: 2 additions & 2 deletions codersdk/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ func (c *Client) ListProvisionerKeys(ctx context.Context, organizationID uuid.UU
return resp, json.NewDecoder(res.Body).Decode(&resp)
}

// FetchProvisionerTagsTagsByKey returns the provisioner tags associated with the provisioner key.
func (c *Client) FetchProvisionerTagsTagsByKey(ctx context.Context, organizationID uuid.UUID, provisionerKey string) (ProvisionerKeyTags, error) {
// FetchProvisionerTagsByKey returns the provisioner tags associated with the provisioner key.
func (c *Client) FetchProvisionerTagsByKey(ctx context.Context, organizationID uuid.UUID, provisionerKey string) (ProvisionerKeyTags, error) {
res, err := c.Request(ctx, http.MethodGet,
fmt.Sprintf("/api/v2/organizations/%s/provisionerkeys/%s/tags", organizationID.String(), provisionerKey),
nil,
Expand Down
4 changes: 2 additions & 2 deletions enterprise/coderd/provisionerkeys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ func TestProvisionerKeyTags(t *testing.T) {
})
require.NoError(t, err)

tags, err := client.FetchProvisionerTagsTagsByKey(ctx, owner.OrganizationID, "key")
tags, err := client.FetchProvisionerTagsByKey(ctx, owner.OrganizationID, "key")
require.NoError(t, err)
require.Equal(t, tags, codersdk.ProvisionerKeyTags{"key1": "value1", "key2": "value2"})

_, err = client.FetchProvisionerTagsTagsByKey(ctx, owner.OrganizationID, "invalid_key")
_, err = client.FetchProvisionerTagsByKey(ctx, owner.OrganizationID, "invalid_key")
require.ErrorContains(t, err, "Resource not found")
})
}
Loading