from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any @dataclass(frozen=True) class ProviderConnection: api_url: str token: str verify_tls: bool = True read_only: bool = True class HypervisorProvider(ABC): @abstractmethod async def test_connection(self, connection: ProviderConnection) -> dict[str, Any]: raise NotImplementedError class InventoryProvider(ABC): @abstractmethod async def sync_inventory(self, connection: ProviderConnection) -> dict[str, list[dict[str, Any]]]: raise NotImplementedError class NetworkProvider(ABC): @abstractmethod async def list_networks(self, connection: ProviderConnection) -> list[dict[str, Any]]: raise NotImplementedError class FirewallProvider(ABC): @abstractmethod async def preview_rules(self, connection: ProviderConnection, rules: list[dict[str, Any]]) -> dict[str, Any]: raise NotImplementedError @abstractmethod async def apply_rules(self, connection: ProviderConnection, rules: list[dict[str, Any]]) -> dict[str, Any]: raise NotImplementedError class Provider( HypervisorProvider, InventoryProvider, NetworkProvider, FirewallProvider, ABC, ): name: str