本文整理了Java中com.google.cloud.dns.ZoneInfo.of()
方法的一些代码示例,展示了ZoneInfo.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneInfo.of()
方法的具体详情如下:
包路径:com.google.cloud.dns.ZoneInfo
类名称:ZoneInfo
方法名:of
[英]Returns a ZoneInfo object with assigned name, dnsName and description.
[中]返回具有指定名称、dnsName和描述的ZoneInfo对象。
代码示例来源: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
public static void main(String... args) {
// Create a service object
// The project ID and credentials will be inferred from the environment.
Dns dns = DnsOptions.getDefaultInstance().getService();
// Create a zone metadata object
String zoneName = "my-unique-zone"; // Change this zone name which is unique within your project
String domainName = "someexampledomain.com."; // Change this to a domain which you own
String description = "This is a google-cloud-dns sample zone.";
ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
// Create zone in Google Cloud DNS
Zone zone = dns.create(zoneInfo);
System.out.printf("Zone was created and assigned ID %s.%n", zone.getGeneratedId());
}
}
代码示例来源:origin: googleapis/google-cloud-java
String domainName = "someexampledomain.com."; // Change this to a domain which you own
String description = "This is a google-cloud-dns sample zone.";
ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testToAndFromPb() {
assertEquals(INFO, ZoneInfo.fromPb(INFO.toPb()));
ZoneInfo partial = ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION);
assertEquals(partial, ZoneInfo.fromPb(partial.toPb()));
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION).toBuilder().setGeneratedId(GENERATED_ID).build();
assertEquals(partial, ZoneInfo.fromPb(partial.toPb()));
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION)
.toBuilder()
.setCreationTimeMillis(CREATION_TIME_MILLIS)
.build();
assertEquals(partial, ZoneInfo.fromPb(partial.toPb()));
List<String> nameServers = new LinkedList<>();
nameServers.add(NS1);
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION).toBuilder().setNameServers(nameServers).build();
assertEquals(partial, ZoneInfo.fromPb(partial.toPb()));
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION)
.toBuilder()
.setNameServerSet(NAME_SERVER_SET)
.build();
assertEquals(partial, ZoneInfo.fromPb(partial.toPb()));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testToBuilder() {
assertEquals(INFO, INFO.toBuilder().build());
ZoneInfo partial = ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION);
assertEquals(partial, partial.toBuilder().build());
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION).toBuilder().setGeneratedId(GENERATED_ID).build();
assertEquals(partial, partial.toBuilder().build());
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION)
.toBuilder()
.setCreationTimeMillis(CREATION_TIME_MILLIS)
.build();
assertEquals(partial, partial.toBuilder().build());
List<String> nameServers = new LinkedList<>();
nameServers.add(NS1);
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION).toBuilder().setNameServers(nameServers).build();
assertEquals(partial, partial.toBuilder().build());
partial =
ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION)
.toBuilder()
.setNameServerSet(NAME_SERVER_SET)
.build();
assertEquals(partial, partial.toBuilder().build());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testOf() {
ZoneInfo partial = ZoneInfo.of(NAME, DNS_NAME, DESCRIPTION);
assertTrue(partial.getNameServers().isEmpty());
assertEquals(NAME, partial.getName());
assertNull(partial.getGeneratedId());
assertNull(partial.getCreationTimeMillis());
assertNull(partial.getNameServerSet());
assertEquals(DESCRIPTION, partial.getDescription());
assertEquals(DNS_NAME, partial.getDnsName());
}
内容来源于网络,如有侵权,请联系作者删除!