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.compute.v1.stub; 18 19 import static com.google.cloud.compute.v1.LicensesClient.ListPagedResponse; 20 21 import com.google.api.core.BetaApi; 22 import com.google.api.core.InternalApi; 23 import com.google.api.gax.core.BackgroundResource; 24 import com.google.api.gax.core.BackgroundResourceAggregation; 25 import com.google.api.gax.httpjson.ApiMethodDescriptor; 26 import com.google.api.gax.httpjson.HttpJsonCallSettings; 27 import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; 28 import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; 29 import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; 30 import com.google.api.gax.httpjson.ProtoMessageResponseParser; 31 import com.google.api.gax.httpjson.ProtoRestSerializer; 32 import com.google.api.gax.rpc.ClientContext; 33 import com.google.api.gax.rpc.OperationCallable; 34 import com.google.api.gax.rpc.UnaryCallable; 35 import com.google.cloud.compute.v1.DeleteLicenseRequest; 36 import com.google.cloud.compute.v1.GetIamPolicyLicenseRequest; 37 import com.google.cloud.compute.v1.GetLicenseRequest; 38 import com.google.cloud.compute.v1.InsertLicenseRequest; 39 import com.google.cloud.compute.v1.License; 40 import com.google.cloud.compute.v1.LicensesListResponse; 41 import com.google.cloud.compute.v1.ListLicensesRequest; 42 import com.google.cloud.compute.v1.Operation; 43 import com.google.cloud.compute.v1.Operation.Status; 44 import com.google.cloud.compute.v1.Policy; 45 import com.google.cloud.compute.v1.SetIamPolicyLicenseRequest; 46 import com.google.cloud.compute.v1.TestIamPermissionsLicenseRequest; 47 import com.google.cloud.compute.v1.TestPermissionsResponse; 48 import com.google.protobuf.TypeRegistry; 49 import java.io.IOException; 50 import java.util.ArrayList; 51 import java.util.HashMap; 52 import java.util.List; 53 import java.util.Map; 54 import java.util.concurrent.TimeUnit; 55 import javax.annotation.Generated; 56 57 // AUTO-GENERATED DOCUMENTATION AND CLASS. 58 /** 59 * REST stub implementation for the Licenses 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 @BetaApi 65 public class HttpJsonLicensesStub extends LicensesStub { 66 private static final TypeRegistry typeRegistry = 67 TypeRegistry.newBuilder().add(Operation.getDescriptor()).build(); 68 69 private static final ApiMethodDescriptor<DeleteLicenseRequest, Operation> deleteMethodDescriptor = 70 ApiMethodDescriptor.<DeleteLicenseRequest, Operation>newBuilder() 71 .setFullMethodName("google.cloud.compute.v1.Licenses/Delete") 72 .setHttpMethod("DELETE") 73 .setType(ApiMethodDescriptor.MethodType.UNARY) 74 .setRequestFormatter( 75 ProtoMessageRequestFormatter.<DeleteLicenseRequest>newBuilder() 76 .setPath( 77 "/compute/v1/projects/{project}/global/licenses/{license}", 78 request -> { 79 Map<String, String> fields = new HashMap<>(); 80 ProtoRestSerializer<DeleteLicenseRequest> serializer = 81 ProtoRestSerializer.create(); 82 serializer.putPathParam(fields, "license", request.getLicense()); 83 serializer.putPathParam(fields, "project", request.getProject()); 84 return fields; 85 }) 86 .setQueryParamsExtractor( 87 request -> { 88 Map<String, List<String>> fields = new HashMap<>(); 89 ProtoRestSerializer<DeleteLicenseRequest> serializer = 90 ProtoRestSerializer.create(); 91 if (request.hasRequestId()) { 92 serializer.putQueryParam(fields, "requestId", request.getRequestId()); 93 } 94 return fields; 95 }) 96 .setRequestBodyExtractor(request -> null) 97 .build()) 98 .setResponseParser( 99 ProtoMessageResponseParser.<Operation>newBuilder() 100 .setDefaultInstance(Operation.getDefaultInstance()) 101 .setDefaultTypeRegistry(typeRegistry) 102 .build()) 103 .setOperationSnapshotFactory( 104 (DeleteLicenseRequest request, Operation response) -> { 105 StringBuilder opName = new StringBuilder(response.getName()); 106 opName.append(":").append(request.getProject()); 107 return HttpJsonOperationSnapshot.newBuilder() 108 .setName(opName.toString()) 109 .setMetadata(response) 110 .setDone(Status.DONE.equals(response.getStatus())) 111 .setResponse(response) 112 .setError(response.getHttpErrorStatusCode(), response.getHttpErrorMessage()) 113 .build(); 114 }) 115 .build(); 116 117 private static final ApiMethodDescriptor<GetLicenseRequest, License> getMethodDescriptor = 118 ApiMethodDescriptor.<GetLicenseRequest, License>newBuilder() 119 .setFullMethodName("google.cloud.compute.v1.Licenses/Get") 120 .setHttpMethod("GET") 121 .setType(ApiMethodDescriptor.MethodType.UNARY) 122 .setRequestFormatter( 123 ProtoMessageRequestFormatter.<GetLicenseRequest>newBuilder() 124 .setPath( 125 "/compute/v1/projects/{project}/global/licenses/{license}", 126 request -> { 127 Map<String, String> fields = new HashMap<>(); 128 ProtoRestSerializer<GetLicenseRequest> serializer = 129 ProtoRestSerializer.create(); 130 serializer.putPathParam(fields, "license", request.getLicense()); 131 serializer.putPathParam(fields, "project", request.getProject()); 132 return fields; 133 }) 134 .setQueryParamsExtractor( 135 request -> { 136 Map<String, List<String>> fields = new HashMap<>(); 137 ProtoRestSerializer<GetLicenseRequest> serializer = 138 ProtoRestSerializer.create(); 139 return fields; 140 }) 141 .setRequestBodyExtractor(request -> null) 142 .build()) 143 .setResponseParser( 144 ProtoMessageResponseParser.<License>newBuilder() 145 .setDefaultInstance(License.getDefaultInstance()) 146 .setDefaultTypeRegistry(typeRegistry) 147 .build()) 148 .build(); 149 150 private static final ApiMethodDescriptor<GetIamPolicyLicenseRequest, Policy> 151 getIamPolicyMethodDescriptor = 152 ApiMethodDescriptor.<GetIamPolicyLicenseRequest, Policy>newBuilder() 153 .setFullMethodName("google.cloud.compute.v1.Licenses/GetIamPolicy") 154 .setHttpMethod("GET") 155 .setType(ApiMethodDescriptor.MethodType.UNARY) 156 .setRequestFormatter( 157 ProtoMessageRequestFormatter.<GetIamPolicyLicenseRequest>newBuilder() 158 .setPath( 159 "/compute/v1/projects/{project}/global/licenses/{resource}/getIamPolicy", 160 request -> { 161 Map<String, String> fields = new HashMap<>(); 162 ProtoRestSerializer<GetIamPolicyLicenseRequest> serializer = 163 ProtoRestSerializer.create(); 164 serializer.putPathParam(fields, "project", request.getProject()); 165 serializer.putPathParam(fields, "resource", request.getResource()); 166 return fields; 167 }) 168 .setQueryParamsExtractor( 169 request -> { 170 Map<String, List<String>> fields = new HashMap<>(); 171 ProtoRestSerializer<GetIamPolicyLicenseRequest> serializer = 172 ProtoRestSerializer.create(); 173 if (request.hasOptionsRequestedPolicyVersion()) { 174 serializer.putQueryParam( 175 fields, 176 "optionsRequestedPolicyVersion", 177 request.getOptionsRequestedPolicyVersion()); 178 } 179 return fields; 180 }) 181 .setRequestBodyExtractor(request -> null) 182 .build()) 183 .setResponseParser( 184 ProtoMessageResponseParser.<Policy>newBuilder() 185 .setDefaultInstance(Policy.getDefaultInstance()) 186 .setDefaultTypeRegistry(typeRegistry) 187 .build()) 188 .build(); 189 190 private static final ApiMethodDescriptor<InsertLicenseRequest, Operation> insertMethodDescriptor = 191 ApiMethodDescriptor.<InsertLicenseRequest, Operation>newBuilder() 192 .setFullMethodName("google.cloud.compute.v1.Licenses/Insert") 193 .setHttpMethod("POST") 194 .setType(ApiMethodDescriptor.MethodType.UNARY) 195 .setRequestFormatter( 196 ProtoMessageRequestFormatter.<InsertLicenseRequest>newBuilder() 197 .setPath( 198 "/compute/v1/projects/{project}/global/licenses", 199 request -> { 200 Map<String, String> fields = new HashMap<>(); 201 ProtoRestSerializer<InsertLicenseRequest> serializer = 202 ProtoRestSerializer.create(); 203 serializer.putPathParam(fields, "project", request.getProject()); 204 return fields; 205 }) 206 .setQueryParamsExtractor( 207 request -> { 208 Map<String, List<String>> fields = new HashMap<>(); 209 ProtoRestSerializer<InsertLicenseRequest> serializer = 210 ProtoRestSerializer.create(); 211 if (request.hasRequestId()) { 212 serializer.putQueryParam(fields, "requestId", request.getRequestId()); 213 } 214 return fields; 215 }) 216 .setRequestBodyExtractor( 217 request -> 218 ProtoRestSerializer.create() 219 .toBody("licenseResource", request.getLicenseResource(), false)) 220 .build()) 221 .setResponseParser( 222 ProtoMessageResponseParser.<Operation>newBuilder() 223 .setDefaultInstance(Operation.getDefaultInstance()) 224 .setDefaultTypeRegistry(typeRegistry) 225 .build()) 226 .setOperationSnapshotFactory( 227 (InsertLicenseRequest request, Operation response) -> { 228 StringBuilder opName = new StringBuilder(response.getName()); 229 opName.append(":").append(request.getProject()); 230 return HttpJsonOperationSnapshot.newBuilder() 231 .setName(opName.toString()) 232 .setMetadata(response) 233 .setDone(Status.DONE.equals(response.getStatus())) 234 .setResponse(response) 235 .setError(response.getHttpErrorStatusCode(), response.getHttpErrorMessage()) 236 .build(); 237 }) 238 .build(); 239 240 private static final ApiMethodDescriptor<ListLicensesRequest, LicensesListResponse> 241 listMethodDescriptor = 242 ApiMethodDescriptor.<ListLicensesRequest, LicensesListResponse>newBuilder() 243 .setFullMethodName("google.cloud.compute.v1.Licenses/List") 244 .setHttpMethod("GET") 245 .setType(ApiMethodDescriptor.MethodType.UNARY) 246 .setRequestFormatter( 247 ProtoMessageRequestFormatter.<ListLicensesRequest>newBuilder() 248 .setPath( 249 "/compute/v1/projects/{project}/global/licenses", 250 request -> { 251 Map<String, String> fields = new HashMap<>(); 252 ProtoRestSerializer<ListLicensesRequest> serializer = 253 ProtoRestSerializer.create(); 254 serializer.putPathParam(fields, "project", request.getProject()); 255 return fields; 256 }) 257 .setQueryParamsExtractor( 258 request -> { 259 Map<String, List<String>> fields = new HashMap<>(); 260 ProtoRestSerializer<ListLicensesRequest> serializer = 261 ProtoRestSerializer.create(); 262 if (request.hasFilter()) { 263 serializer.putQueryParam(fields, "filter", request.getFilter()); 264 } 265 if (request.hasMaxResults()) { 266 serializer.putQueryParam( 267 fields, "maxResults", request.getMaxResults()); 268 } 269 if (request.hasOrderBy()) { 270 serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); 271 } 272 if (request.hasPageToken()) { 273 serializer.putQueryParam(fields, "pageToken", request.getPageToken()); 274 } 275 if (request.hasReturnPartialSuccess()) { 276 serializer.putQueryParam( 277 fields, 278 "returnPartialSuccess", 279 request.getReturnPartialSuccess()); 280 } 281 return fields; 282 }) 283 .setRequestBodyExtractor(request -> null) 284 .build()) 285 .setResponseParser( 286 ProtoMessageResponseParser.<LicensesListResponse>newBuilder() 287 .setDefaultInstance(LicensesListResponse.getDefaultInstance()) 288 .setDefaultTypeRegistry(typeRegistry) 289 .build()) 290 .build(); 291 292 private static final ApiMethodDescriptor<SetIamPolicyLicenseRequest, Policy> 293 setIamPolicyMethodDescriptor = 294 ApiMethodDescriptor.<SetIamPolicyLicenseRequest, Policy>newBuilder() 295 .setFullMethodName("google.cloud.compute.v1.Licenses/SetIamPolicy") 296 .setHttpMethod("POST") 297 .setType(ApiMethodDescriptor.MethodType.UNARY) 298 .setRequestFormatter( 299 ProtoMessageRequestFormatter.<SetIamPolicyLicenseRequest>newBuilder() 300 .setPath( 301 "/compute/v1/projects/{project}/global/licenses/{resource}/setIamPolicy", 302 request -> { 303 Map<String, String> fields = new HashMap<>(); 304 ProtoRestSerializer<SetIamPolicyLicenseRequest> serializer = 305 ProtoRestSerializer.create(); 306 serializer.putPathParam(fields, "project", request.getProject()); 307 serializer.putPathParam(fields, "resource", request.getResource()); 308 return fields; 309 }) 310 .setQueryParamsExtractor( 311 request -> { 312 Map<String, List<String>> fields = new HashMap<>(); 313 ProtoRestSerializer<SetIamPolicyLicenseRequest> serializer = 314 ProtoRestSerializer.create(); 315 return fields; 316 }) 317 .setRequestBodyExtractor( 318 request -> 319 ProtoRestSerializer.create() 320 .toBody( 321 "globalSetPolicyRequestResource", 322 request.getGlobalSetPolicyRequestResource(), 323 false)) 324 .build()) 325 .setResponseParser( 326 ProtoMessageResponseParser.<Policy>newBuilder() 327 .setDefaultInstance(Policy.getDefaultInstance()) 328 .setDefaultTypeRegistry(typeRegistry) 329 .build()) 330 .build(); 331 332 private static final ApiMethodDescriptor< 333 TestIamPermissionsLicenseRequest, TestPermissionsResponse> 334 testIamPermissionsMethodDescriptor = 335 ApiMethodDescriptor 336 .<TestIamPermissionsLicenseRequest, TestPermissionsResponse>newBuilder() 337 .setFullMethodName("google.cloud.compute.v1.Licenses/TestIamPermissions") 338 .setHttpMethod("POST") 339 .setType(ApiMethodDescriptor.MethodType.UNARY) 340 .setRequestFormatter( 341 ProtoMessageRequestFormatter.<TestIamPermissionsLicenseRequest>newBuilder() 342 .setPath( 343 "/compute/v1/projects/{project}/global/licenses/{resource}/testIamPermissions", 344 request -> { 345 Map<String, String> fields = new HashMap<>(); 346 ProtoRestSerializer<TestIamPermissionsLicenseRequest> serializer = 347 ProtoRestSerializer.create(); 348 serializer.putPathParam(fields, "project", request.getProject()); 349 serializer.putPathParam(fields, "resource", request.getResource()); 350 return fields; 351 }) 352 .setQueryParamsExtractor( 353 request -> { 354 Map<String, List<String>> fields = new HashMap<>(); 355 ProtoRestSerializer<TestIamPermissionsLicenseRequest> serializer = 356 ProtoRestSerializer.create(); 357 return fields; 358 }) 359 .setRequestBodyExtractor( 360 request -> 361 ProtoRestSerializer.create() 362 .toBody( 363 "testPermissionsRequestResource", 364 request.getTestPermissionsRequestResource(), 365 false)) 366 .build()) 367 .setResponseParser( 368 ProtoMessageResponseParser.<TestPermissionsResponse>newBuilder() 369 .setDefaultInstance(TestPermissionsResponse.getDefaultInstance()) 370 .setDefaultTypeRegistry(typeRegistry) 371 .build()) 372 .build(); 373 374 private final UnaryCallable<DeleteLicenseRequest, Operation> deleteCallable; 375 private final OperationCallable<DeleteLicenseRequest, Operation, Operation> 376 deleteOperationCallable; 377 private final UnaryCallable<GetLicenseRequest, License> getCallable; 378 private final UnaryCallable<GetIamPolicyLicenseRequest, Policy> getIamPolicyCallable; 379 private final UnaryCallable<InsertLicenseRequest, Operation> insertCallable; 380 private final OperationCallable<InsertLicenseRequest, Operation, Operation> 381 insertOperationCallable; 382 private final UnaryCallable<ListLicensesRequest, LicensesListResponse> listCallable; 383 private final UnaryCallable<ListLicensesRequest, ListPagedResponse> listPagedCallable; 384 private final UnaryCallable<SetIamPolicyLicenseRequest, Policy> setIamPolicyCallable; 385 private final UnaryCallable<TestIamPermissionsLicenseRequest, TestPermissionsResponse> 386 testIamPermissionsCallable; 387 388 private final BackgroundResource backgroundResources; 389 private final HttpJsonGlobalOperationsStub httpJsonOperationsStub; 390 private final HttpJsonStubCallableFactory callableFactory; 391 create(LicensesStubSettings settings)392 public static final HttpJsonLicensesStub create(LicensesStubSettings settings) 393 throws IOException { 394 return new HttpJsonLicensesStub(settings, ClientContext.create(settings)); 395 } 396 create(ClientContext clientContext)397 public static final HttpJsonLicensesStub create(ClientContext clientContext) throws IOException { 398 return new HttpJsonLicensesStub(LicensesStubSettings.newBuilder().build(), clientContext); 399 } 400 create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory)401 public static final HttpJsonLicensesStub create( 402 ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { 403 return new HttpJsonLicensesStub( 404 LicensesStubSettings.newBuilder().build(), clientContext, callableFactory); 405 } 406 407 /** 408 * Constructs an instance of HttpJsonLicensesStub, using the given settings. This is protected so 409 * that it is easy to make a subclass, but otherwise, the static factory methods should be 410 * preferred. 411 */ HttpJsonLicensesStub(LicensesStubSettings settings, ClientContext clientContext)412 protected HttpJsonLicensesStub(LicensesStubSettings settings, ClientContext clientContext) 413 throws IOException { 414 this(settings, clientContext, new HttpJsonLicensesCallableFactory()); 415 } 416 417 /** 418 * Constructs an instance of HttpJsonLicensesStub, using the given settings. This is protected so 419 * that it is easy to make a subclass, but otherwise, the static factory methods should be 420 * preferred. 421 */ HttpJsonLicensesStub( LicensesStubSettings settings, ClientContext clientContext, HttpJsonStubCallableFactory callableFactory)422 protected HttpJsonLicensesStub( 423 LicensesStubSettings settings, 424 ClientContext clientContext, 425 HttpJsonStubCallableFactory callableFactory) 426 throws IOException { 427 this.callableFactory = callableFactory; 428 this.httpJsonOperationsStub = 429 HttpJsonGlobalOperationsStub.create(clientContext, callableFactory); 430 431 HttpJsonCallSettings<DeleteLicenseRequest, Operation> deleteTransportSettings = 432 HttpJsonCallSettings.<DeleteLicenseRequest, Operation>newBuilder() 433 .setMethodDescriptor(deleteMethodDescriptor) 434 .setTypeRegistry(typeRegistry) 435 .build(); 436 HttpJsonCallSettings<GetLicenseRequest, License> getTransportSettings = 437 HttpJsonCallSettings.<GetLicenseRequest, License>newBuilder() 438 .setMethodDescriptor(getMethodDescriptor) 439 .setTypeRegistry(typeRegistry) 440 .build(); 441 HttpJsonCallSettings<GetIamPolicyLicenseRequest, Policy> getIamPolicyTransportSettings = 442 HttpJsonCallSettings.<GetIamPolicyLicenseRequest, Policy>newBuilder() 443 .setMethodDescriptor(getIamPolicyMethodDescriptor) 444 .setTypeRegistry(typeRegistry) 445 .build(); 446 HttpJsonCallSettings<InsertLicenseRequest, Operation> insertTransportSettings = 447 HttpJsonCallSettings.<InsertLicenseRequest, Operation>newBuilder() 448 .setMethodDescriptor(insertMethodDescriptor) 449 .setTypeRegistry(typeRegistry) 450 .build(); 451 HttpJsonCallSettings<ListLicensesRequest, LicensesListResponse> listTransportSettings = 452 HttpJsonCallSettings.<ListLicensesRequest, LicensesListResponse>newBuilder() 453 .setMethodDescriptor(listMethodDescriptor) 454 .setTypeRegistry(typeRegistry) 455 .build(); 456 HttpJsonCallSettings<SetIamPolicyLicenseRequest, Policy> setIamPolicyTransportSettings = 457 HttpJsonCallSettings.<SetIamPolicyLicenseRequest, Policy>newBuilder() 458 .setMethodDescriptor(setIamPolicyMethodDescriptor) 459 .setTypeRegistry(typeRegistry) 460 .build(); 461 HttpJsonCallSettings<TestIamPermissionsLicenseRequest, TestPermissionsResponse> 462 testIamPermissionsTransportSettings = 463 HttpJsonCallSettings 464 .<TestIamPermissionsLicenseRequest, TestPermissionsResponse>newBuilder() 465 .setMethodDescriptor(testIamPermissionsMethodDescriptor) 466 .setTypeRegistry(typeRegistry) 467 .build(); 468 469 this.deleteCallable = 470 callableFactory.createUnaryCallable( 471 deleteTransportSettings, settings.deleteSettings(), clientContext); 472 this.deleteOperationCallable = 473 callableFactory.createOperationCallable( 474 deleteTransportSettings, 475 settings.deleteOperationSettings(), 476 clientContext, 477 httpJsonOperationsStub); 478 this.getCallable = 479 callableFactory.createUnaryCallable( 480 getTransportSettings, settings.getSettings(), clientContext); 481 this.getIamPolicyCallable = 482 callableFactory.createUnaryCallable( 483 getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); 484 this.insertCallable = 485 callableFactory.createUnaryCallable( 486 insertTransportSettings, settings.insertSettings(), clientContext); 487 this.insertOperationCallable = 488 callableFactory.createOperationCallable( 489 insertTransportSettings, 490 settings.insertOperationSettings(), 491 clientContext, 492 httpJsonOperationsStub); 493 this.listCallable = 494 callableFactory.createUnaryCallable( 495 listTransportSettings, settings.listSettings(), clientContext); 496 this.listPagedCallable = 497 callableFactory.createPagedCallable( 498 listTransportSettings, settings.listSettings(), clientContext); 499 this.setIamPolicyCallable = 500 callableFactory.createUnaryCallable( 501 setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); 502 this.testIamPermissionsCallable = 503 callableFactory.createUnaryCallable( 504 testIamPermissionsTransportSettings, 505 settings.testIamPermissionsSettings(), 506 clientContext); 507 508 this.backgroundResources = 509 new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 510 } 511 512 @InternalApi getMethodDescriptors()513 public static List<ApiMethodDescriptor> getMethodDescriptors() { 514 List<ApiMethodDescriptor> methodDescriptors = new ArrayList<>(); 515 methodDescriptors.add(deleteMethodDescriptor); 516 methodDescriptors.add(getMethodDescriptor); 517 methodDescriptors.add(getIamPolicyMethodDescriptor); 518 methodDescriptors.add(insertMethodDescriptor); 519 methodDescriptors.add(listMethodDescriptor); 520 methodDescriptors.add(setIamPolicyMethodDescriptor); 521 methodDescriptors.add(testIamPermissionsMethodDescriptor); 522 return methodDescriptors; 523 } 524 525 @Override deleteCallable()526 public UnaryCallable<DeleteLicenseRequest, Operation> deleteCallable() { 527 return deleteCallable; 528 } 529 530 @Override deleteOperationCallable()531 public OperationCallable<DeleteLicenseRequest, Operation, Operation> deleteOperationCallable() { 532 return deleteOperationCallable; 533 } 534 535 @Override getCallable()536 public UnaryCallable<GetLicenseRequest, License> getCallable() { 537 return getCallable; 538 } 539 540 @Override getIamPolicyCallable()541 public UnaryCallable<GetIamPolicyLicenseRequest, Policy> getIamPolicyCallable() { 542 return getIamPolicyCallable; 543 } 544 545 @Override insertCallable()546 public UnaryCallable<InsertLicenseRequest, Operation> insertCallable() { 547 return insertCallable; 548 } 549 550 @Override insertOperationCallable()551 public OperationCallable<InsertLicenseRequest, Operation, Operation> insertOperationCallable() { 552 return insertOperationCallable; 553 } 554 555 @Override listCallable()556 public UnaryCallable<ListLicensesRequest, LicensesListResponse> listCallable() { 557 return listCallable; 558 } 559 560 @Override listPagedCallable()561 public UnaryCallable<ListLicensesRequest, ListPagedResponse> listPagedCallable() { 562 return listPagedCallable; 563 } 564 565 @Override setIamPolicyCallable()566 public UnaryCallable<SetIamPolicyLicenseRequest, Policy> setIamPolicyCallable() { 567 return setIamPolicyCallable; 568 } 569 570 @Override 571 public UnaryCallable<TestIamPermissionsLicenseRequest, TestPermissionsResponse> testIamPermissionsCallable()572 testIamPermissionsCallable() { 573 return testIamPermissionsCallable; 574 } 575 576 @Override close()577 public final void close() { 578 try { 579 backgroundResources.close(); 580 } catch (RuntimeException e) { 581 throw e; 582 } catch (Exception e) { 583 throw new IllegalStateException("Failed to close resource", e); 584 } 585 } 586 587 @Override shutdown()588 public void shutdown() { 589 backgroundResources.shutdown(); 590 } 591 592 @Override isShutdown()593 public boolean isShutdown() { 594 return backgroundResources.isShutdown(); 595 } 596 597 @Override isTerminated()598 public boolean isTerminated() { 599 return backgroundResources.isTerminated(); 600 } 601 602 @Override shutdownNow()603 public void shutdownNow() { 604 backgroundResources.shutdownNow(); 605 } 606 607 @Override awaitTermination(long duration, TimeUnit unit)608 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 609 return backgroundResources.awaitTermination(duration, unit); 610 } 611 } 612