class ZoneManagementService (View source)

Creates zones for the API with the same checks the web form applies. Failures come back as

message is the API wording, the code lets the web forms word it themselves.

Constants

ERR_NO_OWNER

ERR_INVALID_NAME

ERR_EXISTS

ERR_OVERLAP

ERR_INVALID_TYPE

ERR_MASTER_REQUIRED

ERR_INVALID_MASTER

ERR_INVALID_SOA_EDIT_API

ERR_TEMPLATE_NOT_FOUND

ERR_TEMPLATE_AMBIGUOUS

ERR_TEMPLATE_FORBIDDEN

ERR_ZONE_WRITE

ERR_NOT_FOUND

ERR_READ_ONLY

ERR_ZONE_LIMIT

Methods

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationInterface $config, RepositoryFactoryInterface $repositoryFactory, PermissionService $permissions, RecordChangeWriterInterface $changeLogger, DomainManagerInterface|Closure $domainManager, ZoneTemplateService $zoneTemplates, LoggerInterface|null $logger = null, PdnsCapabilities|Closure|null $capabilities = null, ZoneSigningService|null $signing = null, DomainRepositoryInterface|null $domainRepository = null, ZoneCacheFlusherInterface|null $zoneCacheFlusher = null, ZoneOwnershipLimit|null $ownershipLimit = null, ZoneChangeRequestRepositoryInterface|null $changeRequests = null)

No description

array
resolveZoneTemplate(string $zoneTemplate, int|null $actingUserId)

Resolves a template given by name or numeric id and checks the acting user may apply it (own, global, or ueberuser - the same rule the web UI enforces).

array
createZone(string $domain, string $type, int|null $owner, string $slaveMaster = '', string $zoneTemplate = 'none', bool $enableDnssec = false, array $groupIds = [], int|null $actingUserId = null, string|null $soaEditApi = null)

Create a new DNS zone

array
updateZone(int $zoneId, array $updates)

Update a zone

array
deleteZone(int $zoneId)

Delete a zone

array
applyTemplate(int $zoneId, string $template, int $actingUserId)

Applies a zone template (or "none" to unlink) to an existing zone, replacing the template-managed records. The caller must be allowed to use the template.

Details

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationInterface $config, RepositoryFactoryInterface $repositoryFactory, PermissionService $permissions, RecordChangeWriterInterface $changeLogger, DomainManagerInterface|Closure $domainManager, ZoneTemplateService $zoneTemplates, LoggerInterface|null $logger = null, PdnsCapabilities|Closure|null $capabilities = null, ZoneSigningService|null $signing = null, DomainRepositoryInterface|null $domainRepository = null, ZoneCacheFlusherInterface|null $zoneCacheFlusher = null, ZoneOwnershipLimit|null $ownershipLimit = null, ZoneChangeRequestRepositoryInterface|null $changeRequests = null)

No description

Parameters

ZoneRepositoryInterface $zoneRepository
ConfigurationInterface $config
RepositoryFactoryInterface $repositoryFactory

Builds the record and domain repositories

PermissionService $permissions

Shares the request's permission cache

RecordChangeWriterInterface $changeLogger

Receives the zone create and delete snapshots

DomainManagerInterface|Closure $domainManager

Writes the zone, or a closure returning the writer, resolved on first use

ZoneTemplateService $zoneTemplates

Resolves and authorises the template a zone is created from

LoggerInterface|null $logger
PdnsCapabilities|Closure|null $capabilities

What the connected server supports, or a closure returning it; null admits only the basic kinds

ZoneSigningService|null $signing

Needed for enable_dnssec; without it a create is never signed

DomainRepositoryInterface|null $domainRepository

Zone lookups; built from the repository factory when omitted

ZoneCacheFlusherInterface|null $zoneCacheFlusher
ZoneOwnershipLimit|null $ownershipLimit

Zone limits of the new owners; null enforces none

ZoneChangeRequestRepositoryInterface|null $changeRequests

array resolveZoneTemplate(string $zoneTemplate, int|null $actingUserId)

Resolves a template given by name or numeric id and checks the acting user may apply it (own, global, or ueberuser - the same rule the web UI enforces).

Parameters

string $zoneTemplate
int|null $actingUserId

Return Value

array

array createZone(string $domain, string $type, int|null $owner, string $slaveMaster = '', string $zoneTemplate = 'none', bool $enableDnssec = false, array $groupIds = [], int|null $actingUserId = null, string|null $soaEditApi = null)

Create a new DNS zone

Parameters

string $domain

Domain name

string $type

Zone type (MASTER, SLAVE, NATIVE)

int|null $owner

Owner user ID, or null when only group ownership is set

string $slaveMaster

Master IP for slave zones

string $zoneTemplate

Zone template to use

bool $enableDnssec

Whether to enable DNSSEC

array $groupIds

Optional list of group IDs to assign as owners

int|null $actingUserId

User performing the creation, used for the overlap check

string|null $soaEditApi

Per-zone SOA-EDIT-API choice; null applies the dns.soa_edit_api default

Return Value

array

array updateZone(int $zoneId, array $updates)

Update a zone

Parameters

int $zoneId

Zone ID

array $updates

Array of field => value pairs to update

Return Value

array

Result array with success status and message

array deleteZone(int $zoneId)

Delete a zone

Parameters

int $zoneId

Zone ID

Return Value

array

Result array with success status and message

array applyTemplate(int $zoneId, string $template, int $actingUserId)

Applies a zone template (or "none" to unlink) to an existing zone, replacing the template-managed records. The caller must be allowed to use the template.

Parameters

int $zoneId
string $template
int $actingUserId

Return Value

array