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

Method UpdateUserSecret

codersdk/usersecrets.go:86–97  ·  view source on GitHub ↗
(ctx context.Context, user string, name string, req UpdateUserSecretRequest)

Source from the content-addressed store, hash-verified

84}
85
86func (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
99func (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)

Callers 5

TestUserSecretAuditFunction · 0.80
TestPatchUserSecretFunction · 0.80
TestUserSecretLimitsFunction · 0.80
secretUpdateMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 4

TestUserSecretAuditFunction · 0.64
TestPatchUserSecretFunction · 0.64
TestUserSecretLimitsFunction · 0.64