use of org.jclouds.rackspace.clouddns.v1.domain.CreateSubdomain in project legacy-jclouds-examples by jclouds.
the class CreateDomains method createDomains.
private void createDomains() throws TimeoutException {
System.out.println("Create Domains");
Record createMXRecord = Record.builder().name(NAME).type("MX").data("mail." + NAME).priority(11235).build();
Record createARecord = Record.builder().name(NAME).type("A").data("10.0.0.1").build();
Set<Record> createRecords = ImmutableSet.of(createMXRecord, createARecord);
CreateSubdomain createSubdomain1 = CreateSubdomain.builder().name("dev." + NAME).email("jclouds@" + NAME).comment("Hello dev subdomain").build();
CreateSubdomain createSubdomain2 = CreateSubdomain.builder().name("test." + NAME).email("jclouds@" + NAME).comment("Hello test subdomain").build();
Set<CreateSubdomain> createSubdomains = ImmutableSet.of(createSubdomain1, createSubdomain2);
CreateDomain createDomain1 = CreateDomain.builder().name(NAME).email("jclouds@" + NAME).ttl(600000).comment("Hello Domain").subdomains(createSubdomains).records(createRecords).build();
CreateDomain createDomain2 = CreateDomain.builder().name(ALT_NAME).email("jclouds@" + ALT_NAME).ttl(600000).comment("Hello Domain").build();
Set<CreateDomain> createDomains = ImmutableSet.of(createDomain1, createDomain2);
Map<String, Domain> domains = DomainFunctions.toDomainMap(awaitComplete(dnsApi, dnsApi.getDomainApi().create(createDomains)));
System.out.println(" " + domains.get(NAME));
System.out.println(" " + domains.get(ALT_NAME));
}
Aggregations