gpt4 book ai didi

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

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

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

Zone.getName介绍

暂无

代码示例

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

/**
 * Deletes the zone. The method deletes the zone by name.
 *
 * @return {@code true} is zone was found and deleted and {@code false} otherwise
 * @throws DnsException upon failure
 */
public boolean delete() {
 return dns.delete(getName());
}

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

private static void printZone(Zone zone) {
 System.out.printf("%nName: %s%n", zone.getName());
 System.out.printf("ID: %s%n", zone.getGeneratedId());
 System.out.printf("Description: %s%n", zone.getDescription());
 System.out.printf("Created: %s%n", FORMATTER.print(zone.getCreationTimeMillis()));
 System.out.printf("Name servers: %s%n", Joiner.on(", ").join(zone.getNameServers()));
}

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

DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.NAME));
Zone created = DNS.getZone(ZONE1.getName(), Dns.ZoneOption.fields(ZoneField.CREATION_TIME));
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNotNull(created.getCreationTimeMillis());
assertNull(created.getDescription());
assertNull(created.getGeneratedId());
created = DNS.getZone(ZONE1.getName(), Dns.ZoneOption.fields(ZoneField.DESCRIPTION));
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertEquals(ZONE1.getDescription(), created.getDescription());
assertNull(created.getGeneratedId());
created = DNS.getZone(ZONE1.getName(), Dns.ZoneOption.fields(ZoneField.DNS_NAME));
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertEquals(ZONE1.getDnsName(), created.getDnsName());
assertNull(created.getGeneratedId());
created = DNS.getZone(ZONE1.getName(), Dns.ZoneOption.fields(ZoneField.NAME));
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertNull(created.getDnsName());
assertNull(created.getGeneratedId());
created = DNS.getZone(ZONE1.getName(), Dns.ZoneOption.fields(ZoneField.NAME_SERVER_SET));
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertNull(created.getDnsName());

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

@Test
 public void testBuilder() {
  // one for each build() call because it invokes a constructor
  expect(dns.getOptions()).andReturn(OPTIONS).times(8);
  replay(dns);
  assertNotEquals(
    zone,
    zone.toBuilder()
      .setGeneratedId(new BigInteger(zone.getGeneratedId()).add(BigInteger.ONE).toString())
      .build());
  assertNotEquals(zone, zone.toBuilder().setDnsName(zone.getName() + "aaaa").build());
  assertNotEquals(
    zone, zone.toBuilder().setNameServerSet(zone.getNameServerSet() + "aaaa").build());
  assertNotEquals(
    zone, zone.toBuilder().setNameServers(ImmutableList.of("nameserverpppp")).build());
  assertNotEquals(zone, zone.toBuilder().setDnsName(zone.getDnsName() + "aaaa").build());
  assertNotEquals(
    zone, zone.toBuilder().setCreationTimeMillis(zone.getCreationTimeMillis() + 1).build());
  Zone.Builder builder = zone.toBuilder();
  builder
    .setGeneratedId(ZONE_ID)
    .setDnsName("example.com")
    .setCreationTimeMillis(123478946464L)
    .build();
  assertEquals(zone, builder.build());
 }
}

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

try {
 Zone created = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.CREATION_TIME));
 assertEquals(ZONE1.getName(), created.getName()); // always returned
 assertNotNull(created.getCreationTimeMillis());
 assertNull(created.getDescription());
 created.delete();
 created = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.DESCRIPTION));
 assertEquals(ZONE1.getName(), created.getName()); // always returned
 assertNull(created.getCreationTimeMillis());
 assertEquals(ZONE1.getDescription(), created.getDescription());
 created.delete();
 created = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.DNS_NAME));
 assertEquals(ZONE1.getName(), created.getName()); // always returned
 assertNull(created.getCreationTimeMillis());
 assertEquals(ZONE1.getDnsName(), created.getDnsName());
 created.delete();
 created = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.NAME));
 assertEquals(ZONE1.getName(), created.getName()); // always returned
 assertNull(created.getCreationTimeMillis());
 assertNull(created.getDnsName());
 created.delete();
 created = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.NAME_SERVER_SET));
 assertEquals(ZONE1.getName(), created.getName()); // always returned
 assertNull(created.getCreationTimeMillis());
 assertNull(created.getDnsName());

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

/**
 * Retrieves the latest information about the zone. The method retrieves the zone by name.
 *
 * @param options optional restriction on what fields should be fetched
 * @return zone object containing updated information or {@code null} if not not found
 * @throws DnsException upon failure
 */
