本文整理匯總了Python中networkapi.settings.SPECS.get方法的典型用法代碼示例。如果您正苦於以下問題:Python SPECS.get方法的具體用法?Python SPECS.get怎麽用?Python SPECS.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類networkapi.settings.SPECS
的用法示例。
在下文中一共展示了SPECS.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: put
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def put(self, request, *args, **kwargs):
"""Updates list of equipments."""
data = request.DATA
json_validate(SPECS.get('equipment_put_v4')).validate(data)
response = facade_v4.update_equipment(data['equipments'], request.user)
return Response(response, status=status.HTTP_200_OK)
示例2: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Creates list of equipments."""
data = request.DATA
json_validate(SPECS.get('equipment_post')).validate(data)
response = facade.create_equipment(data['equipments'], request.user)
return Response(response, status=status.HTTP_201_CREATED)
示例3: put
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def put(self, request, *args, **kwargs):
"""Enable/Disable pool member by list of server pool."""
pools = request.DATA
json_validate(SPECS.get('pool_member_status')).validate(pools)
response = facade_pool_deploy.set_poolmember_state(
pools, request.user)
return Response(response, status=status.HTTP_200_OK)
示例4: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Create new Neighbor."""
objects = request.DATA
json_validate(SPECS.get('neighbor_post')).validate(objects)
response = list()
for obj in objects.get('neighbors'):
created_obj = facade.create_neighbor(obj, request.user)
response.append({'id': created_obj.id})
return Response(response, status=status.HTTP_201_CREATED)
示例5: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Create new RouteMapEntry."""
objects = request.DATA
json_validate(SPECS.get('routemap_post')).validate(objects)
response = list()
for obj in objects['route_map_entries']:
created_obj = facade.create_route_map_entry(obj)
response.append({'id': created_obj.id})
return Response(response, status=status.HTTP_201_CREATED)
示例6: put
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def put(self, request, *args, **kwargs):
"""Edit Ipv4."""
ips = request.DATA
json_validate(SPECS.get('ipv4_put_v4')).validate(ips)
response = list()
for ip in ips['ips']:
ret = facade_v3.update_ipv4(ip, request.user)
response.append({'id': ret.id})
return Response(response, status=status.HTTP_200_OK)
示例7: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Save Ipv6."""
ips = request.DATA
json_validate(SPECS.get('ipv6_post_v4')).validate(ips)
response = list()
for ip in ips['ips']:
ret = facade_v3.create_ipv6(ip, request.user)
response.append({'id': ret.id})
return Response(response, status=status.HTTP_201_CREATED)
示例8: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Create new environment."""
envs = request.DATA
json_validate(SPECS.get('environment_post')).validate(envs)
response = list()
for env in envs['environments']:
env_obj = facade.create_environment(env)
response.append({'id': env_obj.id})
return Response(response, status=status.HTTP_201_CREATED)
示例9: get
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def get(self, request, *args, **kwargs):
"""Enable/Disable pool member by list"""
try:
way = kwargs['way']
with open(SPECS.get(way)) as data_file:
data = json.load(data_file)
return Response(data)
except Exception, exception:
log.error(exception)
raise Exception('Spec not exists')
示例10: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Create new AS."""
as_s = request.DATA
json_validate(SPECS.get('as_post_v4')).validate(as_s)
response = list()
for as_ in as_s['asns']:
as_obj = facade.create_as(as_)
response.append({'id': as_obj.id})
return Response(response, status=status.HTTP_201_CREATED)
示例11: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Create new ListConfigBGP."""
objects = request.DATA
json_validate(SPECS.get('list_config_bgp_post_v4')).validate(objects)
response = list()
for obj in objects['lists_config_bgp']:
created_obj = facade.create_list_config_bgp(obj)
response.append({'id': created_obj.id})
return Response(response, status=status.HTTP_201_CREATED)
示例12: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""Creates list of networkv4."""
data = request.DATA
json_validate(SPECS.get('networkv4_post')).validate(data)
response = list()
for networkv4 in data['networks']:
vl = facade.create_networkipv4(networkv4, request.user)
response.append({'id': vl.id})
return Response(response, status=status.HTTP_201_CREATED)
示例13: put
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def put(self, request, *args, **kwargs):
"""Updates list of vlans."""
data = request.DATA
json_validate(SPECS.get('vlan_put')).validate(data)
response = list()
for vlan in data['vlans']:
vl = facade.update_vlan(vlan, request.user)
response.append({'id': vl.id})
return Response(response, status=status.HTTP_200_OK)
示例14: put
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def put(self, request, *args, **kwargs):
"""
Update vrfs
"""
vrfs = request.DATA
json_validate(SPECS.get('vrf_put')).validate(vrfs)
response = list()
for vrf in vrfs['vrfs']:
vrf = facade.update_vrf(vrf)
response.append({
'id': vrf.id
})
return Response(response, status=status.HTTP_200_OK)
示例15: post
# 需要導入模塊: from networkapi.settings import SPECS [as 別名]
# 或者: from networkapi.settings.SPECS import get [as 別名]
def post(self, request, *args, **kwargs):
"""
Save server pool
"""
pools = request.DATA
json_validate(SPECS.get('pool_post')).validate(pools)
verify_ports(pools)
response = list()
for pool in pools['server_pools']:
pl = facade.create_pool(pool, request.user)
response.append({'id': pl.id})
return Response(response, status=status.HTTP_201_CREATED)