Package com.amazonaws.services.route53.model

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


        String[] endpoints = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" };

        SingleCellLattice<HealthCheckedResourceRecord> lattice = new SingleCellLattice<HealthCheckedResourceRecord>();

        for (String endpoint : endpoints) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint(hcrr);
        }

        List<ResourceRecordSet> rrs = RubberTree.vulcanize("Z124", "www.example.com", "TXT", 60L, lattice, 8);
View Full Code Here


                "P", "Q", "R", "S", "T" };

        SingleCellLattice<HealthCheckedResourceRecord> lattice = new SingleCellLattice<HealthCheckedResourceRecord>();

        for (String endpoint : endpoints) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint(hcrr);
        }

        List<ResourceRecordSet> rrs = RubberTree.vulcanize("Z124", "www.example.com", "TXT", 60L, lattice, 8);
View Full Code Here

        String[] endpointsB2 = new String[] { "P", "Q", "R", "S", "T" };

        TwoDimensionalLattice<HealthCheckedResourceRecord> lattice = new TwoDimensionalLattice<HealthCheckedResourceRecord>(
                "AZ", "Version");
        for (String endpoint : endpointsA1) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint("us-east-1a", "1", hcrr);
        }
        for (String endpoint : endpointsA2) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint("us-east-1a", "2", hcrr);
        }
        for (String endpoint : endpointsB1) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint("us-east-1b", "1", hcrr);
        }
        for (String endpoint : endpointsB2) {
            HealthCheckedResourceRecord hcrr = new HealthCheckedResourceRecord(endpoint, endpoint);
            lattice.addEndpoint("us-east-1b", "2", hcrr);
        }

        List<ResourceRecordSet> rrs = RubberTree.vulcanize("Z124", "www.example.com", "TXT", 60L, lattice, 8);
View Full Code Here

                for (String value : lattice.getDimensionValues(dimension)) {
                    /* Create a zero weighted alias to this set */
                    String subTreePrefix = dimension.substring(0, Math.min(dimension.length(), 30)) + "-"
                            + value.substring(0, Math.min(value.length(), 30));
                    String subTreeName = subTreePrefix + "." + secondaryName;
                    AliasTarget target = new AliasTarget();
                    target.setDNSName(subTreeName);
                    target.setEvaluateTargetHealth(true);
                    target.setHostedZoneId(hostedZoneId);
                    ResourceRecordSet rr = new ResourceRecordSet();
                    rr.setName(secondaryName);
                    rr.setWeight(0L);
                    rr.setType(type);
                    rr.setAliasTarget(target);
                    rr.setSetIdentifier(subTreePrefix);

                    vulcanized.addAll(vulcanize(hostedZoneId, subTreeName, type, ttl,
                            lattice.simulateFailure(dimension, value).getAllEndpoints(), recordsPerRecordSet));
                    vulcanized.add(rr);
                }
            }

            /* Add an alias to the secondary level */
            AliasTarget target = new AliasTarget();
            target.setDNSName(secondaryName);
            target.setEvaluateTargetHealth(true);
            target.setHostedZoneId(hostedZoneId);
            ResourceRecordSet rr = new ResourceRecordSet();
            rr.setName(name);
            rr.setWeight(0L);
            rr.setType(type);
            rr.setAliasTarget(target);
View Full Code Here

         * health-check to form a logical AND of the health-checks.
         */
        ResourceRecordSet entryNode = leafNode;
        while (!healthchecksRemaining.isEmpty()) {
            ResourceRecordSet alias = new ResourceRecordSet();
            AliasTarget aliasTarget = new AliasTarget();

            String checksum = checksumResourceRecordSetData(entryNode);

            /* The alias will be the new entry node, inherit its properties */
            alias.setName(entryNode.getName());
            alias.setType(entryNode.getType());
            alias.setWeight(entryNode.getWeight());

            /* Consume a health-check */
            alias.setHealthCheckId(healthchecksRemaining.remove(0));

            /* Rename the previous entry node */
            String targetName = checksum + "." + entryNode.getName();
            entryNode.setName(targetName);
            aliasTarget.setDNSName(targetName);
            aliasTarget.setEvaluateTargetHealth(true);
            aliasTarget.setHostedZoneId(hostedZoneId);

            /* Associate the alias and the alias target */
            alias.setSetIdentifier("Alias to " + checksum);
            alias.setAliasTarget(aliasTarget);

View Full Code Here

    public void changeRecords(String hostedZoneId, List<ResourceRecordSet> create, List<ResourceRecordSet> remove) {
        List<Change> changes = Lists.newArrayList();

        for (ResourceRecordSet r : remove) {
            Change change = new Change(ChangeAction.DELETE, r);
            changes.add(change);
        }

        for (ResourceRecordSet r : create) {
            Change change = new Change(ChangeAction.CREATE, r);
            changes.add(change);
        }

        if (changes.isEmpty()) {
            log.info("No DNS record changes");
View Full Code Here

    //

    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);
View Full Code Here

        if (changes.isEmpty()) {
            log.info("No DNS record changes");
            return;
        }

        ChangeBatch changeBatch = new ChangeBatch();
        changeBatch.setChanges(changes);
        ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest();
        request.setHostedZoneId(hostedZoneId);
        request.setChangeBatch(changeBatch);

        log.info("Changing DNS records: {}", request);
View Full Code Here

      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);
View Full Code Here

    return null;
  }

  protected void assignDomain(BindDomainContext ctx, String record, String zoneId) {
    ChangeBatch changeBatch = new ChangeBatch();

    /**
     * Look for Existing Resource Record Sets
     */
    {
      ResourceRecordSet resourceRecordSet = null;

      ListResourceRecordSetsResult listResourceRecordSets = ctx.r53
          .listResourceRecordSets(new ListResourceRecordSetsRequest(
              zoneId));

      for (ResourceRecordSet rrs : listResourceRecordSets
          .getResourceRecordSets()) {
        if (!rrs.getName().equals(record))
          continue;

        if (!"A".equals(rrs.getType()))
          continue;

        resourceRecordSet = rrs;
        break;
      }

      if (null != resourceRecordSet) {
        if (getLog().isInfoEnabled())
          getLog().info(format("Excluding resourceRecordSet %s for domain %s", resourceRecordSet, record));
        changeBatch.getChanges().add(new Change(ChangeAction.DELETE,
            resourceRecordSet));
      }
    }

    /**
     * Then Add Ours
     */
    AliasTarget aliasTarget = new AliasTarget();

    aliasTarget.setHostedZoneId(ctx.elbHostedZoneId);
    aliasTarget.setDNSName(curEnv.getEndpointURL());

    ResourceRecordSet resourceRecordSet = new ResourceRecordSet();

    resourceRecordSet.setName(record);
    resourceRecordSet.setType(RRType.A);

    resourceRecordSet.setAliasTarget(aliasTarget);

    if (getLog().isInfoEnabled())
      getLog().info(format("Adding resourceRecordSet %s for domain %s mapped to %s", resourceRecordSet, record, aliasTarget.getDNSName()));

    changeBatch.getChanges().add(new Change(ChangeAction.CREATE, resourceRecordSet));

    ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest(
        zoneId, changeBatch);

    ctx.r53.changeResourceRecordSets(req);
View Full Code Here

TOP

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

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.