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

Method CreateProvisionerKey

codersdk/provisionerdaemons.go:424–439  ·  view source on GitHub ↗

CreateProvisionerKey creates a new provisioner key for an organization.

(ctx context.Context, organizationID uuid.UUID, req CreateProvisionerKeyRequest)

Source from the content-addressed store, hash-verified

422
423// CreateProvisionerKey creates a new provisioner key for an organization.
424func (c *Client) CreateProvisionerKey(ctx context.Context, organizationID uuid.UUID, req CreateProvisionerKeyRequest) (CreateProvisionerKeyResponse, error) {
425 res, err := c.Request(ctx, http.MethodPost,
426 fmt.Sprintf("/api/v2/organizations/%s/provisionerkeys", organizationID.String()),
427 req,
428 )
429 if err != nil {
430 return CreateProvisionerKeyResponse{}, xerrors.Errorf("make request: %w", err)
431 }
432 defer res.Body.Close()
433
434 if res.StatusCode != http.StatusCreated {
435 return CreateProvisionerKeyResponse{}, ReadBodyAsError(res)
436 }
437 var resp CreateProvisionerKeyResponse
438 return resp, json.NewDecoder(res.Body).Decode(&resp)
439}
440
441// ListProvisionerKeys lists all provisioner keys for an organization.
442func (c *Client) ListProvisionerKeys(ctx context.Context, organizationID uuid.UUID) ([]ProvisionerKey, error) {

Calls 5

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