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.notebooks.v1beta1; 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.location.GetLocationRequest; 31 import com.google.cloud.location.ListLocationsRequest; 32 import com.google.cloud.location.ListLocationsResponse; 33 import com.google.cloud.location.Location; 34 import com.google.cloud.notebooks.v1beta1.stub.NotebookServiceStub; 35 import com.google.cloud.notebooks.v1beta1.stub.NotebookServiceStubSettings; 36 import com.google.common.util.concurrent.MoreExecutors; 37 import com.google.iam.v1.GetIamPolicyRequest; 38 import com.google.iam.v1.Policy; 39 import com.google.iam.v1.SetIamPolicyRequest; 40 import com.google.iam.v1.TestIamPermissionsRequest; 41 import com.google.iam.v1.TestIamPermissionsResponse; 42 import com.google.longrunning.Operation; 43 import com.google.longrunning.OperationsClient; 44 import com.google.protobuf.Empty; 45 import java.io.IOException; 46 import java.util.List; 47 import java.util.concurrent.TimeUnit; 48 import javax.annotation.Generated; 49 50 // AUTO-GENERATED DOCUMENTATION AND CLASS. 51 /** 52 * Service Description: API v1beta1 service for Cloud AI Platform Notebooks. 53 * 54 * <p>This class provides the ability to make remote calls to the backing service through method 55 * calls that map to API methods. Sample code to get started: 56 * 57 * <pre>{@code 58 * // This snippet has been automatically generated and should be regarded as a code template only. 59 * // It will require modifications to work: 60 * // - It may require correct/in-range values for request initialization. 61 * // - It may require specifying regional endpoints when creating the service client as shown in 62 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 63 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 64 * GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build(); 65 * Instance response = notebookServiceClient.getInstance(request); 66 * } 67 * }</pre> 68 * 69 * <p>Note: close() needs to be called on the NotebookServiceClient object to clean up resources 70 * such as threads. In the example above, try-with-resources is used, which automatically calls 71 * close(). 72 * 73 * <p>The surface of this class includes several types of Java methods for each of the API's 74 * methods: 75 * 76 * <ol> 77 * <li>A "flattened" method. With this type of method, the fields of the request type have been 78 * converted into function parameters. It may be the case that not all fields are available as 79 * parameters, and not every API method will have a flattened method entry point. 80 * <li>A "request object" method. This type of method only takes one parameter, a request object, 81 * which must be constructed before the call. Not every API method will have a request object 82 * method. 83 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 84 * callable object, which can be used to initiate calls to the service. 85 * </ol> 86 * 87 * <p>See the individual methods for example code. 88 * 89 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 90 * these names, this class includes a format method for each type of name, and additionally a parse 91 * method to extract the individual identifiers contained within names that are returned. 92 * 93 * <p>This class can be customized by passing in a custom instance of NotebookServiceSettings to 94 * create(). For example: 95 * 96 * <p>To customize credentials: 97 * 98 * <pre>{@code 99 * // This snippet has been automatically generated and should be regarded as a code template only. 100 * // It will require modifications to work: 101 * // - It may require correct/in-range values for request initialization. 102 * // - It may require specifying regional endpoints when creating the service client as shown in 103 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 104 * NotebookServiceSettings notebookServiceSettings = 105 * NotebookServiceSettings.newBuilder() 106 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 107 * .build(); 108 * NotebookServiceClient notebookServiceClient = 109 * NotebookServiceClient.create(notebookServiceSettings); 110 * }</pre> 111 * 112 * <p>To customize the endpoint: 113 * 114 * <pre>{@code 115 * // This snippet has been automatically generated and should be regarded as a code template only. 116 * // It will require modifications to work: 117 * // - It may require correct/in-range values for request initialization. 118 * // - It may require specifying regional endpoints when creating the service client as shown in 119 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 120 * NotebookServiceSettings notebookServiceSettings = 121 * NotebookServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 122 * NotebookServiceClient notebookServiceClient = 123 * NotebookServiceClient.create(notebookServiceSettings); 124 * }</pre> 125 * 126 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 127 */ 128 @BetaApi 129 @Generated("by gapic-generator-java") 130 public class NotebookServiceClient implements BackgroundResource { 131 private final NotebookServiceSettings settings; 132 private final NotebookServiceStub stub; 133 private final OperationsClient operationsClient; 134 135 /** Constructs an instance of NotebookServiceClient with default settings. */ create()136 public static final NotebookServiceClient create() throws IOException { 137 return create(NotebookServiceSettings.newBuilder().build()); 138 } 139 140 /** 141 * Constructs an instance of NotebookServiceClient, using the given settings. The channels are 142 * created based on the settings passed in, or defaults for any settings that are not set. 143 */ create(NotebookServiceSettings settings)144 public static final NotebookServiceClient create(NotebookServiceSettings settings) 145 throws IOException { 146 return new NotebookServiceClient(settings); 147 } 148 149 /** 150 * Constructs an instance of NotebookServiceClient, using the given stub for making calls. This is 151 * for advanced usage - prefer using create(NotebookServiceSettings). 152 */ create(NotebookServiceStub stub)153 public static final NotebookServiceClient create(NotebookServiceStub stub) { 154 return new NotebookServiceClient(stub); 155 } 156 157 /** 158 * Constructs an instance of NotebookServiceClient, using the given settings. This is protected so 159 * that it is easy to make a subclass, but otherwise, the static factory methods should be 160 * preferred. 161 */ NotebookServiceClient(NotebookServiceSettings settings)162 protected NotebookServiceClient(NotebookServiceSettings settings) throws IOException { 163 this.settings = settings; 164 this.stub = ((NotebookServiceStubSettings) settings.getStubSettings()).createStub(); 165 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 166 } 167 NotebookServiceClient(NotebookServiceStub stub)168 protected NotebookServiceClient(NotebookServiceStub stub) { 169 this.settings = null; 170 this.stub = stub; 171 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 172 } 173 getSettings()174 public final NotebookServiceSettings getSettings() { 175 return settings; 176 } 177 getStub()178 public NotebookServiceStub getStub() { 179 return stub; 180 } 181 182 /** 183 * Returns the OperationsClient that can be used to query the status of a long-running operation 184 * returned by another API method call. 185 */ getOperationsClient()186 public final OperationsClient getOperationsClient() { 187 return operationsClient; 188 } 189 190 // AUTO-GENERATED DOCUMENTATION AND METHOD. 191 /** 192 * Lists instances in a given project and location. 193 * 194 * <p>Sample code: 195 * 196 * <pre>{@code 197 * // This snippet has been automatically generated and should be regarded as a code template only. 198 * // It will require modifications to work: 199 * // - It may require correct/in-range values for request initialization. 200 * // - It may require specifying regional endpoints when creating the service client as shown in 201 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 202 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 203 * ListInstancesRequest request = 204 * ListInstancesRequest.newBuilder() 205 * .setParent("parent-995424086") 206 * .setPageSize(883849137) 207 * .setPageToken("pageToken873572522") 208 * .build(); 209 * for (Instance element : notebookServiceClient.listInstances(request).iterateAll()) { 210 * // doThingsWith(element); 211 * } 212 * } 213 * }</pre> 214 * 215 * @param request The request object containing all of the parameters for the API call. 216 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 217 */ listInstances(ListInstancesRequest request)218 public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) { 219 return listInstancesPagedCallable().call(request); 220 } 221 222 // AUTO-GENERATED DOCUMENTATION AND METHOD. 223 /** 224 * Lists instances in a given project and location. 225 * 226 * <p>Sample code: 227 * 228 * <pre>{@code 229 * // This snippet has been automatically generated and should be regarded as a code template only. 230 * // It will require modifications to work: 231 * // - It may require correct/in-range values for request initialization. 232 * // - It may require specifying regional endpoints when creating the service client as shown in 233 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 234 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 235 * ListInstancesRequest request = 236 * ListInstancesRequest.newBuilder() 237 * .setParent("parent-995424086") 238 * .setPageSize(883849137) 239 * .setPageToken("pageToken873572522") 240 * .build(); 241 * ApiFuture<Instance> future = 242 * notebookServiceClient.listInstancesPagedCallable().futureCall(request); 243 * // Do something. 244 * for (Instance element : future.get().iterateAll()) { 245 * // doThingsWith(element); 246 * } 247 * } 248 * }</pre> 249 */ 250 public final UnaryCallable<ListInstancesRequest, ListInstancesPagedResponse> listInstancesPagedCallable()251 listInstancesPagedCallable() { 252 return stub.listInstancesPagedCallable(); 253 } 254 255 // AUTO-GENERATED DOCUMENTATION AND METHOD. 256 /** 257 * Lists instances in a given project and location. 258 * 259 * <p>Sample code: 260 * 261 * <pre>{@code 262 * // This snippet has been automatically generated and should be regarded as a code template only. 263 * // It will require modifications to work: 264 * // - It may require correct/in-range values for request initialization. 265 * // - It may require specifying regional endpoints when creating the service client as shown in 266 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 267 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 268 * ListInstancesRequest request = 269 * ListInstancesRequest.newBuilder() 270 * .setParent("parent-995424086") 271 * .setPageSize(883849137) 272 * .setPageToken("pageToken873572522") 273 * .build(); 274 * while (true) { 275 * ListInstancesResponse response = 276 * notebookServiceClient.listInstancesCallable().call(request); 277 * for (Instance element : response.getInstancesList()) { 278 * // doThingsWith(element); 279 * } 280 * String nextPageToken = response.getNextPageToken(); 281 * if (!Strings.isNullOrEmpty(nextPageToken)) { 282 * request = request.toBuilder().setPageToken(nextPageToken).build(); 283 * } else { 284 * break; 285 * } 286 * } 287 * } 288 * }</pre> 289 */ listInstancesCallable()290 public final UnaryCallable<ListInstancesRequest, ListInstancesResponse> listInstancesCallable() { 291 return stub.listInstancesCallable(); 292 } 293 294 // AUTO-GENERATED DOCUMENTATION AND METHOD. 295 /** 296 * Gets details of a single Instance. 297 * 298 * <p>Sample code: 299 * 300 * <pre>{@code 301 * // This snippet has been automatically generated and should be regarded as a code template only. 302 * // It will require modifications to work: 303 * // - It may require correct/in-range values for request initialization. 304 * // - It may require specifying regional endpoints when creating the service client as shown in 305 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 306 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 307 * GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build(); 308 * Instance response = notebookServiceClient.getInstance(request); 309 * } 310 * }</pre> 311 * 312 * @param request The request object containing all of the parameters for the API call. 313 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 314 */ getInstance(GetInstanceRequest request)315 public final Instance getInstance(GetInstanceRequest request) { 316 return getInstanceCallable().call(request); 317 } 318 319 // AUTO-GENERATED DOCUMENTATION AND METHOD. 320 /** 321 * Gets details of a single Instance. 322 * 323 * <p>Sample code: 324 * 325 * <pre>{@code 326 * // This snippet has been automatically generated and should be regarded as a code template only. 327 * // It will require modifications to work: 328 * // - It may require correct/in-range values for request initialization. 329 * // - It may require specifying regional endpoints when creating the service client as shown in 330 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 331 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 332 * GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build(); 333 * ApiFuture<Instance> future = notebookServiceClient.getInstanceCallable().futureCall(request); 334 * // Do something. 335 * Instance response = future.get(); 336 * } 337 * }</pre> 338 */ getInstanceCallable()339 public final UnaryCallable<GetInstanceRequest, Instance> getInstanceCallable() { 340 return stub.getInstanceCallable(); 341 } 342 343 // AUTO-GENERATED DOCUMENTATION AND METHOD. 344 /** 345 * Creates a new Instance in a given project and location. 346 * 347 * <p>Sample code: 348 * 349 * <pre>{@code 350 * // This snippet has been automatically generated and should be regarded as a code template only. 351 * // It will require modifications to work: 352 * // - It may require correct/in-range values for request initialization. 353 * // - It may require specifying regional endpoints when creating the service client as shown in 354 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 355 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 356 * CreateInstanceRequest request = 357 * CreateInstanceRequest.newBuilder() 358 * .setParent("parent-995424086") 359 * .setInstanceId("instanceId902024336") 360 * .setInstance(Instance.newBuilder().build()) 361 * .build(); 362 * Instance response = notebookServiceClient.createInstanceAsync(request).get(); 363 * } 364 * }</pre> 365 * 366 * @param request The request object containing all of the parameters for the API call. 367 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 368 */ createInstanceAsync( CreateInstanceRequest request)369 public final OperationFuture<Instance, OperationMetadata> createInstanceAsync( 370 CreateInstanceRequest request) { 371 return createInstanceOperationCallable().futureCall(request); 372 } 373 374 // AUTO-GENERATED DOCUMENTATION AND METHOD. 375 /** 376 * Creates a new Instance in a given project and location. 377 * 378 * <p>Sample code: 379 * 380 * <pre>{@code 381 * // This snippet has been automatically generated and should be regarded as a code template only. 382 * // It will require modifications to work: 383 * // - It may require correct/in-range values for request initialization. 384 * // - It may require specifying regional endpoints when creating the service client as shown in 385 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 386 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 387 * CreateInstanceRequest request = 388 * CreateInstanceRequest.newBuilder() 389 * .setParent("parent-995424086") 390 * .setInstanceId("instanceId902024336") 391 * .setInstance(Instance.newBuilder().build()) 392 * .build(); 393 * OperationFuture<Instance, OperationMetadata> future = 394 * notebookServiceClient.createInstanceOperationCallable().futureCall(request); 395 * // Do something. 396 * Instance response = future.get(); 397 * } 398 * }</pre> 399 */ 400 public final OperationCallable<CreateInstanceRequest, Instance, OperationMetadata> createInstanceOperationCallable()401 createInstanceOperationCallable() { 402 return stub.createInstanceOperationCallable(); 403 } 404 405 // AUTO-GENERATED DOCUMENTATION AND METHOD. 406 /** 407 * Creates a new Instance in a given project and location. 408 * 409 * <p>Sample code: 410 * 411 * <pre>{@code 412 * // This snippet has been automatically generated and should be regarded as a code template only. 413 * // It will require modifications to work: 414 * // - It may require correct/in-range values for request initialization. 415 * // - It may require specifying regional endpoints when creating the service client as shown in 416 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 417 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 418 * CreateInstanceRequest request = 419 * CreateInstanceRequest.newBuilder() 420 * .setParent("parent-995424086") 421 * .setInstanceId("instanceId902024336") 422 * .setInstance(Instance.newBuilder().build()) 423 * .build(); 424 * ApiFuture<Operation> future = 425 * notebookServiceClient.createInstanceCallable().futureCall(request); 426 * // Do something. 427 * Operation response = future.get(); 428 * } 429 * }</pre> 430 */ createInstanceCallable()431 public final UnaryCallable<CreateInstanceRequest, Operation> createInstanceCallable() { 432 return stub.createInstanceCallable(); 433 } 434 435 // AUTO-GENERATED DOCUMENTATION AND METHOD. 436 /** 437 * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances 438 * are instances created with the legacy Compute Engine calls. They are not manageable by the 439 * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. 440 * 441 * <p>Sample code: 442 * 443 * <pre>{@code 444 * // This snippet has been automatically generated and should be regarded as a code template only. 445 * // It will require modifications to work: 446 * // - It may require correct/in-range values for request initialization. 447 * // - It may require specifying regional endpoints when creating the service client as shown in 448 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 449 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 450 * RegisterInstanceRequest request = 451 * RegisterInstanceRequest.newBuilder() 452 * .setParent("parent-995424086") 453 * .setInstanceId("instanceId902024336") 454 * .build(); 455 * Instance response = notebookServiceClient.registerInstanceAsync(request).get(); 456 * } 457 * }</pre> 458 * 459 * @param request The request object containing all of the parameters for the API call. 460 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 461 */ registerInstanceAsync( RegisterInstanceRequest request)462 public final OperationFuture<Instance, OperationMetadata> registerInstanceAsync( 463 RegisterInstanceRequest request) { 464 return registerInstanceOperationCallable().futureCall(request); 465 } 466 467 // AUTO-GENERATED DOCUMENTATION AND METHOD. 468 /** 469 * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances 470 * are instances created with the legacy Compute Engine calls. They are not manageable by the 471 * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. 472 * 473 * <p>Sample code: 474 * 475 * <pre>{@code 476 * // This snippet has been automatically generated and should be regarded as a code template only. 477 * // It will require modifications to work: 478 * // - It may require correct/in-range values for request initialization. 479 * // - It may require specifying regional endpoints when creating the service client as shown in 480 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 481 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 482 * RegisterInstanceRequest request = 483 * RegisterInstanceRequest.newBuilder() 484 * .setParent("parent-995424086") 485 * .setInstanceId("instanceId902024336") 486 * .build(); 487 * OperationFuture<Instance, OperationMetadata> future = 488 * notebookServiceClient.registerInstanceOperationCallable().futureCall(request); 489 * // Do something. 490 * Instance response = future.get(); 491 * } 492 * }</pre> 493 */ 494 public final OperationCallable<RegisterInstanceRequest, Instance, OperationMetadata> registerInstanceOperationCallable()495 registerInstanceOperationCallable() { 496 return stub.registerInstanceOperationCallable(); 497 } 498 499 // AUTO-GENERATED DOCUMENTATION AND METHOD. 500 /** 501 * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances 502 * are instances created with the legacy Compute Engine calls. They are not manageable by the 503 * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. 504 * 505 * <p>Sample code: 506 * 507 * <pre>{@code 508 * // This snippet has been automatically generated and should be regarded as a code template only. 509 * // It will require modifications to work: 510 * // - It may require correct/in-range values for request initialization. 511 * // - It may require specifying regional endpoints when creating the service client as shown in 512 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 513 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 514 * RegisterInstanceRequest request = 515 * RegisterInstanceRequest.newBuilder() 516 * .setParent("parent-995424086") 517 * .setInstanceId("instanceId902024336") 518 * .build(); 519 * ApiFuture<Operation> future = 520 * notebookServiceClient.registerInstanceCallable().futureCall(request); 521 * // Do something. 522 * Operation response = future.get(); 523 * } 524 * }</pre> 525 */ registerInstanceCallable()526 public final UnaryCallable<RegisterInstanceRequest, Operation> registerInstanceCallable() { 527 return stub.registerInstanceCallable(); 528 } 529 530 // AUTO-GENERATED DOCUMENTATION AND METHOD. 531 /** 532 * Updates the guest accelerators of a single Instance. 533 * 534 * <p>Sample code: 535 * 536 * <pre>{@code 537 * // This snippet has been automatically generated and should be regarded as a code template only. 538 * // It will require modifications to work: 539 * // - It may require correct/in-range values for request initialization. 540 * // - It may require specifying regional endpoints when creating the service client as shown in 541 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 542 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 543 * SetInstanceAcceleratorRequest request = 544 * SetInstanceAcceleratorRequest.newBuilder() 545 * .setName("name3373707") 546 * .setCoreCount(-1963855761) 547 * .build(); 548 * Instance response = notebookServiceClient.setInstanceAcceleratorAsync(request).get(); 549 * } 550 * }</pre> 551 * 552 * @param request The request object containing all of the parameters for the API call. 553 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 554 */ setInstanceAcceleratorAsync( SetInstanceAcceleratorRequest request)555 public final OperationFuture<Instance, OperationMetadata> setInstanceAcceleratorAsync( 556 SetInstanceAcceleratorRequest request) { 557 return setInstanceAcceleratorOperationCallable().futureCall(request); 558 } 559 560 // AUTO-GENERATED DOCUMENTATION AND METHOD. 561 /** 562 * Updates the guest accelerators of a single Instance. 563 * 564 * <p>Sample code: 565 * 566 * <pre>{@code 567 * // This snippet has been automatically generated and should be regarded as a code template only. 568 * // It will require modifications to work: 569 * // - It may require correct/in-range values for request initialization. 570 * // - It may require specifying regional endpoints when creating the service client as shown in 571 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 572 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 573 * SetInstanceAcceleratorRequest request = 574 * SetInstanceAcceleratorRequest.newBuilder() 575 * .setName("name3373707") 576 * .setCoreCount(-1963855761) 577 * .build(); 578 * OperationFuture<Instance, OperationMetadata> future = 579 * notebookServiceClient.setInstanceAcceleratorOperationCallable().futureCall(request); 580 * // Do something. 581 * Instance response = future.get(); 582 * } 583 * }</pre> 584 */ 585 public final OperationCallable<SetInstanceAcceleratorRequest, Instance, OperationMetadata> setInstanceAcceleratorOperationCallable()586 setInstanceAcceleratorOperationCallable() { 587 return stub.setInstanceAcceleratorOperationCallable(); 588 } 589 590 // AUTO-GENERATED DOCUMENTATION AND METHOD. 591 /** 592 * Updates the guest accelerators of a single Instance. 593 * 594 * <p>Sample code: 595 * 596 * <pre>{@code 597 * // This snippet has been automatically generated and should be regarded as a code template only. 598 * // It will require modifications to work: 599 * // - It may require correct/in-range values for request initialization. 600 * // - It may require specifying regional endpoints when creating the service client as shown in 601 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 602 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 603 * SetInstanceAcceleratorRequest request = 604 * SetInstanceAcceleratorRequest.newBuilder() 605 * .setName("name3373707") 606 * .setCoreCount(-1963855761) 607 * .build(); 608 * ApiFuture<Operation> future = 609 * notebookServiceClient.setInstanceAcceleratorCallable().futureCall(request); 610 * // Do something. 611 * Operation response = future.get(); 612 * } 613 * }</pre> 614 */ 615 public final UnaryCallable<SetInstanceAcceleratorRequest, Operation> setInstanceAcceleratorCallable()616 setInstanceAcceleratorCallable() { 617 return stub.setInstanceAcceleratorCallable(); 618 } 619 620 // AUTO-GENERATED DOCUMENTATION AND METHOD. 621 /** 622 * Updates the machine type of a single Instance. 623 * 624 * <p>Sample code: 625 * 626 * <pre>{@code 627 * // This snippet has been automatically generated and should be regarded as a code template only. 628 * // It will require modifications to work: 629 * // - It may require correct/in-range values for request initialization. 630 * // - It may require specifying regional endpoints when creating the service client as shown in 631 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 632 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 633 * SetInstanceMachineTypeRequest request = 634 * SetInstanceMachineTypeRequest.newBuilder() 635 * .setName("name3373707") 636 * .setMachineType("machineType-218117087") 637 * .build(); 638 * Instance response = notebookServiceClient.setInstanceMachineTypeAsync(request).get(); 639 * } 640 * }</pre> 641 * 642 * @param request The request object containing all of the parameters for the API call. 643 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 644 */ setInstanceMachineTypeAsync( SetInstanceMachineTypeRequest request)645 public final OperationFuture<Instance, OperationMetadata> setInstanceMachineTypeAsync( 646 SetInstanceMachineTypeRequest request) { 647 return setInstanceMachineTypeOperationCallable().futureCall(request); 648 } 649 650 // AUTO-GENERATED DOCUMENTATION AND METHOD. 651 /** 652 * Updates the machine type of a single Instance. 653 * 654 * <p>Sample code: 655 * 656 * <pre>{@code 657 * // This snippet has been automatically generated and should be regarded as a code template only. 658 * // It will require modifications to work: 659 * // - It may require correct/in-range values for request initialization. 660 * // - It may require specifying regional endpoints when creating the service client as shown in 661 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 662 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 663 * SetInstanceMachineTypeRequest request = 664 * SetInstanceMachineTypeRequest.newBuilder() 665 * .setName("name3373707") 666 * .setMachineType("machineType-218117087") 667 * .build(); 668 * OperationFuture<Instance, OperationMetadata> future = 669 * notebookServiceClient.setInstanceMachineTypeOperationCallable().futureCall(request); 670 * // Do something. 671 * Instance response = future.get(); 672 * } 673 * }</pre> 674 */ 675 public final OperationCallable<SetInstanceMachineTypeRequest, Instance, OperationMetadata> setInstanceMachineTypeOperationCallable()676 setInstanceMachineTypeOperationCallable() { 677 return stub.setInstanceMachineTypeOperationCallable(); 678 } 679 680 // AUTO-GENERATED DOCUMENTATION AND METHOD. 681 /** 682 * Updates the machine type of a single Instance. 683 * 684 * <p>Sample code: 685 * 686 * <pre>{@code 687 * // This snippet has been automatically generated and should be regarded as a code template only. 688 * // It will require modifications to work: 689 * // - It may require correct/in-range values for request initialization. 690 * // - It may require specifying regional endpoints when creating the service client as shown in 691 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 692 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 693 * SetInstanceMachineTypeRequest request = 694 * SetInstanceMachineTypeRequest.newBuilder() 695 * .setName("name3373707") 696 * .setMachineType("machineType-218117087") 697 * .build(); 698 * ApiFuture<Operation> future = 699 * notebookServiceClient.setInstanceMachineTypeCallable().futureCall(request); 700 * // Do something. 701 * Operation response = future.get(); 702 * } 703 * }</pre> 704 */ 705 public final UnaryCallable<SetInstanceMachineTypeRequest, Operation> setInstanceMachineTypeCallable()706 setInstanceMachineTypeCallable() { 707 return stub.setInstanceMachineTypeCallable(); 708 } 709 710 // AUTO-GENERATED DOCUMENTATION AND METHOD. 711 /** 712 * Updates the labels of an Instance. 713 * 714 * <p>Sample code: 715 * 716 * <pre>{@code 717 * // This snippet has been automatically generated and should be regarded as a code template only. 718 * // It will require modifications to work: 719 * // - It may require correct/in-range values for request initialization. 720 * // - It may require specifying regional endpoints when creating the service client as shown in 721 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 722 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 723 * SetInstanceLabelsRequest request = 724 * SetInstanceLabelsRequest.newBuilder() 725 * .setName("name3373707") 726 * .putAllLabels(new HashMap<String, String>()) 727 * .build(); 728 * Instance response = notebookServiceClient.setInstanceLabelsAsync(request).get(); 729 * } 730 * }</pre> 731 * 732 * @param request The request object containing all of the parameters for the API call. 733 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 734 */ setInstanceLabelsAsync( SetInstanceLabelsRequest request)735 public final OperationFuture<Instance, OperationMetadata> setInstanceLabelsAsync( 736 SetInstanceLabelsRequest request) { 737 return setInstanceLabelsOperationCallable().futureCall(request); 738 } 739 740 // AUTO-GENERATED DOCUMENTATION AND METHOD. 741 /** 742 * Updates the labels of an Instance. 743 * 744 * <p>Sample code: 745 * 746 * <pre>{@code 747 * // This snippet has been automatically generated and should be regarded as a code template only. 748 * // It will require modifications to work: 749 * // - It may require correct/in-range values for request initialization. 750 * // - It may require specifying regional endpoints when creating the service client as shown in 751 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 752 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 753 * SetInstanceLabelsRequest request = 754 * SetInstanceLabelsRequest.newBuilder() 755 * .setName("name3373707") 756 * .putAllLabels(new HashMap<String, String>()) 757 * .build(); 758 * OperationFuture<Instance, OperationMetadata> future = 759 * notebookServiceClient.setInstanceLabelsOperationCallable().futureCall(request); 760 * // Do something. 761 * Instance response = future.get(); 762 * } 763 * }</pre> 764 */ 765 public final OperationCallable<SetInstanceLabelsRequest, Instance, OperationMetadata> setInstanceLabelsOperationCallable()766 setInstanceLabelsOperationCallable() { 767 return stub.setInstanceLabelsOperationCallable(); 768 } 769 770 // AUTO-GENERATED DOCUMENTATION AND METHOD. 771 /** 772 * Updates the labels of an Instance. 773 * 774 * <p>Sample code: 775 * 776 * <pre>{@code 777 * // This snippet has been automatically generated and should be regarded as a code template only. 778 * // It will require modifications to work: 779 * // - It may require correct/in-range values for request initialization. 780 * // - It may require specifying regional endpoints when creating the service client as shown in 781 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 782 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 783 * SetInstanceLabelsRequest request = 784 * SetInstanceLabelsRequest.newBuilder() 785 * .setName("name3373707") 786 * .putAllLabels(new HashMap<String, String>()) 787 * .build(); 788 * ApiFuture<Operation> future = 789 * notebookServiceClient.setInstanceLabelsCallable().futureCall(request); 790 * // Do something. 791 * Operation response = future.get(); 792 * } 793 * }</pre> 794 */ setInstanceLabelsCallable()795 public final UnaryCallable<SetInstanceLabelsRequest, Operation> setInstanceLabelsCallable() { 796 return stub.setInstanceLabelsCallable(); 797 } 798 799 // AUTO-GENERATED DOCUMENTATION AND METHOD. 800 /** 801 * Deletes a single Instance. 802 * 803 * <p>Sample code: 804 * 805 * <pre>{@code 806 * // This snippet has been automatically generated and should be regarded as a code template only. 807 * // It will require modifications to work: 808 * // - It may require correct/in-range values for request initialization. 809 * // - It may require specifying regional endpoints when creating the service client as shown in 810 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 811 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 812 * DeleteInstanceRequest request = 813 * DeleteInstanceRequest.newBuilder().setName("name3373707").build(); 814 * notebookServiceClient.deleteInstanceAsync(request).get(); 815 * } 816 * }</pre> 817 * 818 * @param request The request object containing all of the parameters for the API call. 819 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 820 */ deleteInstanceAsync( DeleteInstanceRequest request)821 public final OperationFuture<Empty, OperationMetadata> deleteInstanceAsync( 822 DeleteInstanceRequest request) { 823 return deleteInstanceOperationCallable().futureCall(request); 824 } 825 826 // AUTO-GENERATED DOCUMENTATION AND METHOD. 827 /** 828 * Deletes a single Instance. 829 * 830 * <p>Sample code: 831 * 832 * <pre>{@code 833 * // This snippet has been automatically generated and should be regarded as a code template only. 834 * // It will require modifications to work: 835 * // - It may require correct/in-range values for request initialization. 836 * // - It may require specifying regional endpoints when creating the service client as shown in 837 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 838 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 839 * DeleteInstanceRequest request = 840 * DeleteInstanceRequest.newBuilder().setName("name3373707").build(); 841 * OperationFuture<Empty, OperationMetadata> future = 842 * notebookServiceClient.deleteInstanceOperationCallable().futureCall(request); 843 * // Do something. 844 * future.get(); 845 * } 846 * }</pre> 847 */ 848 public final OperationCallable<DeleteInstanceRequest, Empty, OperationMetadata> deleteInstanceOperationCallable()849 deleteInstanceOperationCallable() { 850 return stub.deleteInstanceOperationCallable(); 851 } 852 853 // AUTO-GENERATED DOCUMENTATION AND METHOD. 854 /** 855 * Deletes a single Instance. 856 * 857 * <p>Sample code: 858 * 859 * <pre>{@code 860 * // This snippet has been automatically generated and should be regarded as a code template only. 861 * // It will require modifications to work: 862 * // - It may require correct/in-range values for request initialization. 863 * // - It may require specifying regional endpoints when creating the service client as shown in 864 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 865 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 866 * DeleteInstanceRequest request = 867 * DeleteInstanceRequest.newBuilder().setName("name3373707").build(); 868 * ApiFuture<Operation> future = 869 * notebookServiceClient.deleteInstanceCallable().futureCall(request); 870 * // Do something. 871 * future.get(); 872 * } 873 * }</pre> 874 */ deleteInstanceCallable()875 public final UnaryCallable<DeleteInstanceRequest, Operation> deleteInstanceCallable() { 876 return stub.deleteInstanceCallable(); 877 } 878 879 // AUTO-GENERATED DOCUMENTATION AND METHOD. 880 /** 881 * Starts a notebook instance. 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 (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 892 * StartInstanceRequest request = 893 * StartInstanceRequest.newBuilder().setName("name3373707").build(); 894 * Instance response = notebookServiceClient.startInstanceAsync(request).get(); 895 * } 896 * }</pre> 897 * 898 * @param request The request object containing all of the parameters for the API call. 899 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 900 */ startInstanceAsync( StartInstanceRequest request)901 public final OperationFuture<Instance, OperationMetadata> startInstanceAsync( 902 StartInstanceRequest request) { 903 return startInstanceOperationCallable().futureCall(request); 904 } 905 906 // AUTO-GENERATED DOCUMENTATION AND METHOD. 907 /** 908 * Starts a notebook instance. 909 * 910 * <p>Sample code: 911 * 912 * <pre>{@code 913 * // This snippet has been automatically generated and should be regarded as a code template only. 914 * // It will require modifications to work: 915 * // - It may require correct/in-range values for request initialization. 916 * // - It may require specifying regional endpoints when creating the service client as shown in 917 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 918 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 919 * StartInstanceRequest request = 920 * StartInstanceRequest.newBuilder().setName("name3373707").build(); 921 * OperationFuture<Instance, OperationMetadata> future = 922 * notebookServiceClient.startInstanceOperationCallable().futureCall(request); 923 * // Do something. 924 * Instance response = future.get(); 925 * } 926 * }</pre> 927 */ 928 public final OperationCallable<StartInstanceRequest, Instance, OperationMetadata> startInstanceOperationCallable()929 startInstanceOperationCallable() { 930 return stub.startInstanceOperationCallable(); 931 } 932 933 // AUTO-GENERATED DOCUMENTATION AND METHOD. 934 /** 935 * Starts a notebook instance. 936 * 937 * <p>Sample code: 938 * 939 * <pre>{@code 940 * // This snippet has been automatically generated and should be regarded as a code template only. 941 * // It will require modifications to work: 942 * // - It may require correct/in-range values for request initialization. 943 * // - It may require specifying regional endpoints when creating the service client as shown in 944 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 945 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 946 * StartInstanceRequest request = 947 * StartInstanceRequest.newBuilder().setName("name3373707").build(); 948 * ApiFuture<Operation> future = 949 * notebookServiceClient.startInstanceCallable().futureCall(request); 950 * // Do something. 951 * Operation response = future.get(); 952 * } 953 * }</pre> 954 */ startInstanceCallable()955 public final UnaryCallable<StartInstanceRequest, Operation> startInstanceCallable() { 956 return stub.startInstanceCallable(); 957 } 958 959 // AUTO-GENERATED DOCUMENTATION AND METHOD. 960 /** 961 * Stops a notebook instance. 962 * 963 * <p>Sample code: 964 * 965 * <pre>{@code 966 * // This snippet has been automatically generated and should be regarded as a code template only. 967 * // It will require modifications to work: 968 * // - It may require correct/in-range values for request initialization. 969 * // - It may require specifying regional endpoints when creating the service client as shown in 970 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 971 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 972 * StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build(); 973 * Instance response = notebookServiceClient.stopInstanceAsync(request).get(); 974 * } 975 * }</pre> 976 * 977 * @param request The request object containing all of the parameters for the API call. 978 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 979 */ stopInstanceAsync( StopInstanceRequest request)980 public final OperationFuture<Instance, OperationMetadata> stopInstanceAsync( 981 StopInstanceRequest request) { 982 return stopInstanceOperationCallable().futureCall(request); 983 } 984 985 // AUTO-GENERATED DOCUMENTATION AND METHOD. 986 /** 987 * Stops a notebook instance. 988 * 989 * <p>Sample code: 990 * 991 * <pre>{@code 992 * // This snippet has been automatically generated and should be regarded as a code template only. 993 * // It will require modifications to work: 994 * // - It may require correct/in-range values for request initialization. 995 * // - It may require specifying regional endpoints when creating the service client as shown in 996 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 997 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 998 * StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build(); 999 * OperationFuture<Instance, OperationMetadata> future = 1000 * notebookServiceClient.stopInstanceOperationCallable().futureCall(request); 1001 * // Do something. 1002 * Instance response = future.get(); 1003 * } 1004 * }</pre> 1005 */ 1006 public final OperationCallable<StopInstanceRequest, Instance, OperationMetadata> stopInstanceOperationCallable()1007 stopInstanceOperationCallable() { 1008 return stub.stopInstanceOperationCallable(); 1009 } 1010 1011 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1012 /** 1013 * Stops a notebook instance. 1014 * 1015 * <p>Sample code: 1016 * 1017 * <pre>{@code 1018 * // This snippet has been automatically generated and should be regarded as a code template only. 1019 * // It will require modifications to work: 1020 * // - It may require correct/in-range values for request initialization. 1021 * // - It may require specifying regional endpoints when creating the service client as shown in 1022 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1023 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1024 * StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build(); 1025 * ApiFuture<Operation> future = 1026 * notebookServiceClient.stopInstanceCallable().futureCall(request); 1027 * // Do something. 1028 * Operation response = future.get(); 1029 * } 1030 * }</pre> 1031 */ stopInstanceCallable()1032 public final UnaryCallable<StopInstanceRequest, Operation> stopInstanceCallable() { 1033 return stub.stopInstanceCallable(); 1034 } 1035 1036 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1037 /** 1038 * Resets a notebook instance. 1039 * 1040 * <p>Sample code: 1041 * 1042 * <pre>{@code 1043 * // This snippet has been automatically generated and should be regarded as a code template only. 1044 * // It will require modifications to work: 1045 * // - It may require correct/in-range values for request initialization. 1046 * // - It may require specifying regional endpoints when creating the service client as shown in 1047 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1048 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1049 * ResetInstanceRequest request = 1050 * ResetInstanceRequest.newBuilder().setName("name3373707").build(); 1051 * Instance response = notebookServiceClient.resetInstanceAsync(request).get(); 1052 * } 1053 * }</pre> 1054 * 1055 * @param request The request object containing all of the parameters for the API call. 1056 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1057 */ resetInstanceAsync( ResetInstanceRequest request)1058 public final OperationFuture<Instance, OperationMetadata> resetInstanceAsync( 1059 ResetInstanceRequest request) { 1060 return resetInstanceOperationCallable().futureCall(request); 1061 } 1062 1063 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1064 /** 1065 * Resets a notebook instance. 1066 * 1067 * <p>Sample code: 1068 * 1069 * <pre>{@code 1070 * // This snippet has been automatically generated and should be regarded as a code template only. 1071 * // It will require modifications to work: 1072 * // - It may require correct/in-range values for request initialization. 1073 * // - It may require specifying regional endpoints when creating the service client as shown in 1074 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1075 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1076 * ResetInstanceRequest request = 1077 * ResetInstanceRequest.newBuilder().setName("name3373707").build(); 1078 * OperationFuture<Instance, OperationMetadata> future = 1079 * notebookServiceClient.resetInstanceOperationCallable().futureCall(request); 1080 * // Do something. 1081 * Instance response = future.get(); 1082 * } 1083 * }</pre> 1084 */ 1085 public final OperationCallable<ResetInstanceRequest, Instance, OperationMetadata> resetInstanceOperationCallable()1086 resetInstanceOperationCallable() { 1087 return stub.resetInstanceOperationCallable(); 1088 } 1089 1090 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1091 /** 1092 * Resets a notebook instance. 1093 * 1094 * <p>Sample code: 1095 * 1096 * <pre>{@code 1097 * // This snippet has been automatically generated and should be regarded as a code template only. 1098 * // It will require modifications to work: 1099 * // - It may require correct/in-range values for request initialization. 1100 * // - It may require specifying regional endpoints when creating the service client as shown in 1101 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1102 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1103 * ResetInstanceRequest request = 1104 * ResetInstanceRequest.newBuilder().setName("name3373707").build(); 1105 * ApiFuture<Operation> future = 1106 * notebookServiceClient.resetInstanceCallable().futureCall(request); 1107 * // Do something. 1108 * Operation response = future.get(); 1109 * } 1110 * }</pre> 1111 */ resetInstanceCallable()1112 public final UnaryCallable<ResetInstanceRequest, Operation> resetInstanceCallable() { 1113 return stub.resetInstanceCallable(); 1114 } 1115 1116 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1117 /** 1118 * Allows notebook instances to report their latest instance information to the Notebooks API 1119 * server. The server will merge the reported information to the instance metadata store. Do not 1120 * use this method directly. 1121 * 1122 * <p>Sample code: 1123 * 1124 * <pre>{@code 1125 * // This snippet has been automatically generated and should be regarded as a code template only. 1126 * // It will require modifications to work: 1127 * // - It may require correct/in-range values for request initialization. 1128 * // - It may require specifying regional endpoints when creating the service client as shown in 1129 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1130 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1131 * ReportInstanceInfoRequest request = 1132 * ReportInstanceInfoRequest.newBuilder() 1133 * .setName("name3373707") 1134 * .setVmId("vmId3622450") 1135 * .putAllMetadata(new HashMap<String, String>()) 1136 * .build(); 1137 * Instance response = notebookServiceClient.reportInstanceInfoAsync(request).get(); 1138 * } 1139 * }</pre> 1140 * 1141 * @param request The request object containing all of the parameters for the API call. 1142 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1143 */ reportInstanceInfoAsync( ReportInstanceInfoRequest request)1144 public final OperationFuture<Instance, OperationMetadata> reportInstanceInfoAsync( 1145 ReportInstanceInfoRequest request) { 1146 return reportInstanceInfoOperationCallable().futureCall(request); 1147 } 1148 1149 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1150 /** 1151 * Allows notebook instances to report their latest instance information to the Notebooks API 1152 * server. The server will merge the reported information to the instance metadata store. Do not 1153 * use this method directly. 1154 * 1155 * <p>Sample code: 1156 * 1157 * <pre>{@code 1158 * // This snippet has been automatically generated and should be regarded as a code template only. 1159 * // It will require modifications to work: 1160 * // - It may require correct/in-range values for request initialization. 1161 * // - It may require specifying regional endpoints when creating the service client as shown in 1162 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1163 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1164 * ReportInstanceInfoRequest request = 1165 * ReportInstanceInfoRequest.newBuilder() 1166 * .setName("name3373707") 1167 * .setVmId("vmId3622450") 1168 * .putAllMetadata(new HashMap<String, String>()) 1169 * .build(); 1170 * OperationFuture<Instance, OperationMetadata> future = 1171 * notebookServiceClient.reportInstanceInfoOperationCallable().futureCall(request); 1172 * // Do something. 1173 * Instance response = future.get(); 1174 * } 1175 * }</pre> 1176 */ 1177 public final OperationCallable<ReportInstanceInfoRequest, Instance, OperationMetadata> reportInstanceInfoOperationCallable()1178 reportInstanceInfoOperationCallable() { 1179 return stub.reportInstanceInfoOperationCallable(); 1180 } 1181 1182 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1183 /** 1184 * Allows notebook instances to report their latest instance information to the Notebooks API 1185 * server. The server will merge the reported information to the instance metadata store. Do not 1186 * use this method directly. 1187 * 1188 * <p>Sample code: 1189 * 1190 * <pre>{@code 1191 * // This snippet has been automatically generated and should be regarded as a code template only. 1192 * // It will require modifications to work: 1193 * // - It may require correct/in-range values for request initialization. 1194 * // - It may require specifying regional endpoints when creating the service client as shown in 1195 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1196 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1197 * ReportInstanceInfoRequest request = 1198 * ReportInstanceInfoRequest.newBuilder() 1199 * .setName("name3373707") 1200 * .setVmId("vmId3622450") 1201 * .putAllMetadata(new HashMap<String, String>()) 1202 * .build(); 1203 * ApiFuture<Operation> future = 1204 * notebookServiceClient.reportInstanceInfoCallable().futureCall(request); 1205 * // Do something. 1206 * Operation response = future.get(); 1207 * } 1208 * }</pre> 1209 */ reportInstanceInfoCallable()1210 public final UnaryCallable<ReportInstanceInfoRequest, Operation> reportInstanceInfoCallable() { 1211 return stub.reportInstanceInfoCallable(); 1212 } 1213 1214 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1215 /** 1216 * Check if a notebook instance is upgradable. Deprecated. Please consider using v1. 1217 * 1218 * <p>Sample code: 1219 * 1220 * <pre>{@code 1221 * // This snippet has been automatically generated and should be regarded as a code template only. 1222 * // It will require modifications to work: 1223 * // - It may require correct/in-range values for request initialization. 1224 * // - It may require specifying regional endpoints when creating the service client as shown in 1225 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1226 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1227 * IsInstanceUpgradeableRequest request = 1228 * IsInstanceUpgradeableRequest.newBuilder() 1229 * .setNotebookInstance("notebookInstance-544239728") 1230 * .build(); 1231 * IsInstanceUpgradeableResponse response = notebookServiceClient.isInstanceUpgradeable(request); 1232 * } 1233 * }</pre> 1234 * 1235 * @param request The request object containing all of the parameters for the API call. 1236 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1237 * @deprecated This method is deprecated and will be removed in the next major version update. 1238 */ 1239 @Deprecated isInstanceUpgradeable( IsInstanceUpgradeableRequest request)1240 public final IsInstanceUpgradeableResponse isInstanceUpgradeable( 1241 IsInstanceUpgradeableRequest request) { 1242 return isInstanceUpgradeableCallable().call(request); 1243 } 1244 1245 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1246 /** 1247 * Check if a notebook instance is upgradable. Deprecated. Please consider using v1. 1248 * 1249 * <p>Sample code: 1250 * 1251 * <pre>{@code 1252 * // This snippet has been automatically generated and should be regarded as a code template only. 1253 * // It will require modifications to work: 1254 * // - It may require correct/in-range values for request initialization. 1255 * // - It may require specifying regional endpoints when creating the service client as shown in 1256 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1257 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1258 * IsInstanceUpgradeableRequest request = 1259 * IsInstanceUpgradeableRequest.newBuilder() 1260 * .setNotebookInstance("notebookInstance-544239728") 1261 * .build(); 1262 * ApiFuture<IsInstanceUpgradeableResponse> future = 1263 * notebookServiceClient.isInstanceUpgradeableCallable().futureCall(request); 1264 * // Do something. 1265 * IsInstanceUpgradeableResponse response = future.get(); 1266 * } 1267 * }</pre> 1268 * 1269 * @deprecated This method is deprecated and will be removed in the next major version update. 1270 */ 1271 @Deprecated 1272 public final UnaryCallable<IsInstanceUpgradeableRequest, IsInstanceUpgradeableResponse> isInstanceUpgradeableCallable()1273 isInstanceUpgradeableCallable() { 1274 return stub.isInstanceUpgradeableCallable(); 1275 } 1276 1277 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1278 /** 1279 * Upgrades a notebook instance to the latest version. Deprecated. Please consider using v1. 1280 * 1281 * <p>Sample code: 1282 * 1283 * <pre>{@code 1284 * // This snippet has been automatically generated and should be regarded as a code template only. 1285 * // It will require modifications to work: 1286 * // - It may require correct/in-range values for request initialization. 1287 * // - It may require specifying regional endpoints when creating the service client as shown in 1288 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1289 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1290 * UpgradeInstanceRequest request = 1291 * UpgradeInstanceRequest.newBuilder().setName("name3373707").build(); 1292 * Instance response = notebookServiceClient.upgradeInstanceAsync(request).get(); 1293 * } 1294 * }</pre> 1295 * 1296 * @param request The request object containing all of the parameters for the API call. 1297 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1298 * @deprecated This method is deprecated and will be removed in the next major version update. 1299 */ 1300 @Deprecated upgradeInstanceAsync( UpgradeInstanceRequest request)1301 public final OperationFuture<Instance, OperationMetadata> upgradeInstanceAsync( 1302 UpgradeInstanceRequest request) { 1303 return upgradeInstanceOperationCallable().futureCall(request); 1304 } 1305 1306 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1307 /** 1308 * Upgrades a notebook instance to the latest version. Deprecated. Please consider using v1. 1309 * 1310 * <p>Sample code: 1311 * 1312 * <pre>{@code 1313 * // This snippet has been automatically generated and should be regarded as a code template only. 1314 * // It will require modifications to work: 1315 * // - It may require correct/in-range values for request initialization. 1316 * // - It may require specifying regional endpoints when creating the service client as shown in 1317 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1318 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1319 * UpgradeInstanceRequest request = 1320 * UpgradeInstanceRequest.newBuilder().setName("name3373707").build(); 1321 * OperationFuture<Instance, OperationMetadata> future = 1322 * notebookServiceClient.upgradeInstanceOperationCallable().futureCall(request); 1323 * // Do something. 1324 * Instance response = future.get(); 1325 * } 1326 * }</pre> 1327 * 1328 * @deprecated This method is deprecated and will be removed in the next major version update. 1329 */ 1330 @Deprecated 1331 public final OperationCallable<UpgradeInstanceRequest, Instance, OperationMetadata> upgradeInstanceOperationCallable()1332 upgradeInstanceOperationCallable() { 1333 return stub.upgradeInstanceOperationCallable(); 1334 } 1335 1336 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1337 /** 1338 * Upgrades a notebook instance to the latest version. Deprecated. Please consider using v1. 1339 * 1340 * <p>Sample code: 1341 * 1342 * <pre>{@code 1343 * // This snippet has been automatically generated and should be regarded as a code template only. 1344 * // It will require modifications to work: 1345 * // - It may require correct/in-range values for request initialization. 1346 * // - It may require specifying regional endpoints when creating the service client as shown in 1347 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1348 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1349 * UpgradeInstanceRequest request = 1350 * UpgradeInstanceRequest.newBuilder().setName("name3373707").build(); 1351 * ApiFuture<Operation> future = 1352 * notebookServiceClient.upgradeInstanceCallable().futureCall(request); 1353 * // Do something. 1354 * Operation response = future.get(); 1355 * } 1356 * }</pre> 1357 * 1358 * @deprecated This method is deprecated and will be removed in the next major version update. 1359 */ 1360 @Deprecated upgradeInstanceCallable()1361 public final UnaryCallable<UpgradeInstanceRequest, Operation> upgradeInstanceCallable() { 1362 return stub.upgradeInstanceCallable(); 1363 } 1364 1365 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1366 /** 1367 * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method 1368 * directly. Deprecated. Please consider using v1. 1369 * 1370 * <p>Sample code: 1371 * 1372 * <pre>{@code 1373 * // This snippet has been automatically generated and should be regarded as a code template only. 1374 * // It will require modifications to work: 1375 * // - It may require correct/in-range values for request initialization. 1376 * // - It may require specifying regional endpoints when creating the service client as shown in 1377 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1378 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1379 * UpgradeInstanceInternalRequest request = 1380 * UpgradeInstanceInternalRequest.newBuilder() 1381 * .setName("name3373707") 1382 * .setVmId("vmId3622450") 1383 * .build(); 1384 * Instance response = notebookServiceClient.upgradeInstanceInternalAsync(request).get(); 1385 * } 1386 * }</pre> 1387 * 1388 * @param request The request object containing all of the parameters for the API call. 1389 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1390 * @deprecated This method is deprecated and will be removed in the next major version update. 1391 */ 1392 @Deprecated upgradeInstanceInternalAsync( UpgradeInstanceInternalRequest request)1393 public final OperationFuture<Instance, OperationMetadata> upgradeInstanceInternalAsync( 1394 UpgradeInstanceInternalRequest request) { 1395 return upgradeInstanceInternalOperationCallable().futureCall(request); 1396 } 1397 1398 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1399 /** 1400 * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method 1401 * directly. Deprecated. Please consider using v1. 1402 * 1403 * <p>Sample code: 1404 * 1405 * <pre>{@code 1406 * // This snippet has been automatically generated and should be regarded as a code template only. 1407 * // It will require modifications to work: 1408 * // - It may require correct/in-range values for request initialization. 1409 * // - It may require specifying regional endpoints when creating the service client as shown in 1410 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1411 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1412 * UpgradeInstanceInternalRequest request = 1413 * UpgradeInstanceInternalRequest.newBuilder() 1414 * .setName("name3373707") 1415 * .setVmId("vmId3622450") 1416 * .build(); 1417 * OperationFuture<Instance, OperationMetadata> future = 1418 * notebookServiceClient.upgradeInstanceInternalOperationCallable().futureCall(request); 1419 * // Do something. 1420 * Instance response = future.get(); 1421 * } 1422 * }</pre> 1423 * 1424 * @deprecated This method is deprecated and will be removed in the next major version update. 1425 */ 1426 @Deprecated 1427 public final OperationCallable<UpgradeInstanceInternalRequest, Instance, OperationMetadata> upgradeInstanceInternalOperationCallable()1428 upgradeInstanceInternalOperationCallable() { 1429 return stub.upgradeInstanceInternalOperationCallable(); 1430 } 1431 1432 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1433 /** 1434 * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method 1435 * directly. Deprecated. Please consider using v1. 1436 * 1437 * <p>Sample code: 1438 * 1439 * <pre>{@code 1440 * // This snippet has been automatically generated and should be regarded as a code template only. 1441 * // It will require modifications to work: 1442 * // - It may require correct/in-range values for request initialization. 1443 * // - It may require specifying regional endpoints when creating the service client as shown in 1444 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1445 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1446 * UpgradeInstanceInternalRequest request = 1447 * UpgradeInstanceInternalRequest.newBuilder() 1448 * .setName("name3373707") 1449 * .setVmId("vmId3622450") 1450 * .build(); 1451 * ApiFuture<Operation> future = 1452 * notebookServiceClient.upgradeInstanceInternalCallable().futureCall(request); 1453 * // Do something. 1454 * Operation response = future.get(); 1455 * } 1456 * }</pre> 1457 * 1458 * @deprecated This method is deprecated and will be removed in the next major version update. 1459 */ 1460 @Deprecated 1461 public final UnaryCallable<UpgradeInstanceInternalRequest, Operation> upgradeInstanceInternalCallable()1462 upgradeInstanceInternalCallable() { 1463 return stub.upgradeInstanceInternalCallable(); 1464 } 1465 1466 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1467 /** 1468 * Lists environments in a project. 1469 * 1470 * <p>Sample code: 1471 * 1472 * <pre>{@code 1473 * // This snippet has been automatically generated and should be regarded as a code template only. 1474 * // It will require modifications to work: 1475 * // - It may require correct/in-range values for request initialization. 1476 * // - It may require specifying regional endpoints when creating the service client as shown in 1477 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1478 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1479 * ListEnvironmentsRequest request = 1480 * ListEnvironmentsRequest.newBuilder() 1481 * .setParent("parent-995424086") 1482 * .setPageSize(883849137) 1483 * .setPageToken("pageToken873572522") 1484 * .build(); 1485 * for (Environment element : notebookServiceClient.listEnvironments(request).iterateAll()) { 1486 * // doThingsWith(element); 1487 * } 1488 * } 1489 * }</pre> 1490 * 1491 * @param request The request object containing all of the parameters for the API call. 1492 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1493 */ listEnvironments(ListEnvironmentsRequest request)1494 public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request) { 1495 return listEnvironmentsPagedCallable().call(request); 1496 } 1497 1498 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1499 /** 1500 * Lists environments in a project. 1501 * 1502 * <p>Sample code: 1503 * 1504 * <pre>{@code 1505 * // This snippet has been automatically generated and should be regarded as a code template only. 1506 * // It will require modifications to work: 1507 * // - It may require correct/in-range values for request initialization. 1508 * // - It may require specifying regional endpoints when creating the service client as shown in 1509 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1510 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1511 * ListEnvironmentsRequest request = 1512 * ListEnvironmentsRequest.newBuilder() 1513 * .setParent("parent-995424086") 1514 * .setPageSize(883849137) 1515 * .setPageToken("pageToken873572522") 1516 * .build(); 1517 * ApiFuture<Environment> future = 1518 * notebookServiceClient.listEnvironmentsPagedCallable().futureCall(request); 1519 * // Do something. 1520 * for (Environment element : future.get().iterateAll()) { 1521 * // doThingsWith(element); 1522 * } 1523 * } 1524 * }</pre> 1525 */ 1526 public final UnaryCallable<ListEnvironmentsRequest, ListEnvironmentsPagedResponse> listEnvironmentsPagedCallable()1527 listEnvironmentsPagedCallable() { 1528 return stub.listEnvironmentsPagedCallable(); 1529 } 1530 1531 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1532 /** 1533 * Lists environments in a project. 1534 * 1535 * <p>Sample code: 1536 * 1537 * <pre>{@code 1538 * // This snippet has been automatically generated and should be regarded as a code template only. 1539 * // It will require modifications to work: 1540 * // - It may require correct/in-range values for request initialization. 1541 * // - It may require specifying regional endpoints when creating the service client as shown in 1542 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1543 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1544 * ListEnvironmentsRequest request = 1545 * ListEnvironmentsRequest.newBuilder() 1546 * .setParent("parent-995424086") 1547 * .setPageSize(883849137) 1548 * .setPageToken("pageToken873572522") 1549 * .build(); 1550 * while (true) { 1551 * ListEnvironmentsResponse response = 1552 * notebookServiceClient.listEnvironmentsCallable().call(request); 1553 * for (Environment element : response.getEnvironmentsList()) { 1554 * // doThingsWith(element); 1555 * } 1556 * String nextPageToken = response.getNextPageToken(); 1557 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1558 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1559 * } else { 1560 * break; 1561 * } 1562 * } 1563 * } 1564 * }</pre> 1565 */ 1566 public final UnaryCallable<ListEnvironmentsRequest, ListEnvironmentsResponse> listEnvironmentsCallable()1567 listEnvironmentsCallable() { 1568 return stub.listEnvironmentsCallable(); 1569 } 1570 1571 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1572 /** 1573 * Gets details of a single Environment. 1574 * 1575 * <p>Sample code: 1576 * 1577 * <pre>{@code 1578 * // This snippet has been automatically generated and should be regarded as a code template only. 1579 * // It will require modifications to work: 1580 * // - It may require correct/in-range values for request initialization. 1581 * // - It may require specifying regional endpoints when creating the service client as shown in 1582 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1583 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1584 * GetEnvironmentRequest request = 1585 * GetEnvironmentRequest.newBuilder().setName("name3373707").build(); 1586 * Environment response = notebookServiceClient.getEnvironment(request); 1587 * } 1588 * }</pre> 1589 * 1590 * @param request The request object containing all of the parameters for the API call. 1591 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1592 */ getEnvironment(GetEnvironmentRequest request)1593 public final Environment getEnvironment(GetEnvironmentRequest request) { 1594 return getEnvironmentCallable().call(request); 1595 } 1596 1597 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1598 /** 1599 * Gets details of a single Environment. 1600 * 1601 * <p>Sample code: 1602 * 1603 * <pre>{@code 1604 * // This snippet has been automatically generated and should be regarded as a code template only. 1605 * // It will require modifications to work: 1606 * // - It may require correct/in-range values for request initialization. 1607 * // - It may require specifying regional endpoints when creating the service client as shown in 1608 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1609 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1610 * GetEnvironmentRequest request = 1611 * GetEnvironmentRequest.newBuilder().setName("name3373707").build(); 1612 * ApiFuture<Environment> future = 1613 * notebookServiceClient.getEnvironmentCallable().futureCall(request); 1614 * // Do something. 1615 * Environment response = future.get(); 1616 * } 1617 * }</pre> 1618 */ getEnvironmentCallable()1619 public final UnaryCallable<GetEnvironmentRequest, Environment> getEnvironmentCallable() { 1620 return stub.getEnvironmentCallable(); 1621 } 1622 1623 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1624 /** 1625 * Creates a new Environment. 1626 * 1627 * <p>Sample code: 1628 * 1629 * <pre>{@code 1630 * // This snippet has been automatically generated and should be regarded as a code template only. 1631 * // It will require modifications to work: 1632 * // - It may require correct/in-range values for request initialization. 1633 * // - It may require specifying regional endpoints when creating the service client as shown in 1634 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1635 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1636 * CreateEnvironmentRequest request = 1637 * CreateEnvironmentRequest.newBuilder() 1638 * .setParent("parent-995424086") 1639 * .setEnvironmentId("environmentId-950205810") 1640 * .setEnvironment(Environment.newBuilder().build()) 1641 * .build(); 1642 * Environment response = notebookServiceClient.createEnvironmentAsync(request).get(); 1643 * } 1644 * }</pre> 1645 * 1646 * @param request The request object containing all of the parameters for the API call. 1647 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1648 */ createEnvironmentAsync( CreateEnvironmentRequest request)1649 public final OperationFuture<Environment, OperationMetadata> createEnvironmentAsync( 1650 CreateEnvironmentRequest request) { 1651 return createEnvironmentOperationCallable().futureCall(request); 1652 } 1653 1654 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1655 /** 1656 * Creates a new Environment. 1657 * 1658 * <p>Sample code: 1659 * 1660 * <pre>{@code 1661 * // This snippet has been automatically generated and should be regarded as a code template only. 1662 * // It will require modifications to work: 1663 * // - It may require correct/in-range values for request initialization. 1664 * // - It may require specifying regional endpoints when creating the service client as shown in 1665 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1666 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1667 * CreateEnvironmentRequest request = 1668 * CreateEnvironmentRequest.newBuilder() 1669 * .setParent("parent-995424086") 1670 * .setEnvironmentId("environmentId-950205810") 1671 * .setEnvironment(Environment.newBuilder().build()) 1672 * .build(); 1673 * OperationFuture<Environment, OperationMetadata> future = 1674 * notebookServiceClient.createEnvironmentOperationCallable().futureCall(request); 1675 * // Do something. 1676 * Environment response = future.get(); 1677 * } 1678 * }</pre> 1679 */ 1680 public final OperationCallable<CreateEnvironmentRequest, Environment, OperationMetadata> createEnvironmentOperationCallable()1681 createEnvironmentOperationCallable() { 1682 return stub.createEnvironmentOperationCallable(); 1683 } 1684 1685 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1686 /** 1687 * Creates a new Environment. 1688 * 1689 * <p>Sample code: 1690 * 1691 * <pre>{@code 1692 * // This snippet has been automatically generated and should be regarded as a code template only. 1693 * // It will require modifications to work: 1694 * // - It may require correct/in-range values for request initialization. 1695 * // - It may require specifying regional endpoints when creating the service client as shown in 1696 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1697 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1698 * CreateEnvironmentRequest request = 1699 * CreateEnvironmentRequest.newBuilder() 1700 * .setParent("parent-995424086") 1701 * .setEnvironmentId("environmentId-950205810") 1702 * .setEnvironment(Environment.newBuilder().build()) 1703 * .build(); 1704 * ApiFuture<Operation> future = 1705 * notebookServiceClient.createEnvironmentCallable().futureCall(request); 1706 * // Do something. 1707 * Operation response = future.get(); 1708 * } 1709 * }</pre> 1710 */ createEnvironmentCallable()1711 public final UnaryCallable<CreateEnvironmentRequest, Operation> createEnvironmentCallable() { 1712 return stub.createEnvironmentCallable(); 1713 } 1714 1715 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1716 /** 1717 * Deletes a single Environment. 1718 * 1719 * <p>Sample code: 1720 * 1721 * <pre>{@code 1722 * // This snippet has been automatically generated and should be regarded as a code template only. 1723 * // It will require modifications to work: 1724 * // - It may require correct/in-range values for request initialization. 1725 * // - It may require specifying regional endpoints when creating the service client as shown in 1726 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1727 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1728 * DeleteEnvironmentRequest request = 1729 * DeleteEnvironmentRequest.newBuilder().setName("name3373707").build(); 1730 * notebookServiceClient.deleteEnvironmentAsync(request).get(); 1731 * } 1732 * }</pre> 1733 * 1734 * @param request The request object containing all of the parameters for the API call. 1735 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1736 */ deleteEnvironmentAsync( DeleteEnvironmentRequest request)1737 public final OperationFuture<Empty, OperationMetadata> deleteEnvironmentAsync( 1738 DeleteEnvironmentRequest request) { 1739 return deleteEnvironmentOperationCallable().futureCall(request); 1740 } 1741 1742 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1743 /** 1744 * Deletes a single Environment. 1745 * 1746 * <p>Sample code: 1747 * 1748 * <pre>{@code 1749 * // This snippet has been automatically generated and should be regarded as a code template only. 1750 * // It will require modifications to work: 1751 * // - It may require correct/in-range values for request initialization. 1752 * // - It may require specifying regional endpoints when creating the service client as shown in 1753 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1754 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1755 * DeleteEnvironmentRequest request = 1756 * DeleteEnvironmentRequest.newBuilder().setName("name3373707").build(); 1757 * OperationFuture<Empty, OperationMetadata> future = 1758 * notebookServiceClient.deleteEnvironmentOperationCallable().futureCall(request); 1759 * // Do something. 1760 * future.get(); 1761 * } 1762 * }</pre> 1763 */ 1764 public final OperationCallable<DeleteEnvironmentRequest, Empty, OperationMetadata> deleteEnvironmentOperationCallable()1765 deleteEnvironmentOperationCallable() { 1766 return stub.deleteEnvironmentOperationCallable(); 1767 } 1768 1769 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1770 /** 1771 * Deletes a single Environment. 1772 * 1773 * <p>Sample code: 1774 * 1775 * <pre>{@code 1776 * // This snippet has been automatically generated and should be regarded as a code template only. 1777 * // It will require modifications to work: 1778 * // - It may require correct/in-range values for request initialization. 1779 * // - It may require specifying regional endpoints when creating the service client as shown in 1780 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1781 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1782 * DeleteEnvironmentRequest request = 1783 * DeleteEnvironmentRequest.newBuilder().setName("name3373707").build(); 1784 * ApiFuture<Operation> future = 1785 * notebookServiceClient.deleteEnvironmentCallable().futureCall(request); 1786 * // Do something. 1787 * future.get(); 1788 * } 1789 * }</pre> 1790 */ deleteEnvironmentCallable()1791 public final UnaryCallable<DeleteEnvironmentRequest, Operation> deleteEnvironmentCallable() { 1792 return stub.deleteEnvironmentCallable(); 1793 } 1794 1795 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1796 /** 1797 * Lists information about the supported locations for this service. 1798 * 1799 * <p>Sample code: 1800 * 1801 * <pre>{@code 1802 * // This snippet has been automatically generated and should be regarded as a code template only. 1803 * // It will require modifications to work: 1804 * // - It may require correct/in-range values for request initialization. 1805 * // - It may require specifying regional endpoints when creating the service client as shown in 1806 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1807 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1808 * ListLocationsRequest request = 1809 * ListLocationsRequest.newBuilder() 1810 * .setName("name3373707") 1811 * .setFilter("filter-1274492040") 1812 * .setPageSize(883849137) 1813 * .setPageToken("pageToken873572522") 1814 * .build(); 1815 * for (Location element : notebookServiceClient.listLocations(request).iterateAll()) { 1816 * // doThingsWith(element); 1817 * } 1818 * } 1819 * }</pre> 1820 * 1821 * @param request The request object containing all of the parameters for the API call. 1822 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1823 */ listLocations(ListLocationsRequest request)1824 public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { 1825 return listLocationsPagedCallable().call(request); 1826 } 1827 1828 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1829 /** 1830 * Lists information about the supported locations for this service. 1831 * 1832 * <p>Sample code: 1833 * 1834 * <pre>{@code 1835 * // This snippet has been automatically generated and should be regarded as a code template only. 1836 * // It will require modifications to work: 1837 * // - It may require correct/in-range values for request initialization. 1838 * // - It may require specifying regional endpoints when creating the service client as shown in 1839 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1840 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1841 * ListLocationsRequest request = 1842 * ListLocationsRequest.newBuilder() 1843 * .setName("name3373707") 1844 * .setFilter("filter-1274492040") 1845 * .setPageSize(883849137) 1846 * .setPageToken("pageToken873572522") 1847 * .build(); 1848 * ApiFuture<Location> future = 1849 * notebookServiceClient.listLocationsPagedCallable().futureCall(request); 1850 * // Do something. 1851 * for (Location element : future.get().iterateAll()) { 1852 * // doThingsWith(element); 1853 * } 1854 * } 1855 * }</pre> 1856 */ 1857 public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()1858 listLocationsPagedCallable() { 1859 return stub.listLocationsPagedCallable(); 1860 } 1861 1862 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1863 /** 1864 * Lists information about the supported locations for this service. 1865 * 1866 * <p>Sample code: 1867 * 1868 * <pre>{@code 1869 * // This snippet has been automatically generated and should be regarded as a code template only. 1870 * // It will require modifications to work: 1871 * // - It may require correct/in-range values for request initialization. 1872 * // - It may require specifying regional endpoints when creating the service client as shown in 1873 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1874 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1875 * ListLocationsRequest request = 1876 * ListLocationsRequest.newBuilder() 1877 * .setName("name3373707") 1878 * .setFilter("filter-1274492040") 1879 * .setPageSize(883849137) 1880 * .setPageToken("pageToken873572522") 1881 * .build(); 1882 * while (true) { 1883 * ListLocationsResponse response = 1884 * notebookServiceClient.listLocationsCallable().call(request); 1885 * for (Location element : response.getLocationsList()) { 1886 * // doThingsWith(element); 1887 * } 1888 * String nextPageToken = response.getNextPageToken(); 1889 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1890 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1891 * } else { 1892 * break; 1893 * } 1894 * } 1895 * } 1896 * }</pre> 1897 */ listLocationsCallable()1898 public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 1899 return stub.listLocationsCallable(); 1900 } 1901 1902 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1903 /** 1904 * Gets information about a location. 1905 * 1906 * <p>Sample code: 1907 * 1908 * <pre>{@code 1909 * // This snippet has been automatically generated and should be regarded as a code template only. 1910 * // It will require modifications to work: 1911 * // - It may require correct/in-range values for request initialization. 1912 * // - It may require specifying regional endpoints when creating the service client as shown in 1913 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1914 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1915 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1916 * Location response = notebookServiceClient.getLocation(request); 1917 * } 1918 * }</pre> 1919 * 1920 * @param request The request object containing all of the parameters for the API call. 1921 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1922 */ getLocation(GetLocationRequest request)1923 public final Location getLocation(GetLocationRequest request) { 1924 return getLocationCallable().call(request); 1925 } 1926 1927 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1928 /** 1929 * Gets information about a location. 1930 * 1931 * <p>Sample code: 1932 * 1933 * <pre>{@code 1934 * // This snippet has been automatically generated and should be regarded as a code template only. 1935 * // It will require modifications to work: 1936 * // - It may require correct/in-range values for request initialization. 1937 * // - It may require specifying regional endpoints when creating the service client as shown in 1938 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1939 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1940 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1941 * ApiFuture<Location> future = notebookServiceClient.getLocationCallable().futureCall(request); 1942 * // Do something. 1943 * Location response = future.get(); 1944 * } 1945 * }</pre> 1946 */ getLocationCallable()1947 public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 1948 return stub.getLocationCallable(); 1949 } 1950 1951 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1952 /** 1953 * Sets the access control policy on the specified resource. Replacesany existing policy. 1954 * 1955 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 1956 * 1957 * <p>Sample code: 1958 * 1959 * <pre>{@code 1960 * // This snippet has been automatically generated and should be regarded as a code template only. 1961 * // It will require modifications to work: 1962 * // - It may require correct/in-range values for request initialization. 1963 * // - It may require specifying regional endpoints when creating the service client as shown in 1964 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1965 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1966 * SetIamPolicyRequest request = 1967 * SetIamPolicyRequest.newBuilder() 1968 * .setResource("SetIamPolicyRequest1223629066".toString()) 1969 * .setPolicy(Policy.newBuilder().build()) 1970 * .setUpdateMask(FieldMask.newBuilder().build()) 1971 * .build(); 1972 * Policy response = notebookServiceClient.setIamPolicy(request); 1973 * } 1974 * }</pre> 1975 * 1976 * @param request The request object containing all of the parameters for the API call. 1977 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1978 */ setIamPolicy(SetIamPolicyRequest request)1979 public final Policy setIamPolicy(SetIamPolicyRequest request) { 1980 return setIamPolicyCallable().call(request); 1981 } 1982 1983 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1984 /** 1985 * Sets the access control policy on the specified resource. Replacesany existing policy. 1986 * 1987 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 1988 * 1989 * <p>Sample code: 1990 * 1991 * <pre>{@code 1992 * // This snippet has been automatically generated and should be regarded as a code template only. 1993 * // It will require modifications to work: 1994 * // - It may require correct/in-range values for request initialization. 1995 * // - It may require specifying regional endpoints when creating the service client as shown in 1996 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1997 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 1998 * SetIamPolicyRequest request = 1999 * SetIamPolicyRequest.newBuilder() 2000 * .setResource("SetIamPolicyRequest1223629066".toString()) 2001 * .setPolicy(Policy.newBuilder().build()) 2002 * .setUpdateMask(FieldMask.newBuilder().build()) 2003 * .build(); 2004 * ApiFuture<Policy> future = notebookServiceClient.setIamPolicyCallable().futureCall(request); 2005 * // Do something. 2006 * Policy response = future.get(); 2007 * } 2008 * }</pre> 2009 */ setIamPolicyCallable()2010 public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { 2011 return stub.setIamPolicyCallable(); 2012 } 2013 2014 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2015 /** 2016 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 2017 * and does not have a policy set. 2018 * 2019 * <p>Sample code: 2020 * 2021 * <pre>{@code 2022 * // This snippet has been automatically generated and should be regarded as a code template only. 2023 * // It will require modifications to work: 2024 * // - It may require correct/in-range values for request initialization. 2025 * // - It may require specifying regional endpoints when creating the service client as shown in 2026 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2027 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 2028 * GetIamPolicyRequest request = 2029 * GetIamPolicyRequest.newBuilder() 2030 * .setResource("GetIamPolicyRequest-1527610370".toString()) 2031 * .setOptions(GetPolicyOptions.newBuilder().build()) 2032 * .build(); 2033 * Policy response = notebookServiceClient.getIamPolicy(request); 2034 * } 2035 * }</pre> 2036 * 2037 * @param request The request object containing all of the parameters for the API call. 2038 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2039 */ getIamPolicy(GetIamPolicyRequest request)2040 public final Policy getIamPolicy(GetIamPolicyRequest request) { 2041 return getIamPolicyCallable().call(request); 2042 } 2043 2044 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2045 /** 2046 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 2047 * and does not have a policy set. 2048 * 2049 * <p>Sample code: 2050 * 2051 * <pre>{@code 2052 * // This snippet has been automatically generated and should be regarded as a code template only. 2053 * // It will require modifications to work: 2054 * // - It may require correct/in-range values for request initialization. 2055 * // - It may require specifying regional endpoints when creating the service client as shown in 2056 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2057 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 2058 * GetIamPolicyRequest request = 2059 * GetIamPolicyRequest.newBuilder() 2060 * .setResource("GetIamPolicyRequest-1527610370".toString()) 2061 * .setOptions(GetPolicyOptions.newBuilder().build()) 2062 * .build(); 2063 * ApiFuture<Policy> future = notebookServiceClient.getIamPolicyCallable().futureCall(request); 2064 * // Do something. 2065 * Policy response = future.get(); 2066 * } 2067 * }</pre> 2068 */ getIamPolicyCallable()2069 public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { 2070 return stub.getIamPolicyCallable(); 2071 } 2072 2073 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2074 /** 2075 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 2076 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 2077 * 2078 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 2079 * command-line tools, not for authorizationchecking. This operation may "fail open" without 2080 * warning. 2081 * 2082 * <p>Sample code: 2083 * 2084 * <pre>{@code 2085 * // This snippet has been automatically generated and should be regarded as a code template only. 2086 * // It will require modifications to work: 2087 * // - It may require correct/in-range values for request initialization. 2088 * // - It may require specifying regional endpoints when creating the service client as shown in 2089 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2090 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 2091 * TestIamPermissionsRequest request = 2092 * TestIamPermissionsRequest.newBuilder() 2093 * .setResource("TestIamPermissionsRequest942398222".toString()) 2094 * .addAllPermissions(new ArrayList<String>()) 2095 * .build(); 2096 * TestIamPermissionsResponse response = notebookServiceClient.testIamPermissions(request); 2097 * } 2098 * }</pre> 2099 * 2100 * @param request The request object containing all of the parameters for the API call. 2101 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2102 */ testIamPermissions(TestIamPermissionsRequest request)2103 public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { 2104 return testIamPermissionsCallable().call(request); 2105 } 2106 2107 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2108 /** 2109 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 2110 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 2111 * 2112 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 2113 * command-line tools, not for authorizationchecking. This operation may "fail open" without 2114 * warning. 2115 * 2116 * <p>Sample code: 2117 * 2118 * <pre>{@code 2119 * // This snippet has been automatically generated and should be regarded as a code template only. 2120 * // It will require modifications to work: 2121 * // - It may require correct/in-range values for request initialization. 2122 * // - It may require specifying regional endpoints when creating the service client as shown in 2123 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2124 * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) { 2125 * TestIamPermissionsRequest request = 2126 * TestIamPermissionsRequest.newBuilder() 2127 * .setResource("TestIamPermissionsRequest942398222".toString()) 2128 * .addAllPermissions(new ArrayList<String>()) 2129 * .build(); 2130 * ApiFuture<TestIamPermissionsResponse> future = 2131 * notebookServiceClient.testIamPermissionsCallable().futureCall(request); 2132 * // Do something. 2133 * TestIamPermissionsResponse response = future.get(); 2134 * } 2135 * }</pre> 2136 */ 2137 public final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable()2138 testIamPermissionsCallable() { 2139 return stub.testIamPermissionsCallable(); 2140 } 2141 2142 @Override close()2143 public final void close() { 2144 stub.close(); 2145 } 2146 2147 @Override shutdown()2148 public void shutdown() { 2149 stub.shutdown(); 2150 } 2151 2152 @Override isShutdown()2153 public boolean isShutdown() { 2154 return stub.isShutdown(); 2155 } 2156 2157 @Override isTerminated()2158 public boolean isTerminated() { 2159 return stub.isTerminated(); 2160 } 2161 2162 @Override shutdownNow()2163 public void shutdownNow() { 2164 stub.shutdownNow(); 2165 } 2166 2167 @Override awaitTermination(long duration, TimeUnit unit)2168 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 2169 return stub.awaitTermination(duration, unit); 2170 } 2171 2172 public static class ListInstancesPagedResponse 2173 extends AbstractPagedListResponse< 2174 ListInstancesRequest, 2175 ListInstancesResponse, 2176 Instance, 2177 ListInstancesPage, 2178 ListInstancesFixedSizeCollection> { 2179 createAsync( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ApiFuture<ListInstancesResponse> futureResponse)2180 public static ApiFuture<ListInstancesPagedResponse> createAsync( 2181 PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, 2182 ApiFuture<ListInstancesResponse> futureResponse) { 2183 ApiFuture<ListInstancesPage> futurePage = 2184 ListInstancesPage.createEmptyPage().createPageAsync(context, futureResponse); 2185 return ApiFutures.transform( 2186 futurePage, 2187 input -> new ListInstancesPagedResponse(input), 2188 MoreExecutors.directExecutor()); 2189 } 2190 ListInstancesPagedResponse(ListInstancesPage page)2191 private ListInstancesPagedResponse(ListInstancesPage page) { 2192 super(page, ListInstancesFixedSizeCollection.createEmptyCollection()); 2193 } 2194 } 2195 2196 public static class ListInstancesPage 2197 extends AbstractPage< 2198 ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage> { 2199 ListInstancesPage( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ListInstancesResponse response)2200 private ListInstancesPage( 2201 PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, 2202 ListInstancesResponse response) { 2203 super(context, response); 2204 } 2205 createEmptyPage()2206 private static ListInstancesPage createEmptyPage() { 2207 return new ListInstancesPage(null, null); 2208 } 2209 2210 @Override createPage( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ListInstancesResponse response)2211 protected ListInstancesPage createPage( 2212 PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, 2213 ListInstancesResponse response) { 2214 return new ListInstancesPage(context, response); 2215 } 2216 2217 @Override createPageAsync( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ApiFuture<ListInstancesResponse> futureResponse)2218 public ApiFuture<ListInstancesPage> createPageAsync( 2219 PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, 2220 ApiFuture<ListInstancesResponse> futureResponse) { 2221 return super.createPageAsync(context, futureResponse); 2222 } 2223 } 2224 2225 public static class ListInstancesFixedSizeCollection 2226 extends AbstractFixedSizeCollection< 2227 ListInstancesRequest, 2228 ListInstancesResponse, 2229 Instance, 2230 ListInstancesPage, 2231 ListInstancesFixedSizeCollection> { 2232 ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize)2233 private ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize) { 2234 super(pages, collectionSize); 2235 } 2236 createEmptyCollection()2237 private static ListInstancesFixedSizeCollection createEmptyCollection() { 2238 return new ListInstancesFixedSizeCollection(null, 0); 2239 } 2240 2241 @Override createCollection( List<ListInstancesPage> pages, int collectionSize)2242 protected ListInstancesFixedSizeCollection createCollection( 2243 List<ListInstancesPage> pages, int collectionSize) { 2244 return new ListInstancesFixedSizeCollection(pages, collectionSize); 2245 } 2246 } 2247 2248 public static class ListEnvironmentsPagedResponse 2249 extends AbstractPagedListResponse< 2250 ListEnvironmentsRequest, 2251 ListEnvironmentsResponse, 2252 Environment, 2253 ListEnvironmentsPage, 2254 ListEnvironmentsFixedSizeCollection> { 2255 createAsync( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ApiFuture<ListEnvironmentsResponse> futureResponse)2256 public static ApiFuture<ListEnvironmentsPagedResponse> createAsync( 2257 PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, 2258 ApiFuture<ListEnvironmentsResponse> futureResponse) { 2259 ApiFuture<ListEnvironmentsPage> futurePage = 2260 ListEnvironmentsPage.createEmptyPage().createPageAsync(context, futureResponse); 2261 return ApiFutures.transform( 2262 futurePage, 2263 input -> new ListEnvironmentsPagedResponse(input), 2264 MoreExecutors.directExecutor()); 2265 } 2266 ListEnvironmentsPagedResponse(ListEnvironmentsPage page)2267 private ListEnvironmentsPagedResponse(ListEnvironmentsPage page) { 2268 super(page, ListEnvironmentsFixedSizeCollection.createEmptyCollection()); 2269 } 2270 } 2271 2272 public static class ListEnvironmentsPage 2273 extends AbstractPage< 2274 ListEnvironmentsRequest, ListEnvironmentsResponse, Environment, ListEnvironmentsPage> { 2275 ListEnvironmentsPage( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ListEnvironmentsResponse response)2276 private ListEnvironmentsPage( 2277 PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, 2278 ListEnvironmentsResponse response) { 2279 super(context, response); 2280 } 2281 createEmptyPage()2282 private static ListEnvironmentsPage createEmptyPage() { 2283 return new ListEnvironmentsPage(null, null); 2284 } 2285 2286 @Override createPage( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ListEnvironmentsResponse response)2287 protected ListEnvironmentsPage createPage( 2288 PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, 2289 ListEnvironmentsResponse response) { 2290 return new ListEnvironmentsPage(context, response); 2291 } 2292 2293 @Override createPageAsync( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ApiFuture<ListEnvironmentsResponse> futureResponse)2294 public ApiFuture<ListEnvironmentsPage> createPageAsync( 2295 PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, 2296 ApiFuture<ListEnvironmentsResponse> futureResponse) { 2297 return super.createPageAsync(context, futureResponse); 2298 } 2299 } 2300 2301 public static class ListEnvironmentsFixedSizeCollection 2302 extends AbstractFixedSizeCollection< 2303 ListEnvironmentsRequest, 2304 ListEnvironmentsResponse, 2305 Environment, 2306 ListEnvironmentsPage, 2307 ListEnvironmentsFixedSizeCollection> { 2308 ListEnvironmentsFixedSizeCollection( List<ListEnvironmentsPage> pages, int collectionSize)2309 private ListEnvironmentsFixedSizeCollection( 2310 List<ListEnvironmentsPage> pages, int collectionSize) { 2311 super(pages, collectionSize); 2312 } 2313 createEmptyCollection()2314 private static ListEnvironmentsFixedSizeCollection createEmptyCollection() { 2315 return new ListEnvironmentsFixedSizeCollection(null, 0); 2316 } 2317 2318 @Override createCollection( List<ListEnvironmentsPage> pages, int collectionSize)2319 protected ListEnvironmentsFixedSizeCollection createCollection( 2320 List<ListEnvironmentsPage> pages, int collectionSize) { 2321 return new ListEnvironmentsFixedSizeCollection(pages, collectionSize); 2322 } 2323 } 2324 2325 public static class ListLocationsPagedResponse 2326 extends AbstractPagedListResponse< 2327 ListLocationsRequest, 2328 ListLocationsResponse, 2329 Location, 2330 ListLocationsPage, 2331 ListLocationsFixedSizeCollection> { 2332 createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2333 public static ApiFuture<ListLocationsPagedResponse> createAsync( 2334 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2335 ApiFuture<ListLocationsResponse> futureResponse) { 2336 ApiFuture<ListLocationsPage> futurePage = 2337 ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); 2338 return ApiFutures.transform( 2339 futurePage, 2340 input -> new ListLocationsPagedResponse(input), 2341 MoreExecutors.directExecutor()); 2342 } 2343 ListLocationsPagedResponse(ListLocationsPage page)2344 private ListLocationsPagedResponse(ListLocationsPage page) { 2345 super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); 2346 } 2347 } 2348 2349 public static class ListLocationsPage 2350 extends AbstractPage< 2351 ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { 2352 ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2353 private ListLocationsPage( 2354 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2355 ListLocationsResponse response) { 2356 super(context, response); 2357 } 2358 createEmptyPage()2359 private static ListLocationsPage createEmptyPage() { 2360 return new ListLocationsPage(null, null); 2361 } 2362 2363 @Override createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2364 protected ListLocationsPage createPage( 2365 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2366 ListLocationsResponse response) { 2367 return new ListLocationsPage(context, response); 2368 } 2369 2370 @Override createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2371 public ApiFuture<ListLocationsPage> createPageAsync( 2372 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2373 ApiFuture<ListLocationsResponse> futureResponse) { 2374 return super.createPageAsync(context, futureResponse); 2375 } 2376 } 2377 2378 public static class ListLocationsFixedSizeCollection 2379 extends AbstractFixedSizeCollection< 2380 ListLocationsRequest, 2381 ListLocationsResponse, 2382 Location, 2383 ListLocationsPage, 2384 ListLocationsFixedSizeCollection> { 2385 ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)2386 private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { 2387 super(pages, collectionSize); 2388 } 2389 createEmptyCollection()2390 private static ListLocationsFixedSizeCollection createEmptyCollection() { 2391 return new ListLocationsFixedSizeCollection(null, 0); 2392 } 2393 2394 @Override createCollection( List<ListLocationsPage> pages, int collectionSize)2395 protected ListLocationsFixedSizeCollection createCollection( 2396 List<ListLocationsPage> pages, int collectionSize) { 2397 return new ListLocationsFixedSizeCollection(pages, collectionSize); 2398 } 2399 } 2400 } 2401