final DefaultSSLContextFactoryConfig sslConfig = new ExampleDefaultSSLContextFactoryConfig();
final DefaultTransactionLogHandlerConfig logConfig = new ExampleDefaultTransactionLogHandlerConfig();
//Instantiate client instance from DNSAPIClientFactory
final DNSAPIClientFactory dnsapiClientFactory = new DNSAPIClientFactory();
DNSAPIClient client = null;
try {
client = dnsapiClientFactory.createInstanceFromDefaultProviders(config, sslConfig, logConfig);
} catch (final Exception e) {
e.printStackTrace();
System.exit(1);
}
//Create command
ZoneCreateCommand command = null;
try {
command = new ZoneCreateCommand.Builder()
.withName("myzone.com")
.withDnssecSigned(Boolean.FALSE)
.withBrandedNameServers(Boolean.TRUE)
.withGroup("mygroup")
.withNameServerSetId("<my-nss-id>")
.withPlanId("<my-plan-id>")
.withResourceRecords(
Sets.newHashSet(
(Record) new ARecord(Name.fromString("myzone.com."), DClass.IN, 3600,
InetAddress.getByName("1.2.3.4"))))
.build();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
//Send command to server and receive response
try {
Response<ZoneCreateResponse> response = client.process(command);
System.out.println("== Successful response ==");
System.out.println("== Server transaction id: " + response.getServerTransactionId());
System.out.println("== Client transaction id: " + response.getClientTransactionId());
System.out.println("== Processing time: " + response.getTransactionProcessingTime() + "ms");