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.AgentsClient.ListLocationsPagedResponse; 20 import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; 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.Agent; 30 import com.google.cloud.dialogflow.v2.DeleteAgentRequest; 31 import com.google.cloud.dialogflow.v2.ExportAgentRequest; 32 import com.google.cloud.dialogflow.v2.ExportAgentResponse; 33 import com.google.cloud.dialogflow.v2.GetAgentRequest; 34 import com.google.cloud.dialogflow.v2.GetValidationResultRequest; 35 import com.google.cloud.dialogflow.v2.ImportAgentRequest; 36 import com.google.cloud.dialogflow.v2.RestoreAgentRequest; 37 import com.google.cloud.dialogflow.v2.SearchAgentsRequest; 38 import com.google.cloud.dialogflow.v2.SearchAgentsResponse; 39 import com.google.cloud.dialogflow.v2.SetAgentRequest; 40 import com.google.cloud.dialogflow.v2.TrainAgentRequest; 41 import com.google.cloud.dialogflow.v2.ValidationResult; 42 import com.google.cloud.location.GetLocationRequest; 43 import com.google.cloud.location.ListLocationsRequest; 44 import com.google.cloud.location.ListLocationsResponse; 45 import com.google.cloud.location.Location; 46 import com.google.common.collect.ImmutableMap; 47 import com.google.longrunning.Operation; 48 import com.google.longrunning.stub.GrpcOperationsStub; 49 import com.google.protobuf.Empty; 50 import com.google.protobuf.Struct; 51 import io.grpc.MethodDescriptor; 52 import io.grpc.protobuf.ProtoUtils; 53 import java.io.IOException; 54 import java.util.concurrent.TimeUnit; 55 import javax.annotation.Generated; 56 57 // AUTO-GENERATED DOCUMENTATION AND CLASS. 58 /** 59 * gRPC stub implementation for the Agents service API. 60 * 61 * <p>This class is for advanced usage and reflects the underlying API directly. 62 */ 63 @Generated("by gapic-generator-java") 64 public class GrpcAgentsStub extends AgentsStub { 65 private static final MethodDescriptor<GetAgentRequest, Agent> getAgentMethodDescriptor = 66 MethodDescriptor.<GetAgentRequest, Agent>newBuilder() 67 .setType(MethodDescriptor.MethodType.UNARY) 68 .setFullMethodName("google.cloud.dialogflow.v2.Agents/GetAgent") 69 .setRequestMarshaller(ProtoUtils.marshaller(GetAgentRequest.getDefaultInstance())) 70 .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) 71 .build(); 72 73 private static final MethodDescriptor<SetAgentRequest, Agent> setAgentMethodDescriptor = 74 MethodDescriptor.<SetAgentRequest, Agent>newBuilder() 75 .setType(MethodDescriptor.MethodType.UNARY) 76 .setFullMethodName("google.cloud.dialogflow.v2.Agents/SetAgent") 77 .setRequestMarshaller(ProtoUtils.marshaller(SetAgentRequest.getDefaultInstance())) 78 .setResponseMarshaller(ProtoUtils.marshaller(Agent.getDefaultInstance())) 79 .build(); 80 81 private static final MethodDescriptor<DeleteAgentRequest, Empty> deleteAgentMethodDescriptor = 82 MethodDescriptor.<DeleteAgentRequest, Empty>newBuilder() 83 .setType(MethodDescriptor.MethodType.UNARY) 84 .setFullMethodName("google.cloud.dialogflow.v2.Agents/DeleteAgent") 85 .setRequestMarshaller(ProtoUtils.marshaller(DeleteAgentRequest.getDefaultInstance())) 86 .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) 87 .build(); 88 89 private static final MethodDescriptor<SearchAgentsRequest, SearchAgentsResponse> 90 searchAgentsMethodDescriptor = 91 MethodDescriptor.<SearchAgentsRequest, SearchAgentsResponse>newBuilder() 92 .setType(MethodDescriptor.MethodType.UNARY) 93 .setFullMethodName("google.cloud.dialogflow.v2.Agents/SearchAgents") 94 .setRequestMarshaller(ProtoUtils.marshaller(SearchAgentsRequest.getDefaultInstance())) 95 .setResponseMarshaller( 96 ProtoUtils.marshaller(SearchAgentsResponse.getDefaultInstance())) 97 .build(); 98 99 private static final MethodDescriptor<TrainAgentRequest, Operation> trainAgentMethodDescriptor = 100 MethodDescriptor.<TrainAgentRequest, Operation>newBuilder() 101 .setType(MethodDescriptor.MethodType.UNARY) 102 .setFullMethodName("google.cloud.dialogflow.v2.Agents/TrainAgent") 103 .setRequestMarshaller(ProtoUtils.marshaller(TrainAgentRequest.getDefaultInstance())) 104 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 105 .build(); 106 107 private static final MethodDescriptor<ExportAgentRequest, Operation> exportAgentMethodDescriptor = 108 MethodDescriptor.<ExportAgentRequest, Operation>newBuilder() 109 .setType(MethodDescriptor.MethodType.UNARY) 110 .setFullMethodName("google.cloud.dialogflow.v2.Agents/ExportAgent") 111 .setRequestMarshaller(ProtoUtils.marshaller(ExportAgentRequest.getDefaultInstance())) 112 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 113 .build(); 114 115 private static final MethodDescriptor<ImportAgentRequest, Operation> importAgentMethodDescriptor = 116 MethodDescriptor.<ImportAgentRequest, Operation>newBuilder() 117 .setType(MethodDescriptor.MethodType.UNARY) 118 .setFullMethodName("google.cloud.dialogflow.v2.Agents/ImportAgent") 119 .setRequestMarshaller(ProtoUtils.marshaller(ImportAgentRequest.getDefaultInstance())) 120 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 121 .build(); 122 123 private static final MethodDescriptor<RestoreAgentRequest, Operation> 124 restoreAgentMethodDescriptor = 125 MethodDescriptor.<RestoreAgentRequest, Operation>newBuilder() 126 .setType(MethodDescriptor.MethodType.UNARY) 127 .setFullMethodName("google.cloud.dialogflow.v2.Agents/RestoreAgent") 128 .setRequestMarshaller(ProtoUtils.marshaller(RestoreAgentRequest.getDefaultInstance())) 129 .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) 130 .build(); 131 132 private static final MethodDescriptor<GetValidationResultRequest, ValidationResult> 133 getValidationResultMethodDescriptor = 134 MethodDescriptor.<GetValidationResultRequest, ValidationResult>newBuilder() 135 .setType(MethodDescriptor.MethodType.UNARY) 136 .setFullMethodName("google.cloud.dialogflow.v2.Agents/GetValidationResult") 137 .setRequestMarshaller( 138 ProtoUtils.marshaller(GetValidationResultRequest.getDefaultInstance())) 139 .setResponseMarshaller(ProtoUtils.marshaller(ValidationResult.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<GetAgentRequest, Agent> getAgentCallable; 162 private final UnaryCallable<SetAgentRequest, Agent> setAgentCallable; 163 private final UnaryCallable<DeleteAgentRequest, Empty> deleteAgentCallable; 164 private final UnaryCallable<SearchAgentsRequest, SearchAgentsResponse> searchAgentsCallable; 165 private final UnaryCallable<SearchAgentsRequest, SearchAgentsPagedResponse> 166 searchAgentsPagedCallable; 167 private final UnaryCallable<TrainAgentRequest, Operation> trainAgentCallable; 168 private final OperationCallable<TrainAgentRequest, Empty, Struct> trainAgentOperationCallable; 169 private final UnaryCallable<ExportAgentRequest, Operation> exportAgentCallable; 170 private final OperationCallable<ExportAgentRequest, ExportAgentResponse, Struct> 171 exportAgentOperationCallable; 172 private final UnaryCallable<ImportAgentRequest, Operation> importAgentCallable; 173 private final OperationCallable<ImportAgentRequest, Empty, Struct> importAgentOperationCallable; 174 private final UnaryCallable<RestoreAgentRequest, Operation> restoreAgentCallable; 175 private final OperationCallable<RestoreAgentRequest, Empty, Struct> restoreAgentOperationCallable; 176 private final UnaryCallable<GetValidationResultRequest, ValidationResult> 177 getValidationResultCallable; 178 private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable; 179 private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> 180 listLocationsPagedCallable; 181 private final UnaryCallable<GetLocationRequest, Location> getLocationCallable; 182 183 private final BackgroundResource backgroundResources; 184 private final GrpcOperationsStub operationsStub; 185 private final GrpcStubCallableFactory callableFactory; 186 create(AgentsStubSettings settings)187 public static final GrpcAgentsStub create(AgentsStubSettings settings) throws IOException { 188 return new GrpcAgentsStub(settings, ClientContext.create(settings)); 189 } 190 create(ClientContext clientContext)191 public static final GrpcAgentsStub create(ClientContext clientContext) throws IOException { 192 return new GrpcAgentsStub(AgentsStubSettings.newBuilder().build(), clientContext); 193 } 194 create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)195 public static final GrpcAgentsStub create( 196 ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { 197 return new GrpcAgentsStub( 198 AgentsStubSettings.newBuilder().build(), clientContext, callableFactory); 199 } 200 201 /** 202 * Constructs an instance of GrpcAgentsStub, using the given settings. This is protected so that 203 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 204 */ GrpcAgentsStub(AgentsStubSettings settings, ClientContext clientContext)205 protected GrpcAgentsStub(AgentsStubSettings settings, ClientContext clientContext) 206 throws IOException { 207 this(settings, clientContext, new GrpcAgentsCallableFactory()); 208 } 209 210 /** 211 * Constructs an instance of GrpcAgentsStub, using the given settings. This is protected so that 212 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 213 */ GrpcAgentsStub( AgentsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)214 protected GrpcAgentsStub( 215 AgentsStubSettings settings, 216 ClientContext clientContext, 217 GrpcStubCallableFactory callableFactory) 218 throws IOException { 219 this.callableFactory = callableFactory; 220 this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); 221 222 GrpcCallSettings<GetAgentRequest, Agent> getAgentTransportSettings = 223 GrpcCallSettings.<GetAgentRequest, Agent>newBuilder() 224 .setMethodDescriptor(getAgentMethodDescriptor) 225 .setParamsExtractor( 226 request -> { 227 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 228 params.put("parent", String.valueOf(request.getParent())); 229 return params.build(); 230 }) 231 .build(); 232 GrpcCallSettings<SetAgentRequest, Agent> setAgentTransportSettings = 233 GrpcCallSettings.<SetAgentRequest, Agent>newBuilder() 234 .setMethodDescriptor(setAgentMethodDescriptor) 235 .setParamsExtractor( 236 request -> { 237 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 238 params.put("agent.parent", String.valueOf(request.getAgent().getParent())); 239 return params.build(); 240 }) 241 .build(); 242 GrpcCallSettings<DeleteAgentRequest, Empty> deleteAgentTransportSettings = 243 GrpcCallSettings.<DeleteAgentRequest, Empty>newBuilder() 244 .setMethodDescriptor(deleteAgentMethodDescriptor) 245 .setParamsExtractor( 246 request -> { 247 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 248 params.put("parent", String.valueOf(request.getParent())); 249 return params.build(); 250 }) 251 .build(); 252 GrpcCallSettings<SearchAgentsRequest, SearchAgentsResponse> searchAgentsTransportSettings = 253 GrpcCallSettings.<SearchAgentsRequest, SearchAgentsResponse>newBuilder() 254 .setMethodDescriptor(searchAgentsMethodDescriptor) 255 .setParamsExtractor( 256 request -> { 257 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 258 params.put("parent", String.valueOf(request.getParent())); 259 return params.build(); 260 }) 261 .build(); 262 GrpcCallSettings<TrainAgentRequest, Operation> trainAgentTransportSettings = 263 GrpcCallSettings.<TrainAgentRequest, Operation>newBuilder() 264 .setMethodDescriptor(trainAgentMethodDescriptor) 265 .setParamsExtractor( 266 request -> { 267 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 268 params.put("parent", String.valueOf(request.getParent())); 269 return params.build(); 270 }) 271 .build(); 272 GrpcCallSettings<ExportAgentRequest, Operation> exportAgentTransportSettings = 273 GrpcCallSettings.<ExportAgentRequest, Operation>newBuilder() 274 .setMethodDescriptor(exportAgentMethodDescriptor) 275 .setParamsExtractor( 276 request -> { 277 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 278 params.put("parent", String.valueOf(request.getParent())); 279 return params.build(); 280 }) 281 .build(); 282 GrpcCallSettings<ImportAgentRequest, Operation> importAgentTransportSettings = 283 GrpcCallSettings.<ImportAgentRequest, Operation>newBuilder() 284 .setMethodDescriptor(importAgentMethodDescriptor) 285 .setParamsExtractor( 286 request -> { 287 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 288 params.put("parent", String.valueOf(request.getParent())); 289 return params.build(); 290 }) 291 .build(); 292 GrpcCallSettings<RestoreAgentRequest, Operation> restoreAgentTransportSettings = 293 GrpcCallSettings.<RestoreAgentRequest, Operation>newBuilder() 294 .setMethodDescriptor(restoreAgentMethodDescriptor) 295 .setParamsExtractor( 296 request -> { 297 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 298 params.put("parent", String.valueOf(request.getParent())); 299 return params.build(); 300 }) 301 .build(); 302 GrpcCallSettings<GetValidationResultRequest, ValidationResult> 303 getValidationResultTransportSettings = 304 GrpcCallSettings.<GetValidationResultRequest, ValidationResult>newBuilder() 305 .setMethodDescriptor(getValidationResultMethodDescriptor) 306 .setParamsExtractor( 307 request -> { 308 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 309 params.put("parent", String.valueOf(request.getParent())); 310 return params.build(); 311 }) 312 .build(); 313 GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings = 314 GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder() 315 .setMethodDescriptor(listLocationsMethodDescriptor) 316 .setParamsExtractor( 317 request -> { 318 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 319 params.put("name", String.valueOf(request.getName())); 320 return params.build(); 321 }) 322 .build(); 323 GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings = 324 GrpcCallSettings.<GetLocationRequest, Location>newBuilder() 325 .setMethodDescriptor(getLocationMethodDescriptor) 326 .setParamsExtractor( 327 request -> { 328 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 329 params.put("name", String.valueOf(request.getName())); 330 return params.build(); 331 }) 332 .build(); 333 334 this.getAgentCallable = 335 callableFactory.createUnaryCallable( 336 getAgentTransportSettings, settings.getAgentSettings(), clientContext); 337 this.setAgentCallable = 338 callableFactory.createUnaryCallable( 339 setAgentTransportSettings, settings.setAgentSettings(), clientContext); 340 this.deleteAgentCallable = 341 callableFactory.createUnaryCallable( 342 deleteAgentTransportSettings, settings.deleteAgentSettings(), clientContext); 343 this.searchAgentsCallable = 344 callableFactory.createUnaryCallable( 345 searchAgentsTransportSettings, settings.searchAgentsSettings(), clientContext); 346 this.searchAgentsPagedCallable = 347 callableFactory.createPagedCallable( 348 searchAgentsTransportSettings, settings.searchAgentsSettings(), clientContext); 349 this.trainAgentCallable = 350 callableFactory.createUnaryCallable( 351 trainAgentTransportSettings, settings.trainAgentSettings(), clientContext); 352 this.trainAgentOperationCallable = 353 callableFactory.createOperationCallable( 354 trainAgentTransportSettings, 355 settings.trainAgentOperationSettings(), 356 clientContext, 357 operationsStub); 358 this.exportAgentCallable = 359 callableFactory.createUnaryCallable( 360 exportAgentTransportSettings, settings.exportAgentSettings(), clientContext); 361 this.exportAgentOperationCallable = 362 callableFactory.createOperationCallable( 363 exportAgentTransportSettings, 364 settings.exportAgentOperationSettings(), 365 clientContext, 366 operationsStub); 367 this.importAgentCallable = 368 callableFactory.createUnaryCallable( 369 importAgentTransportSettings, settings.importAgentSettings(), clientContext); 370 this.importAgentOperationCallable = 371 callableFactory.createOperationCallable( 372 importAgentTransportSettings, 373 settings.importAgentOperationSettings(), 374 clientContext, 375 operationsStub); 376 this.restoreAgentCallable = 377 callableFactory.createUnaryCallable( 378 restoreAgentTransportSettings, settings.restoreAgentSettings(), clientContext); 379 this.restoreAgentOperationCallable = 380 callableFactory.createOperationCallable( 381 restoreAgentTransportSettings, 382 settings.restoreAgentOperationSettings(), 383 clientContext, 384 operationsStub); 385 this.getValidationResultCallable = 386 callableFactory.createUnaryCallable( 387 getValidationResultTransportSettings, 388 settings.getValidationResultSettings(), 389 clientContext); 390 this.listLocationsCallable = 391 callableFactory.createUnaryCallable( 392 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 393 this.listLocationsPagedCallable = 394 callableFactory.createPagedCallable( 395 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 396 this.getLocationCallable = 397 callableFactory.createUnaryCallable( 398 getLocationTransportSettings, settings.getLocationSettings(), clientContext); 399 400 this.backgroundResources = 401 new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 402 } 403 getOperationsStub()404 public GrpcOperationsStub getOperationsStub() { 405 return operationsStub; 406 } 407 408 @Override getAgentCallable()409 public UnaryCallable<GetAgentRequest, Agent> getAgentCallable() { 410 return getAgentCallable; 411 } 412 413 @Override setAgentCallable()414 public UnaryCallable<SetAgentRequest, Agent> setAgentCallable() { 415 return setAgentCallable; 416 } 417 418 @Override deleteAgentCallable()419 public UnaryCallable<DeleteAgentRequest, Empty> deleteAgentCallable() { 420 return deleteAgentCallable; 421 } 422 423 @Override searchAgentsCallable()424 public UnaryCallable<SearchAgentsRequest, SearchAgentsResponse> searchAgentsCallable() { 425 return searchAgentsCallable; 426 } 427 428 @Override searchAgentsPagedCallable()429 public UnaryCallable<SearchAgentsRequest, SearchAgentsPagedResponse> searchAgentsPagedCallable() { 430 return searchAgentsPagedCallable; 431 } 432 433 @Override trainAgentCallable()434 public UnaryCallable<TrainAgentRequest, Operation> trainAgentCallable() { 435 return trainAgentCallable; 436 } 437 438 @Override trainAgentOperationCallable()439 public OperationCallable<TrainAgentRequest, Empty, Struct> trainAgentOperationCallable() { 440 return trainAgentOperationCallable; 441 } 442 443 @Override exportAgentCallable()444 public UnaryCallable<ExportAgentRequest, Operation> exportAgentCallable() { 445 return exportAgentCallable; 446 } 447 448 @Override 449 public OperationCallable<ExportAgentRequest, ExportAgentResponse, Struct> exportAgentOperationCallable()450 exportAgentOperationCallable() { 451 return exportAgentOperationCallable; 452 } 453 454 @Override importAgentCallable()455 public UnaryCallable<ImportAgentRequest, Operation> importAgentCallable() { 456 return importAgentCallable; 457 } 458 459 @Override importAgentOperationCallable()460 public OperationCallable<ImportAgentRequest, Empty, Struct> importAgentOperationCallable() { 461 return importAgentOperationCallable; 462 } 463 464 @Override restoreAgentCallable()465 public UnaryCallable<RestoreAgentRequest, Operation> restoreAgentCallable() { 466 return restoreAgentCallable; 467 } 468 469 @Override restoreAgentOperationCallable()470 public OperationCallable<RestoreAgentRequest, Empty, Struct> restoreAgentOperationCallable() { 471 return restoreAgentOperationCallable; 472 } 473 474 @Override getValidationResultCallable()475 public UnaryCallable<GetValidationResultRequest, ValidationResult> getValidationResultCallable() { 476 return getValidationResultCallable; 477 } 478 479 @Override listLocationsCallable()480 public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 481 return listLocationsCallable; 482 } 483 484 @Override 485 public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()486 listLocationsPagedCallable() { 487 return listLocationsPagedCallable; 488 } 489 490 @Override getLocationCallable()491 public UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 492 return getLocationCallable; 493 } 494 495 @Override close()496 public final void close() { 497 try { 498 backgroundResources.close(); 499 } catch (RuntimeException e) { 500 throw e; 501 } catch (Exception e) { 502 throw new IllegalStateException("Failed to close resource", e); 503 } 504 } 505 506 @Override shutdown()507 public void shutdown() { 508 backgroundResources.shutdown(); 509 } 510 511 @Override isShutdown()512 public boolean isShutdown() { 513 return backgroundResources.isShutdown(); 514 } 515 516 @Override isTerminated()517 public boolean isTerminated() { 518 return backgroundResources.isTerminated(); 519 } 520 521 @Override shutdownNow()522 public void shutdownNow() { 523 backgroundResources.shutdownNow(); 524 } 525 526 @Override awaitTermination(long duration, TimeUnit unit)527 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 528 return backgroundResources.awaitTermination(duration, unit); 529 } 530 } 531