final class DnsBackendProviderFactory (View source)

Factory for creating DNS backend provider instances.

Selects between SQL (direct database) and API (PowerDNS REST API) backends based on configuration. Follows the same pattern as DnssecProviderFactory.

Methods

create(PDO $db, ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null)

Create a DNS backend provider instance.

static bool
isApiBackend(ConfigurationInterface $config)

Check whether the admin configured API mode.

static PowerdnsApiClient|null
createApiClient(ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null, int|null $timeout = null)

No description

static PowerdnsApiClient|null
apiClientFrom(DnsBackendProviderInterface|null $provider)

Reach the client a provider already holds, so callers reuse its per-request read caches instead of constructing a second client against the same server.

Details

static DnsBackendProviderInterface create(PDO $db, ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null)

Create a DNS backend provider instance.

Parameters

PDO $db

Database connection

ConfigurationInterface $config

Configuration object

SessionInterface $session

The request's session, which holds the API outage banner state

LoggerInterface|null $logger

PSR-3 logger

Return Value

DnsBackendProviderInterface

static bool isApiBackend(ConfigurationInterface $config)

Check whether the admin configured API mode.

Mirrors the create() intent: returns true when dns.backend is 'api'. Misconfiguration (missing url/key) is surfaced by create() as an exception and by ConfigValidator as an error, not masked here.

Parameters

ConfigurationInterface $config

Return Value

bool

static PowerdnsApiClient|null createApiClient(ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null, int|null $timeout = null)

No description

Parameters

ConfigurationInterface $config
SessionInterface $session
LoggerInterface|null $logger
int|null $timeout

Return Value

PowerdnsApiClient|null

static PowerdnsApiClient|null apiClientFrom(DnsBackendProviderInterface|null $provider)

Reach the client a provider already holds, so callers reuse its per-request read caches instead of constructing a second client against the same server.

Parameters

DnsBackendProviderInterface|null $provider

Return Value

PowerdnsApiClient|null