chore: initial project setup with backend, frontend, CI/CD, and documentation
Add complete NexaFabric project structure including: - FastAPI backend with SQLAlchemy models, JWT auth, RBAC, audit logging, and provider interfaces - React + TypeScript frontend with Vite, Tailwind CSS, TanStack Query, and Zustand - Docker Compose configuration for PostgreSQL, Redis, API, worker, frontend, and nginx - GitHub Actions and GitLab CI workflows for testing, linting, building, and security scanning - Environment
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from app.models.domain import Cluster, Policy
|
||||
from app.schemas.domain import FirewallPreview
|
||||
from app.services.policy_engine import PolicyEngine
|
||||
from app.services.providers.base import ProviderConnection
|
||||
from app.services.providers.registry import get_provider
|
||||
|
||||
|
||||
class FirewallOrchestrator:
|
||||
def __init__(self) -> None:
|
||||
self.policy_engine = PolicyEngine()
|
||||
|
||||
async def preview(self, cluster: Cluster, policy: Policy) -> FirewallPreview:
|
||||
compiled = self.policy_engine.compile(policy)
|
||||
provider = get_provider(cluster.provider)
|
||||
connection = ProviderConnection(
|
||||
api_url=cluster.api_url,
|
||||
token=cluster.token_ref or "",
|
||||
verify_tls=cluster.verify_tls,
|
||||
read_only=cluster.mode == "read_only",
|
||||
)
|
||||
provider_preview = await provider.preview_rules(connection, compiled["rules"])
|
||||
return FirewallPreview(
|
||||
policy_id=policy.id,
|
||||
dry_run=True,
|
||||
generated_rules=provider_preview["generated"],
|
||||
warnings=[*compiled["warnings"], *provider_preview.get("warnings", [])],
|
||||
conflicts=compiled["conflicts"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user