- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.google.cloud.compute.deprecated.ZoneOperationId
类的一些代码示例,展示了ZoneOperationId
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOperationId
类的具体详情如下:
包路径:com.google.cloud.compute.deprecated.ZoneOperationId
类名称:ZoneOperationId
[英]Identity for a Google Compute Engine zone operation.
[中]谷歌计算引擎区域操作的标识。
代码示例来源:origin: googleapis/google-cloud-java
@Override
ZoneOperationId setProjectId(String projectId) {
if (getProject() != null) {
return this;
}
return ZoneOperationId.of(projectId, zone, getOperation());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testToAndFromUrlZone() {
ZoneOperationId zoneOperationId = ZoneOperationId.of(PROJECT, ZONE, NAME);
compareZoneOperationId(zoneOperationId, ZoneOperationId.fromUrl(zoneOperationId.getSelfLink()));
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("notMatchingUrl is not a valid zone operation URL");
ZoneOperationId.fromUrl("notMatchingUrl");
}
代码示例来源:origin: googleapis/google-cloud-java
private void compareZoneOperationId(ZoneOperationId expected, ZoneOperationId value) {
assertEquals(expected, value);
assertEquals(expected.getProject(), expected.getProject());
assertEquals(expected.getZone(), expected.getZone());
assertEquals(expected.getOperation(), expected.getOperation());
assertEquals(expected.getSelfLink(), expected.getSelfLink());
assertEquals(expected.hashCode(), expected.hashCode());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testAttachDisk() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
AttachedDisk.PersistentDiskConfiguration configuration =
AttachedDisk.PersistentDiskConfiguration.of(DISK_ID);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.attachDisk(INSTANCE_ID, configuration)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.attachDisk(configuration));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSetMetadata() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
Metadata metadata = Metadata.newBuilder().add("k", "v").setFingerprint("fingerprint").build();
expect(compute.setMetadata(INSTANCE_ID, metadata)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.setMetadata(metadata));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSetTagsFromList() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
List<String> tagList = ImmutableList.of("v1", "v2");
Tags tags = Tags.newBuilder().setValues(tagList).setFingerprint("fingerprint").build();
expect(compute.setTags(INSTANCE_ID, tags)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.setTags(tagList));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testCreateSnapshot() {
initializeExpectedDisk(4);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "zone", "op"))
.build();
SnapshotId snapshotId = SnapshotId.of(SNAPSHOT.getSnapshot());
SnapshotInfo snapshot = SnapshotInfo.newBuilder(snapshotId, DISK_ID).build();
expect(compute.create(snapshot)).andReturn(operation);
replay(compute);
initializeDisk();
assertSame(operation, disk.createSnapshot(SNAPSHOT.getSnapshot()));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testListEmptyZoneOperations() {
ImmutableList<com.google.api.services.compute.model.Operation> operations = ImmutableList.of();
Tuple<String, Iterable<com.google.api.services.compute.model.Operation>> result =
Tuple.<String, Iterable<com.google.api.services.compute.model.Operation>>of(
null, operations);
EasyMock.expect(
computeRpcMock.listZoneOperations(ZONE_OPERATION_ID.getZone(), EMPTY_RPC_OPTIONS))
.andReturn(result);
EasyMock.replay(computeRpcMock);
compute = options.getService();
Page<Operation> page = compute.listZoneOperations(ZONE_OPERATION_ID.getZone());
assertNull(page.getNextPageToken());
assertArrayEquals(operations.toArray(), Iterables.toArray(page.getValues(), Operation.class));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testDetachDisk() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.detachDisk(INSTANCE_ID, "dev0")).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.detachDisk("dev0"));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSetDiskAutodelete() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.setDiskAutoDelete(INSTANCE_ID, "dev0", true)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.setDiskAutoDelete("dev0", true));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testDeleteAccessConfig() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.deleteAccessConfig(INSTANCE_ID, "nic0", "NAT")).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.deleteAccessConfig("nic0", "NAT"));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSetMachineType() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.setMachineType(INSTANCE_ID, MACHINE_TYPE)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.setMachineType(MACHINE_TYPE));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testAddAccessConfig() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
NetworkInterface.AccessConfig accessConfig = NetworkInterface.AccessConfig.of("192.168.1.1");
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.addAccessConfig(INSTANCE_ID, "nic0", accessConfig)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.addAccessConfig("nic0", accessConfig));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSetSchedulingOptions() throws Exception {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
SchedulingOptions schedulingOptions =
SchedulingOptions.standard(true, SchedulingOptions.Maintenance.MIGRATE);
expect(compute.setSchedulingOptions(INSTANCE_ID, schedulingOptions)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.setSchedulingOptions(schedulingOptions));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testDeleteZoneOperation_True() {
EasyMock.expect(
computeRpcMock.deleteZoneOperation(
ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation()))
.andReturn(true);
EasyMock.replay(computeRpcMock);
compute = options.getService();
assertTrue(compute.deleteOperation(ZONE_OPERATION_ID));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testGetZoneOperation_Null() {
EasyMock.expect(
computeRpcMock.getZoneOperation(
ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation(), EMPTY_RPC_OPTIONS))
.andReturn(null);
EasyMock.replay(computeRpcMock);
compute = options.getService();
assertNull(compute.getOperation(ZONE_OPERATION_ID));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testGetZoneOperationWithSelectedFields() {
Capture<Map<ComputeRpc.Option, Object>> capturedOptions = Capture.newInstance();
EasyMock.expect(
computeRpcMock.getZoneOperation(
eq(ZONE_OPERATION_ID.getZone()),
eq(ZONE_OPERATION_ID.getOperation()),
capture(capturedOptions)))
.andReturn(zoneOperation.toPb());
EasyMock.replay(computeRpcMock);
compute = options.getService();
Operation operation = compute.getOperation(ZONE_OPERATION_ID, OPERATION_OPTION_FIELDS);
String selector =
(String) capturedOptions.getValue().get(OPERATION_OPTION_FIELDS.getRpcOption());
assertTrue(selector.contains("selfLink"));
assertTrue(selector.contains("id"));
assertTrue(selector.contains("description"));
assertEquals(23, selector.length());
assertEquals(zoneOperation, operation);
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testDeleteOperation() {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.deleteInstance(INSTANCE_ID)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.delete());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testStartOperation() {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.start(INSTANCE_ID)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.start());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testResetOperation() {
initializeExpectedInstance(2);
expect(compute.getOptions()).andReturn(mockOptions);
Operation operation =
new Operation.Builder(serviceMockReturnsOptions)
.setOperationId(ZoneOperationId.of("project", "op"))
.build();
expect(compute.reset(INSTANCE_ID)).andReturn(operation);
replay(compute);
initializeInstance();
assertSame(operation, instance.reset());
}
是否可以使用 boost::compute 复制自定义结构数组?例如 struct A { float a; }; struct AB { float a; float b; }; BOOST_COM
有谁知道如何在项目上配置的Google Cloud Networks之间移动现有的VM实例?我知道您可以在创建新VM时指定网络,但是似乎没有一种实例化它即可对其进行更改的功能。 任何指针表示赞赏! 保
我正在尝试遵循Google云平台控制台上的教程,以使用Compute Engine创建MongoDB应用程序。我遵循创建虚拟机的教程,但未创建它们,并返回以下错误: 字段“resource.netwo
我想知道是否可以将一个实例的类型更改为另一个实例,例如: n1-standard-1至n1-standard-2 我在文档中没有看到任何内容,但可能是我错过了一些东西。 如果这是不可能的,我该如何处理
我正在尝试让我的GCE实例监听多个IP地址(出于SEO的原因-在同一实例上托管多个低流量站点)。 最终目标:mydomain.com指向IP1,myotherdomain.es指向IP2,GCE实例将
使用scp,我可以添加-r标志以通过ssh将目录下载到本地计算机。 使用时: gcloud compute scp -r 它说“ -r”不是可用选项。 没有-r,我会收到一条错误消息,说我的源路径是一
仅某些IP地址的http负载均衡器存在严重问题。 我在这里还看到了其他一些帖子。我们确保防火墙正常,甚至删除并重新创建了转发规则。自IP更改以来,这非常令人讨厌。 仍然没有喜悦。问题仅影响某些IP地址
我正在尝试删除/删除不再使用的静态IP地址,并且看不到执行此操作的方法。我可以从文档中得到的最接近的是this page,它说: When an instance is stopped, you ca
我每天从台式计算机运行一个简单的任务 3 次。它在下午 4 点、晚上 8 点和凌晨 1 点连接到某个网站,下载少量数据(小于 50mb),并将其存储在硬盘上。每天运行这一点很重要,所以我正在考虑将其转
我是一个关于在Google Compute Engine上联网的问题。 是否可以在您的帐户上设置默认的“源代码/ IP范围”,以便在创建新规则时自动设置此值? 例如,如果我创建此规则: gcloud
我正在尝试使用 POST gcloud CLI 创建一个“带有容器”的 GCE 实例(由 https://www.googleapis.com/compute/v1/projects/{project
我们像这样通过命令行创建实例: gcloud compute instances create instance-name [--stuff otherstuff] --metadata-from-f
在我的本地 macOS 上,以下命令运行良好: $ gcloud source repos clone myrepo --project=myproject (虽然我不确定它是否有效,因为之前我遵循了
在 AWS SDK , EC2实例可以通过 AmazonEC2Client 以编程方式启动.是否GCP一般或Compute Engine特别just offer the CLI-based gclou
我想使用 SparkleShare 在计算机之间同步文件,所以我正在寻找一种方法让 git 存储库在线保存文件。 我正在考虑使用 Google Compute Engine 来托管它们。如果我只为我实
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 4年前关闭。 Improve thi
几周前,我在随意玩弄 Google Cloud Console,并创建了一个 Compute Engine VM。这个过程就像“创建一个虚拟机,命名它,保存”一样简单,就是这样。我现在不需要 Comp
我正在关注 this instruction在 GCE 上设置多个实例或服务器集群。它运行良好,但我不知道如何更新应用程序代码。例如,我有一些错误修复,需要更新代码并重新加载所有实例。无论如何我可以做
我在两个 VM 实例上有一个 node.js 应用程序,我试图通过网络负载平衡来进行负载平衡。为了测试我的服务器是否已启动并提供服务,我在我的应用程序内部监听端口上收到了运行状况检查请求“/healt
如何在GCE中永久设置实例的主机名?我可以通过主机名进行设置,但是重启后它又消失了。 我试图输入元数据(主机名:f.q.d.n),但这没有完成。但是它应该通过元数据(https://github.co
我是一名优秀的程序员,十分优秀!