class MetadataDefinitions (View source)

Built-in PowerDNS domain metadata kind definitions.

Shared between the web metadata editor and the API v2 metadata endpoint.

Constants

DEFINITIONS

OPTION_CONFIG_KEYS

Config keys (dns group) that narrow the offered values per kind.

SERIAL_POLICY_PROPERTY_KINDS

The kinds the backend providers may write as a serial policy; a narrower allowlist than ZONE_PROPERTY_KINDS on purpose.

ZONE_PROPERTY_KINDS

Kinds PowerDNS rejects on the /metadata endpoint and accepts as a field on the zone object instead (kind => property name).

BOOLEAN_ZONE_PROPERTY_KINDS

Zone properties PowerDNS types as JSON booleans rather than strings.

SERVER_MANAGED_KINDS

Kinds PowerDNS maintains itself. They are shown read-only and never written back; PUTting them to /metadata is rejected with 422.

CUSTOM_KIND_API_PREFIX

PowerDNS only accepts unknown metadata kinds when they carry this prefix.

REJECT_SERVER_MANAGED

REJECT_NO_API_ROUTE

REJECT_CUSTOM_PREFIX

SOA_EDIT_API_OFF

Zone-creation choice that explicitly disables SOA-EDIT-API (stored as an empty value, distinct from leaving the server default in place).

Methods

static array|null
get(string $kind)

Get the definition for a specific metadata kind.

static bool
isApiWritable(string $kind)

Check if a metadata kind is writable via the API.

static bool
isOperatorOnly(string $kind)

Check whether a metadata kind may only be set by a superuser.

static string|null
requiredCompanionKind(string $kind, string $value)

Check whether a submitted value needs a companion kind to have any effect. PowerDNS ignores NSEC3NARROW unless the zone also has NSEC3PARAM.

static bool
isServerManaged(string $kind)

Check whether PowerDNS maintains this kind itself.

static string|null
writeRejection(string $kind, bool $apiBackend)

Classify why the active backend cannot store a kind, or null when it can.

static bool|string
toZonePropertyValue(string $kind, string $value)

Convert a stored metadata value to the type the zone object expects.

static string
fromZonePropertyValue(string $kind, mixed $value)

Convert a zone object value back to its metadata row representation.

static array
rowsFromApiPayload(array $apiMetadata, array|null $zoneData)

Build metadata rows from a PowerDNS /metadata listing plus the zone object. Zone-property kinds appear in both, and the zone object wins.

static array|null
getOptions(string $kind)

Get the allowed values for a metadata kind, or null when any value is accepted.

static array|null
getOfferedOptions(string $kind, ConfigurationInterface $config)

Get the values offered by the UI for a kind, narrowed by the matching dns.* config list when set. An empty result means the kind's options are all disabled by configuration; null means free-form input.

static array|null
getAllowedValues(string $kind, ConfigurationInterface $config)

The values an editor may store for a kind, or null when any value goes.

static array
getSoaEditApiChoices(ConfigurationInterface $config)

SOA-EDIT-API choices for zone creation: the metadata values plus 'OFF', narrowed by the dns.soa_edit_api_options config list when set.

static bool
isMultiValue(string $kind)

Check if a metadata kind accepts multiple values.

Details

static array|null get(string $kind)

Get the definition for a specific metadata kind.

Parameters

string $kind

Return Value

array|null

static bool isApiWritable(string $kind)

Check if a metadata kind is writable via the API.

Parameters

string $kind

Return Value

bool

static bool isOperatorOnly(string $kind)

Check whether a metadata kind may only be set by a superuser.

These kinds make PowerDNS evaluate operator-supplied Lua, so a zone-level editor setting them would reach past the zone they administer.

Parameters

string $kind

Return Value

bool

static string|null requiredCompanionKind(string $kind, string $value)

Check whether a submitted value needs a companion kind to have any effect. PowerDNS ignores NSEC3NARROW unless the zone also has NSEC3PARAM.

Parameters

string $kind
string $value

Return Value

string|null

static bool isServerManaged(string $kind)

Check whether PowerDNS maintains this kind itself.

Parameters

string $kind

Return Value

bool

static string|null writeRejection(string $kind, bool $apiBackend)

Classify why the active backend cannot store a kind, or null when it can.

Callers turn the reason into their own message and status; keeping the rule (and its ordering) here is what keeps the web editor and API v2 answering the same question the same way.

Parameters

string $kind
bool $apiBackend

Return Value

string|null

static bool|string toZonePropertyValue(string $kind, string $value)

Convert a stored metadata value to the type the zone object expects.

Parameters

string $kind
string $value

Return Value

bool|string

static string fromZonePropertyValue(string $kind, mixed $value)

Convert a zone object value back to its metadata row representation.

Parameters

string $kind
mixed $value

Return Value

string

static array rowsFromApiPayload(array $apiMetadata, array|null $zoneData)

Build metadata rows from a PowerDNS /metadata listing plus the zone object. Zone-property kinds appear in both, and the zone object wins.

Parameters

array $apiMetadata
array|null $zoneData

Return Value

array

static array|null getOptions(string $kind)

Get the allowed values for a metadata kind, or null when any value is accepted.

Parameters

string $kind

Return Value

array|null

static array|null getOfferedOptions(string $kind, ConfigurationInterface $config)

Get the values offered by the UI for a kind, narrowed by the matching dns.* config list when set. An empty result means the kind's options are all disabled by configuration; null means free-form input.

Parameters

string $kind
ConfigurationInterface $config

Return Value

array|null

static array|null getAllowedValues(string $kind, ConfigurationInterface $config)

The values an editor may store for a kind, or null when any value goes.

A kind whose options config narrows to nothing is hidden from the UI but still accepts every PowerDNS value, so rows stored before the restriction keep saving.

Parameters

string $kind
ConfigurationInterface $config

Return Value

array|null

static array getSoaEditApiChoices(ConfigurationInterface $config)

SOA-EDIT-API choices for zone creation: the metadata values plus 'OFF', narrowed by the dns.soa_edit_api_options config list when set.

Parameters

ConfigurationInterface $config

Return Value

array

static bool isMultiValue(string $kind)

Check if a metadata kind accepts multiple values.

Parameters

string $kind

Return Value

bool