WorkspaceAgent returns an agent by ID.
(ctx context.Context, id uuid.UUID)
| 356 | |
| 357 | // WorkspaceAgent returns an agent by ID. |
| 358 | func (c *Client) WorkspaceAgent(ctx context.Context, id uuid.UUID) (WorkspaceAgent, error) { |
| 359 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaceagents/%s", id), nil) |
| 360 | if err != nil { |
| 361 | return WorkspaceAgent{}, err |
| 362 | } |
| 363 | defer res.Body.Close() |
| 364 | if res.StatusCode != http.StatusOK { |
| 365 | return WorkspaceAgent{}, ReadBodyAsError(res) |
| 366 | } |
| 367 | var workspaceAgent WorkspaceAgent |
| 368 | err = json.NewDecoder(res.Body).Decode(&workspaceAgent) |
| 369 | if err != nil { |
| 370 | return WorkspaceAgent{}, err |
| 371 | } |
| 372 | return workspaceAgent, nil |
| 373 | } |
| 374 | |
| 375 | type IssueReconnectingPTYSignedTokenRequest struct { |
| 376 | // URL is the URL of the reconnecting-pty endpoint you are connecting to. |