interface RecordManagerInterface (View source)

Record creation, update and deletion.

Methods

bool
addRecord(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio)

Add a record

addRecordGetId(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio, int $disabled = 0, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])

Add a record and return its ID

editRecord(array $record, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])

Edit a record. An unchanged save is skipped entirely when dns.bump_serial_on_unchanged_save is off, so nothing bumps the serial then; the result then reports changed = false.

previewEdit(array $record)

Runs an edit's permission checks and validation, but not the duplicate check, and writes nothing. A save that moves several records first previews each one: only a record that passes and really moves goes into the vacated set of the real writes.

void
finalizeZone(int $zoneId, bool $bumpSerial = true, bool $rrsetWritten = true)

What every single write ends with: bump the serial (unless told not to) and rectify. Batch callers pass finalizeZone=false to the writes and call this once when they are done; one holding a transaction bumps the serial inside it and calls this with bumpSerial=false after the commit, since PowerDNS rectifies from committed rows. $rrsetWritten is false when nothing was sent to the backend (no-op save, zone comment), so the API backend bumps the serial itself.

deleteRecord(int|string $rid, bool $finalizeZone = true, bool $dryRun = false)

Delete a record and everything that pointed at it (template link, comments)

editZoneComment(int $zone_id, string $comment)

Edit the zone comment

Details

bool addRecord(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio)

Add a record

Parameters

int $zone_id

Zone ID

string $name

Name part of record

string $type

Type of record

string $content

Content of record

int $ttl

Time-To-Live of record

mixed $prio

Priority of record

Return Value

bool

true if successful; addRecordGetId() carries the reason for a refusal

RecordWriteResult addRecordGetId(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio, int $disabled = 0, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])

Add a record and return its ID

Parameters

int $zone_id

Zone ID

string $name

Name part of record

string $type

Type of record

string $content

Content of record

int $ttl

Time-To-Live of record

mixed $prio

Priority of record

int $disabled

Whether the record is created in disabled state (0 or 1)

bool $finalizeZone

Bump the serial and rectify; a batch caller does that once itself

array|null $comment

RRset comment ['content' => string, 'account' => string]; the API backend writes it in the same PATCH as the record, SQL ignores it

bool $dryRun

Run every check and stop before anything is written

array $vacated

Stored content by id of records the same write removes first (an RRset replace); they no longer conflict

Return Value

RecordWriteResult

The new record id, or the reason the write was refused

RecordWriteResult editRecord(array $record, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])

Edit a record. An unchanged save is skipped entirely when dns.bump_serial_on_unchanged_save is off, so nothing bumps the serial then; the result then reports changed = false.

Parameters

array $record

Record structure to update

bool $finalizeZone

Bump the serial and rectify; a batch caller does that once itself

array|null $comment

RRset comment ['content' => string, 'account' => string] to store with the record where the backend keeps them together

bool $dryRun

Run every check and stop before anything is written

array $vacated

Stored content by record id of the records the same save moves to another name, type or content, as previewEdit() reports it. A sibling still holding that content is not counted as a copy, so a swap or rotation passes; the API backend ignores it. The caller must run the writes in one transaction and roll back on any refusal.

Return Value

RecordWriteResult

RecordWriteResult previewEdit(array $record)

Runs an edit's permission checks and validation, but not the duplicate check, and writes nothing. A save that moves several records first previews each one: only a record that passes and really moves goes into the vacated set of the real writes.

Parameters

array $record

Record structure to update

Return Value

RecordWriteResult

On success, vacates holds the stored name, type and content the record leaves (null when it stays) and key its validated ones

void finalizeZone(int $zoneId, bool $bumpSerial = true, bool $rrsetWritten = true)

What every single write ends with: bump the serial (unless told not to) and rectify. Batch callers pass finalizeZone=false to the writes and call this once when they are done; one holding a transaction bumps the serial inside it and calls this with bumpSerial=false after the commit, since PowerDNS rectifies from committed rows. $rrsetWritten is false when nothing was sent to the backend (no-op save, zone comment), so the API backend bumps the serial itself.

Parameters

int $zoneId
bool $bumpSerial
bool $rrsetWritten

Return Value

void

RecordWriteResult deleteRecord(int|string $rid, bool $finalizeZone = true, bool $dryRun = false)

Delete a record and everything that pointed at it (template link, comments)

Parameters

int|string $rid

Record ID

bool $finalizeZone

Bump the serial and rectify; a batch caller does that once itself

bool $dryRun

Run every check and stop before anything is written

Return Value

RecordWriteResult

RecordWriteResult editZoneComment(int $zone_id, string $comment)

Edit the zone comment

Parameters

int $zone_id

Zone ID

string $comment

Comment to set

Return Value

RecordWriteResult

Success, or the reason the write was refused