当前位置: 首页>>代码示例>>Java>>正文


Java ResourceRecordSet类代码示例

本文整理汇总了Java中com.amazonaws.services.route53.model.ResourceRecordSet的典型用法代码示例。如果您正苦于以下问题:Java ResourceRecordSet类的具体用法?Java ResourceRecordSet怎么用?Java ResourceRecordSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceRecordSet类属于com.amazonaws.services.route53.model包,在下文中一共展示了ResourceRecordSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);

}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:26,代码来源:Route53Test.java

示例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);

}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:25,代码来源:Route53Test.java

示例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);
}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:26,代码来源:Route53Test.java

示例4: getCurrentIP

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
@Override
public String getCurrentIP() {
	ResourceRecordSet set = getCurrentRecordSet();
	if (set != null && set.getResourceRecords() != null
			&& set.getResourceRecords().size() > 0) {
		ResourceRecord rr = set.getResourceRecords().get(0);
		if (rr != null) {
			return rr.getValue();
		}
	}
	return null;
}
 
开发者ID:maroussil,项目名称:Ec2InstanceStarter,代码行数:13,代码来源:SimpleRecordService.java

示例5: getCurrentRecordSet

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
public ResourceRecordSet getCurrentRecordSet() {

		if (log.isDebugEnabled()) {
			log.debug("zoneId:" + config.getZoneId());
			log.debug("recordName:" + config.getRecordName());
		}
		ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest();
		request.setHostedZoneId(config.getZoneId());

		ListResourceRecordSetsResult result = config.getAmazonRoute53Client()
				.listResourceRecordSets(request);
		List<ResourceRecordSet> recordSets = result.getResourceRecordSets();

		for (ResourceRecordSet recordSet : recordSets) {

			String currName = recordSet.getName();

			if (currName == null)
				continue;
			currName = currName.trim();

			// AWS ends name with dot.
			if (currName.endsWith("."))
				currName = currName.substring(0, currName.length() - 1);

			if (equalsIgnoreCase(config.getRecordName(), currName)) {
				return recordSet;
			}
		}

		return null;
	}
 
开发者ID:maroussil,项目名称:Ec2InstanceStarter,代码行数:33,代码来源:SimpleRecordService.java

示例6: attachDomainToEip

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
public static ChangeInfo attachDomainToEip(AmazonRoute53 route53, String publicIp, String domain) {
	String hostedZoneId = findHostedZoneForDomain(route53, domain);
	if (hostedZoneId != null) {
		System.out.println("Found HostedZone's Id(" + hostedZoneId + ")");
	} else {
		return null;
	}

	ResourceRecordSet resourceRecordSet = generateResourceRecordSetForARecord(publicIp, domain);
	ChangeInfo changeinfo = AwsRoute53Client.changeResourceRecordSet(route53, hostedZoneId, resourceRecordSet,
			ChangeAction.CREATE);
	return changeinfo;
}
 
开发者ID:betahikaru,项目名称:ec2-util,代码行数:14,代码来源:AwsRoute53Client.java

示例7: 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;
}
 
开发者ID:betahikaru,项目名称:ec2-util,代码行数:13,代码来源:AwsRoute53Client.java

示例8: changeResourceRecordSet

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
public static ChangeInfo changeResourceRecordSet(AmazonRoute53 route53, String hostedZoneId,
		ResourceRecordSet resourceRecordSet, ChangeAction changeAction) {
	Change change = new Change(changeAction, resourceRecordSet);
	ChangeBatch changeBatch = new ChangeBatch().withChanges(change);
	ChangeResourceRecordSetsRequest changeResourceRecordSetsRequest = new ChangeResourceRecordSetsRequest(
			hostedZoneId, changeBatch);
	ChangeResourceRecordSetsResult changeResourceRecordSetsResult = route53
			.changeResourceRecordSets(changeResourceRecordSetsRequest);
	ChangeInfo changeinfo = changeResourceRecordSetsResult.getChangeInfo();
	return changeinfo;
}
 
开发者ID:betahikaru,项目名称:ec2-util,代码行数:12,代码来源:AwsRoute53Client.java

