本文整理汇总了Python中neutron.api.v2.resource_helper.build_resource_info函数的典型用法代码示例。如果您正苦于以下问题:Python build_resource_info函数的具体用法?Python build_resource_info怎么用?Python build_resource_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_resource_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_resources
def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attr.PLURALS.update(plural_mappings)
return resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
constants.SERVICECHAIN)
示例2: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attr.PLURALS.update(plural_mappings)
resources = resource_helper.build_resource_info(
plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
constants.FLAVORS)
plugin = manager.NeutronManager.get_service_plugins()[
constants.FLAVORS]
for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP:
# Special handling needed for sub-resources with 'y' ending
# (e.g. proxies -> proxy)
resource_name = collection_name[:-1]
parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get('parent')
params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get(
'parameters')
controller = base.create_resource(collection_name, resource_name,
plugin, params,
allow_bulk=True,
parent=parent)
resource = extensions.ResourceExtension(
collection_name,
controller, parent,
path_prefix=FLAVORS_PREFIX,
attr_map=params)
resources.append(resource)
return resources
示例3: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings({}, RESOURCE_ATTRIBUTE_MAP)
plural_mappings["sfcs"] = "sfc"
return resource_helper.build_resource_info(
plural_mappings, RESOURCE_ATTRIBUTE_MAP, SFC_EXT, register_quota=True
)
示例4: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, apidef.RESOURCE_ATTRIBUTE_MAP)
resources = resource_helper.build_resource_info(
plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP,
constants.FLAVORS)
plugin = directory.get_plugin(constants.FLAVORS)
for collection_name in apidef.SUB_RESOURCE_ATTRIBUTE_MAP:
# Special handling needed for sub-resources with 'y' ending
# (e.g. proxies -> proxy)
resource_name = collection_name[:-1]
parent = apidef.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get(
'parent')
params = apidef.SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get(
'parameters')
controller = base.create_resource(collection_name, resource_name,
plugin, params,
allow_bulk=True,
parent=parent)
resource = extensions.ResourceExtension(
collection_name,
controller, parent,
path_prefix=apidef.API_PREFIX,
attr_map=params)
resources.append(resource)
return resources
示例5: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings({}, RESOURCE_ATTRIBUTE_MAP)
plural_mappings["flow_classifiers"] = "flow_classifier"
return resource_helper.build_resource_info(
plural_mappings, RESOURCE_ATTRIBUTE_MAP, FLOW_CLASSIFIER_EXT, register_quota=True
)
示例6: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
special_mappings = {"policies": "policy"}
plural_mappings = resource_helper.build_plural_mappings(
special_mappings, itertools.chain(RESOURCE_ATTRIBUTE_MAP, SUB_RESOURCE_ATTRIBUTE_MAP)
)
attr.PLURALS.update(plural_mappings)
resources = resource_helper.build_resource_info(
plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.QOS, translate_name=True, allow_bulk=True
)
plugin = manager.NeutronManager.get_service_plugins()[constants.QOS]
for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP:
resource_name = collection_name[:-1]
parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parent")
params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get("parameters")
controller = base.create_resource(
collection_name,
resource_name,
plugin,
params,
allow_bulk=True,
parent=parent,
allow_pagination=True,
allow_sorting=True,
)
resource = extensions.ResourceExtension(
collection_name, controller, parent, path_prefix=QOS_PREFIX, attr_map=params
)
resources.append(resource)
return resources
示例7: get_resources
def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
plural_mappings['health_monitors_status'] = 'health_monitor_status'
attr.PLURALS.update(plural_mappings)
action_map = {'pool': {'stats': 'GET'}}
resources = resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
constants.LOADBALANCER,
action_map=action_map)
plugin = manager.NeutronManager.get_service_plugins()[
constants.LOADBALANCER]
for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP:
# Special handling needed for sub-resources with 'y' ending
# (e.g. proxies -> proxy)
resource_name = collection_name[:-1]
parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get('parent')
params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get(
'parameters')
controller = base.create_resource(collection_name, resource_name,
plugin, params,
allow_bulk=True,
parent=parent)
resource = extensions.ResourceExtension(
collection_name,
controller, parent,
path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER],
attr_map=params)
resources.append(resource)
return resources
示例8: get_resources
def get_resources(cls):
special_mappings = {'firewall_policies': 'firewall_policy'}
plural_mappings = resource_helper.build_plural_mappings(
special_mappings, firewall.RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info(
plural_mappings, firewall.RESOURCE_ATTRIBUTE_MAP,
fwaas_constants.FIREWALL, action_map=firewall.ACTION_MAP,
register_quota=True)
示例9: get_resources
def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
nconstants.VPN,
register_quota=True,
translate_name=True)
示例10: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, l3_apidef.RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info(
plural_mappings, l3_apidef.RESOURCE_ATTRIBUTE_MAP,
constants.L3, action_map=l3_apidef.ACTION_MAP,
register_quota=True)
示例11: get_resources
def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
gbp_extensions.register_plurals(plural_mappings)
return resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
constants.SERVICECHAIN,
register_quota=True)
示例12: get_resources
def get_resources(cls):
special_mappings = {"ikepolicies": "ikepolicy", "ipsecpolicies": "ipsecpolicy"}
plural_mappings = resource_helper.build_plural_mappings(special_mappings, RESOURCE_ATTRIBUTE_MAP)
plural_mappings["peer_cidrs"] = "peer_cidr"
attr.PLURALS.update(plural_mappings)
return resource_helper.build_resource_info(
plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.VPN, register_quota=True, translate_name=True
)
示例13: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attr.PLURALS.update(plural_mappings)
return resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
constants.L3_ROUTER_NAT)
示例14: get_resources
def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
# attr.PLURALS.update(plural_mappings)
return resource_helper.build_resource_info(plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
None,
register_quota=True)
示例15: get_resources
def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
plural_mappings['service_graphs'] = 'service_graph'
return resource_helper.build_resource_info(
plural_mappings,
RESOURCE_ATTRIBUTE_MAP,
ext_sfc.SFC_EXT,
register_quota=True)