ExpireAPIKey expires an API key by id, setting its expiry to now. This preserves the API key record for audit purposes rather than deleting it.
(ctx context.Context, userID string, id string)
| 179 | // ExpireAPIKey expires an API key by id, setting its expiry to now. |
| 180 | // This preserves the API key record for audit purposes rather than deleting it. |
| 181 | func (c *Client) ExpireAPIKey(ctx context.Context, userID string, id string) error { |
| 182 | res, err := c.Request(ctx, http.MethodPut, fmt.Sprintf("/api/v2/users/%s/keys/%s/expire", userID, id), nil) |
| 183 | if err != nil { |
| 184 | return err |
| 185 | } |
| 186 | defer res.Body.Close() |
| 187 | if res.StatusCode > http.StatusNoContent { |
| 188 | return ReadBodyAsError(res) |
| 189 | } |
| 190 | return nil |
| 191 | } |
| 192 | |
| 193 | // GetTokenConfig returns deployment options related to token management |
| 194 | func (c *Client) GetTokenConfig(ctx context.Context, userID string) (TokenConfig, error) { |