Пример #1
0
def create_api():
    """Return service that encapsulates api logic for DSE2."""
    # ResourceManager inherits from DataService
    api_resource_mgr = application.ResourceManager()
    models = create_api_models(api_resource_mgr)
    router.APIRouterV1(api_resource_mgr, models)
    return models, api_resource_mgr
Пример #2
0
def congress_app_factory(global_conf, **local_conf):
    root_path = cfg.CONF.root_path
    if root_path is None:
        root_path = os.path.dirname(__file__)   # drop filename
        root_path = os.path.dirname(root_path)  # drop to congress src dir
    policy_path = cfg.CONF.policy_path
    if policy_path is None:
        policy_path = os.path.join(root_path, 'etc', 'snapshot')
    data_path = cfg.CONF.datasource_file
    if data_path is None:
        data_path = os.path.join(root_path, 'etc', 'datasources.conf')

    cage = harness.create(root_path, policy_path, data_path)

    api_resource_mgr = application.ResourceManager()
    router.APIRouterV1(api_resource_mgr, cage)
    return application.ApiApplication(api_resource_mgr)