DNS integrations

Create zone

createZone()

This should create the DNS zone at the given integration.

Parameters

Type

Name

Description

IpamRdnsHost

$ipamRdnsHost

The DNS host

string

$zoneName

The name of the zone. Usually needed for zone creation.

array

$nameservers

The nameservers which may (!) be required for zone creation

None.

Response

Instance of ZoneDetails() class.

Type

Name

Description

mixed

id

The ID of the zone. Sometimes an ID, UUID or string.

string

$name

The name of the zone in the integration.

mixed

$serial

The serial ID of the integration. Not used anywhere, just informational.

array or null

$nameservers

The array of nameservers which are required by the domain to point to the dns zone.

array

$records

Should be empty.

Example Code

public function createZone(IpamRdnsHost $ipamRdnsHost, string $zoneName, ?array $nameservers = null): ZoneDetails {
	try {
		$response = $this->_sendRequest($ipamRdnsHost, "zones", "POST", [
			"name" => $this->getZoneName($zoneName, $ipamRdnsHost, false),
			"type" => "full",
		]);

		return new ZoneDetails(
			$response->result->id,
			$response->result->name,
			null,
			$response->result->name_servers
		);
	} catch (ClientException $e) {
		throw new Exception($this->_getErrorMessage($e));
	}
}

Testing

-

Was this helpful?