#!/usr/bin/env python # -*- coding: utf-8 -*- # # (c) 2017, Alice Ferrazzi # Distributed under the terms of the GNU General Public License v2 or later from flask import Flask from flask_restful import Api from elivepatch_server.resources import AgentInfo, dispatcher def create_app(): """ Create server application RESTful api version 1.0 """ app = Flask(__name__, static_url_path="") api = Api(app) api.add_resource(AgentInfo.AgentAPI, '/elivepatch/api/', endpoint='root') # get agento information api.add_resource(AgentInfo.AgentAPI, '/elivepatch/api/v1.0/agent', endpoint='agent') # where to start the livepatch build api.add_resource(dispatcher.BuildLivePatch, '/elivepatch/api/v1.0/build_livepatch', endpoint='build_livepatch') # where to retrieve the live patch when ready api.add_resource(dispatcher.SendLivePatch, '/elivepatch/api/v1.0/send_livepatch', endpoint='send_livepatch') # where to receive the config file api.add_resource(dispatcher.GetFiles, '/elivepatch/api/v1.0/get_files', endpoint='config') return app if __name__ == '__main__': app = create_app() app.run(debug=True, host='0.0.0.0', threaded=True)