MCPcopy Index your code
hub / github.com/coder/coder / ListProvisionerKeys

Method ListProvisionerKeys

codersdk/provisionerdaemons.go:442–457  ·  view source on GitHub ↗

ListProvisionerKeys lists all provisioner keys for an organization.

(ctx context.Context, organizationID uuid.UUID)

Source from the content-addressed store, hash-verified

440
441// ListProvisionerKeys lists all provisioner keys for an organization.
442func (c *Client) ListProvisionerKeys(ctx context.Context, organizationID uuid.UUID) ([]ProvisionerKey, error) {
443 res, err := c.Request(ctx, http.MethodGet,
444 fmt.Sprintf("/api/v2/organizations/%s/provisionerkeys", organizationID.String()),
445 nil,
446 )
447 if err != nil {
448 return nil, xerrors.Errorf("make request: %w", err)
449 }
450 defer res.Body.Close()
451
452 if res.StatusCode != http.StatusOK {
453 return nil, ReadBodyAsError(res)
454 }
455 var resp []ProvisionerKey
456 return resp, json.NewDecoder(res.Body).Decode(&resp)
457}
458
459// GetProvisionerKey returns the provisioner key.
460func (c *Client) GetProvisionerKey(ctx context.Context, pk string) (ProvisionerKey, error) {

Callers 3

TestProvisionerKeysFunction · 0.80
provisionerKeysListMethod · 0.80

Calls 5

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by 2

TestProvisionerKeysFunction · 0.64