| 148 | } |
| 149 | |
| 150 | func (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 | |
| 164 | func (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) |