Example usage for com.amazonaws.services.route53.model ListResourceRecordSetsRequest getStartRecordIdentifier

List of usage examples for com.amazonaws.services.route53.model ListResourceRecordSetsRequest getStartRecordIdentifier

Introduction

In this page you can find the example usage for com.amazonaws.services.route53.model ListResourceRecordSetsRequest getStartRecordIdentifier.

Prototype


public String getStartRecordIdentifier() 

Source Link

Document

Resource record sets that have a routing policy other than simple: If results were truncated for a given DNS name and type, specify the value of NextRecordIdentifier from the previous response to get the next resource record set that has the current DNS name and type.

Usage

From source file:com.msi.dns53.client.DNS53Client.java

License:Apache License

public ListResourceRecordSetsResult listResourceRecordSets(ListResourceRecordSetsRequest req)
        throws AmazonServiceException, AmazonClientException {
    Client c = Client.create();/* w  w  w .  ja  v a2s  .  co m*/
    WebResource r = c.resource(this.serverURL);
    MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl();
    if (req.getStartRecordName() != null) {
        paramMap.add("name", req.getStartRecordName());
    }
    if (req.getStartRecordType() != null) {
        paramMap.add("type", req.getStartRecordType());
    }
    if (req.getStartRecordIdentifier() != null) {
        paramMap.add("identifier", req.getStartRecordIdentifier());
    }
    if (req.getMaxItems() != null) {
        paramMap.add("maxitems", req.getMaxItems());
    }

    ClientResponse response = r.path(req.getHostedZoneId() + "/rrset").queryParams(paramMap)
            .type(MediaType.APPLICATION_XML_TYPE).accept(MediaType.TEXT_XML)
            .header("X-Amzn-Authorization",
                    "AWS3 AWSAccessKeyId=" + this.accessKey + "," + "Algorithm=HmacSHA256,"
                            + "SignedHeaders=Host;X-Amz-Date," + "Signature=THISISANEXAMPLESIGNATURE=")
            .get(ClientResponse.class);

    String resultXml = response.getEntity(String.class);
    if (response.getStatus() != 200) {
        exceptionMapper(response, resultXml);
    }

    ListResourceRecordSetsResponsePOJO interResult = null;
    try {
        StringReader reader = new StringReader(resultXml);
        JAXBContext context = JAXBContext.newInstance(ListResourceRecordSetsResponsePOJO.class);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        interResult = (ListResourceRecordSetsResponsePOJO) unmarshaller.unmarshal(reader);
    } catch (JAXBException e) {
        e.printStackTrace();
        return null;
    }
    if (interResult == null) {
        return null;
    }

    ListResourceRecordSetsResult result = new ListResourceRecordSetsResult();
    result.setMaxItems(interResult.getMaxItems());
    result.setIsTruncated(interResult.isTruncated());
    if (interResult.getResourceRecordSets() != null) {
        Collection<ResourceRecordSet> rrSets = new LinkedList<ResourceRecordSet>();
        for (ResourceRecordSetPOJO p : interResult.getResourceRecordSets()) {
            ResourceRecordSet temp = new ResourceRecordSet();
            temp.setName(p.getName());
            temp.setSetIdentifier(p.getSetIdentifier());
            temp.setTTL(p.getTTL());
            temp.setType(p.getType());
            temp.setWeight(p.getWeight());
            if (p.getResourceRecords() != null) {
                Collection<ResourceRecord> resourceRecords = new LinkedList<ResourceRecord>();
                for (ResourceRecordPOJO record : p.getResourceRecords()) {
                    ResourceRecord newRec = new ResourceRecord();
                    newRec.setValue(record.getValue());
                    resourceRecords.add(newRec);
                }
                temp.setResourceRecords(resourceRecords);
            }
            rrSets.add(temp);
        }
        result.setResourceRecordSets(rrSets);
    }

    return result;
}