本文整理汇总了Java中com.amazonaws.services.route53.model.ResourceRecordSet.setType方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceRecordSet.setType方法的具体用法?Java ResourceRecordSet.setType怎么用?Java ResourceRecordSet.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.route53.model.ResourceRecordSet
的用法示例。
在下文中一共展示了ResourceRecordSet.setType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createARecords
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public static void createARecords(AmazonRoute53Client client) {
ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest();
request.setHostedZoneId("Z6C671E6E1A044F6695AD50EE258D8BAE");
ChangeBatch changeBatch = new ChangeBatch();
Collection<Change> changes = new LinkedList<Change>();
for (int i = 1; i < 151; ++i) {
Change change = new Change();
change.setAction(ChangeAction.CREATE);
ResourceRecordSet rrs = new ResourceRecordSet();
rrs.setType(RRType.A);
rrs.setTTL(900L);
rrs.setName("inst-" + i + ".msicluster.momentumsoftware.com");
Collection<ResourceRecord> rr = new LinkedList<ResourceRecord>();
ResourceRecord e = new ResourceRecord();
e.setValue("172.31.253." + i);
rr.add(e);
rrs.setResourceRecords(rr);
change.setResourceRecordSet(rrs);
changes.add(change);
}
changeBatch.setChanges(changes);
request.setChangeBatch(changeBatch);
client.changeResourceRecordSets(request);
}
示例2: createCNAMERecords
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public static void createCNAMERecords(AmazonRoute53Client client) {
ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest();
request.setHostedZoneId("Z9366F3515BBA46B2AA8C86B1D6DF0311");
ChangeBatch changeBatch = new ChangeBatch();
Collection<Change> changes = new LinkedList<Change>();
Change change = new Change();
change.setAction(ChangeAction.CREATE);
ResourceRecordSet rrs = new ResourceRecordSet();
rrs.setType(RRType.CNAME);
rrs.setTTL(900L);
rrs.setName("devessex.essex.momentumsoftware.com");
Collection<ResourceRecord> rr = new LinkedList<ResourceRecord>();
ResourceRecord e = new ResourceRecord();
e.setValue("inst-5.essex.momentumsoftware.com");
rr.add(e);
rrs.setResourceRecords(rr);
change.setResourceRecordSet(rrs);
changes.add(change);
changeBatch.setChanges(changes);
request.setChangeBatch(changeBatch);
client.changeResourceRecordSets(request);
}
示例3: 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);
}
示例4: generateResourceRecordSetForARecord
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public static ResourceRecordSet generateResourceRecordSetForARecord(String publicIp, String domain) {
ArrayList<ResourceRecord> resourceRecords = new ArrayList<>();
ResourceRecord resourceRecord = new ResourceRecord().withValue(publicIp);
resourceRecords.add(resourceRecord);
ResourceRecordSet resourceRecordSet = new ResourceRecordSet();
resourceRecordSet.setTTL(300L);
resourceRecordSet.setName(domain);
resourceRecordSet.setType(RRType.A);
resourceRecordSet.setResourceRecords(resourceRecords);
return resourceRecordSet;
}
示例5: makeRecordCNAME
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public ResourceRecordSet makeRecordCNAME(final String source,
final String target) {
final Collection<ResourceRecord> resourceList = new ArrayList<ResourceRecord>();
resourceList.add(new ResourceRecord(target));
final ResourceRecordSet record = new ResourceRecordSet();
record.setName(source);
record.setTTL(60L);
record.setType("CNAME");
record.setResourceRecords(resourceList);
return record;
}
示例6: populateServiceMetadata
import com.amazonaws.services.route53.model.ResourceRecordSet; //导入方法依赖的package包/类
public void populateServiceMetadata(
final ServletConfig config, String serviceName) {
logger.debug("init(): TXT record will be created for this service regarding its port and context path.");
String contextPath = config.getServletContext().getContextPath();
String port = Appctx.getBean("TOMCAT_PORT");
String master_passwd = Appctx.getBean("DB_PASSWORD");
final String fqdn = (String) ConfigurationUtil
.getConfiguration(Arrays.asList(new String[] { "FQDN" }));
final String domain = (String) ConfigurationUtil
.getConfiguration(Arrays.asList(new String[] { "FQDN_DOMAIN" }));
String txtRecordValue = ":" + port + contextPath;
String baseDNSServerURL = "http://localhost:" + port + "/DNS53Server/2012-02-29/";
logger.debug("Tomcat port = " + port + "; FQDN = " + fqdn + "; domain = " + domain + "; TXT Record Value = " + txtRecordValue + "; BaseDNSServerUrl = " + baseDNSServerURL);
DNS53Client client = new DNS53Client(baseDNSServerURL + "hostedzone", baseDNSServerURL + "change",
"admin", master_passwd);
logger.debug("Service name = " + serviceName);
String recordName = serviceName + "-" + fqdn;
logger.debug("TXT Record Name: " + recordName);
logger.debug("init(): Calling ListHostedZones to find the target zone!");
ListHostedZonesRequest lhzReq = new ListHostedZonesRequest();
lhzReq.setMaxItems("1");
ListHostedZonesResult lhzResult = client.listHostedZones(lhzReq);
HostedZone zone = null;
List<HostedZone> zones = lhzResult.getHostedZones();
if(zones != null && zones.size() > 0){
for(HostedZone hz : zones){
if(hz.getName().equals(domain + ".") || hz.getName().equals(domain)){
zone = hz;
}
}
} else{
logger.error("BaseAsyncServlet encountered an error while it was trying to find the target hosted zone.");
throw ErrorResponse.InternalFailure();
}
if(zone == null){
logger.error("BaseAsyncServlet could not find any zone for this TopStackWeb instance.");
throw ErrorResponse.InternalFailure();
}
// TODO (optional) check for the CNAME record for this service before proceeding
logger.debug("init(): Creating a new TXT record for " + recordName + " with \"" + txtRecordValue + "\" as its value!");
String zoneId = zone.getId();
ChangeResourceRecordSetsRequest crrsReq = new ChangeResourceRecordSetsRequest();
crrsReq.setHostedZoneId(zoneId);
ChangeBatch cb = new ChangeBatch();
cb.setComment("BaseAsyncServlet => init(): Registering " + serviceName + " service for Transcend TopStack.");
Collection<Change> changes = new LinkedList<Change>();
Change change = new Change();
change.setAction(ChangeAction.CREATE);
ResourceRecordSet rrSet = new ResourceRecordSet();
rrSet.setName(recordName);
rrSet.setTTL(900L);
rrSet.setType(RRType.TXT);
Collection<ResourceRecord> rr = new LinkedList<ResourceRecord>();
ResourceRecord record = new ResourceRecord();
record.setValue(txtRecordValue);
rr.add(record);
rrSet.setResourceRecords(rr);
change.setResourceRecordSet(rrSet);
changes.add(change);
cb.setChanges(changes);
crrsReq.setChangeBatch(cb);
ChangeResourceRecordSetsResult result = client.changeResourceRecordSets(crrsReq);
logger.debug("Result for the last ChangeResourceRecordSets request: " + result.toString());
}
示例7: 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;
}