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

Method DeleteSubAgent

coderd/agentapi/subagent.go:332–346  ·  view source on GitHub ↗
(ctx context.Context, req *agentproto.DeleteSubAgentRequest)

Source from the content-addressed store, hash-verified

330}
331
332func (a *SubAgentAPI) DeleteSubAgent(ctx context.Context, req *agentproto.DeleteSubAgentRequest) (*agentproto.DeleteSubAgentResponse, error) {
333 //nolint:gocritic // This gives us only the permissions required to do the job.
334 ctx = dbauthz.AsSubAgentAPI(ctx, a.OrganizationID, a.OwnerID)
335
336 subAgentID, err := uuid.FromBytes(req.Id)
337 if err != nil {
338 return nil, err
339 }
340
341 if err := a.Database.DeleteWorkspaceSubAgentByID(ctx, subAgentID); err != nil {
342 return nil, err
343 }
344
345 return &agentproto.DeleteSubAgentResponse{}, nil
346}
347
348func (a *SubAgentAPI) ListSubAgents(ctx context.Context, _ *agentproto.ListSubAgentsRequest) (*agentproto.ListSubAgentsResponse, error) {
349 //nolint:gocritic // This gives us only the permissions required to do the job.

Callers 1

TestSubAgentAPIFunction · 0.95

Calls 2

AsSubAgentAPIFunction · 0.92

Tested by 1

TestSubAgentAPIFunction · 0.76