def __init__(self, **local_config): mapper = routes_mapper.Mapper() plugin_provider = cfg.CONF.core_plugin LOG.debug("Plugin location:%s", plugin_provider) plugin = manager.get_plugin(plugin_provider) col_kwargs = dict(collection_actions=COLLECTION_ACTIONS, member_actions=MEMBER_ACTIONS) resources = {'network': 'networks', 'subnet': 'subnets', 'port': 'ports'} def _map_resource(collection, resource, params): controller = base.create_resource(collection, resource, plugin, params) mapper_kwargs = dict(controller=controller, requirements=REQUIREMENTS, **col_kwargs) return mapper.collection(collection, resource, **mapper_kwargs) mapper.connect('index', '/', controller=Index(resources)) for resource in resources: _map_resource(resources[resource], resource, RESOURCE_ATTRIBUTE_MAP.get(resources[resource], dict())) super(APIRouter, self).__init__(mapper)
def __init__(self, conf, **local_config): mapper = routes_mapper.Mapper() plugin_provider = manager.get_plugin_provider(conf) plugin = manager.get_plugin(plugin_provider) # NOTE(jkoelker) Merge local_conf into conf after the plugin # is discovered conf.update(local_config) col_kwargs = dict(collection_actions=COLLECTION_ACTIONS, member_actions=MEMBER_ACTIONS) resources = {'network': 'networks', 'subnet': 'subnets', 'port': 'ports'} def _map_resource(collection, resource, params): controller = base.create_resource(collection, resource, plugin, conf, params) mapper_kwargs = dict(controller=controller, requirements=REQUIREMENTS, **col_kwargs) return mapper.collection(collection, resource, **mapper_kwargs) mapper.connect('index', '/', controller=Index(resources)) for resource in resources: _map_resource(resources[resource], resource, RESOURCE_ATTRIBUTE_MAP.get(resources[resource], dict())) super(APIRouter, self).__init__(mapper)
def __init__(self, **local_config): mapper = routes_mapper.Mapper() plugin_provider = cfg.CONF.core_plugin LOG.debug("Plugin location:%s", plugin_provider) plugin = manager.get_plugin(plugin_provider) col_kwargs = dict(collection_actions=COLLECTION_ACTIONS, member_actions=MEMBER_ACTIONS) resources = { 'network': 'networks', 'subnet': 'subnets', 'port': 'ports' } def _map_resource(collection, resource, params): controller = base.create_resource(collection, resource, plugin, params) mapper_kwargs = dict(controller=controller, requirements=REQUIREMENTS, **col_kwargs) return mapper.collection(collection, resource, **mapper_kwargs) mapper.connect('index', '/', controller=Index(resources)) for resource in resources: _map_resource( resources[resource], resource, RESOURCE_ATTRIBUTE_MAP.get(resources[resource], dict())) super(APIRouter, self).__init__(mapper)
def __init__(self, conf, **local_config): mapper = routes_mapper.Mapper() plugin_provider = manager.get_plugin_provider(conf) plugin = manager.get_plugin(plugin_provider) # NOTE(jkoelker) Merge local_conf into conf after the plugin # is discovered conf.update(local_config) col_kwargs = dict(collection_actions=COLLECTION_ACTIONS, member_actions=MEMBER_ACTIONS) resources = {'network': 'networks', 'subnet': 'subnets', 'port': 'ports'} def _map_resource(collection, resource, params): controller = base.create_resource(collection, resource, plugin, conf, params) mapper_kwargs = dict(controller=controller, requirements=REQUIREMENTS, **col_kwargs) return mapper.collection(collection, resource, **mapper_kwargs) mapper.connect('index', '/', controller=Index(resources)) for resource in resources: _map_resource(resources[resource], resource, RESOURCE_PARAM_MAP.get(resources[resource], dict())) super(APIRouter, self).__init__(mapper)