# Path: ceagle/api/client.py
# CONF = config.CONF
# FAKE_CLIENT_MAP = {
#     "security": security.Client,
# }
# class UnknownService(Exception):
# class Client(base.Client):
#     def get(self, uri="/", **kwargs):
# def get_client(service_name):
# 
# Path: ceagle/api_fake_data/fake_status.py
# RESPONSE_TOTAL_NULL_PROBABILITY = 10
# HEALTH_NULL_PROBABILITY = 5
# PERFORMANCE_NULL_PROBABILITY = 5
# AVAILABILITY_NULL_PROBABILITY = 5
# STATUS_NULL_PROBABILITY = 20
# def validate_period(period):
# def generate_timestamps(period):
# def lucky(probability):
# def generate_values(period_or_timestamps,
#                     ratio=1, null_probability=20, integer=False):
# def generate_service_data(period, service, null_allowed):
# def generate_region_data(region, period, service, null_allowed):
# def generate_status_data(period, service):
# def get_status(period):
# def get_status_health(period):
# def get_status_performance(period):
# def get_status_availability(period):
# def get_region_status(region, period):
# def get_region_status_health(region, period):
# def get_region_status_performance(region, period):
# def get_region_status_availability(region, period):


import flask
from oss_lib import config
from ceagle.api import client
from ceagle.api_fake_data import fake_status
        service_client = client.get_client(service_name)

        if region:
            uri = "/api/v1/region/%s/%s/%s" % (region, service_name, period)
        else:
            uri = "/api/v1/%s/%s" % (service_name, period)

        resp, code = service_client.get(uri)
        if code != 200:
            # FIXME ADD LOGS HERE
            continue

        for r, value in resp[key_map[service_name]["key"]].items():
            result.setdefault(r, {"sla": None, "availability": None,
                                  "health": None, "performance": None})

            result[r][service_name] = value[key_map[service_name]["arg"]]
    return {"period": period, "status": result}


@bp_status.route("/<period>")
@fake_status.get_status
def get_status(period):
    return flask.jsonify(get_status_helper(period))


@bp_status.route("/health/<period>")
@fake_status.get_status_health
def get_status_health(period):
    health_client = client.get_client("health")

# Path: ceagle/api/client.py
# CONF = config.CONF
# FAKE_CLIENT_MAP = {
#     "security": security.Client,
# }
# class UnknownService(Exception):
# class Client(base.Client):
#     def get(self, uri="/", **kwargs):
# def get_client(service_name):
# 
# Path: ceagle/api_fake_data/fake_status.py
# RESPONSE_TOTAL_NULL_PROBABILITY = 10
# HEALTH_NULL_PROBABILITY = 5
# PERFORMANCE_NULL_PROBABILITY = 5
# AVAILABILITY_NULL_PROBABILITY = 5
# STATUS_NULL_PROBABILITY = 20
# def validate_period(period):
# def generate_timestamps(period):
# def lucky(probability):
# def generate_values(period_or_timestamps,
#                     ratio=1, null_probability=20, integer=False):
# def generate_service_data(period, service, null_allowed):
# def generate_region_data(region, period, service, null_allowed):
# def generate_status_data(period, service):
# def get_status(period):
# def get_status_health(period):
# def get_status_performance(period):
# def get_status_availability(period):
# def get_region_status(region, period):
# def get_region_status_health(region, period):
# def get_region_status_performance(region, period):
# def get_region_status_availability(region, period):


# Path: ceagle/api/v1/status.py
import flask
from oss_lib import config
from ceagle.api import client
from ceagle.api_fake_data import fake_status

        service_client = client.get_client(service_name)

        if region:
            uri = "/api/v1/region/%s/%s/%s" % (region, service_name, period)
        else:
            uri = "/api/v1/%s/%s" % (service_name, period)

        resp, code = service_client.get(uri)
        if code != 200:
            # FIXME ADD LOGS HERE
            continue

        for r, value in resp[key_map[service_name]["key"]].items():
            result.setdefault(r, {"sla": None, "availability": None,
                                  "health": None, "performance": None})

            result[r][service_name] = value[key_map[service_name]["arg"]]
    return {"period": period, "status": result}


@bp_status.route("/<period>")
@fake_status.get_status
def get_status(period):
    return flask.jsonify(get_status_helper(period))


@bp_status.route("/health/<period>")
@fake_status.get_status_health
def get_status_health(period):
    health_client = client.get_client("health")

    api_endpoint = "/api/v1/health/{}".format(period)