# Path: ceagle/app.py
# def versions():
# def not_found(error):
# def handle_unknown_service(ex):
# 
# Path: ceagle/config.py
# DEFAULT_CONF_PATH = "/etc/ceagle/config.yaml"
# DEFAULT = {
#     "use_fake_api_data": True,
#     "services": {},
# }
# SCHEMA = {
#     "use_fake_api_data": {"type": "boolean"},
#     "services": {
#         "type": "object",
#         "properties": {
#             "availability": {"type": "string"},
#             "capacity": {"type": "string"},
#             "cis": {"type": "string"},
#             "health": {"type": "string"},
#             "optimization": {"type": "string"},
#             "performance": {"type": "string"},
#             "security": {"type": "string"},
#             "infra": {
#                 "type": "object",
#                 "patternProperties": {
#                     "\w+": {
#                         "type": "array",
#                         "uniqueItems": True,
#                         "items": {
#                             "type": "object",
#                             "properties": {
#                                 "id": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "title": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "description": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "urls": {
#                                     "type": "array",
#                                     "items": {
#                                         "type": "array",
#                                         "items": {
#                                             "type": "string",
#                                             "minLength": 8
#                                         }
#                                     }
#                                 },
#                             },
#                             "required": ["id", "title", "description", "urls"],
#                             "additionalProperties": False,
#                         },
#                     },
#                 }
#             }
#         },
#         "additionalProperties": False,
#     },
# }


import argparse
from oss_lib import config
from ceagle import app
from ceagle import config as cfg
#
#         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.





def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--host",
                        default="0.0.0.0",
                        help="A host to bind development server. "
                             "(default 0.0.0.0)")
    parser.add_argument("--port",
                        type=int,
                        default=5000,
                        help="A port to bind development server. "
                             "(default 5000)")
    args = config.process_args("CEAGLE",
                               parser=parser,
                               default_config_path=cfg.DEFAULT_CONF_PATH,
                               defaults=cfg.DEFAULT,
                               validation_schema=cfg.SCHEMA)
    app.app.config["DEBUG"] = args.debug

# Path: ceagle/app.py
# def versions():
# def not_found(error):
# def handle_unknown_service(ex):
# 
# Path: ceagle/config.py
# DEFAULT_CONF_PATH = "/etc/ceagle/config.yaml"
# DEFAULT = {
#     "use_fake_api_data": True,
#     "services": {},
# }
# SCHEMA = {
#     "use_fake_api_data": {"type": "boolean"},
#     "services": {
#         "type": "object",
#         "properties": {
#             "availability": {"type": "string"},
#             "capacity": {"type": "string"},
#             "cis": {"type": "string"},
#             "health": {"type": "string"},
#             "optimization": {"type": "string"},
#             "performance": {"type": "string"},
#             "security": {"type": "string"},
#             "infra": {
#                 "type": "object",
#                 "patternProperties": {
#                     "\w+": {
#                         "type": "array",
#                         "uniqueItems": True,
#                         "items": {
#                             "type": "object",
#                             "properties": {
#                                 "id": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "title": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "description": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "urls": {
#                                     "type": "array",
#                                     "items": {
#                                         "type": "array",
#                                         "items": {
#                                             "type": "string",
#                                             "minLength": 8
#                                         }
#                                     }
#                                 },
#                             },
#                             "required": ["id", "title", "description", "urls"],
#                             "additionalProperties": False,
#                         },
#                     },
#                 }
#             }
#         },
#         "additionalProperties": False,
#     },
# }


# Path: ceagle/cmd.py
import argparse
from oss_lib import config
from ceagle import app
from ceagle import config as cfg

#
#         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.





def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--host",
                        default="0.0.0.0",
                        help="A host to bind development server. "
                             "(default 0.0.0.0)")
    parser.add_argument("--port",
                        type=int,
                        default=5000,
                        help="A port to bind development server. "
                             "(default 5000)")
    args = config.process_args("CEAGLE",
                               parser=parser,
                               default_config_path=cfg.DEFAULT_CONF_PATH,
                               defaults=cfg.DEFAULT,
                               validation_schema=cfg.SCHEMA)
    app.app.config["DEBUG"] = args.debug

    app.app.run(host=args.host, port=args.port)