Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions app/api/v2/handlers/agent_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ def add_routes(self, app: web.Application):
router.add_get('/deploy_commands', self.get_deploy_commands)
router.add_get('/deploy_commands/{ability_id}', self.get_deploy_commands_for_ability)

@aiohttp_apispec.docs(tags=['agents'])
@aiohttp_apispec.docs(tags=['agents'],
summary="Retrieves all agents",
description="Retrieves all stored agents.")
@aiohttp_apispec.querystring_schema(BaseGetAllQuerySchema)
@aiohttp_apispec.response_schema(AgentSchema(many=True, partial=True))
@aiohttp_apispec.response_schema(AgentSchema(many=True, partial=True),
description="Returns a list of all agents.")
async def get_agents(self, request: web.Request):
agents = await self.get_all_objects(request)
return web.json_response(agents)
Expand All @@ -52,9 +55,11 @@ async def get_agent_by_id(self, request: web.Request):
agent = await self.get_object(request)
return web.json_response(agent)

@aiohttp_apispec.docs(tags=['agents'])
@aiohttp_apispec.docs(tags=['agents'],
summary="Create a new agent",
description="Creates a new agent using the format from 'AgentSchema'.")
@aiohttp_apispec.request_schema(AgentSchema)
@aiohttp_apispec.response_schema(AgentSchema)
@aiohttp_apispec.response_schema(AgentSchema, description="Returns a single agent in 'AgentSchema' format")
async def create_agent(self, request: web.Request):
agent = await self.create_object(request)
return web.json_response(agent.display)
Expand Down