1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.cloud.dialogflow.v2.stub; 18 19 import static com.google.cloud.dialogflow.v2.DocumentsClient.ListDocumentsPagedResponse; 20 import static com.google.cloud.dialogflow.v2.DocumentsClient.ListLocationsPagedResponse; 21 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.core.BackgroundResourceAggregation; 24 import com.google.api.gax.grpc.GrpcCallSettings; 25 import com.google.api.gax.grpc.GrpcStubCallableFactory; 26 import com.google.api.gax.rpc.ClientContext; 27 import com.google.api.gax.rpc.OperationCallable; 28 import com.google.api.gax.rpc.UnaryCallable; 29 import com.google.cloud.dialogflow.v2.CreateDocumentRequest; 30 import com.google.cloud.dialogflow.v2.DeleteDocumentRequest; 31 import com.google.cloud.dialogflow.v2.Document; 32 import com.google.cloud.dialogflow.v2.ExportDocumentRequest; 33 import com.google.cloud.dialogflow.v2.GetDocumentRequest; 34 import com.google.cloud.dialogflow.v2.ImportDocumentsRequest; 35 import com.google.cloud.dialogflow.v2.ImportDocumentsResponse; 36 import com.google.cloud.dialogflow.v2.KnowledgeOperationMetadata; 37 import com.google.cloud.dialogflow.v2.ListDocumentsRequest; 38 import com.google.cloud.dialogflow.v2.ListDocumentsResponse; 39 import com.google.cloud.dialogflow.v2.ReloadDocumentRequest; 40 import com.google.cloud.dialogflow.v2.UpdateDocumentRequest; 41 import com.google.cloud.location.GetLocationRequest; 42 import com.google.cloud.location.ListLocationsRequest; 43 import com.google.cloud.location.ListLocationsResponse; 44 import com.google.cloud.location.Location; 45 import com.google.common.collect.ImmutableMap; 46 import com.google.longrunning.Operation; 47 import com.google.longrunning.stub.GrpcOperationsStub; 48 import com.google.protobuf.Empty; 49 import io.grpc.MethodDescriptor; 50 import io.grpc.protobuf.ProtoUtils; 51 import java.io.IOException; 52 import java.util.concurrent.TimeUnit; 53 import javax.annotation.Generated; 54 55 // AUTO-GENERATED DOCUMENTATION AND CLASS. 56 /** 57 * gRPC stub implementation for the Documents service API. 58 * 59 * <p>This class is for advanced usage and reflects the underlying API directly. 60 */ 61 @Generated("by gapic-generator-java") 62 public class GrpcDocumentsStub extends DocumentsStub { 63 private static final MethodDescriptor<ListDocumentsRequest, ListDocumentsResponse> 64 listDocumentsMethodDescriptor = 65 MethodDescriptor.<ListDocumentsRequest, ListDocumentsResponse>newBuilder() 66 .setType(MethodDescriptor.MethodType.UNARY) 67 .setFullMethodName("google.cloud.dialogflow.v2.Documents/ListDocuments") 68 .setRequestMarshaller( 69 ProtoUtils.marshaller(ListDocumentsRequest.getDefaultInstance())) 70 .setResponseMarshaller( 71 ProtoUtils.marshaller(ListDocumentsResponse.getDefaultInstance())) 72 .build(); 73 74 private static final MethodDescriptor<GetDocumentRequest, Document> getDocumentMethodDescriptor = 75 MethodDescriptor.<GetDocumentRequest, Document>newBuilder() 76 .setType(MethodDescriptor.MethodType.UNARY) 77 .setFullMethodName("google.cloud.dialogflow.v2.Documents/GetDocument") 78 .setRequestMarshaller(ProtoUtils.marshaller(GetDocumentRequest.getDefaultInstance())) 79 .setResponseMarshaller(ProtoUtils.marshaller(Document.getDefaultInstance())) 80 .build(); 81 82 private static final MethodDescriptor<CreateDocumentRequest, Operation> 83 createDocumentMethodDescriptor = 84 MethodDescriptor.<CreateDocumentRequest, Operation>newBuilder() 85 .setType(MethodDescriptor.MethodType.UNARY) 86 .setFullMethodName("google.cloud.dialogflow.v2.Documents/CreateDocument") 87 .setRequestMarshaller( 88 ProtoUtils.marshaller(CreateDocumentRequest.getDefaultInstance())) 89 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 90 .build(); 91 92 private static final MethodDescriptor<ImportDocumentsRequest, Operation> 93 importDocumentsMethodDescriptor = 94 MethodDescriptor.<ImportDocumentsRequest, Operation>newBuilder() 95 .setType(MethodDescriptor.MethodType.UNARY) 96 .setFullMethodName("google.cloud.dialogflow.v2.Documents/ImportDocuments") 97 .setRequestMarshaller( 98 ProtoUtils.marshaller(ImportDocumentsRequest.getDefaultInstance())) 99 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 100 .build(); 101 102 private static final MethodDescriptor<DeleteDocumentRequest, Operation> 103 deleteDocumentMethodDescriptor = 104 MethodDescriptor.<DeleteDocumentRequest, Operation>newBuilder() 105 .setType(MethodDescriptor.MethodType.UNARY) 106 .setFullMethodName("google.cloud.dialogflow.v2.Documents/DeleteDocument") 107 .setRequestMarshaller( 108 ProtoUtils.marshaller(DeleteDocumentRequest.getDefaultInstance())) 109 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 110 .build(); 111 112 private static final MethodDescriptor<UpdateDocumentRequest, Operation> 113 updateDocumentMethodDescriptor = 114 MethodDescriptor.<UpdateDocumentRequest, Operation>newBuilder() 115 .setType(MethodDescriptor.MethodType.UNARY) 116 .setFullMethodName("google.cloud.dialogflow.v2.Documents/UpdateDocument") 117 .setRequestMarshaller( 118 ProtoUtils.marshaller(UpdateDocumentRequest.getDefaultInstance())) 119 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 120 .build(); 121 122 private static final MethodDescriptor<ReloadDocumentRequest, Operation> 123 reloadDocumentMethodDescriptor = 124 MethodDescriptor.<ReloadDocumentRequest, Operation>newBuilder() 125 .setType(MethodDescriptor.MethodType.UNARY) 126 .setFullMethodName("google.cloud.dialogflow.v2.Documents/ReloadDocument") 127 .setRequestMarshaller( 128 ProtoUtils.marshaller(ReloadDocumentRequest.getDefaultInstance())) 129 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 130 .build(); 131 132 private static final MethodDescriptor<ExportDocumentRequest, Operation> 133 exportDocumentMethodDescriptor = 134 MethodDescriptor.<ExportDocumentRequest, Operation>newBuilder() 135 .setType(MethodDescriptor.MethodType.UNARY) 136 .setFullMethodName("google.cloud.dialogflow.v2.Documents/ExportDocument") 137 .setRequestMarshaller( 138 ProtoUtils.marshaller(ExportDocumentRequest.getDefaultInstance())) 139 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 140 .build(); 141 142 private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse> 143 listLocationsMethodDescriptor = 144 MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder() 145 .setType(MethodDescriptor.MethodType.UNARY) 146 .setFullMethodName("google.cloud.location.Locations/ListLocations") 147 .setRequestMarshaller( 148 ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) 149 .setResponseMarshaller( 150 ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) 151 .build(); 152 153 private static final MethodDescriptor<GetLocationRequest, Location> getLocationMethodDescriptor = 154 MethodDescriptor.<GetLocationRequest, Location>newBuilder() 155 .setType(MethodDescriptor.MethodType.UNARY) 156 .setFullMethodName("google.cloud.location.Locations/GetLocation") 157 .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) 158 .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) 159 .build(); 160 161 private final UnaryCallable<ListDocumentsRequest, ListDocumentsResponse> listDocumentsCallable; 162 private final UnaryCallable<ListDocumentsRequest, ListDocumentsPagedResponse> 163 listDocumentsPagedCallable; 164 private final UnaryCallable<GetDocumentRequest, Document> getDocumentCallable; 165 private final UnaryCallable<CreateDocumentRequest, Operation> createDocumentCallable; 166 private final OperationCallable<CreateDocumentRequest, Document, KnowledgeOperationMetadata> 167 createDocumentOperationCallable; 168 private final UnaryCallable<ImportDocumentsRequest, Operation> importDocumentsCallable; 169 private final OperationCallable< 170 ImportDocumentsRequest, ImportDocumentsResponse, KnowledgeOperationMetadata> 171 importDocumentsOperationCallable; 172 private final UnaryCallable<DeleteDocumentRequest, Operation> deleteDocumentCallable; 173 private final OperationCallable<DeleteDocumentRequest, Empty, KnowledgeOperationMetadata> 174 deleteDocumentOperationCallable; 175 private final UnaryCallable<UpdateDocumentRequest, Operation> updateDocumentCallable; 176 private final OperationCallable<UpdateDocumentRequest, Document, KnowledgeOperationMetadata> 177 updateDocumentOperationCallable; 178 private final UnaryCallable<ReloadDocumentRequest, Operation> reloadDocumentCallable; 179 private final OperationCallable<ReloadDocumentRequest, Document, KnowledgeOperationMetadata> 180 reloadDocumentOperationCallable; 181 private final UnaryCallable<ExportDocumentRequest, Operation> exportDocumentCallable; 182 private final OperationCallable<ExportDocumentRequest, Document, KnowledgeOperationMetadata> 183 exportDocumentOperationCallable; 184 private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable; 185 private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> 186 listLocationsPagedCallable; 187 private final UnaryCallable<GetLocationRequest, Location> getLocationCallable; 188 189 private final BackgroundResource backgroundResources; 190 private final GrpcOperationsStub operationsStub; 191 private final GrpcStubCallableFactory callableFactory; 192 create(DocumentsStubSettings settings)193 public static final GrpcDocumentsStub create(DocumentsStubSettings settings) throws IOException { 194 return new GrpcDocumentsStub(settings, ClientContext.create(settings)); 195 } 196 create(ClientContext clientContext)197 public static final GrpcDocumentsStub create(ClientContext clientContext) throws IOException { 198 return new GrpcDocumentsStub(DocumentsStubSettings.newBuilder().build(), clientContext); 199 } 200 create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)201 public static final GrpcDocumentsStub create( 202 ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { 203 return new GrpcDocumentsStub( 204 DocumentsStubSettings.newBuilder().build(), clientContext, callableFactory); 205 } 206 207 /** 208 * Constructs an instance of GrpcDocumentsStub, using the given settings. This is protected so 209 * that it is easy to make a subclass, but otherwise, the static factory methods should be 210 * preferred. 211 */ GrpcDocumentsStub(DocumentsStubSettings settings, ClientContext clientContext)212 protected GrpcDocumentsStub(DocumentsStubSettings settings, ClientContext clientContext) 213 throws IOException { 214 this(settings, clientContext, new GrpcDocumentsCallableFactory()); 215 } 216 217 /** 218 * Constructs an instance of GrpcDocumentsStub, using the given settings. This is protected so 219 * that it is easy to make a subclass, but otherwise, the static factory methods should be 220 * preferred. 221 */ GrpcDocumentsStub( DocumentsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)222 protected GrpcDocumentsStub( 223 DocumentsStubSettings settings, 224 ClientContext clientContext, 225 GrpcStubCallableFactory callableFactory) 226 throws IOException { 227 this.callableFactory = callableFactory; 228 this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); 229 230 GrpcCallSettings<ListDocumentsRequest, ListDocumentsResponse> listDocumentsTransportSettings = 231 GrpcCallSettings.<ListDocumentsRequest, ListDocumentsResponse>newBuilder() 232 .setMethodDescriptor(listDocumentsMethodDescriptor) 233 .setParamsExtractor( 234 request -> { 235 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 236 params.put("parent", String.valueOf(request.getParent())); 237 return params.build(); 238 }) 239 .build(); 240 GrpcCallSettings<GetDocumentRequest, Document> getDocumentTransportSettings = 241 GrpcCallSettings.<GetDocumentRequest, Document>newBuilder() 242 .setMethodDescriptor(getDocumentMethodDescriptor) 243 .setParamsExtractor( 244 request -> { 245 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 246 params.put("name", String.valueOf(request.getName())); 247 return params.build(); 248 }) 249 .build(); 250 GrpcCallSettings<CreateDocumentRequest, Operation> createDocumentTransportSettings = 251 GrpcCallSettings.<CreateDocumentRequest, Operation>newBuilder() 252 .setMethodDescriptor(createDocumentMethodDescriptor) 253 .setParamsExtractor( 254 request -> { 255 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 256 params.put("parent", String.valueOf(request.getParent())); 257 return params.build(); 258 }) 259 .build(); 260 GrpcCallSettings<ImportDocumentsRequest, Operation> importDocumentsTransportSettings = 261 GrpcCallSettings.<ImportDocumentsRequest, Operation>newBuilder() 262 .setMethodDescriptor(importDocumentsMethodDescriptor) 263 .setParamsExtractor( 264 request -> { 265 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 266 params.put("parent", String.valueOf(request.getParent())); 267 return params.build(); 268 }) 269 .build(); 270 GrpcCallSettings<DeleteDocumentRequest, Operation> deleteDocumentTransportSettings = 271 GrpcCallSettings.<DeleteDocumentRequest, Operation>newBuilder() 272 .setMethodDescriptor(deleteDocumentMethodDescriptor) 273 .setParamsExtractor( 274 request -> { 275 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 276 params.put("name", String.valueOf(request.getName())); 277 return params.build(); 278 }) 279 .build(); 280 GrpcCallSettings<UpdateDocumentRequest, Operation> updateDocumentTransportSettings = 281 GrpcCallSettings.<UpdateDocumentRequest, Operation>newBuilder() 282 .setMethodDescriptor(updateDocumentMethodDescriptor) 283 .setParamsExtractor( 284 request -> { 285 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 286 params.put("document.name", String.valueOf(request.getDocument().getName())); 287 return params.build(); 288 }) 289 .build(); 290 GrpcCallSettings<ReloadDocumentRequest, Operation> reloadDocumentTransportSettings = 291 GrpcCallSettings.<ReloadDocumentRequest, Operation>newBuilder() 292 .setMethodDescriptor(reloadDocumentMethodDescriptor) 293 .setParamsExtractor( 294 request -> { 295 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 296 params.put("name", String.valueOf(request.getName())); 297 return params.build(); 298 }) 299 .build(); 300 GrpcCallSettings<ExportDocumentRequest, Operation> exportDocumentTransportSettings = 301 GrpcCallSettings.<ExportDocumentRequest, Operation>newBuilder() 302 .setMethodDescriptor(exportDocumentMethodDescriptor) 303 .setParamsExtractor( 304 request -> { 305 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 306 params.put("name", String.valueOf(request.getName())); 307 return params.build(); 308 }) 309 .build(); 310 GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings = 311 GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder() 312 .setMethodDescriptor(listLocationsMethodDescriptor) 313 .setParamsExtractor( 314 request -> { 315 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 316 params.put("name", String.valueOf(request.getName())); 317 return params.build(); 318 }) 319 .build(); 320 GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings = 321 GrpcCallSettings.<GetLocationRequest, Location>newBuilder() 322 .setMethodDescriptor(getLocationMethodDescriptor) 323 .setParamsExtractor( 324 request -> { 325 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 326 params.put("name", String.valueOf(request.getName())); 327 return params.build(); 328 }) 329 .build(); 330 331 this.listDocumentsCallable = 332 callableFactory.createUnaryCallable( 333 listDocumentsTransportSettings, settings.listDocumentsSettings(), clientContext); 334 this.listDocumentsPagedCallable = 335 callableFactory.createPagedCallable( 336 listDocumentsTransportSettings, settings.listDocumentsSettings(), clientContext); 337 this.getDocumentCallable = 338 callableFactory.createUnaryCallable( 339 getDocumentTransportSettings, settings.getDocumentSettings(), clientContext); 340 this.createDocumentCallable = 341 callableFactory.createUnaryCallable( 342 createDocumentTransportSettings, settings.createDocumentSettings(), clientContext); 343 this.createDocumentOperationCallable = 344 callableFactory.createOperationCallable( 345 createDocumentTransportSettings, 346 settings.createDocumentOperationSettings(), 347 clientContext, 348 operationsStub); 349 this.importDocumentsCallable = 350 callableFactory.createUnaryCallable( 351 importDocumentsTransportSettings, settings.importDocumentsSettings(), clientContext); 352 this.importDocumentsOperationCallable = 353 callableFactory.createOperationCallable( 354 importDocumentsTransportSettings, 355 settings.importDocumentsOperationSettings(), 356 clientContext, 357 operationsStub); 358 this.deleteDocumentCallable = 359 callableFactory.createUnaryCallable( 360 deleteDocumentTransportSettings, settings.deleteDocumentSettings(), clientContext); 361 this.deleteDocumentOperationCallable = 362 callableFactory.createOperationCallable( 363 deleteDocumentTransportSettings, 364 settings.deleteDocumentOperationSettings(), 365 clientContext, 366 operationsStub); 367 this.updateDocumentCallable = 368 callableFactory.createUnaryCallable( 369 updateDocumentTransportSettings, settings.updateDocumentSettings(), clientContext); 370 this.updateDocumentOperationCallable = 371 callableFactory.createOperationCallable( 372 updateDocumentTransportSettings, 373 settings.updateDocumentOperationSettings(), 374 clientContext, 375 operationsStub); 376 this.reloadDocumentCallable = 377 callableFactory.createUnaryCallable( 378 reloadDocumentTransportSettings, settings.reloadDocumentSettings(), clientContext); 379 this.reloadDocumentOperationCallable = 380 callableFactory.createOperationCallable( 381 reloadDocumentTransportSettings, 382 settings.reloadDocumentOperationSettings(), 383 clientContext, 384 operationsStub); 385 this.exportDocumentCallable = 386 callableFactory.createUnaryCallable( 387 exportDocumentTransportSettings, settings.exportDocumentSettings(), clientContext); 388 this.exportDocumentOperationCallable = 389 callableFactory.createOperationCallable( 390 exportDocumentTransportSettings, 391 settings.exportDocumentOperationSettings(), 392 clientContext, 393 operationsStub); 394 this.listLocationsCallable = 395 callableFactory.createUnaryCallable( 396 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 397 this.listLocationsPagedCallable = 398 callableFactory.createPagedCallable( 399 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 400 this.getLocationCallable = 401 callableFactory.createUnaryCallable( 402 getLocationTransportSettings, settings.getLocationSettings(), clientContext); 403 404 this.backgroundResources = 405 new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 406 } 407 getOperationsStub()408 public GrpcOperationsStub getOperationsStub() { 409 return operationsStub; 410 } 411 412 @Override listDocumentsCallable()413 public UnaryCallable<ListDocumentsRequest, ListDocumentsResponse> listDocumentsCallable() { 414 return listDocumentsCallable; 415 } 416 417 @Override 418 public UnaryCallable<ListDocumentsRequest, ListDocumentsPagedResponse> listDocumentsPagedCallable()419 listDocumentsPagedCallable() { 420 return listDocumentsPagedCallable; 421 } 422 423 @Override getDocumentCallable()424 public UnaryCallable<GetDocumentRequest, Document> getDocumentCallable() { 425 return getDocumentCallable; 426 } 427 428 @Override createDocumentCallable()429 public UnaryCallable<CreateDocumentRequest, Operation> createDocumentCallable() { 430 return createDocumentCallable; 431 } 432 433 @Override 434 public OperationCallable<CreateDocumentRequest, Document, KnowledgeOperationMetadata> createDocumentOperationCallable()435 createDocumentOperationCallable() { 436 return createDocumentOperationCallable; 437 } 438 439 @Override importDocumentsCallable()440 public UnaryCallable<ImportDocumentsRequest, Operation> importDocumentsCallable() { 441 return importDocumentsCallable; 442 } 443 444 @Override 445 public OperationCallable< 446 ImportDocumentsRequest, ImportDocumentsResponse, KnowledgeOperationMetadata> importDocumentsOperationCallable()447 importDocumentsOperationCallable() { 448 return importDocumentsOperationCallable; 449 } 450 451 @Override deleteDocumentCallable()452 public UnaryCallable<DeleteDocumentRequest, Operation> deleteDocumentCallable() { 453 return deleteDocumentCallable; 454 } 455 456 @Override 457 public OperationCallable<DeleteDocumentRequest, Empty, KnowledgeOperationMetadata> deleteDocumentOperationCallable()458 deleteDocumentOperationCallable() { 459 return deleteDocumentOperationCallable; 460 } 461 462 @Override updateDocumentCallable()463 public UnaryCallable<UpdateDocumentRequest, Operation> updateDocumentCallable() { 464 return updateDocumentCallable; 465 } 466 467 @Override 468 public OperationCallable<UpdateDocumentRequest, Document, KnowledgeOperationMetadata> updateDocumentOperationCallable()469 updateDocumentOperationCallable() { 470 return updateDocumentOperationCallable; 471 } 472 473 @Override reloadDocumentCallable()474 public UnaryCallable<ReloadDocumentRequest, Operation> reloadDocumentCallable() { 475 return reloadDocumentCallable; 476 } 477 478 @Override 479 public OperationCallable<ReloadDocumentRequest, Document, KnowledgeOperationMetadata> reloadDocumentOperationCallable()480 reloadDocumentOperationCallable() { 481 return reloadDocumentOperationCallable; 482 } 483 484 @Override exportDocumentCallable()485 public UnaryCallable<ExportDocumentRequest, Operation> exportDocumentCallable() { 486 return exportDocumentCallable; 487 } 488 489 @Override 490 public OperationCallable<ExportDocumentRequest, Document, KnowledgeOperationMetadata> exportDocumentOperationCallable()491 exportDocumentOperationCallable() { 492 return exportDocumentOperationCallable; 493 } 494 495 @Override listLocationsCallable()496 public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 497 return listLocationsCallable; 498 } 499 500 @Override 501 public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()502 listLocationsPagedCallable() { 503 return listLocationsPagedCallable; 504 } 505 506 @Override getLocationCallable()507 public UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 508 return getLocationCallable; 509 } 510 511 @Override close()512 public final void close() { 513 try { 514 backgroundResources.close(); 515 } catch (RuntimeException e) { 516 throw e; 517 } catch (Exception e) { 518 throw new IllegalStateException("Failed to close resource", e); 519 } 520 } 521 522 @Override shutdown()523 public void shutdown() { 524 backgroundResources.shutdown(); 525 } 526 527 @Override isShutdown()528 public boolean isShutdown() { 529 return backgroundResources.isShutdown(); 530 } 531 532 @Override isTerminated()533 public boolean isTerminated() { 534 return backgroundResources.isTerminated(); 535 } 536 537 @Override shutdownNow()538 public void shutdownNow() { 539 backgroundResources.shutdownNow(); 540 } 541 542 @Override awaitTermination(long duration, TimeUnit unit)543 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 544 return backgroundResources.awaitTermination(duration, unit); 545 } 546 } 547