gpt4 book ai didi

com.google.cloud.dns.Zone.listChangeRequests()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 08:25:31 27 4
gpt4 key购买 nike

本文整理了Java中com.google.cloud.dns.Zone.listChangeRequests()方法的一些代码示例,展示了Zone.listChangeRequests()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone.listChangeRequests()方法的具体详情如下:
包路径:com.google.cloud.dns.Zone
类名称:Zone
方法名:listChangeRequests

Zone.listChangeRequests介绍

[英]Retrieves all change requests for this zone. The method searches for zone by name. Returns a page of ChangeRequests.
[中]检索此区域的所有更改请求。该方法按名称搜索区域。返回一页更改请求。

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void listChangeRequestsAndZoneFound() {
 @SuppressWarnings("unchecked")
 Page<ChangeRequest> pageMock = createStrictMock(Page.class);
 replay(pageMock);
 expect(dns.listChangeRequests(ZONE_NAME)).andReturn(pageMock).times(2);
 // again for options
 expect(dns.listChangeRequests(ZONE_NAME, CHANGE_REQUEST_LIST_OPTIONS))
   .andReturn(pageMock)
   .times(2);
 replay(dns);
 Page<ChangeRequest> result = zoneNoId.listChangeRequests();
 assertSame(pageMock, result);
 result = zone.listChangeRequests();
 assertSame(pageMock, result);
 verify(pageMock);
 zoneNoId.listChangeRequests(CHANGE_REQUEST_LIST_OPTIONS); // check options
 zone.listChangeRequests(CHANGE_REQUEST_LIST_OPTIONS); // check options
}

代码示例来源:origin: googleapis/google-cloud-java

replay(dns);
try {
 zoneNoId.listChangeRequests();
 fail("Parent container not found, should throw an exception.");
} catch (DnsException e) {
 zone.listChangeRequests();
 fail("Parent container not found, should throw an exception.");
} catch (DnsException e) {
 zoneNoId.listChangeRequests(CHANGE_REQUEST_LIST_OPTIONS); // check options
 fail("Parent container not found, should throw an exception.");
} catch (DnsException e) {
 zone.listChangeRequests(CHANGE_REQUEST_LIST_OPTIONS); // check options
 fail("Parent container not found, should throw an exception.");
} catch (DnsException e) {

代码示例来源:origin: googleapis/google-cloud-java

for (ChangeRequest currentChangeRequest : zone.listChangeRequests().iterateAll()) {
 System.out.println(currentChangeRequest);

代码示例来源:origin: googleapis/google-cloud-java

private static void clear() {
 for (String zoneName : ZONE_NAMES) {
  Zone zone = DNS.getZone(zoneName);
  if (zone != null) {
   /* We wait for all changes to complete before retrieving a list of DNS records to be
   deleted. Waiting is necessary as changes potentially might create more records between
   when the list has been retrieved and executing the subsequent delete operation. */
   Iterator<ChangeRequest> iterator = zone.listChangeRequests().iterateAll().iterator();
   while (iterator.hasNext()) {
    waitForChangeToComplete(zoneName, iterator.next().getGeneratedId());
   }
   Iterator<RecordSet> recordSetIterator = zone.listRecordSets().iterateAll().iterator();
   List<RecordSet> toDelete = new LinkedList<>();
   while (recordSetIterator.hasNext()) {
    RecordSet recordSet = recordSetIterator.next();
    if (!ImmutableList.of(RecordSet.Type.NS, RecordSet.Type.SOA)
      .contains(recordSet.getType())) {
     toDelete.add(recordSet);
    }
   }
   if (!toDelete.isEmpty()) {
    ChangeRequest deletion =
      zone.applyChangeRequest(ChangeRequest.newBuilder().setDeletions(toDelete).build());
    waitForChangeToComplete(zone.getName(), deletion.getGeneratedId());
   }
   zone.delete();
  }
 }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com