Build Proxmox visualizer app
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.core.config import settings
|
||||
from app.models.schemas import ServerInfo
|
||||
from app.services.scanner import parse_server_configs
|
||||
|
||||
router = APIRouter(prefix="/proxmox", tags=["proxmox"])
|
||||
|
||||
|
||||
@router.get("/servers", response_model=list[ServerInfo])
|
||||
async def list_servers() -> list[ServerInfo]:
|
||||
servers, _ = parse_server_configs(settings.parsed_servers)
|
||||
return [
|
||||
ServerInfo(
|
||||
name=server.name,
|
||||
url=str(server.url).rstrip("/"),
|
||||
)
|
||||
for server in servers
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.core.config import settings
|
||||
from app.models.schemas import ScanResponse
|
||||
from app.services.scanner import scan_servers
|
||||
|
||||
router = APIRouter(prefix="/vms", tags=["vms"])
|
||||
|
||||
|
||||
@router.get("/scan", response_model=ScanResponse)
|
||||
async def scan_vms() -> ScanResponse:
|
||||
return await scan_servers(settings.parsed_servers)
|
||||
@@ -0,0 +1,7 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.api.endpoints import proxmox, vms
|
||||
|
||||
api_router = APIRouter(prefix="/api")
|
||||
api_router.include_router(proxmox.router)
|
||||
api_router.include_router(vms.router)
|
||||
Reference in New Issue
Block a user