示例9: getCurrentIP

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
@Override
public String getCurrentIP() {
	ResourceRecordSet set = getCurrentRecordSet();
	if (set!=null && set.getResourceRecords() != null && set.getResourceRecords().size() > 0){
		ResourceRecord	rr = set.getResourceRecords().get(0);
		if(rr!=null){
			return rr.getValue();
		}
	}
	return null;
}
 
开发者ID:renatodelgaudio,项目名称:awsroute53,代码行数:12,代码来源:SimpleRecordService.java

示例10: getCurrentRecordSet

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
public ResourceRecordSet getCurrentRecordSet() {
	
	if (log.isDebugEnabled()){
		log.debug("zoneId:"+config.getZoneId());
		log.debug("recordName:"+config.getRecordName());
	}
	ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest();
	request.setHostedZoneId(config.getZoneId());

	ListResourceRecordSetsResult result = config.getAmazonClient().listResourceRecordSets(request);
	List<ResourceRecordSet> recordSets = result.getResourceRecordSets();


	for(ResourceRecordSet recordSet : recordSets) {

		String currName = recordSet.getName();

		if (currName == null)
			continue;
		currName = currName.trim();

		// AWS ends name with dot.
		if (currName.endsWith("."))
			currName = currName.substring(0,currName.length()-1);

		if (equalsIgnoreCase(config.getRecordName(),currName)) {			
			return recordSet;
		}
	}

	return null;
}
 
开发者ID:renatodelgaudio,项目名称:awsroute53,代码行数:33,代码来源:SimpleRecordService.java

示例11: getCurrentAValue

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
/**
 * TODO: assumes exactly one A record for record set
 * @param recordSetName
 * @return value for A record of record set
 */
private String getCurrentAValue(final String recordSetName) {
    final ListResourceRecordSetsRequest listResourceRecordSetsRequest = new ListResourceRecordSetsRequest()
            .withHostedZoneId(hostedZoneId)
            .withMaxItems("1")
            .withStartRecordName(recordSetName);
    ListResourceRecordSetsResult listResourceRecordSetsResult = execWithRetries(new Callable<ListResourceRecordSetsResult>() {
        @Override
        public ListResourceRecordSetsResult call() throws Exception {
            return route53.listResourceRecordSets(listResourceRecordSetsRequest);
        }
    });

    List<ResourceRecordSet> resourceRecordSets = listResourceRecordSetsResult.getResourceRecordSets();
    if (resourceRecordSets.isEmpty()) {
        throw new IllegalStateException("Could not find any resource record sets for \"" + recordSetName + "\" in hosted zone \"" + hostedZoneId + "\"");
    }

    for (ResourceRecordSet resourceRecordSet : resourceRecordSets) {
        if (RRType.valueOf(resourceRecordSet.getType()) == RRType.A) {
            List<ResourceRecord> resourceRecords = resourceRecordSet.getResourceRecords();
            if (resourceRecords.isEmpty()) {
                throw new IllegalStateException("Could not find any A records for set \"" + resourceRecordSet.getName() + "\" in hosted zone \"" + hostedZoneId + "\"");
            }
            return resourceRecords.get(0).getValue();
        }
    }
    throw new IllegalStateException("Could not find any A records for record set \"" + recordSetName + "\"");
}
 
开发者ID:elprespufferfish,项目名称:route53-dynamic-dns,代码行数:34,代码来源:UpdateDns.java

示例12: updateAValue

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
private void updateAValue(final String recordSetName, final String newValue) {
    ResourceRecord resourceRecord = new ResourceRecord()
            .withValue(newValue);

    ResourceRecordSet resourceRecordSet = new ResourceRecordSet()
            .withName(recordSetName)
            .withType(RRType.A)
            .withTTL(TTL)
            .withResourceRecords(Collections.singleton(resourceRecord));

    Change deleteChange = new Change()
            .withAction(ChangeAction.DELETE)
            .withResourceRecordSet(resourceRecordSet);

    Change createChange = new Change()
            .withAction(ChangeAction.CREATE)
            .withResourceRecordSet(resourceRecordSet);

    ChangeBatch changeBatch = new ChangeBatch()
            .withChanges(deleteChange, createChange);

    final ChangeResourceRecordSetsRequest changeResourceRecordSetsRequest = new ChangeResourceRecordSetsRequest()
            .withHostedZoneId(hostedZoneId)
            .withChangeBatch(changeBatch);

    execWithRetries(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            route53.changeResourceRecordSets(changeResourceRecordSetsRequest);
            // TODO - poll until the change as propagated?
            return null;
        }
    });
}
 
