feat(api): add discriminators to link iface, appliance version and template settings schemas

This commit is contained in:
Mark Paronyan committed 2026-10-07 14:22:18 +03:00
1 parent 2fb7056cb9
commit a4f20e0966
9 files changed
+202 -12

No files matched your search

+4 -2
View File
@@ -20,7 +20,7 @@ API routes for links.
import logging
import os
from typing import Any, List, Union
from typing import Any, List
from uuid import UUID, uuid4
import aiohttp
@@ -484,7 +484,7 @@ async def update_marker(marker_name: str, marker_data: schemas.MarkerUpdate, lin
@router.get(
"/{link_id}/iface",
response_model=Union[schemas.UDPPortInfo, schemas.EthernetPortInfo],
response_model=schemas.LinkIfaceInfo,
dependencies=[Depends(has_privilege("Link.Audit"))],
)
async def get_iface(link: Link = Depends(dep_link)) -> dict:
@@ -515,6 +515,7 @@ async def get_iface(link: Link = Depends(dep_link)) -> dict:
port_type = port.get("type", "")
if "udp" in port_type.lower():
ifaces_info = {
"kind": "udp",
"node_id": node.id,
"type": f"{port_type}",
"lport": port["lport"],
@@ -523,6 +524,7 @@ async def get_iface(link: Link = Depends(dep_link)) -> dict:
}
else:
ifaces_info = {
"kind": "ethernet",
"node_id": node.id,
"type": f"{port_type}",
"interface": port["interface"],