Ejemplo n.º 1
0
from flask import Flask
from flask_cors import CORS

from request_utils import AbacoApi
from controllers import ActorResource, ActorStateResource, ActorsResource, \
    ActorExecutionsResource, ActorExecutionResource, \
    ActorExecutionLogsResource
from auth import authn_and_authz


app = Flask(__name__)
CORS(app)
api = AbacoApi(app)

# Authn/z
@app.before_request
def auth():
    authn_and_authz()

import logs
app.logger.addHandler(logs.get_file_handler('reg_api_logs'))


# Resources
api.add_resource(ActorsResource, '/actors')
api.add_resource(ActorResource, '/actors/<string:actor_id>')
api.add_resource(ActorStateResource, '/actors/<string:actor_id>/state')
api.add_resource(ActorExecutionsResource, '/actors/<string:actor_id>/executions')
api.add_resource(ActorExecutionResource, '/actors/<string:actor_id>/executions/<string:execution_id>')
api.add_resource(ActorExecutionLogsResource, '/actors/<string:actor_id>/executions/<string:execution_id>/logs')
Ejemplo n.º 2
0
from flask import Flask
from flask_cors import CORS 

from request_utils import AbacoApi
from auth import authn_and_authz
from controllers import MessagesResource

app = Flask(__name__)
CORS(app)
api = AbacoApi(app)

# Authn/z
@app.before_request
def auth():
    authn_and_authz()

import logs
app.logger.addHandler(logs.get_file_handler('message_api_logs'))


# Resources
api.add_resource(MessagesResource, '/actors/<string:actor_id>/messages')

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
Ejemplo n.º 3
0
from flask import Flask, g
from flask_cors import CORS

from request_utils import AbacoApi
from auth import authn_and_authz
from controllers import MessagesResource

app = Flask(__name__)
CORS(app)
api = AbacoApi(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"


# Resources
api.add_resource(MessagesResource, "/agave/<string:actor_id>/messages")

if __name__ == "__main__":
    app.run(host="0.0.0.0", debug=True)
Ejemplo n.º 4
0
from flask import Flask
from request_utils import AbacoApi

from auth import authn_and_authz, PermissionsResource
from worker import WorkersResource, WorkerResource

app = Flask(__name__)
api = AbacoApi(app)

# Authn/z
@app.before_request
def auth():
    authn_and_authz()


# 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:ch_name>')

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)