private void deleteAllDomains() throws TimeoutException { System.out.format("Delete Domains%n"); Set<Domain> allDomains = dnsApi.getDomainApi().list().concat().toSet(); Iterable<Domain> topLevelDomains = Iterables.filter(allDomains, IS_DOMAIN); Iterable<Integer> topLevelDomainIds = Iterables.transform(topLevelDomains, GET_DOMAIN_ID); awaitComplete(dnsApi, dnsApi.getDomainApi().delete(topLevelDomainIds, true)); System.out.format( " Deleted %s top level domains and all subdomains%n", Iterables.size(topLevelDomainIds)); }
private void updateDomains() throws TimeoutException { System.out.format("Update Domains%n"); Iterable<Domain> domains = dnsApi.getDomainApi().list().concat(); Iterable<Integer> domainIds = Iterables.transform(domains, GET_DOMAIN_ID); awaitComplete(dnsApi, dnsApi.getDomainApi().updateEmail(domainIds, "jclouder@" + NAME)); domains = dnsApi.getDomainApi().list().concat(); for (Domain domain : domains) { System.out.format(" %s%n", domain); } }
private Domain getDomain() { for (Domain domain : dnsApi.getDomainApi().list().concat()) { if (domain.getName().startsWith(ALT_NAME)) { return domain; } } throw new RuntimeException(ALT_NAME + " not found. Run CreateDomains example first."); }
private void updateDomain() throws TimeoutException { System.out.format("Update Domain%n"); int domainId = 0; Iterable<Domain> domains = dnsApi.getDomainApi().list().concat(); for (Domain domain : domains) { if (domain.getName().equals(ALT_NAME)) { domainId = domain.getId(); } } UpdateDomain updateDomain = UpdateDomain.builder() .email("jcloudie@" + ALT_NAME) .ttl(600001) .comment("Hello Domain Update") .build(); awaitComplete(dnsApi, dnsApi.getDomainApi().update(domainId, updateDomain)); System.out.format(" %s%n", dnsApi.getDomainApi().get(domainId)); }