예제 #1
0
  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));
  }
예제 #2
0
  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));
  }
예제 #3
0
  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);
    }
  }
예제 #4
0
  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.");
  }
예제 #5
0
  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));
  }
 @Override
 protected Function<Object, IterableWithMarker<RecordDetail>> markerToNextForArg0(
     Optional<Object> arg0) {
   int domainId = Integer.class.cast(arg0.get());
   return new ListRecordsAtMarker(api.getRecordApiForDomain(domainId));
 }