Package com.amazonaws.services.route53.model

Examples of com.amazonaws.services.route53.model.HostedZone


  }

  public void ensureCNAME(final String source, final String target)
      throws Exception {

    final HostedZone zone = findZone(source);

    Util.assertNotNull(zone, "missing zone for " + source);

    final String zoneId = zone.getId();

    final boolean isPresent;
    final ResourceRecordSet recordOld;
    {
      final ResourceRecordSet recordFound = findRecord(zoneId, source);
      if (recordFound == null) {
        isPresent = false;
        recordOld = makeRecordCNAME(source, target);
      } else {
        isPresent = true;
        recordOld = recordFound;
      }
    }

    final ResourceRecordSet recordNew = makeRecordCNAME(source, target);

    recordNew.setTTL(recordOld.getTTL());

    //

    final Collection<Change> changeList = new LinkedList<Change>();
    if (isPresent) {
      changeList.add(new Change(ChangeAction.DELETE, recordOld));
      changeList.add(new Change(ChangeAction.CREATE, recordNew));
    } else {
      changeList.add(new Change(ChangeAction.CREATE, recordNew));
    }

    final ChangeBatch changeRequest = new ChangeBatch();
    changeRequest.setComment("updated : " + new Date());
    changeRequest.setChanges(changeList);

    final ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest();
    request.setHostedZoneId(zone.getId());
    request.setChangeBatch(changeRequest);

    final ChangeResourceRecordSetsResult result = amazonClient
        .changeResourceRecordSets(request);
View Full Code Here


      getLog().info("dns find init [" + dnsHostName + "]");

      final CarrotRoute53 route53 = newRoute53();

      final HostedZone zone = route53.findZone( //
          route53.canonical(dnsHostName));

      final Properties props = project().getProperties();

      final String zoneName;

      if (zone == null) {
        zoneName = null;
        props.remove(dnsResultProperty);
      } else {
        zoneName = zone.getName();
        props.put(dnsResultProperty, zoneName);
      }

      getLog().info("dns zone name : " + zoneName);
View Full Code Here

     */
    {
      for (Entry<String, String> entry : recordsToAssign.entrySet()) {
        String record = entry.getKey();
        String zoneId = entry.getValue();
        HostedZone hostedZone = hostedZoneMapping.get(zoneId);
       
        Validate.notNull(hostedZone, format("Unknown Hosted Zone Id: %s for Record: %s", zoneId, record));
        Validate.isTrue(record.endsWith(hostedZone.getName()), format("Record %s does not map to zoneId %s (domain: %s)", record, zoneId, hostedZone.getName()));
      }
    }

    /**
     * Step #5: Get ELB Hosted Zone Id
View Full Code Here

      getLog().info("dns zone init [" + dnsHostName + "]");

      final Route53 route53 = getRoute53();

      final HostedZone zone = route53.findZone( //
          route53.canonical(dnsHostName));

      if (zone == null) {
        throw new IllegalStateException("can not find zone for "
            + dnsHostName);
      }

      final String dnsResultZoneName = zone.getName();

      getLog().info("dns zone name : " + dnsResultZoneName);

      project.getProperties().put(dnsResultProperty, dnsResultZoneName);
View Full Code Here

  public List<String> listZone(final String source) {

    final List<String> nameList = new LinkedList<String>();

    final HostedZone zone = findZone(source);

    if (zone == null) {
      return nameList;
    }

    final ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest();

    request.setHostedZoneId(zone.getId());

    while (true) {

      final ListResourceRecordSetsResult result = amazonClient
          .listResourceRecordSets(request);
View Full Code Here

  }

  public void ensureCNAME(final String source, final String target)
      throws Exception {

    final HostedZone zone = findZone(source);

    assertNotNull(zone, "missing zone for " + source);

    final String zoneId = zone.getId();

    final boolean isPresent;
    final ResourceRecordSet recordOld;
    {
      final ResourceRecordSet recordFound = findRecord(zoneId, source);
      if (recordFound == null) {
        isPresent = false;
        recordOld = makeRecordCNAME(source, target);
      } else {
        isPresent = true;
        recordOld = recordFound;
      }
    }

    final ResourceRecordSet recordNew = makeRecordCNAME(source, target);

    recordNew.setTTL(recordOld.getTTL());

    //

    final Collection<Change> changeList = new LinkedList<Change>();
    if (isPresent) {
      changeList.add(new Change(ChangeAction.DELETE, recordOld));
      changeList.add(new Change(ChangeAction.CREATE, recordNew));
    } else {
      changeList.add(new Change(ChangeAction.CREATE, recordNew));
    }

    final ChangeBatch changeRequest = new ChangeBatch();
    changeRequest.setComment("updated : " + new Date());
    changeRequest.setChanges(changeList);

    final ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest();
    request.setHostedZoneId(zone.getId());
    request.setChangeBatch(changeRequest);

    final ChangeResourceRecordSetsResult result = amazonClient
        .changeResourceRecordSets(request);
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(node);
        if (errorCode == null || !errorCode.equals("HostedZoneAlreadyExists"))
            return null;

        HostedZoneAlreadyExistsException e = (HostedZoneAlreadyExistsException)super.unmarshall(node);
       
        return e;
    }
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(node);
        if (errorCode == null || !errorCode.equals("HostedZoneAlreadyExists"))
            return null;

        HostedZoneAlreadyExistsException e = (HostedZoneAlreadyExistsException)super.unmarshall(node);
       
        return e;
    }
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(node);
        if (errorCode == null || !errorCode.equals("HostedZoneAlreadyExists"))
            return null;

        HostedZoneAlreadyExistsException e = (HostedZoneAlreadyExistsException)super.unmarshall(node);
       
        return e;
    }
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(node);
        if (errorCode == null || !errorCode.equals("HostedZoneNotEmpty"))
            return null;

        HostedZoneNotEmptyException e = (HostedZoneNotEmptyException)super.unmarshall(node);
       
        return e;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.route53.model.HostedZone

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.