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'
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'
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'
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
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.")
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
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
def register_dns_resolver(): data = Service.register_resolver(flask.request.get_json(force=True)) return flask.jsonify(data)
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
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
def query_services(): return flask.jsonify({'services': Service.query_services()})
def register_service(): data = Service.register_service(flask.request.get_json(force=True)) return flask.jsonify(data)
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
def query_resolvers(): return flask.jsonify({'resolvers': Service.query_resolvers()})