From 14a8ebec1be77a5ba3da9e661ee0b950c6852d4a Mon Sep 17 00:00:00 2001 From: adriano Date: Thu, 18 Jan 2024 17:55:46 -0300 Subject: [PATCH] feat: Update ContainerId controller and Swagger description --- app/__init__.py | 2 +- app/controllers/container.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 78ae028..a416256 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -20,7 +20,7 @@ authorizations = { api = Api(app, title='Proxmox container rest API', version='1.0', - description='The Proxmox Container Management API allows users to interact with Proxmox using its REST API for container management. Key functionalities include creating, updating, editing, deleting, and retrieving information about containers.', + description='The Proxmox Container Management API allows users to interact with Proxmox using its REST API for container management. Key functionalities include creating, updating, editing and retrieving information about containers.', prefix='/api', authorizations=authorizations, security='apiKey') diff --git a/app/controllers/container.py b/app/controllers/container.py index 55c4c8d..dab829b 100644 --- a/app/controllers/container.py +++ b/app/controllers/container.py @@ -95,11 +95,11 @@ class ContainerId(Resource): @api.doc('some operation', security='apikey') @token_required @api.doc(params={'id': 'The container id'},) - @api.doc(params={'command': 'start, stop, delete'},) + @api.doc(params={'command': 'start, stop'},) @handle_exceptions def get(self, id: int, command: str): - commands = ['start', 'stop', 'delete'] + commands = ['start', 'stop', 'del_test'] if (command not in commands): return {"error": f"Bad Request: Invalid command passed in your route'{command}'. Valid commands are {', '.join(commands)}"}, 400 @@ -110,7 +110,7 @@ class ContainerId(Resource): endpoint, headers={"Authorization": f"PVEAPIToken={AUTH_TOKEN_PROXMOX}"}, verify=False) response.raise_for_status() - elif command == "delete": + elif command == "del_test": endpoint = f"{API_BASE_URL}/{id}" response = requests.delete(endpoint, headers={ "Authorization": f"PVEAPIToken={AUTH_TOKEN_PROXMOX}"}, verify=False)