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

Method devcontainerByIDLocked

agent/agentcontainers/api.go:1236–1247  ·  view source on GitHub ↗

devcontainerByIDLocked attempts to find a devcontainer by its ID. This method assumes that api.mu is held.

(devcontainerID string)

Source from the content-addressed store, hash-verified

1234// devcontainerByIDLocked attempts to find a devcontainer by its ID.
1235// This method assumes that api.mu is held.
1236func (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
1249func (api *API) handleDevcontainerDelete(w http.ResponseWriter, r *http.Request) {
1250 var (

Callers 2

Calls 2

NewResponseErrorFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected