feat(coderd): support deleting dev containers (#21248)

Add an endpoint to coderd to support deleting dev containers
This commit is contained in:
Danielle Maywood
2025-12-24 12:34:39 +00:00
committed by GitHub
parent df6b316772
commit 05529139bc
9 changed files with 384 additions and 0 deletions
+13
View File
@@ -588,6 +588,19 @@ func (c *Client) WatchWorkspaceAgentContainers(ctx context.Context, agentID uuid
return d.Chan(), d, nil
}
// WorkspaceAgentDeleteDevcontainer deletes the devcontainer with the given ID.
func (c *Client) WorkspaceAgentDeleteDevcontainer(ctx context.Context, agentID uuid.UUID, devcontainerID string) error {
res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/workspaceagents/%s/containers/devcontainers/%s", agentID, devcontainerID), nil)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusNoContent {
return ReadBodyAsError(res)
}
return nil
}
// WorkspaceAgentRecreateDevcontainer recreates the devcontainer with the given ID.
func (c *Client) WorkspaceAgentRecreateDevcontainer(ctx context.Context, agentID uuid.UUID, devcontainerID string) (Response, error) {
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/workspaceagents/%s/containers/devcontainers/%s/recreate", agentID, devcontainerID), nil)