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

Method Replicas

codersdk/replicas.go:31–44  ·  view source on GitHub ↗

Replicas fetches the list of replicas.

(ctx context.Context)

Source from the content-addressed store, hash-verified

29
30// Replicas fetches the list of replicas.
31func (c *Client) Replicas(ctx context.Context) ([]Replica, error) {
32 res, err := c.Request(ctx, http.MethodGet, "/api/v2/replicas", nil)
33 if err != nil {
34 return nil, xerrors.Errorf("execute request: %w", err)
35 }
36 defer res.Body.Close()
37
38 if res.StatusCode != http.StatusOK {
39 return nil, ReadBodyAsError(res)
40 }
41
42 var replicas []Replica
43 return replicas, json.NewDecoder(res.Body).Decode(&replicas)
44}

Callers 2

TestChatStreamRelayFunction · 0.80
TestReplicasFunction · 0.80

Calls 4

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

Tested by 2

TestChatStreamRelayFunction · 0.64
TestReplicasFunction · 0.64