from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from controllers import ActorResource, AliasesResource, AliasResource, AliasNoncesResource, AliasNonceResource, \ ActorStateResource, ActorsResource, \ ActorExecutionsResource, ActorExecutionResource, ActorExecutionResultsResource, \ ActorExecutionLogsResource, ActorNoncesResource, ActorNonceResource, \ AbacoUtilizationResource, SearchResource, CronResource from auth import authn_and_authz from errors import errors app = Flask(__name__) CORS(app) api = AgaveApi(app, errors=errors) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling api.handle_error = handle_error api.handle_exception = handle_error api.handle_user_exception = handle_error # Resources api.add_resource(ActorsResource, '/actors')
from flask import Flask, g from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from auth import authn_and_authz from controllers import MessagesResource app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): g.token = 'N/A' g.user = '******' g.tenant = 'AGAVE-PROD' g.api_server = 'https://public.agaveapi.co' # Set up error handling @app.errorhandler(Exception) def handle_all_errors(e): return handle_error(e) # Resources api.add_resource(MessagesResource, '/agave/<string:actor_id>/messages')
from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from controllers import ActorResource, ActorStateResource, ActorsResource, \ ActorExecutionsResource, ActorExecutionResource, \ ActorExecutionLogsResource from auth import authn_and_authz app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling @app.errorhandler(Exception) def handle_all_errors(e): return handle_error(e) # Resources api.add_resource(ActorsResource, '/actors') api.add_resource(ActorResource, '/actors/<string:actor_id>') api.add_resource(ActorStateResource, '/actors/<string:actor_id>/state')
from flask import Flask, render_template from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from auth import authn_and_authz from controllers import AdminActorsResource, AdminWorkersResource, AdminExecutionsResource, \ ActorPermissionsResource, AliasPermissionsResource, WorkersResource, WorkerResource from dashboard import dashboard app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling api.handle_error = handle_error api.handle_exception = handle_error api.handle_user_exception = handle_error # Resources api.add_resource(WorkersResource, '/actors/<string:actor_id>/workers') api.add_resource(AliasPermissionsResource, '/actors/aliases/<string:identifier>/permissions') api.add_resource(ActorPermissionsResource,
from flask import Flask, render_template from flask_cors import CORS from prometheus_client import Summary, MetricsHandler, Counter from agaveflask.utils import AgaveApi, handle_error from controllers import MetricsResource from errors import errors app = Flask(__name__) CORS(app) api = AgaveApi(app, errors=errors) REQUEST_TIME = Summary('request_processing_seconds', 'DESC: Time spent processing request') # Authn/z # @app.before_request # def auth(): # authn_and_authz() api.handle_error = handle_error api.handle_exception = handle_error api.handle_user_exception = handle_error # Resources api.add_resource(MetricsResource, '/metrics') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
from flask import Flask, render_template from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from auth import authn_and_authz from controllers import AdminActorsResource, AdminWorkersResource, AdminExecutionsResource, \ PermissionsResource, WorkersResource, WorkerResource from dashboard import dashboard app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling @app.errorhandler(Exception) def handle_all_errors(e): return handle_error(e) # Resources api.add_resource(WorkersResource, '/actors/<string:actor_id>/workers') api.add_resource(PermissionsResource, '/actors/<string:actor_id>/permissions') api.add_resource(WorkerResource,
from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from controllers import ActorResource, AliasesResource, AliasResource, ActorStateResource, ActorsResource, \ ActorExecutionsResource, ActorExecutionResource, ActorExecutionResultsResource, \ ActorExecutionLogsResource, ActorNoncesResource, ActorNonceResource from auth import authn_and_authz from errors import errors app = Flask(__name__) CORS(app) api = AgaveApi(app, errors=errors) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling api.handle_error = handle_error api.handle_exception = handle_error api.handle_user_exception = handle_error # Resources api.add_resource(ActorsResource, '/actors') api.add_resource(AliasesResource, '/actors/aliases') api.add_resource(AliasResource, '/actors/aliases/<string:alias>')
from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from auth import authn_and_authz from controllers import MessagesResource app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # set up error handling api.handle_error = handle_error api.handle_exception = handle_error api.handle_user_exception = handle_error # Resources api.add_resource(MessagesResource, '/actors/<string:actor_id>/messages') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi from agaveflask.auth import authn_and_authz from resources import JwtResource app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # Resources api.add_resource(JwtResource, '/admin/jwt') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
from flask import Flask from flask_cors import CORS from agaveflask.utils import AgaveApi, handle_error from auth import authn_and_authz from controllers import PermissionsResource, WorkersResource, WorkerResource app = Flask(__name__) CORS(app) api = AgaveApi(app) # Authn/z @app.before_request def auth(): authn_and_authz() # Set up error handling @app.errorhandler(Exception) def handle_all_errors(e): return handle_error(e) # Resources api.add_resource(WorkersResource, '/actors/<string:actor_id>/workers') api.add_resource(PermissionsResource, '/actors/<string:actor_id>/permissions') api.add_resource(WorkerResource, '/actors/<string:actor_id>/workers/<string:worker_id>')