gpt4 book ai didi

com.google.cloud.compute.deprecated.ZoneId.of()方法的使用及代码示例

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

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

ZoneId.of介绍

[英]Returns a new zone identity given zone name.
[中]返回给定区域名称的新区域标识。

代码示例

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

/** Returns a new zone identity given zone name. */
public static ZoneId of(String zone) {
 return ZoneId.of(null, zone);
}

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

@Override
ZoneId parse(String... args) throws Exception {
 String message;
 if (args.length == 1) {
  return ZoneId.of(args[0]);
 } else if (args.length > 1) {
  message = "Too many arguments.";
 } else {
  message = "Missing required zone id.";
 }
 throw new IllegalArgumentException(message);
}

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

@Override
ZoneId parse(String... args) throws Exception {
 String message;
 if (args.length == 1) {
  return ZoneId.of(args[0]);
 } else if (args.length > 1) {
  message = "Too many arguments.";
 } else {
  return null;
 }
 throw new IllegalArgumentException(message);
}

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

@Override
ZoneId parse(String... args) throws Exception {
 String message;
 if (args.length == 1) {
  return ZoneId.of(args[0]);
 } else if (args.length > 1) {
  message = "Too many arguments.";
 } else {
  message = "Missing required zone id.";
 }
 throw new IllegalArgumentException(message);
}

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

static ZoneId fromUrl(String url) {
  Matcher matcher = PATTERN.matcher(url);
  if (!matcher.matches()) {
   throw new IllegalArgumentException(url + " is not a valid zone URL");
  }
  return ZoneId.of(matcher.group(1), matcher.group(2));
 }
}

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

@Override
ZoneId setProjectId(String projectId) {
 if (getProject() != null) {
  return this;
 }
 return ZoneId.of(projectId, zone);
}

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

/** Returns the identity of the zone this machine type belongs to. */
public ZoneId getZoneId() {
 return ZoneId.of(getProject(), zone);
}

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

/** Returns the identity of the zone this instance belongs to. */
public ZoneId getZoneId() {
 return ZoneId.of(getProject(), zone);
}

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

/** Returns the identity of the zone this disk type belongs to. */
public ZoneId getZoneId() {
 return ZoneId.of(getProject(), zone);
}

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

/** Returns the identity of the zone this address belongs to. */
public ZoneId getZoneId() {
 return ZoneId.of(getProject(), zone);
}

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

/** Returns the identity of the zone this disk belongs to. */
public ZoneId getZoneId() {
 return ZoneId.of(getProject(), zone);
}

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

/** Returns a disk type identity given the zone and disk type names. */
public static DiskTypeId of(String zone, String type) {
 return of(ZoneId.of(null, zone), type);
}

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

/** Returns a disk type identity given project disk, zone and disk type names. */
public static DiskTypeId of(String project, String zone, String type) {
 return of(ZoneId.of(project, zone), type);
}

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

@Test
public void testToAndFromUrl() {
 ZoneId zoneId = ZoneId.of(PROJECT, ZONE);
 compareZoneId(zoneId, ZoneId.fromUrl(zoneId.getSelfLink()));
}

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

@Test
public void testSetProjectId() {
 ZoneId zoneId = ZoneId.of(PROJECT, ZONE);
 assertSame(zoneId, zoneId.setProjectId(PROJECT));
 compareZoneId(zoneId, ZoneId.of(ZONE).setProjectId(PROJECT));
 thrown.expect(IllegalArgumentException.class);
 thrown.expectMessage("notMatchingUrl is not a valid zone URL");
 ZoneId.fromUrl("notMatchingUrl");
}

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

@Test
public void testOf() {
 ZoneId zoneId = ZoneId.of(PROJECT, ZONE);
 assertEquals(PROJECT, zoneId.getProject());
 assertEquals(ZONE, zoneId.getZone());
 assertEquals(URL, zoneId.getSelfLink());
 zoneId = ZoneId.of(ZONE);
 assertNull(zoneId.getProject());
 assertEquals(ZONE, zoneId.getZone());
}

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

@Test
public void testMatchesUrl() {
 assertTrue(ZoneId.matchesUrl(ZoneId.of(PROJECT, ZONE).getSelfLink()));
 assertFalse(ZoneId.matchesUrl("notMatchingUrl"));
}

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

@Test
public void testOf() {
 DiskId diskId = DiskId.of(PROJECT, ZONE, NAME);
 assertEquals(PROJECT, diskId.getProject());
 assertEquals(ZONE, diskId.getZone());
 assertEquals(NAME, diskId.getDisk());
 assertEquals(URL, diskId.getSelfLink());
 diskId = DiskId.of(ZONE, NAME);
 assertNull(diskId.getProject());
 assertEquals(ZONE, diskId.getZone());
 assertEquals(NAME, diskId.getDisk());
 diskId = DiskId.of(ZoneId.of(ZONE), NAME);
 assertNull(diskId.getProject());
 assertEquals(ZONE, diskId.getZone());
 assertEquals(NAME, diskId.getDisk());
}

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

@Test
public void testOf() {
 InstanceId instanceId = InstanceId.of(PROJECT, ZONE, NAME);
 assertEquals(PROJECT, instanceId.getProject());
 assertEquals(ZONE, instanceId.getZone());
 assertEquals(NAME, instanceId.getInstance());
 assertEquals(URL, instanceId.getSelfLink());
 instanceId = InstanceId.of(ZoneId.of(PROJECT, ZONE), NAME);
 assertEquals(PROJECT, instanceId.getProject());
 assertEquals(ZONE, instanceId.getZone());
 assertEquals(NAME, instanceId.getInstance());
 assertEquals(URL, instanceId.getSelfLink());
 instanceId = InstanceId.of(ZONE, NAME);
 assertNull(instanceId.getProject());
 assertEquals(ZONE, instanceId.getZone());
 assertEquals(NAME, instanceId.getInstance());
}

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

assertEquals(ZONE, zoneOperationId.getZone());
assertEquals(NAME, zoneOperationId.getOperation());
zoneOperationId = ZoneOperationId.of(ZoneId.of(PROJECT, ZONE), NAME);
assertEquals(OperationId.Type.ZONE, zoneOperationId.getType());
assertEquals(PROJECT, zoneOperationId.getProject());

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