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

Method WorkspaceAgent

codersdk/workspaceagents.go:358–373  ·  view source on GitHub ↗

WorkspaceAgent returns an agent by ID.

(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

356
357// WorkspaceAgent returns an agent by ID.
358func (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
375type IssueReconnectingPTYSignedTokenRequest struct {
376 // URL is the URL of the reconnecting-pty endpoint you are connecting to.

Callers 7

TestWorkspaceAgentFunction · 0.80
TestTasksNotificationFunction · 0.80
Test_ResolveRequestFunction · 0.80
setupWorkspaceAgentFunction · 0.80
AgentInfoFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 6

TestWorkspaceAgentFunction · 0.64
TestTasksNotificationFunction · 0.64
Test_ResolveRequestFunction · 0.64
setupWorkspaceAgentFunction · 0.64