Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -17,5 +17,6 @@ app.py invoker_sdk_config.json requirements.txt discoverer.pkl invoker.pkl invoker_info/ logs/ No newline at end of file README.md +11 −4 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ A Postman collection is also provided, which can be imported directly to the Pos ## Getting started To start the service, follow the steps below Inside the "app" folder ... 1. Copy requirements_template.txt to requirements.txt ``` Loading @@ -51,11 +52,17 @@ To start the service, follow the steps below 6. To deploy the service, run the following commands in an Ubuntu or MacOS terminal. To stop the invoker just press Ctrl+C or Command+C ``` chmod +x start_invoker.sh ./start_invoker.sh -u <username given by organizers> [-n <host:ip>]" ./start_invoker.sh -u <username given by organizers> ``` 7. To remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands. 7. To see the logs, execute the following commands. ``` chmod +x clean_files.sh ./clean_files.sh chmod +x logs_invoker.sh ./logs_invoker.sh -u <username given by organizers> ``` 8. To stop the invoker service and remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands. ``` chmod +x stop_invoker.sh ./stop_invoker.sh -u <username given by organizers> ``` No newline at end of file Dockerfile→app/Dockerfile +0 −0 File moved. View file app_template.py→app/app_template.py +25 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ def onboard(): def discover(): response_message = "Discover" ### Create the connection with CAPIF as an onboarded invoker # service_discoverer = ... ### Discover APIs according to the filters Loading @@ -60,11 +61,11 @@ def access_service(): # resource_name = request_data['resource_name'] # method = request_data['method'] ### Uncomment, fill the ... with a preferred variable name and fetch the discoverer object ### Uncomment to fetch the discoverer object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE, 'rb') as f: # ... = pickle.load(f) # service_discoverer = pickle.load(f) ### Fetch the necessary information of the targeted API and add to a url parameter # service_path = ... Loading @@ -72,10 +73,11 @@ def access_service(): # service_interface = # url = ... ### Get API token for the discovered API and add it to a header # jwt_token = ... ### Get API token for the discovered API ### Uncomment to add token to a header # headers = { # 'Authorization': 'Bearer {}'.format(jwt_token) # 'Authorization': 'Bearer {}'.format(...) # } ### Uncomment to make the request and return response text Loading @@ -84,6 +86,24 @@ def access_service(): return response_message @app.get("/offboard") def offboard(): response_message = "Offboard" ### Uncomment to fetch the invoker object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE_INV, 'rb') as f: # invoker = pickle.load(f) ### Offboard invoker ### Uncomment to check if invoker was successfully offboarded # if not os.path.exists("./invoker_info/{}".format(user_name)): # response_message = "Invoker offboarded successfully" return response_message if __name__ == "__main__": port = int(os.getenv("PORT", 8001)) app.run(host='0.0.0.0', port=port, debug=True) No newline at end of file invoker_sdk_config_template.json→app/invoker_sdk_config_template.json +0 −0 File moved. View file Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -17,5 +17,6 @@ app.py invoker_sdk_config.json requirements.txt discoverer.pkl invoker.pkl invoker_info/ logs/ No newline at end of file
README.md +11 −4 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ A Postman collection is also provided, which can be imported directly to the Pos ## Getting started To start the service, follow the steps below Inside the "app" folder ... 1. Copy requirements_template.txt to requirements.txt ``` Loading @@ -51,11 +52,17 @@ To start the service, follow the steps below 6. To deploy the service, run the following commands in an Ubuntu or MacOS terminal. To stop the invoker just press Ctrl+C or Command+C ``` chmod +x start_invoker.sh ./start_invoker.sh -u <username given by organizers> [-n <host:ip>]" ./start_invoker.sh -u <username given by organizers> ``` 7. To remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands. 7. To see the logs, execute the following commands. ``` chmod +x clean_files.sh ./clean_files.sh chmod +x logs_invoker.sh ./logs_invoker.sh -u <username given by organizers> ``` 8. To stop the invoker service and remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands. ``` chmod +x stop_invoker.sh ./stop_invoker.sh -u <username given by organizers> ``` No newline at end of file
app_template.py→app/app_template.py +25 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ def onboard(): def discover(): response_message = "Discover" ### Create the connection with CAPIF as an onboarded invoker # service_discoverer = ... ### Discover APIs according to the filters Loading @@ -60,11 +61,11 @@ def access_service(): # resource_name = request_data['resource_name'] # method = request_data['method'] ### Uncomment, fill the ... with a preferred variable name and fetch the discoverer object ### Uncomment to fetch the discoverer object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE, 'rb') as f: # ... = pickle.load(f) # service_discoverer = pickle.load(f) ### Fetch the necessary information of the targeted API and add to a url parameter # service_path = ... Loading @@ -72,10 +73,11 @@ def access_service(): # service_interface = # url = ... ### Get API token for the discovered API and add it to a header # jwt_token = ... ### Get API token for the discovered API ### Uncomment to add token to a header # headers = { # 'Authorization': 'Bearer {}'.format(jwt_token) # 'Authorization': 'Bearer {}'.format(...) # } ### Uncomment to make the request and return response text Loading @@ -84,6 +86,24 @@ def access_service(): return response_message @app.get("/offboard") def offboard(): response_message = "Offboard" ### Uncomment to fetch the invoker object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE_INV, 'rb') as f: # invoker = pickle.load(f) ### Offboard invoker ### Uncomment to check if invoker was successfully offboarded # if not os.path.exists("./invoker_info/{}".format(user_name)): # response_message = "Invoker offboarded successfully" return response_message if __name__ == "__main__": port = int(os.getenv("PORT", 8001)) app.run(host='0.0.0.0', port=port, debug=True) No newline at end of file