Skip to content

Commit 7cb868d

Browse files
authored
Merge pull request #2353 from mitre/bleepbop/VIRTS-3047/update-config-api-docs
[VIRTS-3047] Update Config api docs
2 parents f81bcc6 + a6bb4d7 commit 7cb868d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

app/api/v2/handlers/config_api.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ def add_routes(self, app: web.Application):
1818
router.add_patch('/config/main', self.update_main_config)
1919
router.add_patch('/config/agents', self.update_agents_config)
2020

21-
@aiohttp_apispec.docs(tags=['config'])
21+
@aiohttp_apispec.docs(tags=['config'], summary='Retrieve Config',
22+
parameters=[{
23+
'in': 'path',
24+
'name': 'name',
25+
'schema': {'type': 'string'},
26+
'required': 'true',
27+
'description': 'Name of the configuration file to be retrieved.'
28+
}],
29+
description='Retrieves configuration by name, as specified by {name} in the request url.')
2230
async def get_config_with_name(self, request):
2331
config_name = request.match_info['name']
2432

@@ -28,9 +36,13 @@ async def get_config_with_name(self, request):
2836
raise JsonHttpNotFound(f'Config not found: {config_name}')
2937
return web.json_response(config)
3038

31-
@aiohttp_apispec.docs(tags=['config'])
39+
@aiohttp_apispec.docs(tags=['config'], summary='Update Agent Config',
40+
description='Use fields from the AgentConfigUpdateSchema in the request body to '
41+
'update the Agent Configuration file.')
3242
@aiohttp_apispec.request_schema(AgentConfigUpdateSchema)
33-
@aiohttp_apispec.response_schema(AgentConfigUpdateSchema)
43+
@aiohttp_apispec.response_schema(AgentConfigUpdateSchema,
44+
description='The response consists of data from the Agent configuration file '
45+
'dumped in the AgentConfigUpdateSchema format.')
3446
async def update_agents_config(self, request):
3547
schema = AgentConfigUpdateSchema()
3648
data = await self.parse_json_body(request, schema)
@@ -39,7 +51,9 @@ async def update_agents_config(self, request):
3951
agents_config = self._api_manager.get_filtered_config('agents')
4052
return web.json_response(schema.dump(agents_config))
4153

42-
@aiohttp_apispec.docs(tags=['config'])
54+
@aiohttp_apispec.docs(tags=['config'], summary='Update Main Config',
55+
description='Use fields from the ConfigUpdateSchema in the request body to '
56+
'update the main configuration file.')
4357
@aiohttp_apispec.request_schema(ConfigUpdateSchema)
4458
async def update_main_config(self, request):
4559
data = await self.parse_json_body(

0 commit comments

Comments
 (0)