ListProvisionerKeys lists all provisioner keys for an organization.
(ctx context.Context, organizationID uuid.UUID)
| 440 | |
| 441 | // ListProvisionerKeys lists all provisioner keys for an organization. |
| 442 | func (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. |
| 460 | func (c *Client) GetProvisionerKey(ctx context.Context, pk string) (ProvisionerKey, error) { |