mirror of
https://github.com/Av0idD4rk/firegex.git
synced 2026-10-23 16:31:00 +00:00
Expose 28 tools with shared REST operations, role-scoped bearer authentication, revisions, durable retries, snapshots, jobs and timed rollback. Add Docker verification harnesses and setup/workflow documentation in docs/mcp.md and inst.md. Validated with 330 unit tests, two consecutive 25-case MCP/import runs, and restart recovery; the full upstream regression run remains incomplete.
20 lines
944 B
Python
20 lines
944 B
Python
"""REST bindings; operations also serve the MCP interface."""
|
|
from fastapi import APIRouter, Depends
|
|
from application import firewall as operations
|
|
|
|
app = APIRouter()
|
|
startup = operations.startup
|
|
shutdown = operations.shutdown
|
|
reset = operations.reset
|
|
|
|
# Keep existing imports working while there is only one owner of managers and state.
|
|
def __getattr__(name):
|
|
return getattr(operations, name)
|
|
|
|
app.get('/settings', response_model=operations.FirewallSettings)(operations.get_settings)
|
|
app.put('/settings', response_model=operations.StatusMessageModel)(operations.set_settings)
|
|
app.get('/rules', response_model=operations.RuleInfo)(operations.get_rule_list)
|
|
app.post('/enable', response_model=operations.StatusMessageModel)(operations.enable_firewall)
|
|
app.post('/disable', response_model=operations.StatusMessageModel)(operations.disable_firewall)
|
|
app.post('/rules', response_model=operations.StatusMessageModel)(operations.add_new_service)
|