feat(api): phase 3 step 2 — topology read endpoints (list/get/status/catalog)
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.
This commit is contained in:
@@ -9,10 +9,20 @@ 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"])
|
||||
|
||||
# Sub-routers land in later steps; this skeleton keeps the package
|
||||
# import-safe so the main api router can mount it immediately.
|
||||
# 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"]
|
||||
|
||||
Reference in New Issue
Block a user