本文整理汇总了Python中networkapi.util.json_validate.json_validate函数的典型用法代码示例。如果您正苦于以下问题:Python json_validate函数的具体用法?Python json_validate怎么用?Python json_validate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了json_validate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: put
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
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
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
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)
示例5: post
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)
示例6: post
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)
示例7: put
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)
示例8: post
def post(self, request, *args, **kwargs):
"""
Create new vrfs
"""
vrfs = request.DATA
json_validate(SPECS.get('vrf_post')).validate(vrfs)
response = list()
for vrf in vrfs['vrfs']:
vrf = facade.create_vrf(vrf)
response.append({'id': vrf.id})
return Response(response, status=status.HTTP_201_CREATED)
示例9: post
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)
示例10: post
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: put
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)
示例12: post
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
def put(self, request, *args, **kwargs):
"""Update NeighborV4."""
objects = request.DATA
json_validate(SPECS.get('neighbor_v4_put_v4')).validate(objects)
response = list()
for obj in objects['neighbors']:
created_obj = facade.update_neighbor_v4(obj, request.user)
response.append({
'id': created_obj.id
})
return Response(response, status=status.HTTP_200_OK)
示例14: put
def put(self, request, *args, **kwargs):
envs = request.DATA
json_validate(SPECS.get('environment_vip_put')).validate(envs)
response = list()
for env in envs['environments_vip']:
ret = facade.update_environment_vip(env)
response.append({
'id': ret.id,
'msg': 'success'
})
return Response(response, status=status.HTTP_200_OK)
示例15: post
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)