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

Method UserSecrets

codersdk/usersecrets.go:60–71  ·  view source on GitHub ↗
(ctx context.Context, user string)

Source from the content-addressed store, hash-verified

58}
59
60func (c *Client) UserSecrets(ctx context.Context, user string) ([]UserSecret, error) {
61 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/users/%s/secrets", user), nil)
62 if err != nil {
63 return nil, err
64 }
65 defer res.Body.Close()
66 if res.StatusCode != http.StatusOK {
67 return nil, ReadBodyAsError(res)
68 }
69 var secrets []UserSecret
70 return secrets, json.NewDecoder(res.Body).Decode(&secrets)
71}
72
73func (c *Client) UserSecretByName(ctx context.Context, user string, name string) (UserSecret, error) {
74 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/users/%s/secrets/%s", user, name), nil)

Callers 3

TestUserSecretAuditFunction · 0.80
TestGetUserSecretsFunction · 0.80
secretListMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestUserSecretAuditFunction · 0.64
TestGetUserSecretsFunction · 0.64