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.automl.v1; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.cloud.automl.v1.stub.AutoMlStub; 32 import com.google.cloud.automl.v1.stub.AutoMlStubSettings; 33 import com.google.common.util.concurrent.MoreExecutors; 34 import com.google.longrunning.Operation; 35 import com.google.protobuf.Empty; 36 import com.google.protobuf.FieldMask; 37 import java.io.IOException; 38 import java.util.List; 39 import java.util.concurrent.TimeUnit; 40 import javax.annotation.Generated; 41 42 // AUTO-GENERATED DOCUMENTATION AND CLASS. 43 /** 44 * Service Description: AutoML Server API. 45 * 46 * <p>The resource names are assigned by the server. The server never reuses names that it has 47 * created after the resources with those names are deleted. 48 * 49 * <p>An ID of a resource is the last element of the item's resource name. For 50 * `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then the id for the item 51 * is `{dataset_id}`. 52 * 53 * <p>Currently the only supported `location_id` is "us-central1". 54 * 55 * <p>On any input that is documented to expect a string parameter in snake_case or dash-case, 56 * either of those cases is accepted. 57 * 58 * <p>This class provides the ability to make remote calls to the backing service through method 59 * calls that map to API methods. Sample code to get started: 60 * 61 * <pre>{@code 62 * // This snippet has been automatically generated and should be regarded as a code template only. 63 * // It will require modifications to work: 64 * // - It may require correct/in-range values for request initialization. 65 * // - It may require specifying regional endpoints when creating the service client as shown in 66 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 67 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 68 * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); 69 * Dataset response = autoMlClient.getDataset(name); 70 * } 71 * }</pre> 72 * 73 * <p>Note: close() needs to be called on the AutoMlClient object to clean up resources such as 74 * 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 AutoMlSettings to create(). 97 * 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 * AutoMlSettings autoMlSettings = 108 * AutoMlSettings.newBuilder() 109 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 110 * .build(); 111 * AutoMlClient autoMlClient = AutoMlClient.create(autoMlSettings); 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 * AutoMlSettings autoMlSettings = AutoMlSettings.newBuilder().setEndpoint(myEndpoint).build(); 123 * AutoMlClient autoMlClient = AutoMlClient.create(autoMlSettings); 124 * }</pre> 125 * 126 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 127 * the wire: 128 * 129 * <pre>{@code 130 * // This snippet has been automatically generated and should be regarded as a code template only. 131 * // It will require modifications to work: 132 * // - It may require correct/in-range values for request initialization. 133 * // - It may require specifying regional endpoints when creating the service client as shown in 134 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 135 * AutoMlSettings autoMlSettings = AutoMlSettings.newHttpJsonBuilder().build(); 136 * AutoMlClient autoMlClient = AutoMlClient.create(autoMlSettings); 137 * }</pre> 138 * 139 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 140 */ 141 @Generated("by gapic-generator-java") 142 public class AutoMlClient implements BackgroundResource { 143 private final AutoMlSettings settings; 144 private final AutoMlStub stub; 145 private final OperationsClient httpJsonOperationsClient; 146 private final com.google.longrunning.OperationsClient operationsClient; 147 148 /** Constructs an instance of AutoMlClient with default settings. */ create()149 public static final AutoMlClient create() throws IOException { 150 return create(AutoMlSettings.newBuilder().build()); 151 } 152 153 /** 154 * Constructs an instance of AutoMlClient, using the given settings. The channels are created 155 * based on the settings passed in, or defaults for any settings that are not set. 156 */ create(AutoMlSettings settings)157 public static final AutoMlClient create(AutoMlSettings settings) throws IOException { 158 return new AutoMlClient(settings); 159 } 160 161 /** 162 * Constructs an instance of AutoMlClient, using the given stub for making calls. This is for 163 * advanced usage - prefer using create(AutoMlSettings). 164 */ create(AutoMlStub stub)165 public static final AutoMlClient create(AutoMlStub stub) { 166 return new AutoMlClient(stub); 167 } 168 169 /** 170 * Constructs an instance of AutoMlClient, using the given settings. This is protected so that it 171 * is easy to make a subclass, but otherwise, the static factory methods should be preferred. 172 */ AutoMlClient(AutoMlSettings settings)173 protected AutoMlClient(AutoMlSettings settings) throws IOException { 174 this.settings = settings; 175 this.stub = ((AutoMlStubSettings) settings.getStubSettings()).createStub(); 176 this.operationsClient = 177 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 178 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 179 } 180 AutoMlClient(AutoMlStub stub)181 protected AutoMlClient(AutoMlStub stub) { 182 this.settings = null; 183 this.stub = stub; 184 this.operationsClient = 185 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 186 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 187 } 188 getSettings()189 public final AutoMlSettings getSettings() { 190 return settings; 191 } 192 getStub()193 public AutoMlStub getStub() { 194 return stub; 195 } 196 197 /** 198 * Returns the OperationsClient that can be used to query the status of a long-running operation 199 * returned by another API method call. 200 */ getOperationsClient()201 public final com.google.longrunning.OperationsClient getOperationsClient() { 202 return operationsClient; 203 } 204 205 /** 206 * Returns the OperationsClient that can be used to query the status of a long-running operation 207 * returned by another API method call. 208 */ 209 @BetaApi getHttpJsonOperationsClient()210 public final OperationsClient getHttpJsonOperationsClient() { 211 return httpJsonOperationsClient; 212 } 213 214 // AUTO-GENERATED DOCUMENTATION AND METHOD. 215 /** 216 * Creates a dataset. 217 * 218 * <p>Sample code: 219 * 220 * <pre>{@code 221 * // This snippet has been automatically generated and should be regarded as a code template only. 222 * // It will require modifications to work: 223 * // - It may require correct/in-range values for request initialization. 224 * // - It may require specifying regional endpoints when creating the service client as shown in 225 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 226 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 227 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 228 * Dataset dataset = Dataset.newBuilder().build(); 229 * Dataset response = autoMlClient.createDatasetAsync(parent, dataset).get(); 230 * } 231 * }</pre> 232 * 233 * @param parent Required. The resource name of the project to create the dataset for. 234 * @param dataset Required. The dataset to create. 235 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 236 */ createDatasetAsync( LocationName parent, Dataset dataset)237 public final OperationFuture<Dataset, OperationMetadata> createDatasetAsync( 238 LocationName parent, Dataset dataset) { 239 CreateDatasetRequest request = 240 CreateDatasetRequest.newBuilder() 241 .setParent(parent == null ? null : parent.toString()) 242 .setDataset(dataset) 243 .build(); 244 return createDatasetAsync(request); 245 } 246 247 // AUTO-GENERATED DOCUMENTATION AND METHOD. 248 /** 249 * Creates a dataset. 250 * 251 * <p>Sample code: 252 * 253 * <pre>{@code 254 * // This snippet has been automatically generated and should be regarded as a code template only. 255 * // It will require modifications to work: 256 * // - It may require correct/in-range values for request initialization. 257 * // - It may require specifying regional endpoints when creating the service client as shown in 258 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 259 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 260 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 261 * Dataset dataset = Dataset.newBuilder().build(); 262 * Dataset response = autoMlClient.createDatasetAsync(parent, dataset).get(); 263 * } 264 * }</pre> 265 * 266 * @param parent Required. The resource name of the project to create the dataset for. 267 * @param dataset Required. The dataset to create. 268 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 269 */ createDatasetAsync( String parent, Dataset dataset)270 public final OperationFuture<Dataset, OperationMetadata> createDatasetAsync( 271 String parent, Dataset dataset) { 272 CreateDatasetRequest request = 273 CreateDatasetRequest.newBuilder().setParent(parent).setDataset(dataset).build(); 274 return createDatasetAsync(request); 275 } 276 277 // AUTO-GENERATED DOCUMENTATION AND METHOD. 278 /** 279 * Creates a dataset. 280 * 281 * <p>Sample code: 282 * 283 * <pre>{@code 284 * // This snippet has been automatically generated and should be regarded as a code template only. 285 * // It will require modifications to work: 286 * // - It may require correct/in-range values for request initialization. 287 * // - It may require specifying regional endpoints when creating the service client as shown in 288 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 289 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 290 * CreateDatasetRequest request = 291 * CreateDatasetRequest.newBuilder() 292 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 293 * .setDataset(Dataset.newBuilder().build()) 294 * .build(); 295 * Dataset response = autoMlClient.createDatasetAsync(request).get(); 296 * } 297 * }</pre> 298 * 299 * @param request The request object containing all of the parameters for the API call. 300 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 301 */ createDatasetAsync( CreateDatasetRequest request)302 public final OperationFuture<Dataset, OperationMetadata> createDatasetAsync( 303 CreateDatasetRequest request) { 304 return createDatasetOperationCallable().futureCall(request); 305 } 306 307 // AUTO-GENERATED DOCUMENTATION AND METHOD. 308 /** 309 * Creates a dataset. 310 * 311 * <p>Sample code: 312 * 313 * <pre>{@code 314 * // This snippet has been automatically generated and should be regarded as a code template only. 315 * // It will require modifications to work: 316 * // - It may require correct/in-range values for request initialization. 317 * // - It may require specifying regional endpoints when creating the service client as shown in 318 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 319 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 320 * CreateDatasetRequest request = 321 * CreateDatasetRequest.newBuilder() 322 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 323 * .setDataset(Dataset.newBuilder().build()) 324 * .build(); 325 * OperationFuture<Dataset, OperationMetadata> future = 326 * autoMlClient.createDatasetOperationCallable().futureCall(request); 327 * // Do something. 328 * Dataset response = future.get(); 329 * } 330 * }</pre> 331 */ 332 public final OperationCallable<CreateDatasetRequest, Dataset, OperationMetadata> createDatasetOperationCallable()333 createDatasetOperationCallable() { 334 return stub.createDatasetOperationCallable(); 335 } 336 337 // AUTO-GENERATED DOCUMENTATION AND METHOD. 338 /** 339 * Creates a dataset. 340 * 341 * <p>Sample code: 342 * 343 * <pre>{@code 344 * // This snippet has been automatically generated and should be regarded as a code template only. 345 * // It will require modifications to work: 346 * // - It may require correct/in-range values for request initialization. 347 * // - It may require specifying regional endpoints when creating the service client as shown in 348 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 349 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 350 * CreateDatasetRequest request = 351 * CreateDatasetRequest.newBuilder() 352 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 353 * .setDataset(Dataset.newBuilder().build()) 354 * .build(); 355 * ApiFuture<Operation> future = autoMlClient.createDatasetCallable().futureCall(request); 356 * // Do something. 357 * Operation response = future.get(); 358 * } 359 * }</pre> 360 */ createDatasetCallable()361 public final UnaryCallable<CreateDatasetRequest, Operation> createDatasetCallable() { 362 return stub.createDatasetCallable(); 363 } 364 365 // AUTO-GENERATED DOCUMENTATION AND METHOD. 366 /** 367 * Gets a dataset. 368 * 369 * <p>Sample code: 370 * 371 * <pre>{@code 372 * // This snippet has been automatically generated and should be regarded as a code template only. 373 * // It will require modifications to work: 374 * // - It may require correct/in-range values for request initialization. 375 * // - It may require specifying regional endpoints when creating the service client as shown in 376 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 377 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 378 * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); 379 * Dataset response = autoMlClient.getDataset(name); 380 * } 381 * }</pre> 382 * 383 * @param name Required. The resource name of the dataset to retrieve. 384 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 385 */ getDataset(DatasetName name)386 public final Dataset getDataset(DatasetName name) { 387 GetDatasetRequest request = 388 GetDatasetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 389 return getDataset(request); 390 } 391 392 // AUTO-GENERATED DOCUMENTATION AND METHOD. 393 /** 394 * Gets a dataset. 395 * 396 * <p>Sample code: 397 * 398 * <pre>{@code 399 * // This snippet has been automatically generated and should be regarded as a code template only. 400 * // It will require modifications to work: 401 * // - It may require correct/in-range values for request initialization. 402 * // - It may require specifying regional endpoints when creating the service client as shown in 403 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 404 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 405 * String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); 406 * Dataset response = autoMlClient.getDataset(name); 407 * } 408 * }</pre> 409 * 410 * @param name Required. The resource name of the dataset to retrieve. 411 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 412 */ getDataset(String name)413 public final Dataset getDataset(String name) { 414 GetDatasetRequest request = GetDatasetRequest.newBuilder().setName(name).build(); 415 return getDataset(request); 416 } 417 418 // AUTO-GENERATED DOCUMENTATION AND METHOD. 419 /** 420 * Gets a dataset. 421 * 422 * <p>Sample code: 423 * 424 * <pre>{@code 425 * // This snippet has been automatically generated and should be regarded as a code template only. 426 * // It will require modifications to work: 427 * // - It may require correct/in-range values for request initialization. 428 * // - It may require specifying regional endpoints when creating the service client as shown in 429 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 430 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 431 * GetDatasetRequest request = 432 * GetDatasetRequest.newBuilder() 433 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 434 * .build(); 435 * Dataset response = autoMlClient.getDataset(request); 436 * } 437 * }</pre> 438 * 439 * @param request The request object containing all of the parameters for the API call. 440 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 441 */ getDataset(GetDatasetRequest request)442 public final Dataset getDataset(GetDatasetRequest request) { 443 return getDatasetCallable().call(request); 444 } 445 446 // AUTO-GENERATED DOCUMENTATION AND METHOD. 447 /** 448 * Gets a dataset. 449 * 450 * <p>Sample code: 451 * 452 * <pre>{@code 453 * // This snippet has been automatically generated and should be regarded as a code template only. 454 * // It will require modifications to work: 455 * // - It may require correct/in-range values for request initialization. 456 * // - It may require specifying regional endpoints when creating the service client as shown in 457 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 458 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 459 * GetDatasetRequest request = 460 * GetDatasetRequest.newBuilder() 461 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 462 * .build(); 463 * ApiFuture<Dataset> future = autoMlClient.getDatasetCallable().futureCall(request); 464 * // Do something. 465 * Dataset response = future.get(); 466 * } 467 * }</pre> 468 */ getDatasetCallable()469 public final UnaryCallable<GetDatasetRequest, Dataset> getDatasetCallable() { 470 return stub.getDatasetCallable(); 471 } 472 473 // AUTO-GENERATED DOCUMENTATION AND METHOD. 474 /** 475 * Lists datasets in a project. 476 * 477 * <p>Sample code: 478 * 479 * <pre>{@code 480 * // This snippet has been automatically generated and should be regarded as a code template only. 481 * // It will require modifications to work: 482 * // - It may require correct/in-range values for request initialization. 483 * // - It may require specifying regional endpoints when creating the service client as shown in 484 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 485 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 486 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 487 * for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) { 488 * // doThingsWith(element); 489 * } 490 * } 491 * }</pre> 492 * 493 * @param parent Required. The resource name of the project from which to list datasets. 494 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 495 */ listDatasets(LocationName parent)496 public final ListDatasetsPagedResponse listDatasets(LocationName parent) { 497 ListDatasetsRequest request = 498 ListDatasetsRequest.newBuilder() 499 .setParent(parent == null ? null : parent.toString()) 500 .build(); 501 return listDatasets(request); 502 } 503 504 // AUTO-GENERATED DOCUMENTATION AND METHOD. 505 /** 506 * Lists datasets in a project. 507 * 508 * <p>Sample code: 509 * 510 * <pre>{@code 511 * // This snippet has been automatically generated and should be regarded as a code template only. 512 * // It will require modifications to work: 513 * // - It may require correct/in-range values for request initialization. 514 * // - It may require specifying regional endpoints when creating the service client as shown in 515 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 516 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 517 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 518 * for (Dataset element : autoMlClient.listDatasets(parent).iterateAll()) { 519 * // doThingsWith(element); 520 * } 521 * } 522 * }</pre> 523 * 524 * @param parent Required. The resource name of the project from which to list datasets. 525 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 526 */ listDatasets(String parent)527 public final ListDatasetsPagedResponse listDatasets(String parent) { 528 ListDatasetsRequest request = ListDatasetsRequest.newBuilder().setParent(parent).build(); 529 return listDatasets(request); 530 } 531 532 // AUTO-GENERATED DOCUMENTATION AND METHOD. 533 /** 534 * Lists datasets in a project. 535 * 536 * <p>Sample code: 537 * 538 * <pre>{@code 539 * // This snippet has been automatically generated and should be regarded as a code template only. 540 * // It will require modifications to work: 541 * // - It may require correct/in-range values for request initialization. 542 * // - It may require specifying regional endpoints when creating the service client as shown in 543 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 544 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 545 * ListDatasetsRequest request = 546 * ListDatasetsRequest.newBuilder() 547 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 548 * .setFilter("filter-1274492040") 549 * .setPageSize(883849137) 550 * .setPageToken("pageToken873572522") 551 * .build(); 552 * for (Dataset element : autoMlClient.listDatasets(request).iterateAll()) { 553 * // doThingsWith(element); 554 * } 555 * } 556 * }</pre> 557 * 558 * @param request The request object containing all of the parameters for the API call. 559 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 560 */ listDatasets(ListDatasetsRequest request)561 public final ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) { 562 return listDatasetsPagedCallable().call(request); 563 } 564 565 // AUTO-GENERATED DOCUMENTATION AND METHOD. 566 /** 567 * Lists datasets in a project. 568 * 569 * <p>Sample code: 570 * 571 * <pre>{@code 572 * // This snippet has been automatically generated and should be regarded as a code template only. 573 * // It will require modifications to work: 574 * // - It may require correct/in-range values for request initialization. 575 * // - It may require specifying regional endpoints when creating the service client as shown in 576 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 577 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 578 * ListDatasetsRequest request = 579 * ListDatasetsRequest.newBuilder() 580 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 581 * .setFilter("filter-1274492040") 582 * .setPageSize(883849137) 583 * .setPageToken("pageToken873572522") 584 * .build(); 585 * ApiFuture<Dataset> future = autoMlClient.listDatasetsPagedCallable().futureCall(request); 586 * // Do something. 587 * for (Dataset element : future.get().iterateAll()) { 588 * // doThingsWith(element); 589 * } 590 * } 591 * }</pre> 592 */ 593 public final UnaryCallable<ListDatasetsRequest, ListDatasetsPagedResponse> listDatasetsPagedCallable()594 listDatasetsPagedCallable() { 595 return stub.listDatasetsPagedCallable(); 596 } 597 598 // AUTO-GENERATED DOCUMENTATION AND METHOD. 599 /** 600 * Lists datasets in a project. 601 * 602 * <p>Sample code: 603 * 604 * <pre>{@code 605 * // This snippet has been automatically generated and should be regarded as a code template only. 606 * // It will require modifications to work: 607 * // - It may require correct/in-range values for request initialization. 608 * // - It may require specifying regional endpoints when creating the service client as shown in 609 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 610 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 611 * ListDatasetsRequest request = 612 * ListDatasetsRequest.newBuilder() 613 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 614 * .setFilter("filter-1274492040") 615 * .setPageSize(883849137) 616 * .setPageToken("pageToken873572522") 617 * .build(); 618 * while (true) { 619 * ListDatasetsResponse response = autoMlClient.listDatasetsCallable().call(request); 620 * for (Dataset element : response.getDatasetsList()) { 621 * // doThingsWith(element); 622 * } 623 * String nextPageToken = response.getNextPageToken(); 624 * if (!Strings.isNullOrEmpty(nextPageToken)) { 625 * request = request.toBuilder().setPageToken(nextPageToken).build(); 626 * } else { 627 * break; 628 * } 629 * } 630 * } 631 * }</pre> 632 */ listDatasetsCallable()633 public final UnaryCallable<ListDatasetsRequest, ListDatasetsResponse> listDatasetsCallable() { 634 return stub.listDatasetsCallable(); 635 } 636 637 // AUTO-GENERATED DOCUMENTATION AND METHOD. 638 /** 639 * Updates a dataset. 640 * 641 * <p>Sample code: 642 * 643 * <pre>{@code 644 * // This snippet has been automatically generated and should be regarded as a code template only. 645 * // It will require modifications to work: 646 * // - It may require correct/in-range values for request initialization. 647 * // - It may require specifying regional endpoints when creating the service client as shown in 648 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 649 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 650 * Dataset dataset = Dataset.newBuilder().build(); 651 * FieldMask updateMask = FieldMask.newBuilder().build(); 652 * Dataset response = autoMlClient.updateDataset(dataset, updateMask); 653 * } 654 * }</pre> 655 * 656 * @param dataset Required. The dataset which replaces the resource on the server. 657 * @param updateMask Required. The update mask applies to the resource. 658 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 659 */ updateDataset(Dataset dataset, FieldMask updateMask)660 public final Dataset updateDataset(Dataset dataset, FieldMask updateMask) { 661 UpdateDatasetRequest request = 662 UpdateDatasetRequest.newBuilder().setDataset(dataset).setUpdateMask(updateMask).build(); 663 return updateDataset(request); 664 } 665 666 // AUTO-GENERATED DOCUMENTATION AND METHOD. 667 /** 668 * Updates a dataset. 669 * 670 * <p>Sample code: 671 * 672 * <pre>{@code 673 * // This snippet has been automatically generated and should be regarded as a code template only. 674 * // It will require modifications to work: 675 * // - It may require correct/in-range values for request initialization. 676 * // - It may require specifying regional endpoints when creating the service client as shown in 677 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 678 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 679 * UpdateDatasetRequest request = 680 * UpdateDatasetRequest.newBuilder() 681 * .setDataset(Dataset.newBuilder().build()) 682 * .setUpdateMask(FieldMask.newBuilder().build()) 683 * .build(); 684 * Dataset response = autoMlClient.updateDataset(request); 685 * } 686 * }</pre> 687 * 688 * @param request The request object containing all of the parameters for the API call. 689 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 690 */ updateDataset(UpdateDatasetRequest request)691 public final Dataset updateDataset(UpdateDatasetRequest request) { 692 return updateDatasetCallable().call(request); 693 } 694 695 // AUTO-GENERATED DOCUMENTATION AND METHOD. 696 /** 697 * Updates a dataset. 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 (AutoMlClient autoMlClient = AutoMlClient.create()) { 708 * UpdateDatasetRequest request = 709 * UpdateDatasetRequest.newBuilder() 710 * .setDataset(Dataset.newBuilder().build()) 711 * .setUpdateMask(FieldMask.newBuilder().build()) 712 * .build(); 713 * ApiFuture<Dataset> future = autoMlClient.updateDatasetCallable().futureCall(request); 714 * // Do something. 715 * Dataset response = future.get(); 716 * } 717 * }</pre> 718 */ updateDatasetCallable()719 public final UnaryCallable<UpdateDatasetRequest, Dataset> updateDatasetCallable() { 720 return stub.updateDatasetCallable(); 721 } 722 723 // AUTO-GENERATED DOCUMENTATION AND METHOD. 724 /** 725 * Deletes a dataset and all of its contents. Returns empty response in the 726 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 727 * in the [metadata][google.longrunning.Operation.metadata] field. 728 * 729 * <p>Sample code: 730 * 731 * <pre>{@code 732 * // This snippet has been automatically generated and should be regarded as a code template only. 733 * // It will require modifications to work: 734 * // - It may require correct/in-range values for request initialization. 735 * // - It may require specifying regional endpoints when creating the service client as shown in 736 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 737 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 738 * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); 739 * autoMlClient.deleteDatasetAsync(name).get(); 740 * } 741 * }</pre> 742 * 743 * @param name Required. The resource name of the dataset to delete. 744 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 745 */ deleteDatasetAsync(DatasetName name)746 public final OperationFuture<Empty, OperationMetadata> deleteDatasetAsync(DatasetName name) { 747 DeleteDatasetRequest request = 748 DeleteDatasetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 749 return deleteDatasetAsync(request); 750 } 751 752 // AUTO-GENERATED DOCUMENTATION AND METHOD. 753 /** 754 * Deletes a dataset and all of its contents. Returns empty response in the 755 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 756 * in the [metadata][google.longrunning.Operation.metadata] field. 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 (AutoMlClient autoMlClient = AutoMlClient.create()) { 767 * String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); 768 * autoMlClient.deleteDatasetAsync(name).get(); 769 * } 770 * }</pre> 771 * 772 * @param name Required. The resource name of the dataset to delete. 773 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 774 */ deleteDatasetAsync(String name)775 public final OperationFuture<Empty, OperationMetadata> deleteDatasetAsync(String name) { 776 DeleteDatasetRequest request = DeleteDatasetRequest.newBuilder().setName(name).build(); 777 return deleteDatasetAsync(request); 778 } 779 780 // AUTO-GENERATED DOCUMENTATION AND METHOD. 781 /** 782 * Deletes a dataset and all of its contents. Returns empty response in the 783 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 784 * in the [metadata][google.longrunning.Operation.metadata] field. 785 * 786 * <p>Sample code: 787 * 788 * <pre>{@code 789 * // This snippet has been automatically generated and should be regarded as a code template only. 790 * // It will require modifications to work: 791 * // - It may require correct/in-range values for request initialization. 792 * // - It may require specifying regional endpoints when creating the service client as shown in 793 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 794 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 795 * DeleteDatasetRequest request = 796 * DeleteDatasetRequest.newBuilder() 797 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 798 * .build(); 799 * autoMlClient.deleteDatasetAsync(request).get(); 800 * } 801 * }</pre> 802 * 803 * @param request The request object containing all of the parameters for the API call. 804 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 805 */ deleteDatasetAsync( DeleteDatasetRequest request)806 public final OperationFuture<Empty, OperationMetadata> deleteDatasetAsync( 807 DeleteDatasetRequest request) { 808 return deleteDatasetOperationCallable().futureCall(request); 809 } 810 811 // AUTO-GENERATED DOCUMENTATION AND METHOD. 812 /** 813 * Deletes a dataset and all of its contents. Returns empty response in the 814 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 815 * in the [metadata][google.longrunning.Operation.metadata] field. 816 * 817 * <p>Sample code: 818 * 819 * <pre>{@code 820 * // This snippet has been automatically generated and should be regarded as a code template only. 821 * // It will require modifications to work: 822 * // - It may require correct/in-range values for request initialization. 823 * // - It may require specifying regional endpoints when creating the service client as shown in 824 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 825 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 826 * DeleteDatasetRequest request = 827 * DeleteDatasetRequest.newBuilder() 828 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 829 * .build(); 830 * OperationFuture<Empty, OperationMetadata> future = 831 * autoMlClient.deleteDatasetOperationCallable().futureCall(request); 832 * // Do something. 833 * future.get(); 834 * } 835 * }</pre> 836 */ 837 public final OperationCallable<DeleteDatasetRequest, Empty, OperationMetadata> deleteDatasetOperationCallable()838 deleteDatasetOperationCallable() { 839 return stub.deleteDatasetOperationCallable(); 840 } 841 842 // AUTO-GENERATED DOCUMENTATION AND METHOD. 843 /** 844 * Deletes a dataset and all of its contents. Returns empty response in the 845 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 846 * in the [metadata][google.longrunning.Operation.metadata] field. 847 * 848 * <p>Sample code: 849 * 850 * <pre>{@code 851 * // This snippet has been automatically generated and should be regarded as a code template only. 852 * // It will require modifications to work: 853 * // - It may require correct/in-range values for request initialization. 854 * // - It may require specifying regional endpoints when creating the service client as shown in 855 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 856 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 857 * DeleteDatasetRequest request = 858 * DeleteDatasetRequest.newBuilder() 859 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 860 * .build(); 861 * ApiFuture<Operation> future = autoMlClient.deleteDatasetCallable().futureCall(request); 862 * // Do something. 863 * future.get(); 864 * } 865 * }</pre> 866 */ deleteDatasetCallable()867 public final UnaryCallable<DeleteDatasetRequest, Operation> deleteDatasetCallable() { 868 return stub.deleteDatasetCallable(); 869 } 870 871 // AUTO-GENERATED DOCUMENTATION AND METHOD. 872 /** 873 * Imports data into a dataset. For Tables this method can only be called on an empty Dataset. 874 * 875 * <p>For Tables: 876 * 877 * <ul> 878 * <li>A [schema_inference_version][google.cloud.automl.v1.InputConfig.params] parameter must be 879 * explicitly set. Returns an empty response in the 880 * [response][google.longrunning.Operation.response] field when it completes. 881 * </ul> 882 * 883 * <p>Sample code: 884 * 885 * <pre>{@code 886 * // This snippet has been automatically generated and should be regarded as a code template only. 887 * // It will require modifications to work: 888 * // - It may require correct/in-range values for request initialization. 889 * // - It may require specifying regional endpoints when creating the service client as shown in 890 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 891 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 892 * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); 893 * InputConfig inputConfig = InputConfig.newBuilder().build(); 894 * autoMlClient.importDataAsync(name, inputConfig).get(); 895 * } 896 * }</pre> 897 * 898 * @param name Required. Dataset name. Dataset must already exist. All imported annotations and 899 * examples will be added. 900 * @param inputConfig Required. The desired input location and its domain specific semantics, if 901 * any. 902 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 903 */ importDataAsync( DatasetName name, InputConfig inputConfig)904 public final OperationFuture<Empty, OperationMetadata> importDataAsync( 905 DatasetName name, InputConfig inputConfig) { 906 ImportDataRequest request = 907 ImportDataRequest.newBuilder() 908 .setName(name == null ? null : name.toString()) 909 .setInputConfig(inputConfig) 910 .build(); 911 return importDataAsync(request); 912 } 913 914 // AUTO-GENERATED DOCUMENTATION AND METHOD. 915 /** 916 * Imports data into a dataset. For Tables this method can only be called on an empty Dataset. 917 * 918 * <p>For Tables: 919 * 920 * <ul> 921 * <li>A [schema_inference_version][google.cloud.automl.v1.InputConfig.params] parameter must be 922 * explicitly set. Returns an empty response in the 923 * [response][google.longrunning.Operation.response] field when it completes. 924 * </ul> 925 * 926 * <p>Sample code: 927 * 928 * <pre>{@code 929 * // This snippet has been automatically generated and should be regarded as a code template only. 930 * // It will require modifications to work: 931 * // - It may require correct/in-range values for request initialization. 932 * // - It may require specifying regional endpoints when creating the service client as shown in 933 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 934 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 935 * String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); 936 * InputConfig inputConfig = InputConfig.newBuilder().build(); 937 * autoMlClient.importDataAsync(name, inputConfig).get(); 938 * } 939 * }</pre> 940 * 941 * @param name Required. Dataset name. Dataset must already exist. All imported annotations and 942 * examples will be added. 943 * @param inputConfig Required. The desired input location and its domain specific semantics, if 944 * any. 945 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 946 */ importDataAsync( String name, InputConfig inputConfig)947 public final OperationFuture<Empty, OperationMetadata> importDataAsync( 948 String name, InputConfig inputConfig) { 949 ImportDataRequest request = 950 ImportDataRequest.newBuilder().setName(name).setInputConfig(inputConfig).build(); 951 return importDataAsync(request); 952 } 953 954 // AUTO-GENERATED DOCUMENTATION AND METHOD. 955 /** 956 * Imports data into a dataset. For Tables this method can only be called on an empty Dataset. 957 * 958 * <p>For Tables: 959 * 960 * <ul> 961 * <li>A [schema_inference_version][google.cloud.automl.v1.InputConfig.params] parameter must be 962 * explicitly set. Returns an empty response in the 963 * [response][google.longrunning.Operation.response] field when it completes. 964 * </ul> 965 * 966 * <p>Sample code: 967 * 968 * <pre>{@code 969 * // This snippet has been automatically generated and should be regarded as a code template only. 970 * // It will require modifications to work: 971 * // - It may require correct/in-range values for request initialization. 972 * // - It may require specifying regional endpoints when creating the service client as shown in 973 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 974 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 975 * ImportDataRequest request = 976 * ImportDataRequest.newBuilder() 977 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 978 * .setInputConfig(InputConfig.newBuilder().build()) 979 * .build(); 980 * autoMlClient.importDataAsync(request).get(); 981 * } 982 * }</pre> 983 * 984 * @param request The request object containing all of the parameters for the API call. 985 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 986 */ importDataAsync( ImportDataRequest request)987 public final OperationFuture<Empty, OperationMetadata> importDataAsync( 988 ImportDataRequest request) { 989 return importDataOperationCallable().futureCall(request); 990 } 991 992 // AUTO-GENERATED DOCUMENTATION AND METHOD. 993 /** 994 * Imports data into a dataset. For Tables this method can only be called on an empty Dataset. 995 * 996 * <p>For Tables: 997 * 998 * <ul> 999 * <li>A [schema_inference_version][google.cloud.automl.v1.InputConfig.params] parameter must be 1000 * explicitly set. Returns an empty response in the 1001 * [response][google.longrunning.Operation.response] field when it completes. 1002 * </ul> 1003 * 1004 * <p>Sample code: 1005 * 1006 * <pre>{@code 1007 * // This snippet has been automatically generated and should be regarded as a code template only. 1008 * // It will require modifications to work: 1009 * // - It may require correct/in-range values for request initialization. 1010 * // - It may require specifying regional endpoints when creating the service client as shown in 1011 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1012 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1013 * ImportDataRequest request = 1014 * ImportDataRequest.newBuilder() 1015 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 1016 * .setInputConfig(InputConfig.newBuilder().build()) 1017 * .build(); 1018 * OperationFuture<Empty, OperationMetadata> future = 1019 * autoMlClient.importDataOperationCallable().futureCall(request); 1020 * // Do something. 1021 * future.get(); 1022 * } 1023 * }</pre> 1024 */ 1025 public final OperationCallable<ImportDataRequest, Empty, OperationMetadata> importDataOperationCallable()1026 importDataOperationCallable() { 1027 return stub.importDataOperationCallable(); 1028 } 1029 1030 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1031 /** 1032 * Imports data into a dataset. For Tables this method can only be called on an empty Dataset. 1033 * 1034 * <p>For Tables: 1035 * 1036 * <ul> 1037 * <li>A [schema_inference_version][google.cloud.automl.v1.InputConfig.params] parameter must be 1038 * explicitly set. Returns an empty response in the 1039 * [response][google.longrunning.Operation.response] field when it completes. 1040 * </ul> 1041 * 1042 * <p>Sample code: 1043 * 1044 * <pre>{@code 1045 * // This snippet has been automatically generated and should be regarded as a code template only. 1046 * // It will require modifications to work: 1047 * // - It may require correct/in-range values for request initialization. 1048 * // - It may require specifying regional endpoints when creating the service client as shown in 1049 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1050 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1051 * ImportDataRequest request = 1052 * ImportDataRequest.newBuilder() 1053 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 1054 * .setInputConfig(InputConfig.newBuilder().build()) 1055 * .build(); 1056 * ApiFuture<Operation> future = autoMlClient.importDataCallable().futureCall(request); 1057 * // Do something. 1058 * future.get(); 1059 * } 1060 * }</pre> 1061 */ importDataCallable()1062 public final UnaryCallable<ImportDataRequest, Operation> importDataCallable() { 1063 return stub.importDataCallable(); 1064 } 1065 1066 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1067 /** 1068 * Exports dataset's data to the provided output location. Returns an empty response in the 1069 * [response][google.longrunning.Operation.response] field when it completes. 1070 * 1071 * <p>Sample code: 1072 * 1073 * <pre>{@code 1074 * // This snippet has been automatically generated and should be regarded as a code template only. 1075 * // It will require modifications to work: 1076 * // - It may require correct/in-range values for request initialization. 1077 * // - It may require specifying regional endpoints when creating the service client as shown in 1078 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1079 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1080 * DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]"); 1081 * OutputConfig outputConfig = OutputConfig.newBuilder().build(); 1082 * autoMlClient.exportDataAsync(name, outputConfig).get(); 1083 * } 1084 * }</pre> 1085 * 1086 * @param name Required. The resource name of the dataset. 1087 * @param outputConfig Required. The desired output location. 1088 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1089 */ exportDataAsync( DatasetName name, OutputConfig outputConfig)1090 public final OperationFuture<Empty, OperationMetadata> exportDataAsync( 1091 DatasetName name, OutputConfig outputConfig) { 1092 ExportDataRequest request = 1093 ExportDataRequest.newBuilder() 1094 .setName(name == null ? null : name.toString()) 1095 .setOutputConfig(outputConfig) 1096 .build(); 1097 return exportDataAsync(request); 1098 } 1099 1100 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1101 /** 1102 * Exports dataset's data to the provided output location. Returns an empty response in the 1103 * [response][google.longrunning.Operation.response] field when it completes. 1104 * 1105 * <p>Sample code: 1106 * 1107 * <pre>{@code 1108 * // This snippet has been automatically generated and should be regarded as a code template only. 1109 * // It will require modifications to work: 1110 * // - It may require correct/in-range values for request initialization. 1111 * // - It may require specifying regional endpoints when creating the service client as shown in 1112 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1113 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1114 * String name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString(); 1115 * OutputConfig outputConfig = OutputConfig.newBuilder().build(); 1116 * autoMlClient.exportDataAsync(name, outputConfig).get(); 1117 * } 1118 * }</pre> 1119 * 1120 * @param name Required. The resource name of the dataset. 1121 * @param outputConfig Required. The desired output location. 1122 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1123 */ exportDataAsync( String name, OutputConfig outputConfig)1124 public final OperationFuture<Empty, OperationMetadata> exportDataAsync( 1125 String name, OutputConfig outputConfig) { 1126 ExportDataRequest request = 1127 ExportDataRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build(); 1128 return exportDataAsync(request); 1129 } 1130 1131 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1132 /** 1133 * Exports dataset's data to the provided output location. Returns an empty response in the 1134 * [response][google.longrunning.Operation.response] field when it completes. 1135 * 1136 * <p>Sample code: 1137 * 1138 * <pre>{@code 1139 * // This snippet has been automatically generated and should be regarded as a code template only. 1140 * // It will require modifications to work: 1141 * // - It may require correct/in-range values for request initialization. 1142 * // - It may require specifying regional endpoints when creating the service client as shown in 1143 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1144 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1145 * ExportDataRequest request = 1146 * ExportDataRequest.newBuilder() 1147 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 1148 * .setOutputConfig(OutputConfig.newBuilder().build()) 1149 * .build(); 1150 * autoMlClient.exportDataAsync(request).get(); 1151 * } 1152 * }</pre> 1153 * 1154 * @param request The request object containing all of the parameters for the API call. 1155 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1156 */ exportDataAsync( ExportDataRequest request)1157 public final OperationFuture<Empty, OperationMetadata> exportDataAsync( 1158 ExportDataRequest request) { 1159 return exportDataOperationCallable().futureCall(request); 1160 } 1161 1162 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1163 /** 1164 * Exports dataset's data to the provided output location. Returns an empty response in the 1165 * [response][google.longrunning.Operation.response] field when it completes. 1166 * 1167 * <p>Sample code: 1168 * 1169 * <pre>{@code 1170 * // This snippet has been automatically generated and should be regarded as a code template only. 1171 * // It will require modifications to work: 1172 * // - It may require correct/in-range values for request initialization. 1173 * // - It may require specifying regional endpoints when creating the service client as shown in 1174 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1175 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1176 * ExportDataRequest request = 1177 * ExportDataRequest.newBuilder() 1178 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 1179 * .setOutputConfig(OutputConfig.newBuilder().build()) 1180 * .build(); 1181 * OperationFuture<Empty, OperationMetadata> future = 1182 * autoMlClient.exportDataOperationCallable().futureCall(request); 1183 * // Do something. 1184 * future.get(); 1185 * } 1186 * }</pre> 1187 */ 1188 public final OperationCallable<ExportDataRequest, Empty, OperationMetadata> exportDataOperationCallable()1189 exportDataOperationCallable() { 1190 return stub.exportDataOperationCallable(); 1191 } 1192 1193 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1194 /** 1195 * Exports dataset's data to the provided output location. Returns an empty response in the 1196 * [response][google.longrunning.Operation.response] field when it completes. 1197 * 1198 * <p>Sample code: 1199 * 1200 * <pre>{@code 1201 * // This snippet has been automatically generated and should be regarded as a code template only. 1202 * // It will require modifications to work: 1203 * // - It may require correct/in-range values for request initialization. 1204 * // - It may require specifying regional endpoints when creating the service client as shown in 1205 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1206 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1207 * ExportDataRequest request = 1208 * ExportDataRequest.newBuilder() 1209 * .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString()) 1210 * .setOutputConfig(OutputConfig.newBuilder().build()) 1211 * .build(); 1212 * ApiFuture<Operation> future = autoMlClient.exportDataCallable().futureCall(request); 1213 * // Do something. 1214 * future.get(); 1215 * } 1216 * }</pre> 1217 */ exportDataCallable()1218 public final UnaryCallable<ExportDataRequest, Operation> exportDataCallable() { 1219 return stub.exportDataCallable(); 1220 } 1221 1222 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1223 /** 1224 * Gets an annotation spec. 1225 * 1226 * <p>Sample code: 1227 * 1228 * <pre>{@code 1229 * // This snippet has been automatically generated and should be regarded as a code template only. 1230 * // It will require modifications to work: 1231 * // - It may require correct/in-range values for request initialization. 1232 * // - It may require specifying regional endpoints when creating the service client as shown in 1233 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1234 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1235 * AnnotationSpecName name = 1236 * AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"); 1237 * AnnotationSpec response = autoMlClient.getAnnotationSpec(name); 1238 * } 1239 * }</pre> 1240 * 1241 * @param name Required. The resource name of the annotation spec to retrieve. 1242 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1243 */ getAnnotationSpec(AnnotationSpecName name)1244 public final AnnotationSpec getAnnotationSpec(AnnotationSpecName name) { 1245 GetAnnotationSpecRequest request = 1246 GetAnnotationSpecRequest.newBuilder() 1247 .setName(name == null ? null : name.toString()) 1248 .build(); 1249 return getAnnotationSpec(request); 1250 } 1251 1252 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1253 /** 1254 * Gets an annotation spec. 1255 * 1256 * <p>Sample code: 1257 * 1258 * <pre>{@code 1259 * // This snippet has been automatically generated and should be regarded as a code template only. 1260 * // It will require modifications to work: 1261 * // - It may require correct/in-range values for request initialization. 1262 * // - It may require specifying regional endpoints when creating the service client as shown in 1263 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1264 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1265 * String name = 1266 * AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") 1267 * .toString(); 1268 * AnnotationSpec response = autoMlClient.getAnnotationSpec(name); 1269 * } 1270 * }</pre> 1271 * 1272 * @param name Required. The resource name of the annotation spec to retrieve. 1273 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1274 */ getAnnotationSpec(String name)1275 public final AnnotationSpec getAnnotationSpec(String name) { 1276 GetAnnotationSpecRequest request = GetAnnotationSpecRequest.newBuilder().setName(name).build(); 1277 return getAnnotationSpec(request); 1278 } 1279 1280 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1281 /** 1282 * Gets an annotation spec. 1283 * 1284 * <p>Sample code: 1285 * 1286 * <pre>{@code 1287 * // This snippet has been automatically generated and should be regarded as a code template only. 1288 * // It will require modifications to work: 1289 * // - It may require correct/in-range values for request initialization. 1290 * // - It may require specifying regional endpoints when creating the service client as shown in 1291 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1292 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1293 * GetAnnotationSpecRequest request = 1294 * GetAnnotationSpecRequest.newBuilder() 1295 * .setName( 1296 * AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") 1297 * .toString()) 1298 * .build(); 1299 * AnnotationSpec response = autoMlClient.getAnnotationSpec(request); 1300 * } 1301 * }</pre> 1302 * 1303 * @param request The request object containing all of the parameters for the API call. 1304 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1305 */ getAnnotationSpec(GetAnnotationSpecRequest request)1306 public final AnnotationSpec getAnnotationSpec(GetAnnotationSpecRequest request) { 1307 return getAnnotationSpecCallable().call(request); 1308 } 1309 1310 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1311 /** 1312 * Gets an annotation spec. 1313 * 1314 * <p>Sample code: 1315 * 1316 * <pre>{@code 1317 * // This snippet has been automatically generated and should be regarded as a code template only. 1318 * // It will require modifications to work: 1319 * // - It may require correct/in-range values for request initialization. 1320 * // - It may require specifying regional endpoints when creating the service client as shown in 1321 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1322 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1323 * GetAnnotationSpecRequest request = 1324 * GetAnnotationSpecRequest.newBuilder() 1325 * .setName( 1326 * AnnotationSpecName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]") 1327 * .toString()) 1328 * .build(); 1329 * ApiFuture<AnnotationSpec> future = 1330 * autoMlClient.getAnnotationSpecCallable().futureCall(request); 1331 * // Do something. 1332 * AnnotationSpec response = future.get(); 1333 * } 1334 * }</pre> 1335 */ getAnnotationSpecCallable()1336 public final UnaryCallable<GetAnnotationSpecRequest, AnnotationSpec> getAnnotationSpecCallable() { 1337 return stub.getAnnotationSpecCallable(); 1338 } 1339 1340 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1341 /** 1342 * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field 1343 * when it completes. When you create a model, several model evaluations are created for it: a 1344 * global evaluation, and one evaluation for each annotation spec. 1345 * 1346 * <p>Sample code: 1347 * 1348 * <pre>{@code 1349 * // This snippet has been automatically generated and should be regarded as a code template only. 1350 * // It will require modifications to work: 1351 * // - It may require correct/in-range values for request initialization. 1352 * // - It may require specifying regional endpoints when creating the service client as shown in 1353 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1354 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1355 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1356 * Model model = Model.newBuilder().build(); 1357 * Model response = autoMlClient.createModelAsync(parent, model).get(); 1358 * } 1359 * }</pre> 1360 * 1361 * @param parent Required. Resource name of the parent project where the model is being created. 1362 * @param model Required. The model to create. 1363 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1364 */ createModelAsync( LocationName parent, Model model)1365 public final OperationFuture<Model, OperationMetadata> createModelAsync( 1366 LocationName parent, Model model) { 1367 CreateModelRequest request = 1368 CreateModelRequest.newBuilder() 1369 .setParent(parent == null ? null : parent.toString()) 1370 .setModel(model) 1371 .build(); 1372 return createModelAsync(request); 1373 } 1374 1375 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1376 /** 1377 * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field 1378 * when it completes. When you create a model, several model evaluations are created for it: a 1379 * global evaluation, and one evaluation for each annotation spec. 1380 * 1381 * <p>Sample code: 1382 * 1383 * <pre>{@code 1384 * // This snippet has been automatically generated and should be regarded as a code template only. 1385 * // It will require modifications to work: 1386 * // - It may require correct/in-range values for request initialization. 1387 * // - It may require specifying regional endpoints when creating the service client as shown in 1388 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1389 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1390 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 1391 * Model model = Model.newBuilder().build(); 1392 * Model response = autoMlClient.createModelAsync(parent, model).get(); 1393 * } 1394 * }</pre> 1395 * 1396 * @param parent Required. Resource name of the parent project where the model is being created. 1397 * @param model Required. The model to create. 1398 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1399 */ createModelAsync( String parent, Model model)1400 public final OperationFuture<Model, OperationMetadata> createModelAsync( 1401 String parent, Model model) { 1402 CreateModelRequest request = 1403 CreateModelRequest.newBuilder().setParent(parent).setModel(model).build(); 1404 return createModelAsync(request); 1405 } 1406 1407 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1408 /** 1409 * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field 1410 * when it completes. When you create a model, several model evaluations are created for it: a 1411 * global evaluation, and one evaluation for each annotation spec. 1412 * 1413 * <p>Sample code: 1414 * 1415 * <pre>{@code 1416 * // This snippet has been automatically generated and should be regarded as a code template only. 1417 * // It will require modifications to work: 1418 * // - It may require correct/in-range values for request initialization. 1419 * // - It may require specifying regional endpoints when creating the service client as shown in 1420 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1421 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1422 * CreateModelRequest request = 1423 * CreateModelRequest.newBuilder() 1424 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1425 * .setModel(Model.newBuilder().build()) 1426 * .build(); 1427 * Model response = autoMlClient.createModelAsync(request).get(); 1428 * } 1429 * }</pre> 1430 * 1431 * @param request The request object containing all of the parameters for the API call. 1432 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1433 */ createModelAsync( CreateModelRequest request)1434 public final OperationFuture<Model, OperationMetadata> createModelAsync( 1435 CreateModelRequest request) { 1436 return createModelOperationCallable().futureCall(request); 1437 } 1438 1439 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1440 /** 1441 * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field 1442 * when it completes. When you create a model, several model evaluations are created for it: a 1443 * global evaluation, and one evaluation for each annotation spec. 1444 * 1445 * <p>Sample code: 1446 * 1447 * <pre>{@code 1448 * // This snippet has been automatically generated and should be regarded as a code template only. 1449 * // It will require modifications to work: 1450 * // - It may require correct/in-range values for request initialization. 1451 * // - It may require specifying regional endpoints when creating the service client as shown in 1452 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1453 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1454 * CreateModelRequest request = 1455 * CreateModelRequest.newBuilder() 1456 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1457 * .setModel(Model.newBuilder().build()) 1458 * .build(); 1459 * OperationFuture<Model, OperationMetadata> future = 1460 * autoMlClient.createModelOperationCallable().futureCall(request); 1461 * // Do something. 1462 * Model response = future.get(); 1463 * } 1464 * }</pre> 1465 */ 1466 public final OperationCallable<CreateModelRequest, Model, OperationMetadata> createModelOperationCallable()1467 createModelOperationCallable() { 1468 return stub.createModelOperationCallable(); 1469 } 1470 1471 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1472 /** 1473 * Creates a model. Returns a Model in the [response][google.longrunning.Operation.response] field 1474 * when it completes. When you create a model, several model evaluations are created for it: a 1475 * global evaluation, and one evaluation for each annotation spec. 1476 * 1477 * <p>Sample code: 1478 * 1479 * <pre>{@code 1480 * // This snippet has been automatically generated and should be regarded as a code template only. 1481 * // It will require modifications to work: 1482 * // - It may require correct/in-range values for request initialization. 1483 * // - It may require specifying regional endpoints when creating the service client as shown in 1484 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1485 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1486 * CreateModelRequest request = 1487 * CreateModelRequest.newBuilder() 1488 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1489 * .setModel(Model.newBuilder().build()) 1490 * .build(); 1491 * ApiFuture<Operation> future = autoMlClient.createModelCallable().futureCall(request); 1492 * // Do something. 1493 * Operation response = future.get(); 1494 * } 1495 * }</pre> 1496 */ createModelCallable()1497 public final UnaryCallable<CreateModelRequest, Operation> createModelCallable() { 1498 return stub.createModelCallable(); 1499 } 1500 1501 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1502 /** 1503 * Gets a model. 1504 * 1505 * <p>Sample code: 1506 * 1507 * <pre>{@code 1508 * // This snippet has been automatically generated and should be regarded as a code template only. 1509 * // It will require modifications to work: 1510 * // - It may require correct/in-range values for request initialization. 1511 * // - It may require specifying regional endpoints when creating the service client as shown in 1512 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1513 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1514 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1515 * Model response = autoMlClient.getModel(name); 1516 * } 1517 * }</pre> 1518 * 1519 * @param name Required. Resource name of the model. 1520 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1521 */ getModel(ModelName name)1522 public final Model getModel(ModelName name) { 1523 GetModelRequest request = 1524 GetModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 1525 return getModel(request); 1526 } 1527 1528 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1529 /** 1530 * Gets a model. 1531 * 1532 * <p>Sample code: 1533 * 1534 * <pre>{@code 1535 * // This snippet has been automatically generated and should be regarded as a code template only. 1536 * // It will require modifications to work: 1537 * // - It may require correct/in-range values for request initialization. 1538 * // - It may require specifying regional endpoints when creating the service client as shown in 1539 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1540 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1541 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1542 * Model response = autoMlClient.getModel(name); 1543 * } 1544 * }</pre> 1545 * 1546 * @param name Required. Resource name of the model. 1547 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1548 */ getModel(String name)1549 public final Model getModel(String name) { 1550 GetModelRequest request = GetModelRequest.newBuilder().setName(name).build(); 1551 return getModel(request); 1552 } 1553 1554 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1555 /** 1556 * Gets a model. 1557 * 1558 * <p>Sample code: 1559 * 1560 * <pre>{@code 1561 * // This snippet has been automatically generated and should be regarded as a code template only. 1562 * // It will require modifications to work: 1563 * // - It may require correct/in-range values for request initialization. 1564 * // - It may require specifying regional endpoints when creating the service client as shown in 1565 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1566 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1567 * GetModelRequest request = 1568 * GetModelRequest.newBuilder() 1569 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1570 * .build(); 1571 * Model response = autoMlClient.getModel(request); 1572 * } 1573 * }</pre> 1574 * 1575 * @param request The request object containing all of the parameters for the API call. 1576 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1577 */ getModel(GetModelRequest request)1578 public final Model getModel(GetModelRequest request) { 1579 return getModelCallable().call(request); 1580 } 1581 1582 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1583 /** 1584 * Gets a model. 1585 * 1586 * <p>Sample code: 1587 * 1588 * <pre>{@code 1589 * // This snippet has been automatically generated and should be regarded as a code template only. 1590 * // It will require modifications to work: 1591 * // - It may require correct/in-range values for request initialization. 1592 * // - It may require specifying regional endpoints when creating the service client as shown in 1593 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1594 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1595 * GetModelRequest request = 1596 * GetModelRequest.newBuilder() 1597 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1598 * .build(); 1599 * ApiFuture<Model> future = autoMlClient.getModelCallable().futureCall(request); 1600 * // Do something. 1601 * Model response = future.get(); 1602 * } 1603 * }</pre> 1604 */ getModelCallable()1605 public final UnaryCallable<GetModelRequest, Model> getModelCallable() { 1606 return stub.getModelCallable(); 1607 } 1608 1609 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1610 /** 1611 * Lists models. 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 (AutoMlClient autoMlClient = AutoMlClient.create()) { 1622 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1623 * for (Model element : autoMlClient.listModels(parent).iterateAll()) { 1624 * // doThingsWith(element); 1625 * } 1626 * } 1627 * }</pre> 1628 * 1629 * @param parent Required. Resource name of the project, from which to list the models. 1630 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1631 */ listModels(LocationName parent)1632 public final ListModelsPagedResponse listModels(LocationName parent) { 1633 ListModelsRequest request = 1634 ListModelsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 1635 return listModels(request); 1636 } 1637 1638 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1639 /** 1640 * Lists models. 1641 * 1642 * <p>Sample code: 1643 * 1644 * <pre>{@code 1645 * // This snippet has been automatically generated and should be regarded as a code template only. 1646 * // It will require modifications to work: 1647 * // - It may require correct/in-range values for request initialization. 1648 * // - It may require specifying regional endpoints when creating the service client as shown in 1649 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1650 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1651 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 1652 * for (Model element : autoMlClient.listModels(parent).iterateAll()) { 1653 * // doThingsWith(element); 1654 * } 1655 * } 1656 * }</pre> 1657 * 1658 * @param parent Required. Resource name of the project, from which to list the models. 1659 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1660 */ listModels(String parent)1661 public final ListModelsPagedResponse listModels(String parent) { 1662 ListModelsRequest request = ListModelsRequest.newBuilder().setParent(parent).build(); 1663 return listModels(request); 1664 } 1665 1666 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1667 /** 1668 * Lists models. 1669 * 1670 * <p>Sample code: 1671 * 1672 * <pre>{@code 1673 * // This snippet has been automatically generated and should be regarded as a code template only. 1674 * // It will require modifications to work: 1675 * // - It may require correct/in-range values for request initialization. 1676 * // - It may require specifying regional endpoints when creating the service client as shown in 1677 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1678 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1679 * ListModelsRequest request = 1680 * ListModelsRequest.newBuilder() 1681 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1682 * .setFilter("filter-1274492040") 1683 * .setPageSize(883849137) 1684 * .setPageToken("pageToken873572522") 1685 * .build(); 1686 * for (Model element : autoMlClient.listModels(request).iterateAll()) { 1687 * // doThingsWith(element); 1688 * } 1689 * } 1690 * }</pre> 1691 * 1692 * @param request The request object containing all of the parameters for the API call. 1693 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1694 */ listModels(ListModelsRequest request)1695 public final ListModelsPagedResponse listModels(ListModelsRequest request) { 1696 return listModelsPagedCallable().call(request); 1697 } 1698 1699 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1700 /** 1701 * Lists models. 1702 * 1703 * <p>Sample code: 1704 * 1705 * <pre>{@code 1706 * // This snippet has been automatically generated and should be regarded as a code template only. 1707 * // It will require modifications to work: 1708 * // - It may require correct/in-range values for request initialization. 1709 * // - It may require specifying regional endpoints when creating the service client as shown in 1710 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1711 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1712 * ListModelsRequest request = 1713 * ListModelsRequest.newBuilder() 1714 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1715 * .setFilter("filter-1274492040") 1716 * .setPageSize(883849137) 1717 * .setPageToken("pageToken873572522") 1718 * .build(); 1719 * ApiFuture<Model> future = autoMlClient.listModelsPagedCallable().futureCall(request); 1720 * // Do something. 1721 * for (Model element : future.get().iterateAll()) { 1722 * // doThingsWith(element); 1723 * } 1724 * } 1725 * }</pre> 1726 */ listModelsPagedCallable()1727 public final UnaryCallable<ListModelsRequest, ListModelsPagedResponse> listModelsPagedCallable() { 1728 return stub.listModelsPagedCallable(); 1729 } 1730 1731 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1732 /** 1733 * Lists models. 1734 * 1735 * <p>Sample code: 1736 * 1737 * <pre>{@code 1738 * // This snippet has been automatically generated and should be regarded as a code template only. 1739 * // It will require modifications to work: 1740 * // - It may require correct/in-range values for request initialization. 1741 * // - It may require specifying regional endpoints when creating the service client as shown in 1742 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1743 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1744 * ListModelsRequest request = 1745 * ListModelsRequest.newBuilder() 1746 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1747 * .setFilter("filter-1274492040") 1748 * .setPageSize(883849137) 1749 * .setPageToken("pageToken873572522") 1750 * .build(); 1751 * while (true) { 1752 * ListModelsResponse response = autoMlClient.listModelsCallable().call(request); 1753 * for (Model element : response.getModelList()) { 1754 * // doThingsWith(element); 1755 * } 1756 * String nextPageToken = response.getNextPageToken(); 1757 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1758 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1759 * } else { 1760 * break; 1761 * } 1762 * } 1763 * } 1764 * }</pre> 1765 */ listModelsCallable()1766 public final UnaryCallable<ListModelsRequest, ListModelsResponse> listModelsCallable() { 1767 return stub.listModelsCallable(); 1768 } 1769 1770 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1771 /** 1772 * Deletes a model. Returns `google.protobuf.Empty` in the 1773 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 1774 * in the [metadata][google.longrunning.Operation.metadata] field. 1775 * 1776 * <p>Sample code: 1777 * 1778 * <pre>{@code 1779 * // This snippet has been automatically generated and should be regarded as a code template only. 1780 * // It will require modifications to work: 1781 * // - It may require correct/in-range values for request initialization. 1782 * // - It may require specifying regional endpoints when creating the service client as shown in 1783 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1784 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1785 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1786 * autoMlClient.deleteModelAsync(name).get(); 1787 * } 1788 * }</pre> 1789 * 1790 * @param name Required. Resource name of the model being deleted. 1791 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1792 */ deleteModelAsync(ModelName name)1793 public final OperationFuture<Empty, OperationMetadata> deleteModelAsync(ModelName name) { 1794 DeleteModelRequest request = 1795 DeleteModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 1796 return deleteModelAsync(request); 1797 } 1798 1799 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1800 /** 1801 * Deletes a model. Returns `google.protobuf.Empty` in the 1802 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 1803 * in the [metadata][google.longrunning.Operation.metadata] field. 1804 * 1805 * <p>Sample code: 1806 * 1807 * <pre>{@code 1808 * // This snippet has been automatically generated and should be regarded as a code template only. 1809 * // It will require modifications to work: 1810 * // - It may require correct/in-range values for request initialization. 1811 * // - It may require specifying regional endpoints when creating the service client as shown in 1812 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1813 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1814 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1815 * autoMlClient.deleteModelAsync(name).get(); 1816 * } 1817 * }</pre> 1818 * 1819 * @param name Required. Resource name of the model being deleted. 1820 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1821 */ deleteModelAsync(String name)1822 public final OperationFuture<Empty, OperationMetadata> deleteModelAsync(String name) { 1823 DeleteModelRequest request = DeleteModelRequest.newBuilder().setName(name).build(); 1824 return deleteModelAsync(request); 1825 } 1826 1827 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1828 /** 1829 * Deletes a model. Returns `google.protobuf.Empty` in the 1830 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 1831 * in the [metadata][google.longrunning.Operation.metadata] field. 1832 * 1833 * <p>Sample code: 1834 * 1835 * <pre>{@code 1836 * // This snippet has been automatically generated and should be regarded as a code template only. 1837 * // It will require modifications to work: 1838 * // - It may require correct/in-range values for request initialization. 1839 * // - It may require specifying regional endpoints when creating the service client as shown in 1840 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1841 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1842 * DeleteModelRequest request = 1843 * DeleteModelRequest.newBuilder() 1844 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1845 * .build(); 1846 * autoMlClient.deleteModelAsync(request).get(); 1847 * } 1848 * }</pre> 1849 * 1850 * @param request The request object containing all of the parameters for the API call. 1851 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1852 */ deleteModelAsync( DeleteModelRequest request)1853 public final OperationFuture<Empty, OperationMetadata> deleteModelAsync( 1854 DeleteModelRequest request) { 1855 return deleteModelOperationCallable().futureCall(request); 1856 } 1857 1858 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1859 /** 1860 * Deletes a model. Returns `google.protobuf.Empty` in the 1861 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 1862 * in the [metadata][google.longrunning.Operation.metadata] field. 1863 * 1864 * <p>Sample code: 1865 * 1866 * <pre>{@code 1867 * // This snippet has been automatically generated and should be regarded as a code template only. 1868 * // It will require modifications to work: 1869 * // - It may require correct/in-range values for request initialization. 1870 * // - It may require specifying regional endpoints when creating the service client as shown in 1871 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1872 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1873 * DeleteModelRequest request = 1874 * DeleteModelRequest.newBuilder() 1875 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1876 * .build(); 1877 * OperationFuture<Empty, OperationMetadata> future = 1878 * autoMlClient.deleteModelOperationCallable().futureCall(request); 1879 * // Do something. 1880 * future.get(); 1881 * } 1882 * }</pre> 1883 */ 1884 public final OperationCallable<DeleteModelRequest, Empty, OperationMetadata> deleteModelOperationCallable()1885 deleteModelOperationCallable() { 1886 return stub.deleteModelOperationCallable(); 1887 } 1888 1889 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1890 /** 1891 * Deletes a model. Returns `google.protobuf.Empty` in the 1892 * [response][google.longrunning.Operation.response] field when it completes, and `delete_details` 1893 * in the [metadata][google.longrunning.Operation.metadata] field. 1894 * 1895 * <p>Sample code: 1896 * 1897 * <pre>{@code 1898 * // This snippet has been automatically generated and should be regarded as a code template only. 1899 * // It will require modifications to work: 1900 * // - It may require correct/in-range values for request initialization. 1901 * // - It may require specifying regional endpoints when creating the service client as shown in 1902 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1903 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1904 * DeleteModelRequest request = 1905 * DeleteModelRequest.newBuilder() 1906 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1907 * .build(); 1908 * ApiFuture<Operation> future = autoMlClient.deleteModelCallable().futureCall(request); 1909 * // Do something. 1910 * future.get(); 1911 * } 1912 * }</pre> 1913 */ deleteModelCallable()1914 public final UnaryCallable<DeleteModelRequest, Operation> deleteModelCallable() { 1915 return stub.deleteModelCallable(); 1916 } 1917 1918 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1919 /** 1920 * Updates a model. 1921 * 1922 * <p>Sample code: 1923 * 1924 * <pre>{@code 1925 * // This snippet has been automatically generated and should be regarded as a code template only. 1926 * // It will require modifications to work: 1927 * // - It may require correct/in-range values for request initialization. 1928 * // - It may require specifying regional endpoints when creating the service client as shown in 1929 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1930 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1931 * Model model = Model.newBuilder().build(); 1932 * FieldMask updateMask = FieldMask.newBuilder().build(); 1933 * Model response = autoMlClient.updateModel(model, updateMask); 1934 * } 1935 * }</pre> 1936 * 1937 * @param model Required. The model which replaces the resource on the server. 1938 * @param updateMask Required. The update mask applies to the resource. 1939 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1940 */ updateModel(Model model, FieldMask updateMask)1941 public final Model updateModel(Model model, FieldMask updateMask) { 1942 UpdateModelRequest request = 1943 UpdateModelRequest.newBuilder().setModel(model).setUpdateMask(updateMask).build(); 1944 return updateModel(request); 1945 } 1946 1947 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1948 /** 1949 * Updates a model. 1950 * 1951 * <p>Sample code: 1952 * 1953 * <pre>{@code 1954 * // This snippet has been automatically generated and should be regarded as a code template only. 1955 * // It will require modifications to work: 1956 * // - It may require correct/in-range values for request initialization. 1957 * // - It may require specifying regional endpoints when creating the service client as shown in 1958 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1959 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1960 * UpdateModelRequest request = 1961 * UpdateModelRequest.newBuilder() 1962 * .setModel(Model.newBuilder().build()) 1963 * .setUpdateMask(FieldMask.newBuilder().build()) 1964 * .build(); 1965 * Model response = autoMlClient.updateModel(request); 1966 * } 1967 * }</pre> 1968 * 1969 * @param request The request object containing all of the parameters for the API call. 1970 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1971 */ updateModel(UpdateModelRequest request)1972 public final Model updateModel(UpdateModelRequest request) { 1973 return updateModelCallable().call(request); 1974 } 1975 1976 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1977 /** 1978 * Updates a model. 1979 * 1980 * <p>Sample code: 1981 * 1982 * <pre>{@code 1983 * // This snippet has been automatically generated and should be regarded as a code template only. 1984 * // It will require modifications to work: 1985 * // - It may require correct/in-range values for request initialization. 1986 * // - It may require specifying regional endpoints when creating the service client as shown in 1987 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1988 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 1989 * UpdateModelRequest request = 1990 * UpdateModelRequest.newBuilder() 1991 * .setModel(Model.newBuilder().build()) 1992 * .setUpdateMask(FieldMask.newBuilder().build()) 1993 * .build(); 1994 * ApiFuture<Model> future = autoMlClient.updateModelCallable().futureCall(request); 1995 * // Do something. 1996 * Model response = future.get(); 1997 * } 1998 * }</pre> 1999 */ updateModelCallable()2000 public final UnaryCallable<UpdateModelRequest, Model> updateModelCallable() { 2001 return stub.updateModelCallable(); 2002 } 2003 2004 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2005 /** 2006 * Deploys a model. If a model is already deployed, deploying it with the same parameters has no 2007 * effect. Deploying with different parametrs (as e.g. changing 2008 * [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 2009 * will reset the deployment state without pausing the model's availability. 2010 * 2011 * <p>Only applicable for Text Classification, Image Object Detection , Tables, and Image 2012 * Segmentation; all other domains manage deployment automatically. 2013 * 2014 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2015 * when it completes. 2016 * 2017 * <p>Sample code: 2018 * 2019 * <pre>{@code 2020 * // This snippet has been automatically generated and should be regarded as a code template only. 2021 * // It will require modifications to work: 2022 * // - It may require correct/in-range values for request initialization. 2023 * // - It may require specifying regional endpoints when creating the service client as shown in 2024 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2025 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2026 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 2027 * autoMlClient.deployModelAsync(name).get(); 2028 * } 2029 * }</pre> 2030 * 2031 * @param name Required. Resource name of the model to deploy. 2032 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2033 */ deployModelAsync(ModelName name)2034 public final OperationFuture<Empty, OperationMetadata> deployModelAsync(ModelName name) { 2035 DeployModelRequest request = 2036 DeployModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 2037 return deployModelAsync(request); 2038 } 2039 2040 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2041 /** 2042 * Deploys a model. If a model is already deployed, deploying it with the same parameters has no 2043 * effect. Deploying with different parametrs (as e.g. changing 2044 * [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 2045 * will reset the deployment state without pausing the model's availability. 2046 * 2047 * <p>Only applicable for Text Classification, Image Object Detection , Tables, and Image 2048 * Segmentation; all other domains manage deployment automatically. 2049 * 2050 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2051 * when it completes. 2052 * 2053 * <p>Sample code: 2054 * 2055 * <pre>{@code 2056 * // This snippet has been automatically generated and should be regarded as a code template only. 2057 * // It will require modifications to work: 2058 * // - It may require correct/in-range values for request initialization. 2059 * // - It may require specifying regional endpoints when creating the service client as shown in 2060 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2061 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2062 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2063 * autoMlClient.deployModelAsync(name).get(); 2064 * } 2065 * }</pre> 2066 * 2067 * @param name Required. Resource name of the model to deploy. 2068 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2069 */ deployModelAsync(String name)2070 public final OperationFuture<Empty, OperationMetadata> deployModelAsync(String name) { 2071 DeployModelRequest request = DeployModelRequest.newBuilder().setName(name).build(); 2072 return deployModelAsync(request); 2073 } 2074 2075 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2076 /** 2077 * Deploys a model. If a model is already deployed, deploying it with the same parameters has no 2078 * effect. Deploying with different parametrs (as e.g. changing 2079 * [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 2080 * will reset the deployment state without pausing the model's availability. 2081 * 2082 * <p>Only applicable for Text Classification, Image Object Detection , Tables, and Image 2083 * Segmentation; all other domains manage deployment automatically. 2084 * 2085 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2086 * when it completes. 2087 * 2088 * <p>Sample code: 2089 * 2090 * <pre>{@code 2091 * // This snippet has been automatically generated and should be regarded as a code template only. 2092 * // It will require modifications to work: 2093 * // - It may require correct/in-range values for request initialization. 2094 * // - It may require specifying regional endpoints when creating the service client as shown in 2095 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2096 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2097 * DeployModelRequest request = 2098 * DeployModelRequest.newBuilder() 2099 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2100 * .build(); 2101 * autoMlClient.deployModelAsync(request).get(); 2102 * } 2103 * }</pre> 2104 * 2105 * @param request The request object containing all of the parameters for the API call. 2106 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2107 */ deployModelAsync( DeployModelRequest request)2108 public final OperationFuture<Empty, OperationMetadata> deployModelAsync( 2109 DeployModelRequest request) { 2110 return deployModelOperationCallable().futureCall(request); 2111 } 2112 2113 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2114 /** 2115 * Deploys a model. If a model is already deployed, deploying it with the same parameters has no 2116 * effect. Deploying with different parametrs (as e.g. changing 2117 * [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 2118 * will reset the deployment state without pausing the model's availability. 2119 * 2120 * <p>Only applicable for Text Classification, Image Object Detection , Tables, and Image 2121 * Segmentation; all other domains manage deployment automatically. 2122 * 2123 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2124 * when it completes. 2125 * 2126 * <p>Sample code: 2127 * 2128 * <pre>{@code 2129 * // This snippet has been automatically generated and should be regarded as a code template only. 2130 * // It will require modifications to work: 2131 * // - It may require correct/in-range values for request initialization. 2132 * // - It may require specifying regional endpoints when creating the service client as shown in 2133 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2134 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2135 * DeployModelRequest request = 2136 * DeployModelRequest.newBuilder() 2137 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2138 * .build(); 2139 * OperationFuture<Empty, OperationMetadata> future = 2140 * autoMlClient.deployModelOperationCallable().futureCall(request); 2141 * // Do something. 2142 * future.get(); 2143 * } 2144 * }</pre> 2145 */ 2146 public final OperationCallable<DeployModelRequest, Empty, OperationMetadata> deployModelOperationCallable()2147 deployModelOperationCallable() { 2148 return stub.deployModelOperationCallable(); 2149 } 2150 2151 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2152 /** 2153 * Deploys a model. If a model is already deployed, deploying it with the same parameters has no 2154 * effect. Deploying with different parametrs (as e.g. changing 2155 * [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 2156 * will reset the deployment state without pausing the model's availability. 2157 * 2158 * <p>Only applicable for Text Classification, Image Object Detection , Tables, and Image 2159 * Segmentation; all other domains manage deployment automatically. 2160 * 2161 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2162 * when it completes. 2163 * 2164 * <p>Sample code: 2165 * 2166 * <pre>{@code 2167 * // This snippet has been automatically generated and should be regarded as a code template only. 2168 * // It will require modifications to work: 2169 * // - It may require correct/in-range values for request initialization. 2170 * // - It may require specifying regional endpoints when creating the service client as shown in 2171 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2172 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2173 * DeployModelRequest request = 2174 * DeployModelRequest.newBuilder() 2175 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2176 * .build(); 2177 * ApiFuture<Operation> future = autoMlClient.deployModelCallable().futureCall(request); 2178 * // Do something. 2179 * future.get(); 2180 * } 2181 * }</pre> 2182 */ deployModelCallable()2183 public final UnaryCallable<DeployModelRequest, Operation> deployModelCallable() { 2184 return stub.deployModelCallable(); 2185 } 2186 2187 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2188 /** 2189 * Undeploys a model. If the model is not deployed this method has no effect. 2190 * 2191 * <p>Only applicable for Text Classification, Image Object Detection and Tables; all other 2192 * domains manage deployment automatically. 2193 * 2194 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2195 * when it completes. 2196 * 2197 * <p>Sample code: 2198 * 2199 * <pre>{@code 2200 * // This snippet has been automatically generated and should be regarded as a code template only. 2201 * // It will require modifications to work: 2202 * // - It may require correct/in-range values for request initialization. 2203 * // - It may require specifying regional endpoints when creating the service client as shown in 2204 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2205 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2206 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 2207 * autoMlClient.undeployModelAsync(name).get(); 2208 * } 2209 * }</pre> 2210 * 2211 * @param name Required. Resource name of the model to undeploy. 2212 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2213 */ undeployModelAsync(ModelName name)2214 public final OperationFuture<Empty, OperationMetadata> undeployModelAsync(ModelName name) { 2215 UndeployModelRequest request = 2216 UndeployModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 2217 return undeployModelAsync(request); 2218 } 2219 2220 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2221 /** 2222 * Undeploys a model. If the model is not deployed this method has no effect. 2223 * 2224 * <p>Only applicable for Text Classification, Image Object Detection and Tables; all other 2225 * domains manage deployment automatically. 2226 * 2227 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2228 * when it completes. 2229 * 2230 * <p>Sample code: 2231 * 2232 * <pre>{@code 2233 * // This snippet has been automatically generated and should be regarded as a code template only. 2234 * // It will require modifications to work: 2235 * // - It may require correct/in-range values for request initialization. 2236 * // - It may require specifying regional endpoints when creating the service client as shown in 2237 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2238 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2239 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2240 * autoMlClient.undeployModelAsync(name).get(); 2241 * } 2242 * }</pre> 2243 * 2244 * @param name Required. Resource name of the model to undeploy. 2245 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2246 */ undeployModelAsync(String name)2247 public final OperationFuture<Empty, OperationMetadata> undeployModelAsync(String name) { 2248 UndeployModelRequest request = UndeployModelRequest.newBuilder().setName(name).build(); 2249 return undeployModelAsync(request); 2250 } 2251 2252 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2253 /** 2254 * Undeploys a model. If the model is not deployed this method has no effect. 2255 * 2256 * <p>Only applicable for Text Classification, Image Object Detection and Tables; all other 2257 * domains manage deployment automatically. 2258 * 2259 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2260 * when it completes. 2261 * 2262 * <p>Sample code: 2263 * 2264 * <pre>{@code 2265 * // This snippet has been automatically generated and should be regarded as a code template only. 2266 * // It will require modifications to work: 2267 * // - It may require correct/in-range values for request initialization. 2268 * // - It may require specifying regional endpoints when creating the service client as shown in 2269 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2270 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2271 * UndeployModelRequest request = 2272 * UndeployModelRequest.newBuilder() 2273 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2274 * .build(); 2275 * autoMlClient.undeployModelAsync(request).get(); 2276 * } 2277 * }</pre> 2278 * 2279 * @param request The request object containing all of the parameters for the API call. 2280 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2281 */ undeployModelAsync( UndeployModelRequest request)2282 public final OperationFuture<Empty, OperationMetadata> undeployModelAsync( 2283 UndeployModelRequest request) { 2284 return undeployModelOperationCallable().futureCall(request); 2285 } 2286 2287 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2288 /** 2289 * Undeploys a model. If the model is not deployed this method has no effect. 2290 * 2291 * <p>Only applicable for Text Classification, Image Object Detection and Tables; all other 2292 * domains manage deployment automatically. 2293 * 2294 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2295 * when it completes. 2296 * 2297 * <p>Sample code: 2298 * 2299 * <pre>{@code 2300 * // This snippet has been automatically generated and should be regarded as a code template only. 2301 * // It will require modifications to work: 2302 * // - It may require correct/in-range values for request initialization. 2303 * // - It may require specifying regional endpoints when creating the service client as shown in 2304 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2305 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2306 * UndeployModelRequest request = 2307 * UndeployModelRequest.newBuilder() 2308 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2309 * .build(); 2310 * OperationFuture<Empty, OperationMetadata> future = 2311 * autoMlClient.undeployModelOperationCallable().futureCall(request); 2312 * // Do something. 2313 * future.get(); 2314 * } 2315 * }</pre> 2316 */ 2317 public final OperationCallable<UndeployModelRequest, Empty, OperationMetadata> undeployModelOperationCallable()2318 undeployModelOperationCallable() { 2319 return stub.undeployModelOperationCallable(); 2320 } 2321 2322 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2323 /** 2324 * Undeploys a model. If the model is not deployed this method has no effect. 2325 * 2326 * <p>Only applicable for Text Classification, Image Object Detection and Tables; all other 2327 * domains manage deployment automatically. 2328 * 2329 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2330 * when it completes. 2331 * 2332 * <p>Sample code: 2333 * 2334 * <pre>{@code 2335 * // This snippet has been automatically generated and should be regarded as a code template only. 2336 * // It will require modifications to work: 2337 * // - It may require correct/in-range values for request initialization. 2338 * // - It may require specifying regional endpoints when creating the service client as shown in 2339 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2340 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2341 * UndeployModelRequest request = 2342 * UndeployModelRequest.newBuilder() 2343 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2344 * .build(); 2345 * ApiFuture<Operation> future = autoMlClient.undeployModelCallable().futureCall(request); 2346 * // Do something. 2347 * future.get(); 2348 * } 2349 * }</pre> 2350 */ undeployModelCallable()2351 public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallable() { 2352 return stub.undeployModelCallable(); 2353 } 2354 2355 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2356 /** 2357 * Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A 2358 * model is considered export-able if and only if it has an export format defined for it in 2359 * [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 2360 * 2361 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2362 * when it completes. 2363 * 2364 * <p>Sample code: 2365 * 2366 * <pre>{@code 2367 * // This snippet has been automatically generated and should be regarded as a code template only. 2368 * // It will require modifications to work: 2369 * // - It may require correct/in-range values for request initialization. 2370 * // - It may require specifying regional endpoints when creating the service client as shown in 2371 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2372 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2373 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 2374 * ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build(); 2375 * autoMlClient.exportModelAsync(name, outputConfig).get(); 2376 * } 2377 * }</pre> 2378 * 2379 * @param name Required. The resource name of the model to export. 2380 * @param outputConfig Required. The desired output location and configuration. 2381 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2382 */ exportModelAsync( ModelName name, ModelExportOutputConfig outputConfig)2383 public final OperationFuture<Empty, OperationMetadata> exportModelAsync( 2384 ModelName name, ModelExportOutputConfig outputConfig) { 2385 ExportModelRequest request = 2386 ExportModelRequest.newBuilder() 2387 .setName(name == null ? null : name.toString()) 2388 .setOutputConfig(outputConfig) 2389 .build(); 2390 return exportModelAsync(request); 2391 } 2392 2393 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2394 /** 2395 * Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A 2396 * model is considered export-able if and only if it has an export format defined for it in 2397 * [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 2398 * 2399 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2400 * when it completes. 2401 * 2402 * <p>Sample code: 2403 * 2404 * <pre>{@code 2405 * // This snippet has been automatically generated and should be regarded as a code template only. 2406 * // It will require modifications to work: 2407 * // - It may require correct/in-range values for request initialization. 2408 * // - It may require specifying regional endpoints when creating the service client as shown in 2409 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2410 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2411 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2412 * ModelExportOutputConfig outputConfig = ModelExportOutputConfig.newBuilder().build(); 2413 * autoMlClient.exportModelAsync(name, outputConfig).get(); 2414 * } 2415 * }</pre> 2416 * 2417 * @param name Required. The resource name of the model to export. 2418 * @param outputConfig Required. The desired output location and configuration. 2419 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2420 */ exportModelAsync( String name, ModelExportOutputConfig outputConfig)2421 public final OperationFuture<Empty, OperationMetadata> exportModelAsync( 2422 String name, ModelExportOutputConfig outputConfig) { 2423 ExportModelRequest request = 2424 ExportModelRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build(); 2425 return exportModelAsync(request); 2426 } 2427 2428 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2429 /** 2430 * Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A 2431 * model is considered export-able if and only if it has an export format defined for it in 2432 * [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 2433 * 2434 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2435 * when it completes. 2436 * 2437 * <p>Sample code: 2438 * 2439 * <pre>{@code 2440 * // This snippet has been automatically generated and should be regarded as a code template only. 2441 * // It will require modifications to work: 2442 * // - It may require correct/in-range values for request initialization. 2443 * // - It may require specifying regional endpoints when creating the service client as shown in 2444 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2445 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2446 * ExportModelRequest request = 2447 * ExportModelRequest.newBuilder() 2448 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2449 * .setOutputConfig(ModelExportOutputConfig.newBuilder().build()) 2450 * .build(); 2451 * autoMlClient.exportModelAsync(request).get(); 2452 * } 2453 * }</pre> 2454 * 2455 * @param request The request object containing all of the parameters for the API call. 2456 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2457 */ exportModelAsync( ExportModelRequest request)2458 public final OperationFuture<Empty, OperationMetadata> exportModelAsync( 2459 ExportModelRequest request) { 2460 return exportModelOperationCallable().futureCall(request); 2461 } 2462 2463 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2464 /** 2465 * Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A 2466 * model is considered export-able if and only if it has an export format defined for it in 2467 * [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 2468 * 2469 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2470 * when it completes. 2471 * 2472 * <p>Sample code: 2473 * 2474 * <pre>{@code 2475 * // This snippet has been automatically generated and should be regarded as a code template only. 2476 * // It will require modifications to work: 2477 * // - It may require correct/in-range values for request initialization. 2478 * // - It may require specifying regional endpoints when creating the service client as shown in 2479 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2480 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2481 * ExportModelRequest request = 2482 * ExportModelRequest.newBuilder() 2483 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2484 * .setOutputConfig(ModelExportOutputConfig.newBuilder().build()) 2485 * .build(); 2486 * OperationFuture<Empty, OperationMetadata> future = 2487 * autoMlClient.exportModelOperationCallable().futureCall(request); 2488 * // Do something. 2489 * future.get(); 2490 * } 2491 * }</pre> 2492 */ 2493 public final OperationCallable<ExportModelRequest, Empty, OperationMetadata> exportModelOperationCallable()2494 exportModelOperationCallable() { 2495 return stub.exportModelOperationCallable(); 2496 } 2497 2498 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2499 /** 2500 * Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A 2501 * model is considered export-able if and only if it has an export format defined for it in 2502 * [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 2503 * 2504 * <p>Returns an empty response in the [response][google.longrunning.Operation.response] field 2505 * when it completes. 2506 * 2507 * <p>Sample code: 2508 * 2509 * <pre>{@code 2510 * // This snippet has been automatically generated and should be regarded as a code template only. 2511 * // It will require modifications to work: 2512 * // - It may require correct/in-range values for request initialization. 2513 * // - It may require specifying regional endpoints when creating the service client as shown in 2514 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2515 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2516 * ExportModelRequest request = 2517 * ExportModelRequest.newBuilder() 2518 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2519 * .setOutputConfig(ModelExportOutputConfig.newBuilder().build()) 2520 * .build(); 2521 * ApiFuture<Operation> future = autoMlClient.exportModelCallable().futureCall(request); 2522 * // Do something. 2523 * future.get(); 2524 * } 2525 * }</pre> 2526 */ exportModelCallable()2527 public final UnaryCallable<ExportModelRequest, Operation> exportModelCallable() { 2528 return stub.exportModelCallable(); 2529 } 2530 2531 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2532 /** 2533 * Gets a model evaluation. 2534 * 2535 * <p>Sample code: 2536 * 2537 * <pre>{@code 2538 * // This snippet has been automatically generated and should be regarded as a code template only. 2539 * // It will require modifications to work: 2540 * // - It may require correct/in-range values for request initialization. 2541 * // - It may require specifying regional endpoints when creating the service client as shown in 2542 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2543 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2544 * ModelEvaluationName name = 2545 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"); 2546 * ModelEvaluation response = autoMlClient.getModelEvaluation(name); 2547 * } 2548 * }</pre> 2549 * 2550 * @param name Required. Resource name for the model evaluation. 2551 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2552 */ getModelEvaluation(ModelEvaluationName name)2553 public final ModelEvaluation getModelEvaluation(ModelEvaluationName name) { 2554 GetModelEvaluationRequest request = 2555 GetModelEvaluationRequest.newBuilder() 2556 .setName(name == null ? null : name.toString()) 2557 .build(); 2558 return getModelEvaluation(request); 2559 } 2560 2561 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2562 /** 2563 * Gets a model evaluation. 2564 * 2565 * <p>Sample code: 2566 * 2567 * <pre>{@code 2568 * // This snippet has been automatically generated and should be regarded as a code template only. 2569 * // It will require modifications to work: 2570 * // - It may require correct/in-range values for request initialization. 2571 * // - It may require specifying regional endpoints when creating the service client as shown in 2572 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2573 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2574 * String name = 2575 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]") 2576 * .toString(); 2577 * ModelEvaluation response = autoMlClient.getModelEvaluation(name); 2578 * } 2579 * }</pre> 2580 * 2581 * @param name Required. Resource name for the model evaluation. 2582 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2583 */ getModelEvaluation(String name)2584 public final ModelEvaluation getModelEvaluation(String name) { 2585 GetModelEvaluationRequest request = 2586 GetModelEvaluationRequest.newBuilder().setName(name).build(); 2587 return getModelEvaluation(request); 2588 } 2589 2590 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2591 /** 2592 * Gets a model evaluation. 2593 * 2594 * <p>Sample code: 2595 * 2596 * <pre>{@code 2597 * // This snippet has been automatically generated and should be regarded as a code template only. 2598 * // It will require modifications to work: 2599 * // - It may require correct/in-range values for request initialization. 2600 * // - It may require specifying regional endpoints when creating the service client as shown in 2601 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2602 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2603 * GetModelEvaluationRequest request = 2604 * GetModelEvaluationRequest.newBuilder() 2605 * .setName( 2606 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]") 2607 * .toString()) 2608 * .build(); 2609 * ModelEvaluation response = autoMlClient.getModelEvaluation(request); 2610 * } 2611 * }</pre> 2612 * 2613 * @param request The request object containing all of the parameters for the API call. 2614 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2615 */ getModelEvaluation(GetModelEvaluationRequest request)2616 public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest request) { 2617 return getModelEvaluationCallable().call(request); 2618 } 2619 2620 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2621 /** 2622 * Gets a model evaluation. 2623 * 2624 * <p>Sample code: 2625 * 2626 * <pre>{@code 2627 * // This snippet has been automatically generated and should be regarded as a code template only. 2628 * // It will require modifications to work: 2629 * // - It may require correct/in-range values for request initialization. 2630 * // - It may require specifying regional endpoints when creating the service client as shown in 2631 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2632 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2633 * GetModelEvaluationRequest request = 2634 * GetModelEvaluationRequest.newBuilder() 2635 * .setName( 2636 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]") 2637 * .toString()) 2638 * .build(); 2639 * ApiFuture<ModelEvaluation> future = 2640 * autoMlClient.getModelEvaluationCallable().futureCall(request); 2641 * // Do something. 2642 * ModelEvaluation response = future.get(); 2643 * } 2644 * }</pre> 2645 */ 2646 public final UnaryCallable<GetModelEvaluationRequest, ModelEvaluation> getModelEvaluationCallable()2647 getModelEvaluationCallable() { 2648 return stub.getModelEvaluationCallable(); 2649 } 2650 2651 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2652 /** 2653 * Lists model evaluations. 2654 * 2655 * <p>Sample code: 2656 * 2657 * <pre>{@code 2658 * // This snippet has been automatically generated and should be regarded as a code template only. 2659 * // It will require modifications to work: 2660 * // - It may require correct/in-range values for request initialization. 2661 * // - It may require specifying regional endpoints when creating the service client as shown in 2662 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2663 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2664 * ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 2665 * String filter = "filter-1274492040"; 2666 * for (ModelEvaluation element : 2667 * autoMlClient.listModelEvaluations(parent, filter).iterateAll()) { 2668 * // doThingsWith(element); 2669 * } 2670 * } 2671 * }</pre> 2672 * 2673 * @param parent Required. Resource name of the model to list the model evaluations for. If 2674 * modelId is set as "-", this will list model evaluations from across all models of the 2675 * parent location. 2676 * @param filter Required. An expression for filtering the results of the request. 2677 * <p>* `annotation_spec_id` - for =, != or existence. See example below for the last. 2678 * <p>Some examples of using the filter are: 2679 * <p>* `annotation_spec_id!=4` --> The model evaluation was done for annotation spec 2680 * with ID different than 4. * `NOT annotation_spec_id:*` --> The model evaluation 2681 * was done for aggregate of all annotation specs. 2682 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2683 */ listModelEvaluations( ModelName parent, String filter)2684 public final ListModelEvaluationsPagedResponse listModelEvaluations( 2685 ModelName parent, String filter) { 2686 ListModelEvaluationsRequest request = 2687 ListModelEvaluationsRequest.newBuilder() 2688 .setParent(parent == null ? null : parent.toString()) 2689 .setFilter(filter) 2690 .build(); 2691 return listModelEvaluations(request); 2692 } 2693 2694 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2695 /** 2696 * Lists model evaluations. 2697 * 2698 * <p>Sample code: 2699 * 2700 * <pre>{@code 2701 * // This snippet has been automatically generated and should be regarded as a code template only. 2702 * // It will require modifications to work: 2703 * // - It may require correct/in-range values for request initialization. 2704 * // - It may require specifying regional endpoints when creating the service client as shown in 2705 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2706 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2707 * String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2708 * String filter = "filter-1274492040"; 2709 * for (ModelEvaluation element : 2710 * autoMlClient.listModelEvaluations(parent, filter).iterateAll()) { 2711 * // doThingsWith(element); 2712 * } 2713 * } 2714 * }</pre> 2715 * 2716 * @param parent Required. Resource name of the model to list the model evaluations for. If 2717 * modelId is set as "-", this will list model evaluations from across all models of the 2718 * parent location. 2719 * @param filter Required. An expression for filtering the results of the request. 2720 * <p>* `annotation_spec_id` - for =, != or existence. See example below for the last. 2721 * <p>Some examples of using the filter are: 2722 * <p>* `annotation_spec_id!=4` --> The model evaluation was done for annotation spec 2723 * with ID different than 4. * `NOT annotation_spec_id:*` --> The model evaluation 2724 * was done for aggregate of all annotation specs. 2725 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2726 */ listModelEvaluations( String parent, String filter)2727 public final ListModelEvaluationsPagedResponse listModelEvaluations( 2728 String parent, String filter) { 2729 ListModelEvaluationsRequest request = 2730 ListModelEvaluationsRequest.newBuilder().setParent(parent).setFilter(filter).build(); 2731 return listModelEvaluations(request); 2732 } 2733 2734 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2735 /** 2736 * Lists model evaluations. 2737 * 2738 * <p>Sample code: 2739 * 2740 * <pre>{@code 2741 * // This snippet has been automatically generated and should be regarded as a code template only. 2742 * // It will require modifications to work: 2743 * // - It may require correct/in-range values for request initialization. 2744 * // - It may require specifying regional endpoints when creating the service client as shown in 2745 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2746 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2747 * ListModelEvaluationsRequest request = 2748 * ListModelEvaluationsRequest.newBuilder() 2749 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2750 * .setFilter("filter-1274492040") 2751 * .setPageSize(883849137) 2752 * .setPageToken("pageToken873572522") 2753 * .build(); 2754 * for (ModelEvaluation element : autoMlClient.listModelEvaluations(request).iterateAll()) { 2755 * // doThingsWith(element); 2756 * } 2757 * } 2758 * }</pre> 2759 * 2760 * @param request The request object containing all of the parameters for the API call. 2761 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2762 */ listModelEvaluations( ListModelEvaluationsRequest request)2763 public final ListModelEvaluationsPagedResponse listModelEvaluations( 2764 ListModelEvaluationsRequest request) { 2765 return listModelEvaluationsPagedCallable().call(request); 2766 } 2767 2768 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2769 /** 2770 * Lists model evaluations. 2771 * 2772 * <p>Sample code: 2773 * 2774 * <pre>{@code 2775 * // This snippet has been automatically generated and should be regarded as a code template only. 2776 * // It will require modifications to work: 2777 * // - It may require correct/in-range values for request initialization. 2778 * // - It may require specifying regional endpoints when creating the service client as shown in 2779 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2780 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2781 * ListModelEvaluationsRequest request = 2782 * ListModelEvaluationsRequest.newBuilder() 2783 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2784 * .setFilter("filter-1274492040") 2785 * .setPageSize(883849137) 2786 * .setPageToken("pageToken873572522") 2787 * .build(); 2788 * ApiFuture<ModelEvaluation> future = 2789 * autoMlClient.listModelEvaluationsPagedCallable().futureCall(request); 2790 * // Do something. 2791 * for (ModelEvaluation element : future.get().iterateAll()) { 2792 * // doThingsWith(element); 2793 * } 2794 * } 2795 * }</pre> 2796 */ 2797 public final UnaryCallable<ListModelEvaluationsRequest, ListModelEvaluationsPagedResponse> listModelEvaluationsPagedCallable()2798 listModelEvaluationsPagedCallable() { 2799 return stub.listModelEvaluationsPagedCallable(); 2800 } 2801 2802 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2803 /** 2804 * Lists model evaluations. 2805 * 2806 * <p>Sample code: 2807 * 2808 * <pre>{@code 2809 * // This snippet has been automatically generated and should be regarded as a code template only. 2810 * // It will require modifications to work: 2811 * // - It may require correct/in-range values for request initialization. 2812 * // - It may require specifying regional endpoints when creating the service client as shown in 2813 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2814 * try (AutoMlClient autoMlClient = AutoMlClient.create()) { 2815 * ListModelEvaluationsRequest request = 2816 * ListModelEvaluationsRequest.newBuilder() 2817 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2818 * .setFilter("filter-1274492040") 2819 * .setPageSize(883849137) 2820 * .setPageToken("pageToken873572522") 2821 * .build(); 2822 * while (true) { 2823 * ListModelEvaluationsResponse response = 2824 * autoMlClient.listModelEvaluationsCallable().call(request); 2825 * for (ModelEvaluation element : response.getModelEvaluationList()) { 2826 * // doThingsWith(element); 2827 * } 2828 * String nextPageToken = response.getNextPageToken(); 2829 * if (!Strings.isNullOrEmpty(nextPageToken)) { 2830 * request = request.toBuilder().setPageToken(nextPageToken).build(); 2831 * } else { 2832 * break; 2833 * } 2834 * } 2835 * } 2836 * }</pre> 2837 */ 2838 public final UnaryCallable<ListModelEvaluationsRequest, ListModelEvaluationsResponse> listModelEvaluationsCallable()2839 listModelEvaluationsCallable() { 2840 return stub.listModelEvaluationsCallable(); 2841 } 2842 2843 @Override close()2844 public final void close() { 2845 stub.close(); 2846 } 2847 2848 @Override shutdown()2849 public void shutdown() { 2850 stub.shutdown(); 2851 } 2852 2853 @Override isShutdown()2854 public boolean isShutdown() { 2855 return stub.isShutdown(); 2856 } 2857 2858 @Override isTerminated()2859 public boolean isTerminated() { 2860 return stub.isTerminated(); 2861 } 2862 2863 @Override shutdownNow()2864 public void shutdownNow() { 2865 stub.shutdownNow(); 2866 } 2867 2868 @Override awaitTermination(long duration, TimeUnit unit)2869 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 2870 return stub.awaitTermination(duration, unit); 2871 } 2872 2873 public static class ListDatasetsPagedResponse 2874 extends AbstractPagedListResponse< 2875 ListDatasetsRequest, 2876 ListDatasetsResponse, 2877 Dataset, 2878 ListDatasetsPage, 2879 ListDatasetsFixedSizeCollection> { 2880 createAsync( PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, ApiFuture<ListDatasetsResponse> futureResponse)2881 public static ApiFuture<ListDatasetsPagedResponse> createAsync( 2882 PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, 2883 ApiFuture<ListDatasetsResponse> futureResponse) { 2884 ApiFuture<ListDatasetsPage> futurePage = 2885 ListDatasetsPage.createEmptyPage().createPageAsync(context, futureResponse); 2886 return ApiFutures.transform( 2887 futurePage, 2888 input -> new ListDatasetsPagedResponse(input), 2889 MoreExecutors.directExecutor()); 2890 } 2891 ListDatasetsPagedResponse(ListDatasetsPage page)2892 private ListDatasetsPagedResponse(ListDatasetsPage page) { 2893 super(page, ListDatasetsFixedSizeCollection.createEmptyCollection()); 2894 } 2895 } 2896 2897 public static class ListDatasetsPage 2898 extends AbstractPage<ListDatasetsRequest, ListDatasetsResponse, Dataset, ListDatasetsPage> { 2899 ListDatasetsPage( PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, ListDatasetsResponse response)2900 private ListDatasetsPage( 2901 PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, 2902 ListDatasetsResponse response) { 2903 super(context, response); 2904 } 2905 createEmptyPage()2906 private static ListDatasetsPage createEmptyPage() { 2907 return new ListDatasetsPage(null, null); 2908 } 2909 2910 @Override createPage( PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, ListDatasetsResponse response)2911 protected ListDatasetsPage createPage( 2912 PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, 2913 ListDatasetsResponse response) { 2914 return new ListDatasetsPage(context, response); 2915 } 2916 2917 @Override createPageAsync( PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, ApiFuture<ListDatasetsResponse> futureResponse)2918 public ApiFuture<ListDatasetsPage> createPageAsync( 2919 PageContext<ListDatasetsRequest, ListDatasetsResponse, Dataset> context, 2920 ApiFuture<ListDatasetsResponse> futureResponse) { 2921 return super.createPageAsync(context, futureResponse); 2922 } 2923 } 2924 2925 public static class ListDatasetsFixedSizeCollection 2926 extends AbstractFixedSizeCollection< 2927 ListDatasetsRequest, 2928 ListDatasetsResponse, 2929 Dataset, 2930 ListDatasetsPage, 2931 ListDatasetsFixedSizeCollection> { 2932 ListDatasetsFixedSizeCollection(List<ListDatasetsPage> pages, int collectionSize)2933 private ListDatasetsFixedSizeCollection(List<ListDatasetsPage> pages, int collectionSize) { 2934 super(pages, collectionSize); 2935 } 2936 createEmptyCollection()2937 private static ListDatasetsFixedSizeCollection createEmptyCollection() { 2938 return new ListDatasetsFixedSizeCollection(null, 0); 2939 } 2940 2941 @Override createCollection( List<ListDatasetsPage> pages, int collectionSize)2942 protected ListDatasetsFixedSizeCollection createCollection( 2943 List<ListDatasetsPage> pages, int collectionSize) { 2944 return new ListDatasetsFixedSizeCollection(pages, collectionSize); 2945 } 2946 } 2947 2948 public static class ListModelsPagedResponse 2949 extends AbstractPagedListResponse< 2950 ListModelsRequest, 2951 ListModelsResponse, 2952 Model, 2953 ListModelsPage, 2954 ListModelsFixedSizeCollection> { 2955 createAsync( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ApiFuture<ListModelsResponse> futureResponse)2956 public static ApiFuture<ListModelsPagedResponse> createAsync( 2957 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 2958 ApiFuture<ListModelsResponse> futureResponse) { 2959 ApiFuture<ListModelsPage> futurePage = 2960 ListModelsPage.createEmptyPage().createPageAsync(context, futureResponse); 2961 return ApiFutures.transform( 2962 futurePage, input -> new ListModelsPagedResponse(input), MoreExecutors.directExecutor()); 2963 } 2964 ListModelsPagedResponse(ListModelsPage page)2965 private ListModelsPagedResponse(ListModelsPage page) { 2966 super(page, ListModelsFixedSizeCollection.createEmptyCollection()); 2967 } 2968 } 2969 2970 public static class ListModelsPage 2971 extends AbstractPage<ListModelsRequest, ListModelsResponse, Model, ListModelsPage> { 2972 ListModelsPage( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ListModelsResponse response)2973 private ListModelsPage( 2974 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 2975 ListModelsResponse response) { 2976 super(context, response); 2977 } 2978 createEmptyPage()2979 private static ListModelsPage createEmptyPage() { 2980 return new ListModelsPage(null, null); 2981 } 2982 2983 @Override createPage( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ListModelsResponse response)2984 protected ListModelsPage createPage( 2985 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 2986 ListModelsResponse response) { 2987 return new ListModelsPage(context, response); 2988 } 2989 2990 @Override createPageAsync( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ApiFuture<ListModelsResponse> futureResponse)2991 public ApiFuture<ListModelsPage> createPageAsync( 2992 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 2993 ApiFuture<ListModelsResponse> futureResponse) { 2994 return super.createPageAsync(context, futureResponse); 2995 } 2996 } 2997 2998 public static class ListModelsFixedSizeCollection 2999 extends AbstractFixedSizeCollection< 3000 ListModelsRequest, 3001 ListModelsResponse, 3002 Model, 3003 ListModelsPage, 3004 ListModelsFixedSizeCollection> { 3005 ListModelsFixedSizeCollection(List<ListModelsPage> pages, int collectionSize)3006 private ListModelsFixedSizeCollection(List<ListModelsPage> pages, int collectionSize) { 3007 super(pages, collectionSize); 3008 } 3009 createEmptyCollection()3010 private static ListModelsFixedSizeCollection createEmptyCollection() { 3011 return new ListModelsFixedSizeCollection(null, 0); 3012 } 3013 3014 @Override createCollection( List<ListModelsPage> pages, int collectionSize)3015 protected ListModelsFixedSizeCollection createCollection( 3016 List<ListModelsPage> pages, int collectionSize) { 3017 return new ListModelsFixedSizeCollection(pages, collectionSize); 3018 } 3019 } 3020 3021 public static class ListModelEvaluationsPagedResponse 3022 extends AbstractPagedListResponse< 3023 ListModelEvaluationsRequest, 3024 ListModelEvaluationsResponse, 3025 ModelEvaluation, 3026 ListModelEvaluationsPage, 3027 ListModelEvaluationsFixedSizeCollection> { 3028 createAsync( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ApiFuture<ListModelEvaluationsResponse> futureResponse)3029 public static ApiFuture<ListModelEvaluationsPagedResponse> createAsync( 3030 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3031 context, 3032 ApiFuture<ListModelEvaluationsResponse> futureResponse) { 3033 ApiFuture<ListModelEvaluationsPage> futurePage = 3034 ListModelEvaluationsPage.createEmptyPage().createPageAsync(context, futureResponse); 3035 return ApiFutures.transform( 3036 futurePage, 3037 input -> new ListModelEvaluationsPagedResponse(input), 3038 MoreExecutors.directExecutor()); 3039 } 3040 ListModelEvaluationsPagedResponse(ListModelEvaluationsPage page)3041 private ListModelEvaluationsPagedResponse(ListModelEvaluationsPage page) { 3042 super(page, ListModelEvaluationsFixedSizeCollection.createEmptyCollection()); 3043 } 3044 } 3045 3046 public static class ListModelEvaluationsPage 3047 extends AbstractPage< 3048 ListModelEvaluationsRequest, 3049 ListModelEvaluationsResponse, 3050 ModelEvaluation, 3051 ListModelEvaluationsPage> { 3052 ListModelEvaluationsPage( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ListModelEvaluationsResponse response)3053 private ListModelEvaluationsPage( 3054 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3055 context, 3056 ListModelEvaluationsResponse response) { 3057 super(context, response); 3058 } 3059 createEmptyPage()3060 private static ListModelEvaluationsPage createEmptyPage() { 3061 return new ListModelEvaluationsPage(null, null); 3062 } 3063 3064 @Override createPage( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ListModelEvaluationsResponse response)3065 protected ListModelEvaluationsPage createPage( 3066 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3067 context, 3068 ListModelEvaluationsResponse response) { 3069 return new ListModelEvaluationsPage(context, response); 3070 } 3071 3072 @Override createPageAsync( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ApiFuture<ListModelEvaluationsResponse> futureResponse)3073 public ApiFuture<ListModelEvaluationsPage> createPageAsync( 3074 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3075 context, 3076 ApiFuture<ListModelEvaluationsResponse> futureResponse) { 3077 return super.createPageAsync(context, futureResponse); 3078 } 3079 } 3080 3081 public static class ListModelEvaluationsFixedSizeCollection 3082 extends AbstractFixedSizeCollection< 3083 ListModelEvaluationsRequest, 3084 ListModelEvaluationsResponse, 3085 ModelEvaluation, 3086 ListModelEvaluationsPage, 3087 ListModelEvaluationsFixedSizeCollection> { 3088 ListModelEvaluationsFixedSizeCollection( List<ListModelEvaluationsPage> pages, int collectionSize)3089 private ListModelEvaluationsFixedSizeCollection( 3090 List<ListModelEvaluationsPage> pages, int collectionSize) { 3091 super(pages, collectionSize); 3092 } 3093 createEmptyCollection()3094 private static ListModelEvaluationsFixedSizeCollection createEmptyCollection() { 3095 return new ListModelEvaluationsFixedSizeCollection(null, 0); 3096 } 3097 3098 @Override createCollection( List<ListModelEvaluationsPage> pages, int collectionSize)3099 protected ListModelEvaluationsFixedSizeCollection createCollection( 3100 List<ListModelEvaluationsPage> pages, int collectionSize) { 3101 return new ListModelEvaluationsFixedSizeCollection(pages, collectionSize); 3102 } 3103 } 3104 } 3105