feat: Update ContainerId controller and Swagger description

master
adriano 2024-01-18 17:55:46 -03:00
parent c5d994ee94
commit 14a8ebec1b
2 changed files with 4 additions and 4 deletions

View File

@ -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')

View File

@ -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)