Rename __json__() to asdict()

This commit is contained in:
grossmj
2021-04-17 23:34:28 +09:30
parent 44074ff7c9
commit cefab8d362
89 changed files with 286 additions and 282 deletions

View File

@ -67,7 +67,7 @@ async def create_nat_node(project_id: UUID, node_data: schemas.NATCreate):
)
node.usage = node_data.get("usage", "")
return node.__json__()
return node.asdict()
@router.get("/{node_id}", response_model=schemas.NAT)
@ -76,7 +76,7 @@ def get_nat_node(node: Nat = Depends(dep_node)):
Return a NAT node.
"""
return node.__json__()
return node.asdict()
@router.put("/{node_id}", response_model=schemas.NAT)
@ -90,7 +90,7 @@ def update_nat_node(node_data: schemas.NATUpdate, node: Nat = Depends(dep_node))
if hasattr(node, name) and getattr(node, name) != value:
setattr(node, name, value)
node.updated()
return node.__json__()
return node.asdict()
@router.delete("/{node_id}", status_code=status.HTTP_204_NO_CONTENT)
@ -149,7 +149,7 @@ async def create_nat_node_nio(
nio = Builtin.instance().create_nio(jsonable_encoder(nio_data, exclude_unset=True))
await node.add_nio(nio, port_number)
return nio.__json__()
return nio.asdict()
@router.put(
@ -172,7 +172,7 @@ async def update_nat_node_nio(
if nio_data.filters:
nio.filters = nio_data.filters
await node.update_nio(port_number, nio)
return nio.__json__()
return nio.asdict()
@router.delete("/{node_id}/adapters/{adapter_number}/ports/{port_number}/nio", status_code=status.HTTP_204_NO_CONTENT)