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

Method RecreateDevcontainer

codersdk/workspacesdk/agentconn.go:796–812  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

794// RecreateDevcontainer recreates a devcontainer with the given container.
795// This is a blocking call and will wait for the container to be recreated.
796func (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.

Callers

nothing calls this directly

Calls 5

apiRequestMethod · 0.95
StartSpanFunction · 0.92
ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected