devcontainerByIDLocked attempts to find a devcontainer by its ID. This method assumes that api.mu is held.
(devcontainerID string)
| 1234 | // devcontainerByIDLocked attempts to find a devcontainer by its ID. |
| 1235 | // This method assumes that api.mu is held. |
| 1236 | func (api *API) devcontainerByIDLocked(devcontainerID string) (codersdk.WorkspaceAgentDevcontainer, error) { |
| 1237 | for _, knownDC := range api.knownDevcontainers { |
| 1238 | if knownDC.ID.String() == devcontainerID { |
| 1239 | return knownDC, nil |
| 1240 | } |
| 1241 | } |
| 1242 | |
| 1243 | return codersdk.WorkspaceAgentDevcontainer{}, httperror.NewResponseError(http.StatusNotFound, codersdk.Response{ |
| 1244 | Message: "Devcontainer not found.", |
| 1245 | Detail: fmt.Sprintf("Could not find devcontainer with ID: %q", devcontainerID), |
| 1246 | }) |
| 1247 | } |
| 1248 | |
| 1249 | func (api *API) handleDevcontainerDelete(w http.ResponseWriter, r *http.Request) { |
| 1250 | var ( |
no test coverage detected