use of com.google.longrunning.DeleteOperationRequest in project gax-java by googleapis.
the class GrpcLongRunningClientTest method delete.
@Test
public void delete() {
OperationsStub operationsStub = mock(OperationsStub.class);
when(operationsStub.deleteOperationCallable()).thenReturn(new UnaryCallable<DeleteOperationRequest, Empty>() {
@Override
public ApiFuture<Empty> futureCall(DeleteOperationRequest request, ApiCallContext context) {
if (!request.getName().equals("poseidon")) {
return ApiFutures.immediateFailedFuture(new IllegalStateException("Unexpected request: " + request));
} else {
return ApiFutures.immediateFuture(Empty.getDefaultInstance());
}
}
});
LongRunningClient longRunningClient = new GrpcLongRunningClient(operationsStub);
Truth.assertThat(longRunningClient.deleteOperationCallable().call("poseidon")).isNull();
}
use of com.google.longrunning.DeleteOperationRequest in project gax-java by googleapis.
the class OperationsClient method deleteOperation.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a long-running operation. This method indicates that the client is no longer interested
* in the operation result. It does not cancel the operation. If the server doesn't support this
* method, it returns `google.rpc.Code.UNIMPLEMENTED`.
*
* <p>Sample code:
*
* <pre>{@code
* try (OperationsClient operationsClient = OperationsClient.create()) {
* String name = "name3373707";
* operationsClient.deleteOperation(name);
* }
* }</pre>
*
* @param name The name of the operation resource to be deleted.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteOperation(String name) {
DeleteOperationRequest request = DeleteOperationRequest.newBuilder().setName(name).build();
deleteOperation(request);
}
Aggregations