September 26, 2011

Classes
Tags blog

cPanel Provides SoftLayer DNS Clustering Support

<p>Since the release of <a href=http://www.cpanel.net/2011/08/cpanel-expands-its-dns-cluster-functionality-with-softlay

Since the release of cPanel & WHM 11.30, users of the control panel have had the ability to incorporate the native DNS Cluster Management with DNS services offered by SoftLayer and UK2Group (under the brand VPS.NET). While the benefits utilizing a geographically diverse and scalable DNS architecture merit a post dedicated to them, it is the implementation of this feature which has caught my attention.
Simply providing a SLAPI user with DNS management permissions and its associated SLAPI key allows cPanel to seamlessly integrate interaction with the SoftLayer DNS infrastructure. Once the straightforward setup is complete, any zones currently on SoftLayer's DNS servers will be available for administration.

All of this was accomplished with the same tools and APIs exposed to our entire customer base; no special endpoints or services were needed to utilize the API in this manner. Below is one piece of the DNS management puzzle: an example of how to create an A record on an existing zone using the SoftLayer PHP SOAP client.


// Set our API User/Key information and the ID of our domain
$apiUsername = 'SET ME';
$apiKey = 'SET ME';
$domainId = 'SET ME';
 
// Create a SLAPI client for the SoftLayer_Dns_Domain_ResourceRecord service
$client = SoftLayer_SoapClient::getClient('SoftLayer_Dns_Domain_ResourceRecord', $domainId, $apiUsername, $apiKey);
 
// SoftLayer_Dns_Domain_ResourceRecord::createObject expects an object with specific properties defined
$newRecord = new stdObject();
$newRecord->data => '127.0.0.1';
$newRecord->host => 'hostname';
$newRecord->domainId => $domainId;
$newRecord->ttl => 990;
$newRecord->type => 'a';
 
try {
                $result = $client->createObject($newRecord);
                print_r($result);
} catch (Exception $e) {
                die("Record creation failed: $e->getMessage()");
}

Feedback?

If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue