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