public Zone reload(Dns.ZoneOption... options) {
 return dns.getZone(getName(), options);
}

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

System.err.println("The thread was interrupted while waiting...");
 changeRequest = dns.getChangeRequest(zone.getName(), changeRequest.getGeneratedId());
System.out.println(String.format("Record sets inside %s:", zone.getName()));
for (RecordSet recordSet : recordSetPage.iterateAll()) {
 System.out.println(recordSet);
System.out.println(String.format("The history of changes in %s:", zone.getName()));
for (ChangeRequest currentChangeRequest : zone.listChangeRequests().iterateAll()) {
 System.out.println(currentChangeRequest);

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

batch.submit();
Zone created = timeResult.get();
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNotNull(created.getCreationTimeMillis());
assertNull(created.getDescription());
assertNull(created.getGeneratedId());
created = descriptionResult.get();
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertEquals(ZONE1.getDescription(), created.getDescription());
assertNull(created.getGeneratedId());
created = dnsNameResult.get();
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertEquals(ZONE1.getDnsName(), created.getDnsName());
assertNull(created.getGeneratedId());
created = nameResult.get();
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertNull(created.getDnsName());
assertNull(created.getGeneratedId());
created = nameServerSetResult.get();
assertEquals(ZONE1.getName(), created.getName()); // always returned
assertNull(created.getCreationTimeMillis());
assertNull(created.getDnsName());

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

/**
 * Lists all {@link RecordSet}s associated with this zone. The method searches for zone by name.
 *
 * @param options optional restriction on listing and fields of {@link RecordSet}s returned
 * @return a page of record sets
 * @throws DnsException upon failure or if the zone is not found
 */
public Page<RecordSet> listRecordSets(Dns.RecordSetListOption... options) {
 return dns.listRecordSets(getName(), options);
}

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

@Test
public void testCreateValidZone() {
 try {
  Zone created = DNS.create(ZONE1);
  assertEquals(ZONE1.getDescription(), created.getDescription());
  assertEquals(ZONE1.getDnsName(), created.getDnsName());
  assertEquals(ZONE1.getName(), created.getName());
  assertNotNull(created.getCreationTimeMillis());
  assertNotNull(created.getNameServers());
  assertNull(created.getNameServerSet());
  assertNotNull(created.getGeneratedId());
  Zone retrieved = DNS.getZone(ZONE1.getName());
  assertEquals(created, retrieved);
  created = DNS.create(ZONE_EMPTY_DESCRIPTION);
  assertEquals(ZONE_EMPTY_DESCRIPTION.getDescription(), created.getDescription());
  assertEquals(ZONE_EMPTY_DESCRIPTION.getDnsName(), created.getDnsName());
  assertEquals(ZONE_EMPTY_DESCRIPTION.getName(), created.getName());
  assertNotNull(created.getCreationTimeMillis());
  assertNotNull(created.getNameServers());
  assertNull(created.getNameServerSet());
  assertNotNull(created.getGeneratedId());
  retrieved = DNS.getZone(ZONE_EMPTY_DESCRIPTION.getName());
  assertEquals(created, retrieved);
 } finally {
  DNS.delete(ZONE1.getName());
  DNS.delete(ZONE_EMPTY_DESCRIPTION.getName());
 }
}

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

/**
 * Retrieves all change requests for this zone. The method searches for zone by name. Returns a
 * page of {@link ChangeRequest}s.
 *
 * @param options optional restriction on listing and fields to be returned
 * @return a page of change requests
 * @throws DnsException upon failure or if the zone is not found
 */
public Page<ChangeRequest> listChangeRequests(Dns.ChangeRequestListOption... options) {
 return dns.listChangeRequests(getName(), options);
}

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

assertEquals(ZONE1.getDescription(), created.getDescription());
assertEquals(ZONE1.getDnsName(), created.getDnsName());
assertEquals(ZONE1.getName(), created.getName());
assertNotNull(created.getCreationTimeMillis());
assertNotNull(created.getNameServers());
assertEquals(ZONE_EMPTY_DESCRIPTION.getDescription(), created.getDescription());
assertEquals(ZONE_EMPTY_DESCRIPTION.getDnsName(), created.getDnsName());
assertEquals(ZONE_EMPTY_DESCRIPTION.getName(), created.getName());
assertNotNull(created.getCreationTimeMillis());
assertNotNull(created.getNameServers());

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

/**
 * Submits {@link ChangeRequestInfo} to the service for it to applied to this zone. The method
 * searches for zone by name.
 *
 * @param options optional restriction on what fields of {@link ChangeRequest} should be returned
 * @return ChangeRequest with server-assigned ID
 * @throws DnsException upon failure or if the zone is not found
 */
public ChangeRequest applyChangeRequest(
  ChangeRequestInfo changeRequest, Dns.ChangeRequestOption... options) {
 checkNotNull(changeRequest);
 return dns.applyChangeRequest(getName(), changeRequest, options);
}

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

/**
 * Retrieves an updated information about a change request previously submitted to be applied to
 * this zone. Returns a {@link ChangeRequest} or {@code null} if the change request was not found.
 * Throws {@link DnsException} if the zone is not found.
 *
 * @param options optional restriction on what fields of {@link ChangeRequest} should be returned
 * @return updated ChangeRequest
 * @throws DnsException upon failure or if the zone is not found
 * @throws NullPointerException if {@code changeRequestId} is null
 */
public ChangeRequest getChangeRequest(
  String changeRequestId, Dns.ChangeRequestOption... options) {
 checkNotNull(changeRequestId);
 return dns.getChangeRequest(getName(), changeRequestId, options);
}

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

/** Creates a zone with the provided name, DNS name and description (in this order). */
@Override
public void run(Dns dns, String... args) {
 String zoneName = args[0];
 String dnsName = args[1];
 String description = args[2];
 ZoneInfo zoneInfo = ZoneInfo.of(zoneName, dnsName, description);
 Zone zone = dns.create(zoneInfo);
 System.out.printf(
   "Successfully created zone with name %s which was assigned ID %s.%n",
   zone.getName(), zone.getGeneratedId());
}

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

private static List<Zone> filter(Iterator<Zone> iterator) {
 List<Zone> result = new LinkedList<>();
 while (iterator.hasNext()) {
  Zone zone = iterator.next();
  if (ZONE_NAMES.contains(zone.getName())) {
   result.add(zone);
  }
 }
 return result;
}

代码示例来源: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();
  }
 }
}

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

