Example usage for com.amazonaws.services.route53.model ResourceRecordSet getWeight

List of usage examples for com.amazonaws.services.route53.model ResourceRecordSet getWeight

Introduction

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

Prototype


public Long getWeight() 

Source Link

Document

Weighted resource record sets only: Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.

Usage

From source file:com.msi.dns53.server.query.ListResourceRecordSets.java

License:Apache License

@Override
public String marshall(MarshallStruct<ListResourceRecordSetsResult> input, HttpServletResponse resp)
        throws Exception {
    ListResourceRecordSetsResult result = input.getMainObject();

    XMLNode response = new XMLNode(DNS53Constants.LISTRESOURCERECORDSETSRESPONSE);
    response.addAttr(DNS53Constants.XMLNS, DNS53Constants.XMLNS_VALUE);
    if (result.getResourceRecordSets() != null) {
        XMLNode rrSet = QueryUtil.addNode(response, DNS53Constants.RESOURCERECORDSETS);
        for (ResourceRecordSet rrs : result.getResourceRecordSets()) {
            XMLNode rr = QueryUtil.addNode(rrSet, DNS53Constants.RESOURCERECORDSET);
            QueryUtil.addNode(rr, DNS53Constants.NAME, rrs.getName());
            QueryUtil.addNode(rr, DNS53Constants.TYPE, rrs.getType());
            QueryUtil.addNode(rr, DNS53Constants.TTL, rrs.getTTL());
            if (rrs.getSetIdentifier() != null) {
                QueryUtil.addNode(rr, DNS53Constants.SETIDENTIFIER, rrs.getSetIdentifier());
            }//from   w  ww.  j av  a2s  .  co  m
            if (rrs.getWeight() != null && rrs.getWeight() != -1) {
                QueryUtil.addNode(rr, DNS53Constants.WEIGHT, rrs.getWeight());
            }
            if (rrs.getResourceRecords() != null && rrs.getResourceRecords().size() > 0) {
                XMLNode records = QueryUtil.addNode(rr, DNS53Constants.RESOURCERECORDS);
                for (ResourceRecord record : rrs.getResourceRecords()) {
                    XMLNode r = QueryUtil.addNode(records, DNS53Constants.RESOURCERECORD);
                    QueryUtil.addNode(r, DNS53Constants.VALUE, record.getValue());
                }
            }
        }
    }
    QueryUtil.addNode(response, DNS53Constants.ISTRUNCATED, result.getIsTruncated());
    QueryUtil.addNode(response, DNS53Constants.MAXITEMS, result.getMaxItems());
    if (result.getIsTruncated() && result.getNextRecordName() != null) {
        QueryUtil.addNode(response, DNS53Constants.NEXTRECORDNAME, result.getNextRecordName());
    }
    if (result.getIsTruncated() && result.getNextRecordType() != null) {
        QueryUtil.addNode(response, DNS53Constants.NEXTRECORDTYPE, result.getNextRecordType());
    }
    if (result.getIsTruncated() && result.getNextRecordIdentifier() != null) {
        QueryUtil.addNode(response, DNS53Constants.NEXTRECORDIDENTIFIER, result.getNextRecordIdentifier());
    }
    return response.toString();
}