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