use of com.google.logging.v2.DeleteViewRequest in project gapic-generator-java by googleapis.
the class ConfigClientTest method deleteViewExceptionTest.
@Test
public void deleteViewExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
DeleteViewRequest request = DeleteViewRequest.newBuilder().setName(LogViewName.ofProjectLocationBucketViewName("[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]").toString()).build();
client.deleteView(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.logging.v2.DeleteViewRequest in project gapic-generator-java by googleapis.
the class AsyncDeleteView method asyncDeleteView.
public static void asyncDeleteView() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
DeleteViewRequest request = DeleteViewRequest.newBuilder().setName(LogViewName.ofProjectLocationBucketViewName("[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]").toString()).build();
ApiFuture<Empty> future = configClient.deleteViewCallable().futureCall(request);
// Do something.
future.get();
}
}
use of com.google.logging.v2.DeleteViewRequest in project gapic-generator-java by googleapis.
the class SyncDeleteView method syncDeleteView.
public static void syncDeleteView() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
DeleteViewRequest request = DeleteViewRequest.newBuilder().setName(LogViewName.ofProjectLocationBucketViewName("[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]").toString()).build();
configClient.deleteView(request);
}
}
use of com.google.logging.v2.DeleteViewRequest in project java-logging by googleapis.
the class ConfigClientTest method deleteViewExceptionTest.
@Test
public void deleteViewExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
DeleteViewRequest request = DeleteViewRequest.newBuilder().setName(LogViewName.ofProjectLocationBucketViewName("[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]").toString()).build();
client.deleteView(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.logging.v2.DeleteViewRequest in project java-logging by googleapis.
the class ConfigClientTest method deleteViewTest.
@Test
public void deleteViewTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
DeleteViewRequest request = DeleteViewRequest.newBuilder().setName(LogViewName.ofProjectLocationBucketViewName("[PROJECT]", "[LOCATION]", "[BUCKET]", "[VIEW]").toString()).build();
client.deleteView(request);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteViewRequest actualRequest = ((DeleteViewRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations