| 330 | } |
| 331 | |
| 332 | func (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 | |
| 348 | func (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. |