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

@ -73,7 +73,7 @@ async def create_vmware_node(project_id: UUID, node_data: schemas.VMwareCreate):
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
return vm.__json__()
return vm.asdict()
@router.get("/{node_id}", response_model=schemas.VMware)
@ -82,7 +82,7 @@ def get_vmware_node(node: VMwareVM = Depends(dep_node)):
Return a VMware node.
"""
return node.__json__()
return node.asdict()
@router.put("/{node_id}", response_model=schemas.VMware)
@ -99,7 +99,7 @@ def update_vmware_node(node_data: schemas.VMwareUpdate, node: VMwareVM = Depends
setattr(node, name, value)
node.updated()
return node.__json__()
return node.asdict()
@router.delete("/{node_id}", status_code=status.HTTP_204_NO_CONTENT)
@ -171,7 +171,7 @@ async def create_vmware_node_nio(
nio = VMware.instance().create_nio(jsonable_encoder(nio_data, exclude_unset=True))
await node.adapter_add_nio_binding(adapter_number, nio)
return nio.__json__()
return nio.asdict()
@router.put(
@ -191,7 +191,7 @@ async def update_vmware_node_nio(
if nio_data.filters:
nio.filters = nio_data.filters
await node.adapter_update_nio_binding(adapter_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)