本文整理汇总了Java中com.amazonaws.services.route53.model.ResourceRecordSet.setWeight方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceRecordSet.setWeight方法的具体用法?Java ResourceRecordSet.setWeight怎么用?Java ResourceRecordSet.setWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.route53.model.ResourceRecordSet
的用法示例。
在下文中一共展示了ResourceRecordSet.setWeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testChangeResourceRecordSets
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public static void testChangeResourceRecordSets(AmazonRoute53Client client) {
ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest();
req.setHostedZoneId("Z3HKYAOP6P7EX7");
ChangeBatch batch = new ChangeBatch();
Collection<Change> changes = new LinkedList<Change>();
Change change = new Change();
change.setAction("DELETE");
ResourceRecordSet rrSet = new ResourceRecordSet();
rrSet.setName("www.examplethatshouldntbequeried.com.");
rrSet.setType("A");
rrSet.setTTL(300L);
rrSet.setWeight(1L);
Collection<ResourceRecord> rrs = new LinkedList<ResourceRecord>();
ResourceRecord e = new ResourceRecord();
e.setValue("172.31.255.2");
rrs.add(e);
rrSet.setResourceRecords(rrs);
rrSet.setSetIdentifier("1");
rrSet.setTTL(300L);
change.setResourceRecordSet(rrSet);
changes.add(change);
batch.setChanges(changes);
req.setChangeBatch(batch);
client.changeResourceRecordSets(req);
}
示例2: listResourceRecordSets
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public ListResourceRecordSetsResult listResourceRecordSets(ListResourceRecordSetsRequest req) throws AmazonServiceException, AmazonClientException{
Client c = Client.create();
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;
}