# Path: ceagle/api_fake_data/fake_infra.py
# INFRAS = [
#     [{"id": "horizon",
#       "title": "Horizon",
#       "description": "Web UI that manages OpenStack resources",
#       "urls": [["http://none"]]},
#      {"id": "git",
#       "title": "Git Source Control",
#       "description": ("Gitlab with Git repositories with all "
#                       "projects source code"),
#       "urls": [["http://none"], ["http://none", "http://none"]]},
#      {"id": "packages",
#       "title": "JFrog Artifactory Packages",
#       "description": ("JFrog Artifactory service that contains "
#                       "all cloud packages & images"),
#       "urls": [["http://none"],
#                ["http://none", "http://none"],
#                ["http://none", "http://none", "http://none"],
#                ]},
#      {"id": "stacklight",
#       "title": "Stacklight",
#       "description": "Cloud Logging, Metering and Alerting services",
#       "urls": [["http://none", "http://none", "http://none", "http://none"]]}],
#     [{"id": "horizon",
#       "title": "Horizon",
#       "description": "Web UI that manages OpenStack resources",
#       "urls": [["http://none"]]},
#      {"id": "baremetal",
#       "title": "Baremetal Provisioning",
#       "description": "MaaS service that manages baremetal infrastructure",
#       "urls": [["http://none", "http://none"], ["http://none"]]},
#      {"id": "jenkins",
#       "title": "Jenkins CI/CD",
#       "description": "Cloud Continues Integration and Deployment.",
#       "urls": [["http://none"]]}]]
# def get_region_infra(region):
# def get_regions_infra():


import flask
from oss_lib import config
from ceagle.api_fake_data import fake_infra
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



CONF = config.CONF

bp = flask.Blueprint("infra", __name__)


@bp.route("/region/<region>/infra")
@fake_infra.get_region_infra
def get_region_infra(region):
    infra = CONF["services"].get("infra", {}).get(region)
    if not infra:
        flask.abort(404)
    return flask.jsonify({"region": region, "infra": infra})


@bp.route("/infra")

# Path: ceagle/api_fake_data/fake_infra.py
# INFRAS = [
#     [{"id": "horizon",
#       "title": "Horizon",
#       "description": "Web UI that manages OpenStack resources",
#       "urls": [["http://none"]]},
#      {"id": "git",
#       "title": "Git Source Control",
#       "description": ("Gitlab with Git repositories with all "
#                       "projects source code"),
#       "urls": [["http://none"], ["http://none", "http://none"]]},
#      {"id": "packages",
#       "title": "JFrog Artifactory Packages",
#       "description": ("JFrog Artifactory service that contains "
#                       "all cloud packages & images"),
#       "urls": [["http://none"],
#                ["http://none", "http://none"],
#                ["http://none", "http://none", "http://none"],
#                ]},
#      {"id": "stacklight",
#       "title": "Stacklight",
#       "description": "Cloud Logging, Metering and Alerting services",
#       "urls": [["http://none", "http://none", "http://none", "http://none"]]}],
#     [{"id": "horizon",
#       "title": "Horizon",
#       "description": "Web UI that manages OpenStack resources",
#       "urls": [["http://none"]]},
#      {"id": "baremetal",
#       "title": "Baremetal Provisioning",
#       "description": "MaaS service that manages baremetal infrastructure",
#       "urls": [["http://none", "http://none"], ["http://none"]]},
#      {"id": "jenkins",
#       "title": "Jenkins CI/CD",
#       "description": "Cloud Continues Integration and Deployment.",
#       "urls": [["http://none"]]}]]
# def get_region_infra(region):
# def get_regions_infra():


# Path: ceagle/api/v1/infrastructure.py
import flask
from oss_lib import config
from ceagle.api_fake_data import fake_infra

#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



CONF = config.CONF

bp = flask.Blueprint("infra", __name__)


@bp.route("/region/<region>/infra")
@fake_infra.get_region_infra
def get_region_infra(region):
    infra = CONF["services"].get("infra", {}).get(region)
    if not infra:
        flask.abort(404)
    return flask.jsonify({"region": region, "infra": infra})


@bp.route("/infra")

@fake_infra.get_regions_infra