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

Method AgentConnectionInfoGeneric

codersdk/workspacesdk/workspacesdk.go:150–162  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

148}
149
150func (c *Client) AgentConnectionInfoGeneric(ctx context.Context) (AgentConnectionInfo, error) {
151 res, err := c.client.Request(ctx, http.MethodGet, "/api/v2/workspaceagents/connection", nil)
152 if err != nil {
153 return AgentConnectionInfo{}, err
154 }
155 defer res.Body.Close()
156 if res.StatusCode != http.StatusOK {
157 return AgentConnectionInfo{}, codersdk.ReadBodyAsError(res)
158 }
159
160 var connInfo AgentConnectionInfo
161 return connInfo, json.NewDecoder(res.Body).Decode(&connInfo)
162}
163
164func (c *Client) AgentConnectionInfo(ctx context.Context, agentID uuid.UUID) (AgentConnectionInfo, error) {
165 res, err := c.client.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaceagents/%s/connection", agentID), nil)

Callers 8

IsCoderConnectRunningMethod · 0.95
TestAgentConnectionInfoFunction · 0.80
TestDERPForceWebSocketsFunction · 0.80
NewConnMethod · 0.80
pingMethod · 0.80
sshMethod · 0.80
netcheckMethod · 0.80
NetworkInfoFunction · 0.80

Calls 3

ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
RequestMethod · 0.45

Tested by 2

TestAgentConnectionInfoFunction · 0.64
TestDERPForceWebSocketsFunction · 0.64