Loading edge_cloud_management_api/controllers/app_controllers.py +20 −12 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,6 @@ def get_apps(x_correlator=None): # noqa: E501 def get_app(appId, x_correlator=None): # noqa: E501 def get_app(appId, x_correlator=None): # noqa: E501 """Retrieve the information of an Application""" """Retrieve the information of an Application""" # if connexion.request.is_json: # app_id = AppId.from_dict(connexion.request.get_json()) # noqa: E501 try: try: with MongoManager() as db: with MongoManager() as db: document = db.find_document("apps", {"_id": appId}) document = db.find_document("apps", {"_id": appId}) Loading @@ -86,18 +84,28 @@ def get_app(appId, x_correlator=None): # noqa: E501 def delete_app(appId, x_correlator=None): # noqa: E501 def delete_app(appId, x_correlator=None): # noqa: E501 """Delete an Application from an Edge Cloud Provider """Delete Application metadata from an Edge Cloud Provider""" try: Delete all the information and content related to an Application # noqa: E501 with MongoManager() as db: number_of_deleted_documents = db.delete_document("apps", {"_id": appId}) if number_of_deleted_documents == 0: raise NotFound404Exception() elif number_of_deleted_documents == 1: return ("", 204) else: raise Exception(f"deleted {number_of_deleted_documents} documents") :param appId: Identificator of the application to be deleted provided by the Edge Cloud Provider once the submission was successful except NotFound404Exception: :type appId: dict | bytes return ( :param x_correlator: Correlation id for the different services jsonify({"status": 404, "code": "NOT_FOUND", "message": "Resource does not exist"}), :type x_correlator: str 404, ) :rtype: None except Exception as e: """ return ( return "do some magic!" jsonify({"status": 500, "code": "INTERNAL", "message": f"Internal server error: {str(e)}"}), 500, ) def create_app_instance(body, app_id, x_correlator=None): # noqa: E501 def create_app_instance(body, app_id, x_correlator=None): # noqa: E501 Loading Loading
edge_cloud_management_api/controllers/app_controllers.py +20 −12 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,6 @@ def get_apps(x_correlator=None): # noqa: E501 def get_app(appId, x_correlator=None): # noqa: E501 def get_app(appId, x_correlator=None): # noqa: E501 """Retrieve the information of an Application""" """Retrieve the information of an Application""" # if connexion.request.is_json: # app_id = AppId.from_dict(connexion.request.get_json()) # noqa: E501 try: try: with MongoManager() as db: with MongoManager() as db: document = db.find_document("apps", {"_id": appId}) document = db.find_document("apps", {"_id": appId}) Loading @@ -86,18 +84,28 @@ def get_app(appId, x_correlator=None): # noqa: E501 def delete_app(appId, x_correlator=None): # noqa: E501 def delete_app(appId, x_correlator=None): # noqa: E501 """Delete an Application from an Edge Cloud Provider """Delete Application metadata from an Edge Cloud Provider""" try: Delete all the information and content related to an Application # noqa: E501 with MongoManager() as db: number_of_deleted_documents = db.delete_document("apps", {"_id": appId}) if number_of_deleted_documents == 0: raise NotFound404Exception() elif number_of_deleted_documents == 1: return ("", 204) else: raise Exception(f"deleted {number_of_deleted_documents} documents") :param appId: Identificator of the application to be deleted provided by the Edge Cloud Provider once the submission was successful except NotFound404Exception: :type appId: dict | bytes return ( :param x_correlator: Correlation id for the different services jsonify({"status": 404, "code": "NOT_FOUND", "message": "Resource does not exist"}), :type x_correlator: str 404, ) :rtype: None except Exception as e: """ return ( return "do some magic!" jsonify({"status": 500, "code": "INTERNAL", "message": f"Internal server error: {str(e)}"}), 500, ) def create_app_instance(body, app_id, x_correlator=None): # noqa: E501 def create_app_instance(body, app_id, x_correlator=None): # noqa: E501 Loading