class ZoneMetadataService (View source)

The zone metadata rules the editor and the API share: what a kind accepts, who may change it, what the active backend can store, and how a change is persisted and logged. Callers parse their input and word the refusals.

Constants

SUPPORT_SUPPORTED

SUPPORT_UNSUPPORTED_KNOWN

SUPPORT_UNKNOWN

MAX_KIND_LENGTH

Methods

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationInterface $config, PermissionService $permissions, AuditService $audit, RecordChangeLogger $changeLogger, PowerdnsApiClient|null $apiClient = null, LoggerInterface|null $logger = null)

No description

bool
isApiBackend()

Whether metadata lives in PowerDNS behind its API rather than in the database

static string
normalizeKind(string $kind)

No description

static array
normalizeRows(array $rows)

Trim the submitted rows and drop the ones with no kind or no content, so an add/remove-row editor never produces an empty write.

static array
changedKinds(array $submitted, array $current)

The kinds whose value set differs between two snapshots.

string|null
writeRejection(string $kind)

Why the active backend cannot store this kind (a MetadataDefinitions::REJECT_* code), or null.

string
kindSupport(array $definition, PdnsCapabilities $capabilities)

Whether the connected server is known to take a version-gated kind: SUPPORT_* constants. The SQL backend stores anything.

array
load(int $zoneId, string $zoneName)

The zone's metadata rows, sorted by kind. In API mode the zone-object properties that stand in for metadata kinds are folded in.

replaceAll(int $zoneId, string $zoneName, array $rows, int $actingUserId)

Replace the zone's whole metadata set, as the editor does. Every row is checked first, then only the kinds that actually change are gated, so a value set out of band does not lock the editor out of the rest.

replaceKind(int $zoneId, string $zoneName, string $kind, array $values, int $actingUserId)

Set every value of one kind, as the API does.

deleteKind(int $zoneId, string $zoneName, string $kind, int $actingUserId)

Remove every value of one kind, as the API does.

Details

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationInterface $config, PermissionService $permissions, AuditService $audit, RecordChangeLogger $changeLogger, PowerdnsApiClient|null $apiClient = null, LoggerInterface|null $logger = null)

No description

Parameters

ZoneRepositoryInterface $zoneRepository
ConfigurationInterface $config
PermissionService $permissions
AuditService $audit
RecordChangeLogger $changeLogger
PowerdnsApiClient|null $apiClient
LoggerInterface|null $logger

bool isApiBackend()

Whether metadata lives in PowerDNS behind its API rather than in the database

Return Value

bool

static string normalizeKind(string $kind)

No description

Parameters

string $kind

Return Value

string

static array normalizeRows(array $rows)

Trim the submitted rows and drop the ones with no kind or no content, so an add/remove-row editor never produces an empty write.

Parameters

array $rows

Return Value

array

static array changedKinds(array $submitted, array $current)

The kinds whose value set differs between two snapshots.

Parameters

array $submitted
array $current

Return Value

array

string|null writeRejection(string $kind)

Why the active backend cannot store this kind (a MetadataDefinitions::REJECT_* code), or null.

Parameters

string $kind

Return Value

string|null

string kindSupport(array $definition, PdnsCapabilities $capabilities)

Whether the connected server is known to take a version-gated kind: SUPPORT_* constants. The SQL backend stores anything.

Parameters

array $definition

A MetadataDefinitions entry

PdnsCapabilities $capabilities

Return Value

string

array load(int $zoneId, string $zoneName)

The zone's metadata rows, sorted by kind. In API mode the zone-object properties that stand in for metadata kinds are folded in.

Parameters

int $zoneId
string $zoneName

Return Value

array

ZoneMetadataResult replaceAll(int $zoneId, string $zoneName, array $rows, int $actingUserId)

Replace the zone's whole metadata set, as the editor does. Every row is checked first, then only the kinds that actually change are gated, so a value set out of band does not lock the editor out of the rest.

Parameters

int $zoneId
string $zoneName
array $rows

Already normalised

int $actingUserId

Return Value

ZoneMetadataResult

ZoneMetadataResult replaceKind(int $zoneId, string $zoneName, string $kind, array $values, int $actingUserId)

Set every value of one kind, as the API does.

Parameters

int $zoneId
string $zoneName
string $kind
array $values
int $actingUserId

Return Value

ZoneMetadataResult

ZoneMetadataResult deleteKind(int $zoneId, string $zoneName, string $kind, int $actingUserId)

Remove every value of one kind, as the API does.

Parameters

int $zoneId
string $zoneName
string $kind
int $actingUserId

Return Value

ZoneMetadataResult