|
27 | 27 | from .database import get_db_session |
28 | 28 | from .middleware.metrics import PrometheusMiddleware, background_updater |
29 | 29 | from .middleware.rate_limiting import get_rate_limiting_middleware |
30 | | -from .routes import ( # noqa: E501; REMOVED route consolidation notes:; - api_keys, auth, mfa: Consolidated into routes/auth/ (E1-S4); - hosts, host_*_discovery: Consolidated into routes/hosts/ (Phase 3); - mongodb_scan_api, rule_scanning, scan_config_api, scan_templates: Consolidated into routes/scans/ (Phase 2); - compliance, drift_events, owca: Consolidated into routes/compliance/ (Phase 4); - plugin_management, webhooks: Consolidated into routes/integrations/ (Phase 4); - ssh_debug, ssh_settings: Consolidated into routes/ssh/ (Phase 4); - bulk_remediation_routes, remediation_api: Moved to SecureOps/AEGIS (ORSA subsystem) |
| 30 | + |
| 31 | +# Flat route modules (not yet organized into packages) |
| 32 | +from .routes import ( |
31 | 33 | adaptive_scheduler, |
32 | | - audit, |
33 | 34 | baselines, |
34 | 35 | bulk_operations, |
35 | 36 | capabilities, |
36 | | - compliance_rules_api, |
37 | | - content, |
38 | | - credentials, |
39 | 37 | health_monitoring, |
40 | 38 | integration_metrics, |
41 | 39 | mongodb_test, |
42 | 40 | monitoring, |
43 | 41 | os_discovery, |
44 | 42 | remediation_callback, |
45 | 43 | remediation_provider, |
46 | | - rule_management, |
47 | 44 | scans, |
48 | | - scap_import, |
49 | | - users, |
50 | 45 | version, |
51 | | - xccdf_api, |
52 | 46 | ) |
53 | 47 |
|
| 48 | +# Import admin from new modular package (E1-S6 Route Consolidation) |
| 49 | +# This package consolidates users.py, audit.py, and credentials.py |
| 50 | +from .routes.admin import router as admin_router |
| 51 | + |
54 | 52 | # Import auth from new modular package (E1-S4 Route Consolidation) |
55 | 53 | # This package consolidates auth.py, mfa.py, and api_keys.py into a single |
56 | 54 | # modular package with login, MFA, and API key endpoints |
|
61 | 59 | # modular package with intelligence, OWCA, and drift endpoints |
62 | 60 | from .routes.compliance import router as compliance_router |
63 | 61 |
|
| 62 | +# Import content from new modular package (E1-S7 Route Consolidation) |
| 63 | +# This package consolidates content.py, scap_import.py, and xccdf_api.py |
| 64 | +from .routes.content import router as content_pkg_router |
| 65 | + |
64 | 66 | # Import host_groups from new modular package (Phase 1 API Standardization) |
65 | 67 | # This package consolidates host_groups.py and group_compliance.py into a single |
66 | 68 | # modular package with CRUD and scanning endpoints aligned with frontend scanService.ts |
|
77 | 79 | # modular package with webhooks and plugins endpoints |
78 | 80 | from .routes.integrations import router as integrations_router |
79 | 81 |
|
| 82 | +# Import rules from new modular package (E1-S5 Route Consolidation) |
| 83 | +# This package consolidates rule_management.py, rule_scanning.py, and |
| 84 | +# compliance_rules_api.py into a single modular package |
| 85 | +from .routes.rules import router as rules_router |
| 86 | + |
80 | 87 | # Import SSH from new modular package (Phase 4 API Standardization) |
81 | 88 | # This package consolidates ssh_settings.py and ssh_debug.py into a single |
82 | 89 | # modular package with settings and debug endpoints |
@@ -560,98 +567,41 @@ async def metrics() -> PlainTextResponse: |
560 | 567 | # Capabilities and system information |
561 | 568 | app.include_router(capabilities.router, prefix="/api", tags=["System Capabilities"]) |
562 | 569 |
|
563 | | -# MongoDB and SCAP endpoints (consolidated from v1) |
| 570 | +# MongoDB test endpoints |
564 | 571 | app.include_router(mongodb_test.router, prefix="/api/mongodb", tags=["MongoDB Integration Test"]) |
565 | | -app.include_router(scap_import.router, prefix="/api", tags=["SCAP Import"]) |
566 | | -app.include_router(rule_management.router, prefix="/api", tags=["Enhanced Rule Management"]) |
567 | | -app.include_router(compliance_rules_api.router, prefix="/api", tags=["MongoDB Compliance Rules"]) |
568 | | -# mongodb_scan_api - REMOVED: Consolidated into routes/scans/mongodb.py (Phase 2) |
569 | | -# Endpoints now available at /api/scans/mongodb/* |
570 | | - |
571 | | -# XCCDF and scanning services (consolidated from v1) |
572 | | -app.include_router(xccdf_api.router, prefix="/api/xccdf", tags=["XCCDF Generator"]) |
573 | | -# remediation_api - REMOVED: Moved to SecureOps/AEGIS (ORSA subsystem) |
574 | | -# scan_config_api - REMOVED: Consolidated into routes/scans/config.py and templates.py (Phase 2) |
575 | | -# Endpoints now available at /api/scans/config/* and /api/scans/templates/* |
| 572 | + |
| 573 | +# Health and monitoring |
576 | 574 | app.include_router(health_monitoring.router, prefix="/api/health-monitoring", tags=["Health Monitoring"]) |
| 575 | +app.include_router(monitoring.router, prefix="/api", tags=["Host Monitoring"]) |
577 | 576 |
|
578 | 577 | # Remediation provider (registration interface for ORSA adapters) |
579 | 578 | app.include_router(remediation_provider.router, prefix="/api/remediation", tags=["Remediation Provider"]) |
| 579 | +app.include_router(remediation_callback.router, prefix="/api", tags=["AEGIS Integration"]) |
580 | 580 |
|
581 | | -# Core API routes |
582 | | -# auth - Modular package (E1-S4) - consolidates login, MFA, API keys |
| 581 | +# Modular route packages |
| 582 | +# Each package aggregates related sub-routers with their own prefixes |
583 | 583 | app.include_router(auth_router, prefix="/api/auth", tags=["Authentication"]) |
584 | | -# Hosts - Modular package with all host-related endpoints (Phase 3 API Standardization) |
585 | | -# Includes: crud, discovery (basic, network, security, compliance) |
586 | | -# The router already has prefix="/hosts" defined in routes/hosts/__init__.py |
587 | 584 | app.include_router(hosts_router, prefix="/api", tags=["Hosts"]) |
588 | | -app.include_router(baselines.router, tags=["Baseline Management"]) |
589 | | -# drift_events - REMOVED: Consolidated into routes/compliance/drift.py (Phase 4) |
590 | | -# Endpoints now available at /api/compliance/drift/* |
591 | | -# Scans - Modular package with all scan-related endpoints (Phase 2 API Standardization) |
592 | | -# Includes: compliance, crud, reports, bulk, validation, config, templates, rules, mongodb |
593 | | -# The router already has prefix="/scans" defined in routes/scans/__init__.py |
594 | 585 | app.include_router(scans.router, prefix="/api", tags=["Security Scans"]) |
595 | | -# owca - REMOVED: Consolidated into routes/compliance/owca.py (Phase 4) |
596 | | -# Endpoints now available at /api/compliance/owca/* |
597 | | -app.include_router(content.router, prefix="/api/content", tags=["Legacy Content"]) |
598 | | -app.include_router(monitoring.router, prefix="/api", tags=["Host Monitoring"]) |
| 586 | +app.include_router(compliance_router, prefix="/api", tags=["Compliance"]) |
| 587 | +app.include_router(rules_router, prefix="/api", tags=["Rules"]) |
| 588 | +app.include_router(admin_router, prefix="/api", tags=["Administration"]) |
| 589 | +app.include_router(content_pkg_router, prefix="/api", tags=["Content"]) |
| 590 | +app.include_router(host_groups_router, prefix="/api", tags=["Host Groups"]) |
| 591 | +app.include_router(ssh_router, prefix="/api", tags=["SSH"]) |
| 592 | +app.include_router(integrations_router, prefix="/api", tags=["Integrations"]) |
| 593 | + |
| 594 | +# Remaining flat route modules (not yet packaged) |
| 595 | +app.include_router(baselines.router, tags=["Baseline Management"]) |
599 | 596 | app.include_router(adaptive_scheduler.router, prefix="/api", tags=["Adaptive Scheduler"]) |
600 | 597 | app.include_router(os_discovery.router, prefix="/api", tags=["OS Discovery"]) |
601 | 598 | app.include_router(system_settings_router, prefix="/api", tags=["System Settings"]) |
602 | | -app.include_router(users.router, prefix="/api", tags=["User Management"]) |
603 | | -app.include_router(audit.router, prefix="/api", tags=["Audit Logs"]) |
604 | | -# Host Groups - Modular package with CRUD and scanning endpoints |
605 | | -# The router already has prefix="/host-groups" defined in the package |
606 | | -app.include_router(host_groups_router, prefix="/api", tags=["Host Groups"]) |
607 | | -# scan_templates - REMOVED: Consolidated into routes/scans/templates.py (Phase 2) |
608 | | -# Endpoints now available at /api/scans/templates/* |
609 | | -# webhooks - REMOVED: Consolidated into routes/integrations/webhooks.py (Phase 4) |
610 | | -# Endpoints now available at /api/integrations/webhooks/* |
611 | | -app.include_router(credentials.router, prefix="/api", tags=["Credential Sharing"]) |
612 | | -# api_keys - REMOVED: Consolidated into auth_router (E1-S4) |
613 | | -app.include_router(remediation_callback.router, prefix="/api", tags=["AEGIS Integration"]) |
614 | 599 | app.include_router( |
615 | 600 | integration_metrics.router, |
616 | 601 | prefix="/api/integration/metrics", |
617 | 602 | tags=["Integration Metrics"], |
618 | 603 | ) |
619 | 604 | app.include_router(bulk_operations.router, prefix="/api/bulk", tags=["Bulk Operations"]) |
620 | | -# app.include_router(terminal.router, tags=["Terminal"]) # Terminal module not available |
621 | | -# Compliance - Modular package with all compliance-related endpoints (Phase 4 API Standardization) |
622 | | -# Includes: intelligence (semantic rules, framework data), owca (scoring), drift (detection) |
623 | | -# The router already has prefix="/compliance" defined in routes/compliance/__init__.py |
624 | | -app.include_router(compliance_router, prefix="/api", tags=["Compliance"]) |
625 | | -# rule_scanning - REMOVED: Consolidated into routes/scans/rules.py (Phase 2) |
626 | | -# Endpoints now available at /api/scans/rules/* |
627 | | -# SSH - Modular package with all SSH-related endpoints (Phase 4 API Standardization) |
628 | | -# Includes: settings (policy, known-hosts), debug (test-authentication, paramiko-log) |
629 | | -# The router already has prefix="/ssh" defined in routes/ssh/__init__.py |
630 | | -app.include_router(ssh_router, prefix="/api", tags=["SSH"]) |
631 | | -# ssh_settings - REMOVED: Consolidated into routes/ssh/settings.py (Phase 4) |
632 | | -# Endpoints now available at /api/ssh/settings/* |
633 | | -# ssh_debug - REMOVED: Consolidated into routes/ssh/debug.py (Phase 4) |
634 | | -# Endpoints now available at /api/ssh/debug/* |
635 | | -# host_network_discovery - REMOVED: Consolidated into routes/hosts/discovery.py (Phase 3) |
636 | | -# Endpoints now available at /api/hosts/{host_id}/discovery/network/* |
637 | | -# group_compliance.py removed - functionality consolidated into host_groups package |
638 | | -# See: routes/host_groups/scans.py for group scanning endpoints |
639 | | -# host_compliance_discovery - REMOVED: Consolidated into routes/hosts/discovery.py (Phase 3) |
640 | | -# Endpoints now available at /api/hosts/{host_id}/discovery/compliance/* |
641 | | -# host_discovery - REMOVED: Consolidated into routes/hosts/discovery.py (Phase 3) |
642 | | -# Endpoints now available at /api/hosts/{host_id}/discovery/basic/* |
643 | | -# host_security_discovery - REMOVED: Consolidated into routes/hosts/discovery.py (Phase 3) |
644 | | -# Endpoints now available at /api/hosts/{host_id}/discovery/security/* |
645 | | -# Integrations - Modular package with all integration-related endpoints (Phase 4 API Standardization) |
646 | | -# Includes: webhooks (CRUD, deliveries, test), plugins (import, execute, statistics) |
647 | | -# The router already has prefix="/integrations" defined in routes/integrations/__init__.py |
648 | | -app.include_router(integrations_router, prefix="/api", tags=["Integrations"]) |
649 | | -# plugin_management - REMOVED: Consolidated into routes/integrations/plugins.py (Phase 4) |
650 | | -# Endpoints now available at /api/integrations/plugins/* |
651 | | -# bulk_remediation_routes - REMOVED: Moved to SecureOps/AEGIS (ORSA subsystem) |
652 | | - |
653 | | -# QueryBuilder validation endpoints (temporary testing) - DISABLED: module not available |
654 | | -# app.include_router(test_querybuilder.router, prefix="/api", tags=["QueryBuilder Validation"]) |
655 | 605 |
|
656 | 606 | # Register security routes if available |
657 | 607 | if automated_fixes: |
|
0 commit comments