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 deleteRecords(Domain domain) throws TimeoutException { System.out.format("Delete Records%n"); Set<RecordDetail> recordDetails = dnsApi.getRecordApiForDomain(domain.getId()).listByType("TXT").concat().toSet(); Iterable<String> recordIds = Iterables.transform(recordDetails, GET_RECORD_ID); awaitComplete(dnsApi, dnsApi.getRecordApiForDomain(domain.getId()).delete(recordIds)); System.out.format(" Deleted %s records", Iterables.size(recordDetails)); }
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)); }
public String apply(Domain domain) { return domain.getName(); }