本文整理了Java中com.google.cloud.compute.v1.ZoneOperationClient.deleteZoneOperation()
方法的一些代码示例,展示了ZoneOperationClient.deleteZoneOperation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOperationClient.deleteZoneOperation()
方法的具体详情如下:
包路径:com.google.cloud.compute.v1.ZoneOperationClient
类名称:ZoneOperationClient
方法名:deleteZoneOperation
[英]Deletes the specified zone-specific Operations resource.
Sample code:
try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
DeleteZoneOperationHttpRequest request = DeleteZoneOperationHttpRequest.newBuilder()
.setOperation(operation.toString())
.build();
zoneOperationClient.deleteZoneOperation(request);
}
[中]删除指定的特定于区域的操作资源。
示例代码:
try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
DeleteZoneOperationHttpRequest request = DeleteZoneOperationHttpRequest.newBuilder()
.setOperation(operation.toString())
.build();
zoneOperationClient.deleteZoneOperation(request);
}
代码示例来源:origin: googleapis/google-cloud-java
/**
* Deletes the specified zone-specific Operations resource.
*
* <p>Sample code:
*
* <pre><code>
* try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
* ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
* zoneOperationClient.deleteZoneOperation(operation.toString());
* }
* </code></pre>
*
* @param operation Name of the Operations resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi
public final void deleteZoneOperation(String operation) {
DeleteZoneOperationHttpRequest request =
DeleteZoneOperationHttpRequest.newBuilder().setOperation(operation).build();
deleteZoneOperation(request);
}
代码示例来源:origin: googleapis/google-cloud-java
/**
* Deletes the specified zone-specific Operations resource.
*
* <p>Sample code:
*
* <pre><code>
* try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
* ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
* zoneOperationClient.deleteZoneOperation(operation);
* }
* </code></pre>
*
* @param operation Name of the Operations resource to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi
public final void deleteZoneOperation(ProjectZoneOperationName operation) {
DeleteZoneOperationHttpRequest request =
DeleteZoneOperationHttpRequest.newBuilder()
.setOperation(operation == null ? null : operation.toString())
.build();
deleteZoneOperation(request);
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
@SuppressWarnings("all")
public void deleteZoneOperationTest() {
mockService.addNullResponse();
ProjectZoneOperationName operation =
ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
client.deleteZoneOperation(operation);
List<String> actualRequests = mockService.getRequestPaths();
Assert.assertEquals(1, actualRequests.size());
String apiClientHeaderKey =
mockService
.getRequestHeaders()
.get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
.iterator()
.next();
Assert.assertTrue(
GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
.matcher(apiClientHeaderKey)
.matches());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
@SuppressWarnings("all")
public void deleteZoneOperationExceptionTest() throws Exception {
ApiException exception =
ApiExceptionFactory.createException(
new Exception(), FakeStatusCode.of(Code.INVALID_ARGUMENT), false);
mockService.addException(exception);
try {
ProjectZoneOperationName operation =
ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
client.deleteZoneOperation(operation);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
}
}
内容来源于网络,如有侵权,请联系作者删除!