feat:
--ADDED Api to get node details
This commit is contained in:
1 parent
b6245bed08
commit
a4aca1216d
1 file changed
+43
@@ -555,6 +555,49 @@ def get_node_interfaces(db: Session = Depends(get_db),token_data: dict = Depends
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/spock/node-interfaces/{node_uuid}")
|
||||||
|
def get_node_interface_by_uuid(
|
||||||
|
node_uuid: UUID,
|
||||||
|
db: Session = Depends(get_db),
|
||||||
|
token_data: dict = Depends(verify_token)
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
row = (
|
||||||
|
db.query(NodeInterface)
|
||||||
|
.filter(NodeInterface.uuid == node_uuid)
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
|
||||||
|
if not row:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=404,
|
||||||
|
detail="Node not found"
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"status": "success",
|
||||||
|
"node": {
|
||||||
|
"uuid": str(row.uuid),
|
||||||
|
"if_id": row.if_id,
|
||||||
|
"if_name": row.if_name,
|
||||||
|
"if_nodeid": row.if_nodeid,
|
||||||
|
"host": row.host,
|
||||||
|
"port": row.port,
|
||||||
|
"dbname": row.dbname,
|
||||||
|
"user": row.user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
except HTTPException:
|
||||||
|
raise
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=500,
|
||||||
|
detail=str(e)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# !!!!!!!!!!!!!!!!!PASSWORD MUST BE STORED IN MANAGEMENT TABLE!!!!!!!!!!!!!!
|
# !!!!!!!!!!!!!!!!!PASSWORD MUST BE STORED IN MANAGEMENT TABLE!!!!!!!!!!!!!!
|
||||||
@app.delete("/spock/del-node-interfaces")
|
@app.delete("/spock/del-node-interfaces")
|
||||||
def delete_node_interface(
|
def delete_node_interface(
|
||||||
|
|||||||
Reference in new issue
Block a user