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

Function deprecatedQuotaEndpoint

enterprise/coderd/workspacequota_test.go:1179–1190  ·  view source on GitHub ↗
(ctx context.Context, client *codersdk.Client, userID string)

Source from the content-addressed store, hash-verified

1177}
1178
1179func deprecatedQuotaEndpoint(ctx context.Context, client *codersdk.Client, userID string) (codersdk.WorkspaceQuota, error) {
1180 res, err := client.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspace-quota/%s", userID), nil)
1181 if err != nil {
1182 return codersdk.WorkspaceQuota{}, err
1183 }
1184 defer res.Body.Close()
1185 if res.StatusCode != http.StatusOK {
1186 return codersdk.WorkspaceQuota{}, codersdk.ReadBodyAsError(res)
1187 }
1188 var quota codersdk.WorkspaceQuota
1189 return quota, json.NewDecoder(res.Body).Decode(&quota)
1190}
1191
1192func planWithCost(cost int32) []*proto.Response {
1193 return []*proto.Response{{

Callers 1

verifyQuotaUserFunction · 0.85

Calls 3

ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
RequestMethod · 0.45

Tested by

no test coverage detected