Aucune description

api_routes.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # IRIS Source Code
  2. # Copyright (C) 2021 - Airbus CyberSecurity (SAS)
  3. # ir@cyberactionlab.net
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 3 of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public License
  16. # along with this program; if not, write to the Free Software Foundation,
  17. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. from flask import Blueprint
  19. from app import app
  20. from app.blueprints.access_controls import ac_api_requires
  21. from app.blueprints.responses import response_success
  22. rest_api_blueprint = Blueprint('rest_api', __name__)
  23. @rest_api_blueprint.route('/api/ping', methods=['GET'])
  24. @ac_api_requires()
  25. def api_ping():
  26. return response_success("pong")
  27. @rest_api_blueprint.route('/api/versions', methods=['GET'])
  28. @ac_api_requires()
  29. def api_version():
  30. versions = {
  31. "iris_current": app.config.get('IRIS_VERSION'),
  32. "api_min": app.config.get('API_MIN_VERSION'),
  33. "api_current": app.config.get('API_MAX_VERSION')
  34. }
  35. return response_success(data=versions)