开发者ID:elprespufferfish,项目名称:route53-dynamic-dns,代码行数:35,代码来源:UpdateDns.java

示例13: changeResourceRecordSets0

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
@Test
public void changeResourceRecordSets0() {
    String batchComment = "I have no idea what I'm doing.";
    ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest();
    req.setHostedZoneId(getZoneId(zoneName0));
    ChangeBatch batch = new ChangeBatch();
    batch.setComment(batchComment);
    Collection<Change> changes = new LinkedList<Change>();
    ResourceRecord resourceRecord = new ResourceRecord()
            .withValue("172.31.255.235");
    changes.add(new Change().withAction("CREATE").withResourceRecordSet(
            new ResourceRecordSet().withName("www." + zoneName0)
                    .withType("A").withTTL(300L)
                    .withResourceRecords(resourceRecord)));
    batch.setChanges(changes);
    req.setChangeBatch(batch);
    ChangeResourceRecordSetsResult result = customDNS53Client
            .changeResourceRecordSets(req);

    assertNotNull(result);
    assertNotNull(result.getChangeInfo());
    assertNotNull(result.getChangeInfo().getId());
    assertNotNull(result.getChangeInfo().getStatus());
    assertNotNull(result.getChangeInfo().getSubmittedAt());

    System.out.println(result);
}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:28,代码来源:DNS53IntegrationTest.java

示例14: listResourceRecordSets0

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
@Test
public void listResourceRecordSets0() {
    ListResourceRecordSetsRequest req = new ListResourceRecordSetsRequest(
            this.getZoneId(zoneName0));
    ListResourceRecordSetsResult result = customDNS53Client
            .listResourceRecordSets(req);

    assertNotNull(result);
    assertNotNull(result.getResourceRecordSets());
    assertEquals(true, result.getResourceRecordSets().size() > 0);
    boolean found = false;
    for (ResourceRecordSet rrSet : result.getResourceRecordSets()) {
        if (rrSet.getName().equals("www." + zoneName0)
                && rrSet.getTTL().equals(300L)
                && rrSet.getType().equals("A")
                && rrSet.getResourceRecords().get(0).getValue()
                        .equals("172.31.255.235")) {
            found = true;
        }
    }
    assertEquals(true, found);
    assertEquals(false, result.getIsTruncated());
    assertEquals("100", result.getMaxItems());
    assertEquals(null, result.getNextRecordIdentifier());
    assertEquals(null, result.getNextRecordName());
    assertEquals(null, result.getNextRecordType());
    System.out.println(result);
}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:29,代码来源:DNS53IntegrationTest.java

示例15: changeResourceRecordSets1

import com.amazonaws.services.route53.model.ResourceRecordSet; //导入依赖的package包/类
@Test
public void changeResourceRecordSets1() {
    String batchComment = "I have no idea what I'm doing.";
    ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest();
    req.setHostedZoneId(getZoneId(zoneName0));
    ChangeBatch batch = new ChangeBatch();
    batch.setComment(batchComment);
    Collection<Change> changes = new LinkedList<Change>();
    ResourceRecord resourceRecord = new ResourceRecord()
            .withValue("172.31.255.235");
    ResourceRecord resourceRecord2 = new ResourceRecord()
            .withValue("172.31.255.254");
    changes.add(new Change().withAction("CREATE").withResourceRecordSet(
            new ResourceRecordSet().withName("w2." + zoneName0)
                    .withType("A").withTTL(300L)
                    .withResourceRecords(resourceRecord, resourceRecord2)));
    batch.setChanges(changes);
    req.setChangeBatch(batch);
    ChangeResourceRecordSetsResult result = customDNS53Client
            .changeResourceRecordSets(req);

    assertNotNull(result);
    assertNotNull(result.getChangeInfo());
    assertNotNull(result.getChangeInfo().getId());
    assertNotNull(result.getChangeInfo().getStatus());
    assertNotNull(result.getChangeInfo().getSubmittedAt());

    System.out.println(result);
}
 
开发者ID:TranscendComputing,项目名称:TopStackDNS53,代码行数:30,代码来源:DNS53IntegrationTest.java


注:本文中的com.amazonaws.services.route53.model.ResourceRecordSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。