"""Aggregate status API blueprint. Exposed at /api/status/* and delegates all operations to vacuum-walld. """ from flask import Blueprint from daemon.client import ( # noqa: F401 (resolved via module globals at dispatch) get, post, ) from daemon.iface import ( GET_STATUS_PENDING, GET_SYSTEM_METRICS, POST_STATUS_APPLY_ALL, POST_STATUS_CANCEL_ALL, POST_STATUS_REFRESH, ) from webui.api.common import NO_BODY, daemon_route bp = Blueprint("status", __name__) @daemon_route(GET_STATUS_PENDING, bp) def pending(): """GET /api/status/pending — Per-subsystem pending status + total change count.""" @daemon_route(POST_STATUS_APPLY_ALL, bp) def apply_all(): """POST /api/status/apply-all — Apply pending changes in dependency order.""" @daemon_route(POST_STATUS_CANCEL_ALL, bp, body=NO_BODY) def cancel_all(): """POST /api/status/cancel-all — Revert pending changes to last applied config.""" @daemon_route(POST_STATUS_REFRESH, bp) def refresh(): """POST /api/status/refresh — Re-collect state, optionally filtered by subsystem.""" @daemon_route(GET_SYSTEM_METRICS, bp, rule="/system-metrics") def system_metrics(): """GET /api/status/system-metrics — System-wide CPU/memory/network metrics."""