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; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.longrunning.OperationFuture; 24 import com.google.api.gax.paging.AbstractFixedSizeCollection; 25 import com.google.api.gax.paging.AbstractPage; 26 import com.google.api.gax.paging.AbstractPagedListResponse; 27 import com.google.api.gax.rpc.OperationCallable; 28 import com.google.api.gax.rpc.PageContext; 29 import com.google.api.gax.rpc.UnaryCallable; 30 import com.google.cloud.compute.v1.stub.NodeTemplatesStub; 31 import com.google.cloud.compute.v1.stub.NodeTemplatesStubSettings; 32 import com.google.common.util.concurrent.MoreExecutors; 33 import java.io.IOException; 34 import java.util.List; 35 import java.util.Map; 36 import java.util.concurrent.TimeUnit; 37 import javax.annotation.Generated; 38 39 // AUTO-GENERATED DOCUMENTATION AND CLASS. 40 /** 41 * Service Description: The NodeTemplates API. 42 * 43 * <p>This class provides the ability to make remote calls to the backing service through method 44 * calls that map to API methods. Sample code to get started: 45 * 46 * <pre>{@code 47 * // This snippet has been automatically generated and should be regarded as a code template only. 48 * // It will require modifications to work: 49 * // - It may require correct/in-range values for request initialization. 50 * // - It may require specifying regional endpoints when creating the service client as shown in 51 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 52 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 53 * String project = "project-309310695"; 54 * String region = "region-934795532"; 55 * String nodeTemplate = "nodeTemplate2118368412"; 56 * NodeTemplate response = nodeTemplatesClient.get(project, region, nodeTemplate); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the NodeTemplatesClient object to clean up resources such 61 * as threads. In the example above, try-with-resources is used, which automatically calls close(). 62 * 63 * <p>The surface of this class includes several types of Java methods for each of the API's 64 * methods: 65 * 66 * <ol> 67 * <li>A "flattened" method. With this type of method, the fields of the request type have been 68 * converted into function parameters. It may be the case that not all fields are available as 69 * parameters, and not every API method will have a flattened method entry point. 70 * <li>A "request object" method. This type of method only takes one parameter, a request object, 71 * which must be constructed before the call. Not every API method will have a request object 72 * method. 73 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 74 * callable object, which can be used to initiate calls to the service. 75 * </ol> 76 * 77 * <p>See the individual methods for example code. 78 * 79 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 80 * these names, this class includes a format method for each type of name, and additionally a parse 81 * method to extract the individual identifiers contained within names that are returned. 82 * 83 * <p>This class can be customized by passing in a custom instance of NodeTemplatesSettings to 84 * create(). For example: 85 * 86 * <p>To customize credentials: 87 * 88 * <pre>{@code 89 * // This snippet has been automatically generated and should be regarded as a code template only. 90 * // It will require modifications to work: 91 * // - It may require correct/in-range values for request initialization. 92 * // - It may require specifying regional endpoints when creating the service client as shown in 93 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 94 * NodeTemplatesSettings nodeTemplatesSettings = 95 * NodeTemplatesSettings.newBuilder() 96 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 97 * .build(); 98 * NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create(nodeTemplatesSettings); 99 * }</pre> 100 * 101 * <p>To customize the endpoint: 102 * 103 * <pre>{@code 104 * // This snippet has been automatically generated and should be regarded as a code template only. 105 * // It will require modifications to work: 106 * // - It may require correct/in-range values for request initialization. 107 * // - It may require specifying regional endpoints when creating the service client as shown in 108 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 109 * NodeTemplatesSettings nodeTemplatesSettings = 110 * NodeTemplatesSettings.newBuilder().setEndpoint(myEndpoint).build(); 111 * NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create(nodeTemplatesSettings); 112 * }</pre> 113 * 114 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 115 */ 116 @Generated("by gapic-generator-java") 117 public class NodeTemplatesClient implements BackgroundResource { 118 private final NodeTemplatesSettings settings; 119 private final NodeTemplatesStub stub; 120 121 /** Constructs an instance of NodeTemplatesClient with default settings. */ create()122 public static final NodeTemplatesClient create() throws IOException { 123 return create(NodeTemplatesSettings.newBuilder().build()); 124 } 125 126 /** 127 * Constructs an instance of NodeTemplatesClient, using the given settings. The channels are 128 * created based on the settings passed in, or defaults for any settings that are not set. 129 */ create(NodeTemplatesSettings settings)130 public static final NodeTemplatesClient create(NodeTemplatesSettings settings) 131 throws IOException { 132 return new NodeTemplatesClient(settings); 133 } 134 135 /** 136 * Constructs an instance of NodeTemplatesClient, using the given stub for making calls. This is 137 * for advanced usage - prefer using create(NodeTemplatesSettings). 138 */ create(NodeTemplatesStub stub)139 public static final NodeTemplatesClient create(NodeTemplatesStub stub) { 140 return new NodeTemplatesClient(stub); 141 } 142 143 /** 144 * Constructs an instance of NodeTemplatesClient, using the given settings. This is protected so 145 * that it is easy to make a subclass, but otherwise, the static factory methods should be 146 * preferred. 147 */ NodeTemplatesClient(NodeTemplatesSettings settings)148 protected NodeTemplatesClient(NodeTemplatesSettings settings) throws IOException { 149 this.settings = settings; 150 this.stub = ((NodeTemplatesStubSettings) settings.getStubSettings()).createStub(); 151 } 152 NodeTemplatesClient(NodeTemplatesStub stub)153 protected NodeTemplatesClient(NodeTemplatesStub stub) { 154 this.settings = null; 155 this.stub = stub; 156 } 157 getSettings()158 public final NodeTemplatesSettings getSettings() { 159 return settings; 160 } 161 getStub()162 public NodeTemplatesStub getStub() { 163 return stub; 164 } 165 166 // AUTO-GENERATED DOCUMENTATION AND METHOD. 167 /** 168 * Retrieves an aggregated list of node templates. 169 * 170 * <p>Sample code: 171 * 172 * <pre>{@code 173 * // This snippet has been automatically generated and should be regarded as a code template only. 174 * // It will require modifications to work: 175 * // - It may require correct/in-range values for request initialization. 176 * // - It may require specifying regional endpoints when creating the service client as shown in 177 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 178 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 179 * String project = "project-309310695"; 180 * for (Map.Entry<String, NodeTemplatesScopedList> element : 181 * nodeTemplatesClient.aggregatedList(project).iterateAll()) { 182 * // doThingsWith(element); 183 * } 184 * } 185 * }</pre> 186 * 187 * @param project Project ID for this request. 188 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 189 */ aggregatedList(String project)190 public final AggregatedListPagedResponse aggregatedList(String project) { 191 AggregatedListNodeTemplatesRequest request = 192 AggregatedListNodeTemplatesRequest.newBuilder().setProject(project).build(); 193 return aggregatedList(request); 194 } 195 196 // AUTO-GENERATED DOCUMENTATION AND METHOD. 197 /** 198 * Retrieves an aggregated list of node templates. 199 * 200 * <p>Sample code: 201 * 202 * <pre>{@code 203 * // This snippet has been automatically generated and should be regarded as a code template only. 204 * // It will require modifications to work: 205 * // - It may require correct/in-range values for request initialization. 206 * // - It may require specifying regional endpoints when creating the service client as shown in 207 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 208 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 209 * AggregatedListNodeTemplatesRequest request = 210 * AggregatedListNodeTemplatesRequest.newBuilder() 211 * .setFilter("filter-1274492040") 212 * .setIncludeAllScopes(true) 213 * .setMaxResults(1128457243) 214 * .setOrderBy("orderBy-1207110587") 215 * .setPageToken("pageToken873572522") 216 * .setProject("project-309310695") 217 * .setReturnPartialSuccess(true) 218 * .build(); 219 * for (Map.Entry<String, NodeTemplatesScopedList> element : 220 * nodeTemplatesClient.aggregatedList(request).iterateAll()) { 221 * // doThingsWith(element); 222 * } 223 * } 224 * }</pre> 225 * 226 * @param request The request object containing all of the parameters for the API call. 227 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 228 */ aggregatedList( AggregatedListNodeTemplatesRequest request)229 public final AggregatedListPagedResponse aggregatedList( 230 AggregatedListNodeTemplatesRequest request) { 231 return aggregatedListPagedCallable().call(request); 232 } 233 234 // AUTO-GENERATED DOCUMENTATION AND METHOD. 235 /** 236 * Retrieves an aggregated list of node templates. 237 * 238 * <p>Sample code: 239 * 240 * <pre>{@code 241 * // This snippet has been automatically generated and should be regarded as a code template only. 242 * // It will require modifications to work: 243 * // - It may require correct/in-range values for request initialization. 244 * // - It may require specifying regional endpoints when creating the service client as shown in 245 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 246 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 247 * AggregatedListNodeTemplatesRequest request = 248 * AggregatedListNodeTemplatesRequest.newBuilder() 249 * .setFilter("filter-1274492040") 250 * .setIncludeAllScopes(true) 251 * .setMaxResults(1128457243) 252 * .setOrderBy("orderBy-1207110587") 253 * .setPageToken("pageToken873572522") 254 * .setProject("project-309310695") 255 * .setReturnPartialSuccess(true) 256 * .build(); 257 * ApiFuture<Map.Entry<String, NodeTemplatesScopedList>> future = 258 * nodeTemplatesClient.aggregatedListPagedCallable().futureCall(request); 259 * // Do something. 260 * for (Map.Entry<String, NodeTemplatesScopedList> element : future.get().iterateAll()) { 261 * // doThingsWith(element); 262 * } 263 * } 264 * }</pre> 265 */ 266 public final UnaryCallable<AggregatedListNodeTemplatesRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()267 aggregatedListPagedCallable() { 268 return stub.aggregatedListPagedCallable(); 269 } 270 271 // AUTO-GENERATED DOCUMENTATION AND METHOD. 272 /** 273 * Retrieves an aggregated list of node templates. 274 * 275 * <p>Sample code: 276 * 277 * <pre>{@code 278 * // This snippet has been automatically generated and should be regarded as a code template only. 279 * // It will require modifications to work: 280 * // - It may require correct/in-range values for request initialization. 281 * // - It may require specifying regional endpoints when creating the service client as shown in 282 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 283 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 284 * AggregatedListNodeTemplatesRequest request = 285 * AggregatedListNodeTemplatesRequest.newBuilder() 286 * .setFilter("filter-1274492040") 287 * .setIncludeAllScopes(true) 288 * .setMaxResults(1128457243) 289 * .setOrderBy("orderBy-1207110587") 290 * .setPageToken("pageToken873572522") 291 * .setProject("project-309310695") 292 * .setReturnPartialSuccess(true) 293 * .build(); 294 * while (true) { 295 * NodeTemplateAggregatedList response = 296 * nodeTemplatesClient.aggregatedListCallable().call(request); 297 * for (Map.Entry<String, NodeTemplatesScopedList> element : response.getItemsList()) { 298 * // doThingsWith(element); 299 * } 300 * String nextPageToken = response.getNextPageToken(); 301 * if (!Strings.isNullOrEmpty(nextPageToken)) { 302 * request = request.toBuilder().setPageToken(nextPageToken).build(); 303 * } else { 304 * break; 305 * } 306 * } 307 * } 308 * }</pre> 309 */ 310 public final UnaryCallable<AggregatedListNodeTemplatesRequest, NodeTemplateAggregatedList> aggregatedListCallable()311 aggregatedListCallable() { 312 return stub.aggregatedListCallable(); 313 } 314 315 // AUTO-GENERATED DOCUMENTATION AND METHOD. 316 /** 317 * Deletes the specified NodeTemplate resource. 318 * 319 * <p>Sample code: 320 * 321 * <pre>{@code 322 * // This snippet has been automatically generated and should be regarded as a code template only. 323 * // It will require modifications to work: 324 * // - It may require correct/in-range values for request initialization. 325 * // - It may require specifying regional endpoints when creating the service client as shown in 326 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 327 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 328 * String project = "project-309310695"; 329 * String region = "region-934795532"; 330 * String nodeTemplate = "nodeTemplate2118368412"; 331 * Operation response = nodeTemplatesClient.deleteAsync(project, region, nodeTemplate).get(); 332 * } 333 * }</pre> 334 * 335 * @param project Project ID for this request. 336 * @param region The name of the region for this request. 337 * @param nodeTemplate Name of the NodeTemplate resource to delete. 338 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 339 */ deleteAsync( String project, String region, String nodeTemplate)340 public final OperationFuture<Operation, Operation> deleteAsync( 341 String project, String region, String nodeTemplate) { 342 DeleteNodeTemplateRequest request = 343 DeleteNodeTemplateRequest.newBuilder() 344 .setProject(project) 345 .setRegion(region) 346 .setNodeTemplate(nodeTemplate) 347 .build(); 348 return deleteAsync(request); 349 } 350 351 // AUTO-GENERATED DOCUMENTATION AND METHOD. 352 /** 353 * Deletes the specified NodeTemplate resource. 354 * 355 * <p>Sample code: 356 * 357 * <pre>{@code 358 * // This snippet has been automatically generated and should be regarded as a code template only. 359 * // It will require modifications to work: 360 * // - It may require correct/in-range values for request initialization. 361 * // - It may require specifying regional endpoints when creating the service client as shown in 362 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 363 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 364 * DeleteNodeTemplateRequest request = 365 * DeleteNodeTemplateRequest.newBuilder() 366 * .setNodeTemplate("nodeTemplate2118368412") 367 * .setProject("project-309310695") 368 * .setRegion("region-934795532") 369 * .setRequestId("requestId693933066") 370 * .build(); 371 * Operation response = nodeTemplatesClient.deleteAsync(request).get(); 372 * } 373 * }</pre> 374 * 375 * @param request The request object containing all of the parameters for the API call. 376 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 377 */ 378 @BetaApi( 379 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync( DeleteNodeTemplateRequest request)380 public final OperationFuture<Operation, Operation> deleteAsync( 381 DeleteNodeTemplateRequest request) { 382 return deleteOperationCallable().futureCall(request); 383 } 384 385 // AUTO-GENERATED DOCUMENTATION AND METHOD. 386 /** 387 * Deletes the specified NodeTemplate resource. 388 * 389 * <p>Sample code: 390 * 391 * <pre>{@code 392 * // This snippet has been automatically generated and should be regarded as a code template only. 393 * // It will require modifications to work: 394 * // - It may require correct/in-range values for request initialization. 395 * // - It may require specifying regional endpoints when creating the service client as shown in 396 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 397 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 398 * DeleteNodeTemplateRequest request = 399 * DeleteNodeTemplateRequest.newBuilder() 400 * .setNodeTemplate("nodeTemplate2118368412") 401 * .setProject("project-309310695") 402 * .setRegion("region-934795532") 403 * .setRequestId("requestId693933066") 404 * .build(); 405 * OperationFuture<Operation, Operation> future = 406 * nodeTemplatesClient.deleteOperationCallable().futureCall(request); 407 * // Do something. 408 * Operation response = future.get(); 409 * } 410 * }</pre> 411 */ 412 public final OperationCallable<DeleteNodeTemplateRequest, Operation, Operation> deleteOperationCallable()413 deleteOperationCallable() { 414 return stub.deleteOperationCallable(); 415 } 416 417 // AUTO-GENERATED DOCUMENTATION AND METHOD. 418 /** 419 * Deletes the specified NodeTemplate resource. 420 * 421 * <p>Sample code: 422 * 423 * <pre>{@code 424 * // This snippet has been automatically generated and should be regarded as a code template only. 425 * // It will require modifications to work: 426 * // - It may require correct/in-range values for request initialization. 427 * // - It may require specifying regional endpoints when creating the service client as shown in 428 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 429 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 430 * DeleteNodeTemplateRequest request = 431 * DeleteNodeTemplateRequest.newBuilder() 432 * .setNodeTemplate("nodeTemplate2118368412") 433 * .setProject("project-309310695") 434 * .setRegion("region-934795532") 435 * .setRequestId("requestId693933066") 436 * .build(); 437 * ApiFuture<Operation> future = nodeTemplatesClient.deleteCallable().futureCall(request); 438 * // Do something. 439 * Operation response = future.get(); 440 * } 441 * }</pre> 442 */ deleteCallable()443 public final UnaryCallable<DeleteNodeTemplateRequest, Operation> deleteCallable() { 444 return stub.deleteCallable(); 445 } 446 447 // AUTO-GENERATED DOCUMENTATION AND METHOD. 448 /** 449 * Returns the specified node template. 450 * 451 * <p>Sample code: 452 * 453 * <pre>{@code 454 * // This snippet has been automatically generated and should be regarded as a code template only. 455 * // It will require modifications to work: 456 * // - It may require correct/in-range values for request initialization. 457 * // - It may require specifying regional endpoints when creating the service client as shown in 458 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 459 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 460 * String project = "project-309310695"; 461 * String region = "region-934795532"; 462 * String nodeTemplate = "nodeTemplate2118368412"; 463 * NodeTemplate response = nodeTemplatesClient.get(project, region, nodeTemplate); 464 * } 465 * }</pre> 466 * 467 * @param project Project ID for this request. 468 * @param region The name of the region for this request. 469 * @param nodeTemplate Name of the node template to return. 470 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 471 */ get(String project, String region, String nodeTemplate)472 public final NodeTemplate get(String project, String region, String nodeTemplate) { 473 GetNodeTemplateRequest request = 474 GetNodeTemplateRequest.newBuilder() 475 .setProject(project) 476 .setRegion(region) 477 .setNodeTemplate(nodeTemplate) 478 .build(); 479 return get(request); 480 } 481 482 // AUTO-GENERATED DOCUMENTATION AND METHOD. 483 /** 484 * Returns the specified node template. 485 * 486 * <p>Sample code: 487 * 488 * <pre>{@code 489 * // This snippet has been automatically generated and should be regarded as a code template only. 490 * // It will require modifications to work: 491 * // - It may require correct/in-range values for request initialization. 492 * // - It may require specifying regional endpoints when creating the service client as shown in 493 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 494 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 495 * GetNodeTemplateRequest request = 496 * GetNodeTemplateRequest.newBuilder() 497 * .setNodeTemplate("nodeTemplate2118368412") 498 * .setProject("project-309310695") 499 * .setRegion("region-934795532") 500 * .build(); 501 * NodeTemplate response = nodeTemplatesClient.get(request); 502 * } 503 * }</pre> 504 * 505 * @param request The request object containing all of the parameters for the API call. 506 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 507 */ get(GetNodeTemplateRequest request)508 public final NodeTemplate get(GetNodeTemplateRequest request) { 509 return getCallable().call(request); 510 } 511 512 // AUTO-GENERATED DOCUMENTATION AND METHOD. 513 /** 514 * Returns the specified node template. 515 * 516 * <p>Sample code: 517 * 518 * <pre>{@code 519 * // This snippet has been automatically generated and should be regarded as a code template only. 520 * // It will require modifications to work: 521 * // - It may require correct/in-range values for request initialization. 522 * // - It may require specifying regional endpoints when creating the service client as shown in 523 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 524 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 525 * GetNodeTemplateRequest request = 526 * GetNodeTemplateRequest.newBuilder() 527 * .setNodeTemplate("nodeTemplate2118368412") 528 * .setProject("project-309310695") 529 * .setRegion("region-934795532") 530 * .build(); 531 * ApiFuture<NodeTemplate> future = nodeTemplatesClient.getCallable().futureCall(request); 532 * // Do something. 533 * NodeTemplate response = future.get(); 534 * } 535 * }</pre> 536 */ getCallable()537 public final UnaryCallable<GetNodeTemplateRequest, NodeTemplate> getCallable() { 538 return stub.getCallable(); 539 } 540 541 // AUTO-GENERATED DOCUMENTATION AND METHOD. 542 /** 543 * Gets the access control policy for a resource. May be empty if no such policy or resource 544 * exists. 545 * 546 * <p>Sample code: 547 * 548 * <pre>{@code 549 * // This snippet has been automatically generated and should be regarded as a code template only. 550 * // It will require modifications to work: 551 * // - It may require correct/in-range values for request initialization. 552 * // - It may require specifying regional endpoints when creating the service client as shown in 553 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 554 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 555 * String project = "project-309310695"; 556 * String region = "region-934795532"; 557 * String resource = "resource-341064690"; 558 * Policy response = nodeTemplatesClient.getIamPolicy(project, region, resource); 559 * } 560 * }</pre> 561 * 562 * @param project Project ID for this request. 563 * @param region The name of the region for this request. 564 * @param resource Name or id of the resource for this request. 565 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 566 */ getIamPolicy(String project, String region, String resource)567 public final Policy getIamPolicy(String project, String region, String resource) { 568 GetIamPolicyNodeTemplateRequest request = 569 GetIamPolicyNodeTemplateRequest.newBuilder() 570 .setProject(project) 571 .setRegion(region) 572 .setResource(resource) 573 .build(); 574 return getIamPolicy(request); 575 } 576 577 // AUTO-GENERATED DOCUMENTATION AND METHOD. 578 /** 579 * Gets the access control policy for a resource. May be empty if no such policy or resource 580 * exists. 581 * 582 * <p>Sample code: 583 * 584 * <pre>{@code 585 * // This snippet has been automatically generated and should be regarded as a code template only. 586 * // It will require modifications to work: 587 * // - It may require correct/in-range values for request initialization. 588 * // - It may require specifying regional endpoints when creating the service client as shown in 589 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 590 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 591 * GetIamPolicyNodeTemplateRequest request = 592 * GetIamPolicyNodeTemplateRequest.newBuilder() 593 * .setOptionsRequestedPolicyVersion(-574521795) 594 * .setProject("project-309310695") 595 * .setRegion("region-934795532") 596 * .setResource("resource-341064690") 597 * .build(); 598 * Policy response = nodeTemplatesClient.getIamPolicy(request); 599 * } 600 * }</pre> 601 * 602 * @param request The request object containing all of the parameters for the API call. 603 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 604 */ getIamPolicy(GetIamPolicyNodeTemplateRequest request)605 public final Policy getIamPolicy(GetIamPolicyNodeTemplateRequest request) { 606 return getIamPolicyCallable().call(request); 607 } 608 609 // AUTO-GENERATED DOCUMENTATION AND METHOD. 610 /** 611 * Gets the access control policy for a resource. May be empty if no such policy or resource 612 * exists. 613 * 614 * <p>Sample code: 615 * 616 * <pre>{@code 617 * // This snippet has been automatically generated and should be regarded as a code template only. 618 * // It will require modifications to work: 619 * // - It may require correct/in-range values for request initialization. 620 * // - It may require specifying regional endpoints when creating the service client as shown in 621 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 622 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 623 * GetIamPolicyNodeTemplateRequest request = 624 * GetIamPolicyNodeTemplateRequest.newBuilder() 625 * .setOptionsRequestedPolicyVersion(-574521795) 626 * .setProject("project-309310695") 627 * .setRegion("region-934795532") 628 * .setResource("resource-341064690") 629 * .build(); 630 * ApiFuture<Policy> future = nodeTemplatesClient.getIamPolicyCallable().futureCall(request); 631 * // Do something. 632 * Policy response = future.get(); 633 * } 634 * }</pre> 635 */ getIamPolicyCallable()636 public final UnaryCallable<GetIamPolicyNodeTemplateRequest, Policy> getIamPolicyCallable() { 637 return stub.getIamPolicyCallable(); 638 } 639 640 // AUTO-GENERATED DOCUMENTATION AND METHOD. 641 /** 642 * Creates a NodeTemplate resource in the specified project using the data included in the 643 * request. 644 * 645 * <p>Sample code: 646 * 647 * <pre>{@code 648 * // This snippet has been automatically generated and should be regarded as a code template only. 649 * // It will require modifications to work: 650 * // - It may require correct/in-range values for request initialization. 651 * // - It may require specifying regional endpoints when creating the service client as shown in 652 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 653 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 654 * String project = "project-309310695"; 655 * String region = "region-934795532"; 656 * NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build(); 657 * Operation response = 658 * nodeTemplatesClient.insertAsync(project, region, nodeTemplateResource).get(); 659 * } 660 * }</pre> 661 * 662 * @param project Project ID for this request. 663 * @param region The name of the region for this request. 664 * @param nodeTemplateResource The body resource for this request 665 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 666 */ insertAsync( String project, String region, NodeTemplate nodeTemplateResource)667 public final OperationFuture<Operation, Operation> insertAsync( 668 String project, String region, NodeTemplate nodeTemplateResource) { 669 InsertNodeTemplateRequest request = 670 InsertNodeTemplateRequest.newBuilder() 671 .setProject(project) 672 .setRegion(region) 673 .setNodeTemplateResource(nodeTemplateResource) 674 .build(); 675 return insertAsync(request); 676 } 677 678 // AUTO-GENERATED DOCUMENTATION AND METHOD. 679 /** 680 * Creates a NodeTemplate resource in the specified project using the data included in the 681 * request. 682 * 683 * <p>Sample code: 684 * 685 * <pre>{@code 686 * // This snippet has been automatically generated and should be regarded as a code template only. 687 * // It will require modifications to work: 688 * // - It may require correct/in-range values for request initialization. 689 * // - It may require specifying regional endpoints when creating the service client as shown in 690 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 691 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 692 * InsertNodeTemplateRequest request = 693 * InsertNodeTemplateRequest.newBuilder() 694 * .setNodeTemplateResource(NodeTemplate.newBuilder().build()) 695 * .setProject("project-309310695") 696 * .setRegion("region-934795532") 697 * .setRequestId("requestId693933066") 698 * .build(); 699 * Operation response = nodeTemplatesClient.insertAsync(request).get(); 700 * } 701 * }</pre> 702 * 703 * @param request The request object containing all of the parameters for the API call. 704 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 705 */ 706 @BetaApi( 707 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync( InsertNodeTemplateRequest request)708 public final OperationFuture<Operation, Operation> insertAsync( 709 InsertNodeTemplateRequest request) { 710 return insertOperationCallable().futureCall(request); 711 } 712 713 // AUTO-GENERATED DOCUMENTATION AND METHOD. 714 /** 715 * Creates a NodeTemplate resource in the specified project using the data included in the 716 * request. 717 * 718 * <p>Sample code: 719 * 720 * <pre>{@code 721 * // This snippet has been automatically generated and should be regarded as a code template only. 722 * // It will require modifications to work: 723 * // - It may require correct/in-range values for request initialization. 724 * // - It may require specifying regional endpoints when creating the service client as shown in 725 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 726 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 727 * InsertNodeTemplateRequest request = 728 * InsertNodeTemplateRequest.newBuilder() 729 * .setNodeTemplateResource(NodeTemplate.newBuilder().build()) 730 * .setProject("project-309310695") 731 * .setRegion("region-934795532") 732 * .setRequestId("requestId693933066") 733 * .build(); 734 * OperationFuture<Operation, Operation> future = 735 * nodeTemplatesClient.insertOperationCallable().futureCall(request); 736 * // Do something. 737 * Operation response = future.get(); 738 * } 739 * }</pre> 740 */ 741 public final OperationCallable<InsertNodeTemplateRequest, Operation, Operation> insertOperationCallable()742 insertOperationCallable() { 743 return stub.insertOperationCallable(); 744 } 745 746 // AUTO-GENERATED DOCUMENTATION AND METHOD. 747 /** 748 * Creates a NodeTemplate resource in the specified project using the data included in the 749 * request. 750 * 751 * <p>Sample code: 752 * 753 * <pre>{@code 754 * // This snippet has been automatically generated and should be regarded as a code template only. 755 * // It will require modifications to work: 756 * // - It may require correct/in-range values for request initialization. 757 * // - It may require specifying regional endpoints when creating the service client as shown in 758 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 759 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 760 * InsertNodeTemplateRequest request = 761 * InsertNodeTemplateRequest.newBuilder() 762 * .setNodeTemplateResource(NodeTemplate.newBuilder().build()) 763 * .setProject("project-309310695") 764 * .setRegion("region-934795532") 765 * .setRequestId("requestId693933066") 766 * .build(); 767 * ApiFuture<Operation> future = nodeTemplatesClient.insertCallable().futureCall(request); 768 * // Do something. 769 * Operation response = future.get(); 770 * } 771 * }</pre> 772 */ insertCallable()773 public final UnaryCallable<InsertNodeTemplateRequest, Operation> insertCallable() { 774 return stub.insertCallable(); 775 } 776 777 // AUTO-GENERATED DOCUMENTATION AND METHOD. 778 /** 779 * Retrieves a list of node templates available to the specified project. 780 * 781 * <p>Sample code: 782 * 783 * <pre>{@code 784 * // This snippet has been automatically generated and should be regarded as a code template only. 785 * // It will require modifications to work: 786 * // - It may require correct/in-range values for request initialization. 787 * // - It may require specifying regional endpoints when creating the service client as shown in 788 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 789 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 790 * String project = "project-309310695"; 791 * String region = "region-934795532"; 792 * for (NodeTemplate element : nodeTemplatesClient.list(project, region).iterateAll()) { 793 * // doThingsWith(element); 794 * } 795 * } 796 * }</pre> 797 * 798 * @param project Project ID for this request. 799 * @param region The name of the region for this request. 800 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 801 */ list(String project, String region)802 public final ListPagedResponse list(String project, String region) { 803 ListNodeTemplatesRequest request = 804 ListNodeTemplatesRequest.newBuilder().setProject(project).setRegion(region).build(); 805 return list(request); 806 } 807 808 // AUTO-GENERATED DOCUMENTATION AND METHOD. 809 /** 810 * Retrieves a list of node templates available to the specified project. 811 * 812 * <p>Sample code: 813 * 814 * <pre>{@code 815 * // This snippet has been automatically generated and should be regarded as a code template only. 816 * // It will require modifications to work: 817 * // - It may require correct/in-range values for request initialization. 818 * // - It may require specifying regional endpoints when creating the service client as shown in 819 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 820 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 821 * ListNodeTemplatesRequest request = 822 * ListNodeTemplatesRequest.newBuilder() 823 * .setFilter("filter-1274492040") 824 * .setMaxResults(1128457243) 825 * .setOrderBy("orderBy-1207110587") 826 * .setPageToken("pageToken873572522") 827 * .setProject("project-309310695") 828 * .setRegion("region-934795532") 829 * .setReturnPartialSuccess(true) 830 * .build(); 831 * for (NodeTemplate element : nodeTemplatesClient.list(request).iterateAll()) { 832 * // doThingsWith(element); 833 * } 834 * } 835 * }</pre> 836 * 837 * @param request The request object containing all of the parameters for the API call. 838 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 839 */ list(ListNodeTemplatesRequest request)840 public final ListPagedResponse list(ListNodeTemplatesRequest request) { 841 return listPagedCallable().call(request); 842 } 843 844 // AUTO-GENERATED DOCUMENTATION AND METHOD. 845 /** 846 * Retrieves a list of node templates available to the specified project. 847 * 848 * <p>Sample code: 849 * 850 * <pre>{@code 851 * // This snippet has been automatically generated and should be regarded as a code template only. 852 * // It will require modifications to work: 853 * // - It may require correct/in-range values for request initialization. 854 * // - It may require specifying regional endpoints when creating the service client as shown in 855 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 856 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 857 * ListNodeTemplatesRequest request = 858 * ListNodeTemplatesRequest.newBuilder() 859 * .setFilter("filter-1274492040") 860 * .setMaxResults(1128457243) 861 * .setOrderBy("orderBy-1207110587") 862 * .setPageToken("pageToken873572522") 863 * .setProject("project-309310695") 864 * .setRegion("region-934795532") 865 * .setReturnPartialSuccess(true) 866 * .build(); 867 * ApiFuture<NodeTemplate> future = nodeTemplatesClient.listPagedCallable().futureCall(request); 868 * // Do something. 869 * for (NodeTemplate element : future.get().iterateAll()) { 870 * // doThingsWith(element); 871 * } 872 * } 873 * }</pre> 874 */ listPagedCallable()875 public final UnaryCallable<ListNodeTemplatesRequest, ListPagedResponse> listPagedCallable() { 876 return stub.listPagedCallable(); 877 } 878 879 // AUTO-GENERATED DOCUMENTATION AND METHOD. 880 /** 881 * Retrieves a list of node templates available to the specified project. 882 * 883 * <p>Sample code: 884 * 885 * <pre>{@code 886 * // This snippet has been automatically generated and should be regarded as a code template only. 887 * // It will require modifications to work: 888 * // - It may require correct/in-range values for request initialization. 889 * // - It may require specifying regional endpoints when creating the service client as shown in 890 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 891 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 892 * ListNodeTemplatesRequest request = 893 * ListNodeTemplatesRequest.newBuilder() 894 * .setFilter("filter-1274492040") 895 * .setMaxResults(1128457243) 896 * .setOrderBy("orderBy-1207110587") 897 * .setPageToken("pageToken873572522") 898 * .setProject("project-309310695") 899 * .setRegion("region-934795532") 900 * .setReturnPartialSuccess(true) 901 * .build(); 902 * while (true) { 903 * NodeTemplateList response = nodeTemplatesClient.listCallable().call(request); 904 * for (NodeTemplate element : response.getItemsList()) { 905 * // doThingsWith(element); 906 * } 907 * String nextPageToken = response.getNextPageToken(); 908 * if (!Strings.isNullOrEmpty(nextPageToken)) { 909 * request = request.toBuilder().setPageToken(nextPageToken).build(); 910 * } else { 911 * break; 912 * } 913 * } 914 * } 915 * }</pre> 916 */ listCallable()917 public final UnaryCallable<ListNodeTemplatesRequest, NodeTemplateList> listCallable() { 918 return stub.listCallable(); 919 } 920 921 // AUTO-GENERATED DOCUMENTATION AND METHOD. 922 /** 923 * Sets the access control policy on the specified resource. Replaces any existing policy. 924 * 925 * <p>Sample code: 926 * 927 * <pre>{@code 928 * // This snippet has been automatically generated and should be regarded as a code template only. 929 * // It will require modifications to work: 930 * // - It may require correct/in-range values for request initialization. 931 * // - It may require specifying regional endpoints when creating the service client as shown in 932 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 933 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 934 * String project = "project-309310695"; 935 * String region = "region-934795532"; 936 * String resource = "resource-341064690"; 937 * RegionSetPolicyRequest regionSetPolicyRequestResource = 938 * RegionSetPolicyRequest.newBuilder().build(); 939 * Policy response = 940 * nodeTemplatesClient.setIamPolicy( 941 * project, region, resource, regionSetPolicyRequestResource); 942 * } 943 * }</pre> 944 * 945 * @param project Project ID for this request. 946 * @param region The name of the region for this request. 947 * @param resource Name or id of the resource for this request. 948 * @param regionSetPolicyRequestResource The body resource for this request 949 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 950 */ setIamPolicy( String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)951 public final Policy setIamPolicy( 952 String project, 953 String region, 954 String resource, 955 RegionSetPolicyRequest regionSetPolicyRequestResource) { 956 SetIamPolicyNodeTemplateRequest request = 957 SetIamPolicyNodeTemplateRequest.newBuilder() 958 .setProject(project) 959 .setRegion(region) 960 .setResource(resource) 961 .setRegionSetPolicyRequestResource(regionSetPolicyRequestResource) 962 .build(); 963 return setIamPolicy(request); 964 } 965 966 // AUTO-GENERATED DOCUMENTATION AND METHOD. 967 /** 968 * Sets the access control policy on the specified resource. Replaces any existing policy. 969 * 970 * <p>Sample code: 971 * 972 * <pre>{@code 973 * // This snippet has been automatically generated and should be regarded as a code template only. 974 * // It will require modifications to work: 975 * // - It may require correct/in-range values for request initialization. 976 * // - It may require specifying regional endpoints when creating the service client as shown in 977 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 978 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 979 * SetIamPolicyNodeTemplateRequest request = 980 * SetIamPolicyNodeTemplateRequest.newBuilder() 981 * .setProject("project-309310695") 982 * .setRegion("region-934795532") 983 * .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build()) 984 * .setResource("resource-341064690") 985 * .build(); 986 * Policy response = nodeTemplatesClient.setIamPolicy(request); 987 * } 988 * }</pre> 989 * 990 * @param request The request object containing all of the parameters for the API call. 991 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 992 */ setIamPolicy(SetIamPolicyNodeTemplateRequest request)993 public final Policy setIamPolicy(SetIamPolicyNodeTemplateRequest request) { 994 return setIamPolicyCallable().call(request); 995 } 996 997 // AUTO-GENERATED DOCUMENTATION AND METHOD. 998 /** 999 * Sets the access control policy on the specified resource. Replaces any existing policy. 1000 * 1001 * <p>Sample code: 1002 * 1003 * <pre>{@code 1004 * // This snippet has been automatically generated and should be regarded as a code template only. 1005 * // It will require modifications to work: 1006 * // - It may require correct/in-range values for request initialization. 1007 * // - It may require specifying regional endpoints when creating the service client as shown in 1008 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1009 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 1010 * SetIamPolicyNodeTemplateRequest request = 1011 * SetIamPolicyNodeTemplateRequest.newBuilder() 1012 * .setProject("project-309310695") 1013 * .setRegion("region-934795532") 1014 * .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build()) 1015 * .setResource("resource-341064690") 1016 * .build(); 1017 * ApiFuture<Policy> future = nodeTemplatesClient.setIamPolicyCallable().futureCall(request); 1018 * // Do something. 1019 * Policy response = future.get(); 1020 * } 1021 * }</pre> 1022 */ setIamPolicyCallable()1023 public final UnaryCallable<SetIamPolicyNodeTemplateRequest, Policy> setIamPolicyCallable() { 1024 return stub.setIamPolicyCallable(); 1025 } 1026 1027 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1028 /** 1029 * Returns permissions that a caller has on the specified resource. 1030 * 1031 * <p>Sample code: 1032 * 1033 * <pre>{@code 1034 * // This snippet has been automatically generated and should be regarded as a code template only. 1035 * // It will require modifications to work: 1036 * // - It may require correct/in-range values for request initialization. 1037 * // - It may require specifying regional endpoints when creating the service client as shown in 1038 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1039 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 1040 * String project = "project-309310695"; 1041 * String region = "region-934795532"; 1042 * String resource = "resource-341064690"; 1043 * TestPermissionsRequest testPermissionsRequestResource = 1044 * TestPermissionsRequest.newBuilder().build(); 1045 * TestPermissionsResponse response = 1046 * nodeTemplatesClient.testIamPermissions( 1047 * project, region, resource, testPermissionsRequestResource); 1048 * } 1049 * }</pre> 1050 * 1051 * @param project Project ID for this request. 1052 * @param region The name of the region for this request. 1053 * @param resource Name or id of the resource for this request. 1054 * @param testPermissionsRequestResource The body resource for this request 1055 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1056 */ testIamPermissions( String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)1057 public final TestPermissionsResponse testIamPermissions( 1058 String project, 1059 String region, 1060 String resource, 1061 TestPermissionsRequest testPermissionsRequestResource) { 1062 TestIamPermissionsNodeTemplateRequest request = 1063 TestIamPermissionsNodeTemplateRequest.newBuilder() 1064 .setProject(project) 1065 .setRegion(region) 1066 .setResource(resource) 1067 .setTestPermissionsRequestResource(testPermissionsRequestResource) 1068 .build(); 1069 return testIamPermissions(request); 1070 } 1071 1072 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1073 /** 1074 * Returns permissions that a caller has on the specified resource. 1075 * 1076 * <p>Sample code: 1077 * 1078 * <pre>{@code 1079 * // This snippet has been automatically generated and should be regarded as a code template only. 1080 * // It will require modifications to work: 1081 * // - It may require correct/in-range values for request initialization. 1082 * // - It may require specifying regional endpoints when creating the service client as shown in 1083 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1084 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 1085 * TestIamPermissionsNodeTemplateRequest request = 1086 * TestIamPermissionsNodeTemplateRequest.newBuilder() 1087 * .setProject("project-309310695") 1088 * .setRegion("region-934795532") 1089 * .setResource("resource-341064690") 1090 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 1091 * .build(); 1092 * TestPermissionsResponse response = nodeTemplatesClient.testIamPermissions(request); 1093 * } 1094 * }</pre> 1095 * 1096 * @param request The request object containing all of the parameters for the API call. 1097 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1098 */ testIamPermissions( TestIamPermissionsNodeTemplateRequest request)1099 public final TestPermissionsResponse testIamPermissions( 1100 TestIamPermissionsNodeTemplateRequest request) { 1101 return testIamPermissionsCallable().call(request); 1102 } 1103 1104 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1105 /** 1106 * Returns permissions that a caller has on the specified resource. 1107 * 1108 * <p>Sample code: 1109 * 1110 * <pre>{@code 1111 * // This snippet has been automatically generated and should be regarded as a code template only. 1112 * // It will require modifications to work: 1113 * // - It may require correct/in-range values for request initialization. 1114 * // - It may require specifying regional endpoints when creating the service client as shown in 1115 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1116 * try (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) { 1117 * TestIamPermissionsNodeTemplateRequest request = 1118 * TestIamPermissionsNodeTemplateRequest.newBuilder() 1119 * .setProject("project-309310695") 1120 * .setRegion("region-934795532") 1121 * .setResource("resource-341064690") 1122 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 1123 * .build(); 1124 * ApiFuture<TestPermissionsResponse> future = 1125 * nodeTemplatesClient.testIamPermissionsCallable().futureCall(request); 1126 * // Do something. 1127 * TestPermissionsResponse response = future.get(); 1128 * } 1129 * }</pre> 1130 */ 1131 public final UnaryCallable<TestIamPermissionsNodeTemplateRequest, TestPermissionsResponse> testIamPermissionsCallable()1132 testIamPermissionsCallable() { 1133 return stub.testIamPermissionsCallable(); 1134 } 1135 1136 @Override close()1137 public final void close() { 1138 stub.close(); 1139 } 1140 1141 @Override shutdown()1142 public void shutdown() { 1143 stub.shutdown(); 1144 } 1145 1146 @Override isShutdown()1147 public boolean isShutdown() { 1148 return stub.isShutdown(); 1149 } 1150 1151 @Override isTerminated()1152 public boolean isTerminated() { 1153 return stub.isTerminated(); 1154 } 1155 1156 @Override shutdownNow()1157 public void shutdownNow() { 1158 stub.shutdownNow(); 1159 } 1160 1161 @Override awaitTermination(long duration, TimeUnit unit)1162 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1163 return stub.awaitTermination(duration, unit); 1164 } 1165 1166 public static class AggregatedListPagedResponse 1167 extends AbstractPagedListResponse< 1168 AggregatedListNodeTemplatesRequest, 1169 NodeTemplateAggregatedList, 1170 Map.Entry<String, NodeTemplatesScopedList>, 1171 AggregatedListPage, 1172 AggregatedListFixedSizeCollection> { 1173 createAsync( PageContext< AggregatedListNodeTemplatesRequest, NodeTemplateAggregatedList, Map.Entry<String, NodeTemplatesScopedList>> context, ApiFuture<NodeTemplateAggregatedList> futureResponse)1174 public static ApiFuture<AggregatedListPagedResponse> createAsync( 1175 PageContext< 1176 AggregatedListNodeTemplatesRequest, 1177 NodeTemplateAggregatedList, 1178 Map.Entry<String, NodeTemplatesScopedList>> 1179 context, 1180 ApiFuture<NodeTemplateAggregatedList> futureResponse) { 1181 ApiFuture<AggregatedListPage> futurePage = 1182 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 1183 return ApiFutures.transform( 1184 futurePage, 1185 input -> new AggregatedListPagedResponse(input), 1186 MoreExecutors.directExecutor()); 1187 } 1188 AggregatedListPagedResponse(AggregatedListPage page)1189 private AggregatedListPagedResponse(AggregatedListPage page) { 1190 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 1191 } 1192 } 1193 1194 public static class AggregatedListPage 1195 extends AbstractPage< 1196 AggregatedListNodeTemplatesRequest, 1197 NodeTemplateAggregatedList, 1198 Map.Entry<String, NodeTemplatesScopedList>, 1199 AggregatedListPage> { 1200 AggregatedListPage( PageContext< AggregatedListNodeTemplatesRequest, NodeTemplateAggregatedList, Map.Entry<String, NodeTemplatesScopedList>> context, NodeTemplateAggregatedList response)1201 private AggregatedListPage( 1202 PageContext< 1203 AggregatedListNodeTemplatesRequest, 1204 NodeTemplateAggregatedList, 1205 Map.Entry<String, NodeTemplatesScopedList>> 1206 context, 1207 NodeTemplateAggregatedList response) { 1208 super(context, response); 1209 } 1210 createEmptyPage()1211 private static AggregatedListPage createEmptyPage() { 1212 return new AggregatedListPage(null, null); 1213 } 1214 1215 @Override createPage( PageContext< AggregatedListNodeTemplatesRequest, NodeTemplateAggregatedList, Map.Entry<String, NodeTemplatesScopedList>> context, NodeTemplateAggregatedList response)1216 protected AggregatedListPage createPage( 1217 PageContext< 1218 AggregatedListNodeTemplatesRequest, 1219 NodeTemplateAggregatedList, 1220 Map.Entry<String, NodeTemplatesScopedList>> 1221 context, 1222 NodeTemplateAggregatedList response) { 1223 return new AggregatedListPage(context, response); 1224 } 1225 1226 @Override createPageAsync( PageContext< AggregatedListNodeTemplatesRequest, NodeTemplateAggregatedList, Map.Entry<String, NodeTemplatesScopedList>> context, ApiFuture<NodeTemplateAggregatedList> futureResponse)1227 public ApiFuture<AggregatedListPage> createPageAsync( 1228 PageContext< 1229 AggregatedListNodeTemplatesRequest, 1230 NodeTemplateAggregatedList, 1231 Map.Entry<String, NodeTemplatesScopedList>> 1232 context, 1233 ApiFuture<NodeTemplateAggregatedList> futureResponse) { 1234 return super.createPageAsync(context, futureResponse); 1235 } 1236 } 1237 1238 public static class AggregatedListFixedSizeCollection 1239 extends AbstractFixedSizeCollection< 1240 AggregatedListNodeTemplatesRequest, 1241 NodeTemplateAggregatedList, 1242 Map.Entry<String, NodeTemplatesScopedList>, 1243 AggregatedListPage, 1244 AggregatedListFixedSizeCollection> { 1245 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1246 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 1247 super(pages, collectionSize); 1248 } 1249 createEmptyCollection()1250 private static AggregatedListFixedSizeCollection createEmptyCollection() { 1251 return new AggregatedListFixedSizeCollection(null, 0); 1252 } 1253 1254 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)1255 protected AggregatedListFixedSizeCollection createCollection( 1256 List<AggregatedListPage> pages, int collectionSize) { 1257 return new AggregatedListFixedSizeCollection(pages, collectionSize); 1258 } 1259 } 1260 1261 public static class ListPagedResponse 1262 extends AbstractPagedListResponse< 1263 ListNodeTemplatesRequest, 1264 NodeTemplateList, 1265 NodeTemplate, 1266 ListPage, 1267 ListFixedSizeCollection> { 1268 createAsync( PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, ApiFuture<NodeTemplateList> futureResponse)1269 public static ApiFuture<ListPagedResponse> createAsync( 1270 PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, 1271 ApiFuture<NodeTemplateList> futureResponse) { 1272 ApiFuture<ListPage> futurePage = 1273 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 1274 return ApiFutures.transform( 1275 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 1276 } 1277 ListPagedResponse(ListPage page)1278 private ListPagedResponse(ListPage page) { 1279 super(page, ListFixedSizeCollection.createEmptyCollection()); 1280 } 1281 } 1282 1283 public static class ListPage 1284 extends AbstractPage<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate, ListPage> { 1285 ListPage( PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, NodeTemplateList response)1286 private ListPage( 1287 PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, 1288 NodeTemplateList response) { 1289 super(context, response); 1290 } 1291 createEmptyPage()1292 private static ListPage createEmptyPage() { 1293 return new ListPage(null, null); 1294 } 1295 1296 @Override createPage( PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, NodeTemplateList response)1297 protected ListPage createPage( 1298 PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, 1299 NodeTemplateList response) { 1300 return new ListPage(context, response); 1301 } 1302 1303 @Override createPageAsync( PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, ApiFuture<NodeTemplateList> futureResponse)1304 public ApiFuture<ListPage> createPageAsync( 1305 PageContext<ListNodeTemplatesRequest, NodeTemplateList, NodeTemplate> context, 1306 ApiFuture<NodeTemplateList> futureResponse) { 1307 return super.createPageAsync(context, futureResponse); 1308 } 1309 } 1310 1311 public static class ListFixedSizeCollection 1312 extends AbstractFixedSizeCollection< 1313 ListNodeTemplatesRequest, 1314 NodeTemplateList, 1315 NodeTemplate, 1316 ListPage, 1317 ListFixedSizeCollection> { 1318 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1319 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 1320 super(pages, collectionSize); 1321 } 1322 createEmptyCollection()1323 private static ListFixedSizeCollection createEmptyCollection() { 1324 return new ListFixedSizeCollection(null, 0); 1325 } 1326 1327 @Override createCollection(List<ListPage> pages, int collectionSize)1328 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 1329 return new ListFixedSizeCollection(pages, collectionSize); 1330 } 1331 } 1332 } 1333