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,35 @@
|
||||
from typing import Any
|
||||
|
||||
from app.services.providers.base import Provider, ProviderConnection
|
||||
|
||||
|
||||
class DemoProvider(Provider):
|
||||
name = "demo"
|
||||
|
||||
async def test_connection(self, connection: ProviderConnection) -> dict[str, Any]:
|
||||
return {"version": "demo", "api_url": connection.api_url, "mode": "offline"}
|
||||
|
||||
async def sync_inventory(self, connection: ProviderConnection) -> dict[str, list[dict[str, Any]]]:
|
||||
return {
|
||||
"nodes": [
|
||||
{"node": "demo-pve-01", "status": "online", "maxcpu": 16, "maxmem": 68719476736},
|
||||
{"node": "demo-pve-02", "status": "online", "maxcpu": 16, "maxmem": 68719476736},
|
||||
],
|
||||
"workloads": [
|
||||
{"vmid": 201, "name": "demo-web-01", "type": "qemu", "status": "running", "node": "demo-pve-01"},
|
||||
{"vmid": 202, "name": "demo-db-01", "type": "qemu", "status": "running", "node": "demo-pve-02"},
|
||||
],
|
||||
"networks": [
|
||||
{"name": "vmbr0", "type": "bridge", "vlan": 10},
|
||||
{"name": "vnet-prod", "type": "vnet", "vlan": 120},
|
||||
],
|
||||
}
|
||||
|
||||
async def list_networks(self, connection: ProviderConnection) -> list[dict[str, Any]]:
|
||||
return (await self.sync_inventory(connection))["networks"]
|
||||
|
||||
async def preview_rules(self, connection: ProviderConnection, rules: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
return {"provider": self.name, "generated": rules, "warnings": ["Demo provider preview."]}
|
||||
|
||||
async def apply_rules(self, connection: ProviderConnection, rules: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
return {"applied": False, "reason": "Demo provider never applies firewall changes.", "rules": rules}
|
||||
Reference in New Issue
Block a user