RecreateDevcontainer recreates a devcontainer with the given container. This is a blocking call and will wait for the container to be recreated.
(ctx context.Context, devcontainerID string)
| 794 | // RecreateDevcontainer recreates a devcontainer with the given container. |
| 795 | // This is a blocking call and will wait for the container to be recreated. |
| 796 | func (c *agentConn) RecreateDevcontainer(ctx context.Context, devcontainerID string) (codersdk.Response, error) { |
| 797 | ctx, span := tracing.StartSpan(ctx) |
| 798 | defer span.End() |
| 799 | res, err := c.apiRequest(ctx, http.MethodPost, "/api/v0/containers/devcontainers/"+devcontainerID+"/recreate", nil) |
| 800 | if err != nil { |
| 801 | return codersdk.Response{}, xerrors.Errorf("do request: %w", err) |
| 802 | } |
| 803 | defer res.Body.Close() |
| 804 | if res.StatusCode != http.StatusAccepted { |
| 805 | return codersdk.Response{}, codersdk.ReadBodyAsError(res) |
| 806 | } |
| 807 | var m codersdk.Response |
| 808 | if err := json.NewDecoder(res.Body).Decode(&m); err != nil { |
| 809 | return codersdk.Response{}, xerrors.Errorf("decode response body: %w", err) |
| 810 | } |
| 811 | return m, nil |
| 812 | } |
| 813 | |
| 814 | // StartProcessRequest is the request body for starting a |
| 815 | // process on the workspace agent. |
nothing calls this directly
no test coverage detected