Пример #1
0
def deregister_backend(service_name, target_group_name, host):
    try:
        Service.deregister_backend(service_name, target_group_name, host)
    except Service.DoesNotExist:
        return 'Backend: {} for target group: {} in service: {}' \
               ' not currently registered with Flyby.'.format(host, target_group_name, service_name), 404
    return 'OK'
Пример #2
0
def delete_service(service_name, target_group_name):
    try:
        Service.deregister_target_group(service_name, target_group_name)
    except Service.DoesNotExist:
        return 'Target group: {} for service: {} not currently registered with Flyby.'.format(
            target_group_name, service_name), 404
    return 'OK'
Пример #3
0
def deregister_service(service_name):
    try:
        Service.deregister_service(service_name)
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
    return 'OK'
Пример #4
0
def deregister_resolver(resolver_name):
    try:
        Service.deregister_resolver(resolver_name)
        return 'OK'
    except Service.DoesNotExist:
        return 'Resolver: {} not currently registered with Flyby.'.format(
            resolver_name), 404
Пример #5
0
def update(fqdn):
    logger.debug("Started job...")
    try:
        start_time = time.time()
        resolvers = Service.query_resolvers()
        services = Service.query_services()
        Haproxy().update(fqdn=fqdn, resolvers=resolvers, services=services)
        metrics.info('background-refresh.duration {}'.format(time.time() - start_time))
        metrics.info('active-thread-count {}'.format(threading.active_count()))
    finally:
        logger.debug("Finished job.")
Пример #6
0
def register_target_group():
    try:
        return flask.jsonify(
            Service.register_target_group(flask.request.get_json(force=True)))
    except Service.DoesNotExist as e:
        return 'Service: {} not currently registered with Flyby.'.format(
            e.args[0]), 404
Пример #7
0
def update_service(service_name):
    try:
        data = Service.update_service(service_name,
                                      flask.request.get_json(force=True))
        return flask.jsonify(data)
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
Пример #8
0
def register_dns_resolver():
    data = Service.register_resolver(flask.request.get_json(force=True))
    return flask.jsonify(data)
Пример #9
0
def register_backend():
    try:
        return flask.jsonify(
            Service.register_backend(flask.request.get_json(force=True)))
    except Service.DoesNotExist as e:
        return "{} does not exist.".format(e.args[0]), 404
Пример #10
0
def describe_service(service_name):
    try:
        return flask.jsonify(Service.describe_service(service_name))
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
Пример #11
0
def query_services():
    return flask.jsonify({'services': Service.query_services()})
Пример #12
0
def register_service():
    data = Service.register_service(flask.request.get_json(force=True))
    return flask.jsonify(data)
Пример #13
0
def describe_resolver(resolver_name):
    try:
        return flask.jsonify(Service.describe_resolver(resolver_name))
    except Service.DoesNotExist:
        return 'Resolver: {} not currently registered with Flyby.'.format(
            resolver_name), 404
Пример #14
0
def query_resolvers():
    return flask.jsonify({'resolvers': Service.query_resolvers()})