Zone zone = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.NAME));
ChangeRequest created = zone.applyChangeRequest(CHANGE_ADD_ZONE1);
ChangeRequest retrieved = DNS.getChangeRequest(zone.getName(), created.getGeneratedId());
assertEqChangesIgnoreStatus(created, retrieved);
waitForChangeToComplete(zone.getName(), created.getGeneratedId());
zone.applyChangeRequest(CHANGE_DELETE_ZONE1);
retrieved =
  DNS.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.ID));
assertEqChangesIgnoreStatus(created, retrieved);
waitForChangeToComplete(zone.getName(), created.getGeneratedId());
zone.applyChangeRequest(CHANGE_DELETE_ZONE1);
created =
retrieved =
  DNS.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.STATUS));
assertEqChangesIgnoreStatus(created, retrieved);
waitForChangeToComplete(zone.getName(), created.getGeneratedId());
zone.applyChangeRequest(CHANGE_DELETE_ZONE1);
created =
retrieved =
  DNS.getChangeRequest(

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

Zone zone = DNS.create(ZONE1, Dns.ZoneOption.fields(ZoneField.NAME));
ChangeRequest created = zone.applyChangeRequest(CHANGE_ADD_ZONE1);
waitForChangeToComplete(zone.getName(), created.getGeneratedId());
DnsBatch batch = DNS.batch();
DnsBatchResult<ChangeRequest> completeResult =
  batch.getChangeRequest(zone.getName(), created.getGeneratedId());
DnsBatchResult<ChangeRequest> idResult =
  batch.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.ID));
DnsBatchResult<ChangeRequest> statusResult =
  batch.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.STATUS));
DnsBatchResult<ChangeRequest> timeResult =
  batch.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.START_TIME));
DnsBatchResult<ChangeRequest> additionsResult =
  batch.getChangeRequest(
    zone.getName(),
    created.getGeneratedId(),
    Dns.ChangeRequestOption.fields(ChangeRequestField.ADDITIONS));
DnsBatchResult<ChangeRequest> deletionsResult =
  batch.getChangeRequest(

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

ChangeRequestInfo deletion = ChangeRequest.newBuilder().delete(validA).build();
ChangeRequest request = zone.applyChangeRequest(deletion);
waitForChangeToComplete(zone.getName(), request.getGeneratedId());

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