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

Method Regions

codersdk/workspaceproxy.go:205–221  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

203}
204
205func (c *Client) Regions(ctx context.Context) ([]Region, error) {
206 res, err := c.Request(ctx, http.MethodGet,
207 "/api/v2/regions",
208 nil,
209 )
210 if err != nil {
211 return nil, xerrors.Errorf("make request: %w", err)
212 }
213 defer res.Body.Close()
214
215 if res.StatusCode != http.StatusOK {
216 return nil, ReadBodyAsError(res)
217 }
218
219 var regions RegionsResponse[Region]
220 return regions.Regions, json.NewDecoder(res.Body).Decode(&regions)
221}

Callers 6

TestDERPFunction · 0.95
TestRegionsFunction · 0.80
openAppMethod · 0.80
TestRegionsFunction · 0.80
TestDERPOnlyFunction · 0.80
TestDERPEndToEndFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
ErrorfMethod · 0.45

Tested by 5

TestDERPFunction · 0.76
TestRegionsFunction · 0.64
TestRegionsFunction · 0.64
TestDERPOnlyFunction · 0.64
TestDERPEndToEndFunction · 0.64