| 84 | } |
| 85 | |
| 86 | func (c *Client) UpdateUserSecret(ctx context.Context, user string, name string, req UpdateUserSecretRequest) (UserSecret, error) { |
| 87 | res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/users/%s/secrets/%s", user, name), req) |
| 88 | if err != nil { |
| 89 | return UserSecret{}, err |
| 90 | } |
| 91 | defer res.Body.Close() |
| 92 | if res.StatusCode != http.StatusOK { |
| 93 | return UserSecret{}, ReadBodyAsError(res) |
| 94 | } |
| 95 | var secret UserSecret |
| 96 | return secret, json.NewDecoder(res.Body).Decode(&secret) |
| 97 | } |
| 98 | |
| 99 | func (c *Client) DeleteUserSecret(ctx context.Context, user string, name string) error { |
| 100 | res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/users/%s/secrets/%s", user, name), nil) |