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

Method WorkspaceAgentListContainers

codersdk/workspaceagents.go:573–586  ·  view source on GitHub ↗

WorkspaceAgentListContainers returns a list of containers that are currently running on a Docker daemon accessible to the workspace agent.

(ctx context.Context, agentID uuid.UUID, labels map[string]string)

Source from the content-addressed store, hash-verified

571// WorkspaceAgentListContainers returns a list of containers that are currently
572// running on a Docker daemon accessible to the workspace agent.
573func (c *Client) WorkspaceAgentListContainers(ctx context.Context, agentID uuid.UUID, labels map[string]string) (WorkspaceAgentListContainersResponse, error) {
574 lf := workspaceAgentContainersLabelFilter(labels)
575 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/workspaceagents/%s/containers", agentID), nil, lf)
576 if err != nil {
577 return WorkspaceAgentListContainersResponse{}, err
578 }
579 defer res.Body.Close()
580 if res.StatusCode != http.StatusOK {
581 return WorkspaceAgentListContainersResponse{}, ReadBodyAsError(res)
582 }
583 var cr WorkspaceAgentListContainersResponse
584
585 return cr, json.NewDecoder(res.Body).Decode(&cr)
586}
587
588func (c *Client) WatchWorkspaceAgentContainers(ctx context.Context, agentID uuid.UUID) (<-chan WorkspaceAgentListContainersResponse, io.Closer, error) {
589 reqURL, err := c.URL.Parse(fmt.Sprintf("/api/v2/workspaceagents/%s/containers/watch", agentID))

Callers 6

handleRPTYFunction · 0.80
sshMethod · 0.80
fetchRuntimeResourcesFunction · 0.80
openVSCodeMethod · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2