You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
874 B
Python
39 lines
874 B
Python
from flask import Blueprint, render_template
|
|
from app.models import Operation
|
|
from app.library.cache import cache
|
|
from app import config
|
|
|
|
|
|
bp = Blueprint('api', 'api')
|
|
|
|
|
|
@bp.route('/api/info/<codename>')
|
|
def get_info(codename):
|
|
op = Operation.query.filter(Operation.codename == codename).first()
|
|
if op:
|
|
return cache.get_info(op.codename)
|
|
else:
|
|
return {}
|
|
|
|
@bp.route('/api/export/ansible')
|
|
def export_ansible():
|
|
ops = Operation.query.filter(
|
|
Operation.droplet_id > 0
|
|
)
|
|
return render_template(
|
|
'export_ansible.html',
|
|
ops=ops,
|
|
domain=config.DO_DOMAIN
|
|
)
|
|
|
|
@bp.route('/api/export/upstreams')
|
|
def export_upstreams():
|
|
ops = Operation.query.filter(
|
|
Operation.droplet_id > 0
|
|
)
|
|
return render_template(
|
|
'export_upstreams.html',
|
|
ops=ops,
|
|
domain=config.DO_DOMAIN
|
|
)
|