WWW::eNom::Role::Command::Domain::PrivateNameServer - Domain Private Nameserver Operations
# Create a new Private Nameserver my $domain = WWW::eNom::Domain->new( ... ); my $private_nameserver = WWW::eNom::PrivateNameServer->new( name => 'ns1.' . $domain->name, ip => '4.2.2.1', ); my $updated_domain = $api->create_private_nameserver( domain_name => $domain->name, private_nameserver => $private_nameserver, ); # Update the IP of an existing Private Nameserver my $updated_private_nameserver = $api->update_private_nameserver_ip( name => $private_nameserver->name, old_ip => $private_nameserver->ip, new_ip => '8.8.8.8', ); # Retrieve existing Private Nameserver my $private_nameserver = $api->retrieve_private_nameserver_by_name( 'ns1.' . $domain->name ); # Delete Private Nameserver $api->delete_private_nameserver( domain_name => $domain->name, private_nameserver_name => $private_nameserver->name );
Needed in order to keep private nameservers synced with the authoritative ones.
Implemented private name server operations with eNom's API.
eNom's API does not offer a method to retrieve a list of registered nameservers. As a workaround, and so that we do not lose track of Private Nameservers, private nameservers are always added to the authoritative nameservers. In the same vein, if a private nameserver is removed then it is also removed from the authoritative nameservers.
my $domain = WWW::eNom::Domain->new( ... ); my $private_nameserver = WWW::eNom::PrivateNameServer->new( name => 'ns1.' . $domain->name, ip => '4.2.2.1', ); my $updated_domain = $api->create_private_nameserver( domain_name => $domain->name, private_nameserver => $private_nameserver, );
Abstraction of the RegisterNameServer eNom API call. Given a FQDN and a WWW::eNom::PrivateNameServer (or a HashRef that can be coerced into one), creates the private nameserver and adds it to the list of authoritative nameservers for the domain. Keep in mind, the name of private nameserver must be a root of the domain. So if the domain is your-domain.com, you can have ns1.your-domain.com as a private nameserver but you can not have ns1.your-other-domain.com as a private nameserver.
This method will croak if the domain is owned by someone else, if it's not registered, or if the private nameserver name or ip are invalid.
my $existing_private_nameserver = $api->retrieve_private_nameserver_by_name( ... ); my $updated_private_nameserver = $api->update_private_nameserver_ip( name => $existing_private_nameserver->name, old_ip => $existing_private_nameserver->ip, new_ip => '8.8.8.8', );
Abstraction of the UpdateNameServer eNom API call. Given a FQDN of an existing WWW::eNom::PrivateNameServer as well as the old_ip, updates that private nameserver to use the new_ip. Returned is the updated WWW::eNom::PrivateNameServer.
This method will croak if the domain is owned by someone else, if it's not registered, if private nameserver does not exist, or if the provided old_ip is incorrect.
my $private_nameserver = $api->retrieve_private_nameserver_by_name( 'ns1.' . $domain->name );
Abstraction of the CheckNSStatus eNom API Call. Given a FQDN that is the hostname of a private nameserver, returns an instance of WWW::eNom::PrivateNameServer that describes the registered nameserver.
This method will croak if the domain is owned by someone else, if it's not registered, or if private nameserver does not exist.
NOTE At some point in eNom's past it was possible to associate multiple ip addresses with a private nameservers. This is no longer possible but very old private nameservers when retrieved from the API will show both IPs. As a workaround, only the first IP address will be populated into the instance of WWW::eNom::PrivateNameServer returned.
$api->delete_private_nameserver( domain_name => $domain->name, private_nameserver_name => 'ns1.' . $domain->name, );
Abstraction of the DeleteNameServer eNom API Call. Given a FQDN and a the FQDN of the private nameserver you wish to delete, deletes the private nameserver and removes it from the authoritative nameservers.
If deleting this private nameserver would leave the domain with no authoritative nameservers this method will croak with 'Blocked deletion - Deleting this would leave this domain with no nameservers!' This is a safety that is part of the workaround needed in order to implement private nameservers.
This method will also croak if the domain is owned by someone else, if it's not registered, or if private nameserver does not exist.
To install WWW::eNom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::eNom
CPAN shell
perl -MCPAN -e shell install WWW::eNom
For more information on module installation, please visit the detailed CPAN module installation guide.