43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from typing import Protocol
|
|
|
|
from .adapters import (
|
|
Capability,
|
|
DiscoveredObject,
|
|
Endpoint,
|
|
NormalizedObject,
|
|
PlanAction,
|
|
)
|
|
from .models import DesiredRecord, ProviderCapabilities, ProviderRecord
|
|
|
|
|
|
class AdapterPlugin(Protocol):
|
|
name: str
|
|
endpoint: Endpoint
|
|
capabilities: frozenset[Capability]
|
|
|
|
def connect(self) -> None: ...
|
|
def discover(self, object_type: str) -> list[DiscoveredObject]: ...
|
|
def apply(self, action: PlanAction) -> str | None: ...
|
|
def verify(self, object: NormalizedObject) -> bool: ...
|
|
|
|
|
|
# Compatibility protocols for the existing DNS-only execution path. They remain
|
|
# in place until the current plugins and CLI are migrated to AdapterPlugin.
|
|
class SourcePlugin(Protocol):
|
|
name: str
|
|
|
|
def discover(self) -> list[DesiredRecord]: ...
|
|
|
|
|
|
class ProviderPlugin(Protocol):
|
|
name: str
|
|
capabilities: ProviderCapabilities
|
|
|
|
def connect(self) -> None: ...
|
|
def list_records(self) -> dict[str, ProviderRecord]: ...
|
|
def add_record(self, record: DesiredRecord) -> str | None: ...
|
|
def update_record(self, record: DesiredRecord) -> str | None: ...
|
|
def delete_record(self, hostname: str) -> str | None: ...
|
|
def verify_record(self, record: DesiredRecord) -> bool: ...
|
|
def capacity(self) -> tuple[int, int | None]: ...
|