| 1395 | } |
| 1396 | |
| 1397 | func (t *tunnelUpdater) deleteAgentLocked(workspaceID, id uuid.UUID) (*Agent, error) { |
| 1398 | w, ok := t.workspaces[workspaceID] |
| 1399 | if !ok { |
| 1400 | return nil, xerrors.Errorf("workspace %s not found", workspaceID) |
| 1401 | } |
| 1402 | a, ok := w.agents[id] |
| 1403 | if !ok { |
| 1404 | return nil, xerrors.Errorf("agent %s not found in workspace %s", id, workspaceID) |
| 1405 | } |
| 1406 | delete(w.agents, id) |
| 1407 | return a, nil |
| 1408 | } |
| 1409 | |
| 1410 | func (t *tunnelUpdater) allAgentIDsLocked() []uuid.UUID { |
| 1411 | out := make([]uuid.UUID, 0, len(t.workspaces)) |