GET /api/v1/topologies — paginated list with status filter. Extends
repo.list_topologies() to accept limit/offset and adds count_topologies()
for the total envelope field.
GET /api/v1/topologies/{id} — hydrated TopologyDetail; 404 if missing.
GET /api/v1/topologies/{id}/status-events — audit trail, limit-capped.
Catalog helpers for the phase-4 canvas UI:
* GET /topologies/services — full service catalog.
* GET /topologies/next-subnet?base=172.20 — wraps SubnetAllocator against
reserved_subnets across non-torn-down topologies.
* GET /topologies/{id}/lans/{lan_id}/next-ip — IPAllocator pre-seeded
with existing decky IPs in that LAN.
All read routes are viewer-or-admin. Sub-routers are included in an
order that keeps literal catalog paths (/services, /next-subnet) from
being shadowed by the /{topology_id} trie branch.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""MazeNET topology REST endpoints (phase 3).
|
|
|
|
Thin FastAPI layer over the phase-2 topology machinery:
|
|
generate/validate/deploy/teardown, pending-only child CRUD, and the
|
|
live-mutation queue for active|degraded topologies.
|
|
|
|
Mounted at ``/api/v1/topologies`` by the main api router. Sub-routers
|
|
live one-per-file and are aggregated here.
|
|
"""
|
|
from fastapi import APIRouter
|
|
|
|
from .api_catalog import router as _catalog_router
|
|
from .api_get_topology import router as _get_router
|
|
from .api_list_topologies import router as _list_router
|
|
|
|
topology_router = APIRouter(prefix="/topologies", tags=["topologies"])
|
|
|
|
# Order matters: catalog routes use literal path segments (e.g.
|
|
# /services, /next-subnet) that would otherwise be shadowed by the
|
|
# `/{topology_id}` path in api_get_topology. Keep the catalog router
|
|
# included first so FastAPI's trie resolves literals before the
|
|
# parameterized fallback.
|
|
topology_router.include_router(_catalog_router)
|
|
topology_router.include_router(_list_router)
|
|
topology_router.include_router(_get_router)
|
|
|
|
|
|
__all__ = ["topology_router"]
|