1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.cloud.aiplatform.v1beta1; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.longrunning.OperationFuture; 24 import com.google.api.gax.paging.AbstractFixedSizeCollection; 25 import com.google.api.gax.paging.AbstractPage; 26 import com.google.api.gax.paging.AbstractPagedListResponse; 27 import com.google.api.gax.rpc.OperationCallable; 28 import com.google.api.gax.rpc.PageContext; 29 import com.google.api.gax.rpc.UnaryCallable; 30 import com.google.cloud.aiplatform.v1beta1.stub.ModelServiceStub; 31 import com.google.cloud.aiplatform.v1beta1.stub.ModelServiceStubSettings; 32 import com.google.cloud.location.GetLocationRequest; 33 import com.google.cloud.location.ListLocationsRequest; 34 import com.google.cloud.location.ListLocationsResponse; 35 import com.google.cloud.location.Location; 36 import com.google.common.util.concurrent.MoreExecutors; 37 import com.google.iam.v1.GetIamPolicyRequest; 38 import com.google.iam.v1.Policy; 39 import com.google.iam.v1.SetIamPolicyRequest; 40 import com.google.iam.v1.TestIamPermissionsRequest; 41 import com.google.iam.v1.TestIamPermissionsResponse; 42 import com.google.longrunning.Operation; 43 import com.google.longrunning.OperationsClient; 44 import com.google.protobuf.Empty; 45 import com.google.protobuf.FieldMask; 46 import java.io.IOException; 47 import java.util.List; 48 import java.util.concurrent.TimeUnit; 49 import javax.annotation.Generated; 50 51 // AUTO-GENERATED DOCUMENTATION AND CLASS. 52 /** 53 * Service Description: A service for managing Vertex AI's machine learning Models. 54 * 55 * <p>This class provides the ability to make remote calls to the backing service through method 56 * calls that map to API methods. Sample code to get started: 57 * 58 * <pre>{@code 59 * // This snippet has been automatically generated and should be regarded as a code template only. 60 * // It will require modifications to work: 61 * // - It may require correct/in-range values for request initialization. 62 * // - It may require specifying regional endpoints when creating the service client as shown in 63 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 64 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 65 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 66 * Model response = modelServiceClient.getModel(name); 67 * } 68 * }</pre> 69 * 70 * <p>Note: close() needs to be called on the ModelServiceClient object to clean up resources such 71 * as threads. In the example above, try-with-resources is used, which automatically calls close(). 72 * 73 * <p>The surface of this class includes several types of Java methods for each of the API's 74 * methods: 75 * 76 * <ol> 77 * <li>A "flattened" method. With this type of method, the fields of the request type have been 78 * converted into function parameters. It may be the case that not all fields are available as 79 * parameters, and not every API method will have a flattened method entry point. 80 * <li>A "request object" method. This type of method only takes one parameter, a request object, 81 * which must be constructed before the call. Not every API method will have a request object 82 * method. 83 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 84 * callable object, which can be used to initiate calls to the service. 85 * </ol> 86 * 87 * <p>See the individual methods for example code. 88 * 89 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 90 * these names, this class includes a format method for each type of name, and additionally a parse 91 * method to extract the individual identifiers contained within names that are returned. 92 * 93 * <p>This class can be customized by passing in a custom instance of ModelServiceSettings to 94 * create(). For example: 95 * 96 * <p>To customize credentials: 97 * 98 * <pre>{@code 99 * // This snippet has been automatically generated and should be regarded as a code template only. 100 * // It will require modifications to work: 101 * // - It may require correct/in-range values for request initialization. 102 * // - It may require specifying regional endpoints when creating the service client as shown in 103 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 104 * ModelServiceSettings modelServiceSettings = 105 * ModelServiceSettings.newBuilder() 106 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 107 * .build(); 108 * ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); 109 * }</pre> 110 * 111 * <p>To customize the endpoint: 112 * 113 * <pre>{@code 114 * // This snippet has been automatically generated and should be regarded as a code template only. 115 * // It will require modifications to work: 116 * // - It may require correct/in-range values for request initialization. 117 * // - It may require specifying regional endpoints when creating the service client as shown in 118 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 119 * ModelServiceSettings modelServiceSettings = 120 * ModelServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 121 * ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings); 122 * }</pre> 123 * 124 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 125 */ 126 @BetaApi 127 @Generated("by gapic-generator-java") 128 public class ModelServiceClient implements BackgroundResource { 129 private final ModelServiceSettings settings; 130 private final ModelServiceStub stub; 131 private final OperationsClient operationsClient; 132 133 /** Constructs an instance of ModelServiceClient with default settings. */ create()134 public static final ModelServiceClient create() throws IOException { 135 return create(ModelServiceSettings.newBuilder().build()); 136 } 137 138 /** 139 * Constructs an instance of ModelServiceClient, using the given settings. The channels are 140 * created based on the settings passed in, or defaults for any settings that are not set. 141 */ create(ModelServiceSettings settings)142 public static final ModelServiceClient create(ModelServiceSettings settings) throws IOException { 143 return new ModelServiceClient(settings); 144 } 145 146 /** 147 * Constructs an instance of ModelServiceClient, using the given stub for making calls. This is 148 * for advanced usage - prefer using create(ModelServiceSettings). 149 */ create(ModelServiceStub stub)150 public static final ModelServiceClient create(ModelServiceStub stub) { 151 return new ModelServiceClient(stub); 152 } 153 154 /** 155 * Constructs an instance of ModelServiceClient, using the given settings. This is protected so 156 * that it is easy to make a subclass, but otherwise, the static factory methods should be 157 * preferred. 158 */ ModelServiceClient(ModelServiceSettings settings)159 protected ModelServiceClient(ModelServiceSettings settings) throws IOException { 160 this.settings = settings; 161 this.stub = ((ModelServiceStubSettings) settings.getStubSettings()).createStub(); 162 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 163 } 164 ModelServiceClient(ModelServiceStub stub)165 protected ModelServiceClient(ModelServiceStub stub) { 166 this.settings = null; 167 this.stub = stub; 168 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 169 } 170 getSettings()171 public final ModelServiceSettings getSettings() { 172 return settings; 173 } 174 getStub()175 public ModelServiceStub getStub() { 176 return stub; 177 } 178 179 /** 180 * Returns the OperationsClient that can be used to query the status of a long-running operation 181 * returned by another API method call. 182 */ getOperationsClient()183 public final OperationsClient getOperationsClient() { 184 return operationsClient; 185 } 186 187 // AUTO-GENERATED DOCUMENTATION AND METHOD. 188 /** 189 * Uploads a Model artifact into Vertex AI. 190 * 191 * <p>Sample code: 192 * 193 * <pre>{@code 194 * // This snippet has been automatically generated and should be regarded as a code template only. 195 * // It will require modifications to work: 196 * // - It may require correct/in-range values for request initialization. 197 * // - It may require specifying regional endpoints when creating the service client as shown in 198 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 199 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 200 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 201 * Model model = Model.newBuilder().build(); 202 * UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); 203 * } 204 * }</pre> 205 * 206 * @param parent Required. The resource name of the Location into which to upload the Model. 207 * Format: `projects/{project}/locations/{location}` 208 * @param model Required. The Model to create. 209 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 210 */ uploadModelAsync( LocationName parent, Model model)211 public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata> uploadModelAsync( 212 LocationName parent, Model model) { 213 UploadModelRequest request = 214 UploadModelRequest.newBuilder() 215 .setParent(parent == null ? null : parent.toString()) 216 .setModel(model) 217 .build(); 218 return uploadModelAsync(request); 219 } 220 221 // AUTO-GENERATED DOCUMENTATION AND METHOD. 222 /** 223 * Uploads a Model artifact into Vertex AI. 224 * 225 * <p>Sample code: 226 * 227 * <pre>{@code 228 * // This snippet has been automatically generated and should be regarded as a code template only. 229 * // It will require modifications to work: 230 * // - It may require correct/in-range values for request initialization. 231 * // - It may require specifying regional endpoints when creating the service client as shown in 232 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 233 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 234 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 235 * Model model = Model.newBuilder().build(); 236 * UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); 237 * } 238 * }</pre> 239 * 240 * @param parent Required. The resource name of the Location into which to upload the Model. 241 * Format: `projects/{project}/locations/{location}` 242 * @param model Required. The Model to create. 243 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 244 */ uploadModelAsync( String parent, Model model)245 public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata> uploadModelAsync( 246 String parent, Model model) { 247 UploadModelRequest request = 248 UploadModelRequest.newBuilder().setParent(parent).setModel(model).build(); 249 return uploadModelAsync(request); 250 } 251 252 // AUTO-GENERATED DOCUMENTATION AND METHOD. 253 /** 254 * Uploads a Model artifact into Vertex AI. 255 * 256 * <p>Sample code: 257 * 258 * <pre>{@code 259 * // This snippet has been automatically generated and should be regarded as a code template only. 260 * // It will require modifications to work: 261 * // - It may require correct/in-range values for request initialization. 262 * // - It may require specifying regional endpoints when creating the service client as shown in 263 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 264 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 265 * UploadModelRequest request = 266 * UploadModelRequest.newBuilder() 267 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 268 * .setParentModel("parentModel998431903") 269 * .setModelId("modelId1226956324") 270 * .setModel(Model.newBuilder().build()) 271 * .setServiceAccount("serviceAccount1079137720") 272 * .build(); 273 * UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get(); 274 * } 275 * }</pre> 276 * 277 * @param request The request object containing all of the parameters for the API call. 278 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 279 */ uploadModelAsync( UploadModelRequest request)280 public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata> uploadModelAsync( 281 UploadModelRequest request) { 282 return uploadModelOperationCallable().futureCall(request); 283 } 284 285 // AUTO-GENERATED DOCUMENTATION AND METHOD. 286 /** 287 * Uploads a Model artifact into Vertex AI. 288 * 289 * <p>Sample code: 290 * 291 * <pre>{@code 292 * // This snippet has been automatically generated and should be regarded as a code template only. 293 * // It will require modifications to work: 294 * // - It may require correct/in-range values for request initialization. 295 * // - It may require specifying regional endpoints when creating the service client as shown in 296 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 297 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 298 * UploadModelRequest request = 299 * UploadModelRequest.newBuilder() 300 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 301 * .setParentModel("parentModel998431903") 302 * .setModelId("modelId1226956324") 303 * .setModel(Model.newBuilder().build()) 304 * .setServiceAccount("serviceAccount1079137720") 305 * .build(); 306 * OperationFuture<UploadModelResponse, UploadModelOperationMetadata> future = 307 * modelServiceClient.uploadModelOperationCallable().futureCall(request); 308 * // Do something. 309 * UploadModelResponse response = future.get(); 310 * } 311 * }</pre> 312 */ 313 public final OperationCallable< 314 UploadModelRequest, UploadModelResponse, UploadModelOperationMetadata> uploadModelOperationCallable()315 uploadModelOperationCallable() { 316 return stub.uploadModelOperationCallable(); 317 } 318 319 // AUTO-GENERATED DOCUMENTATION AND METHOD. 320 /** 321 * Uploads a Model artifact into Vertex AI. 322 * 323 * <p>Sample code: 324 * 325 * <pre>{@code 326 * // This snippet has been automatically generated and should be regarded as a code template only. 327 * // It will require modifications to work: 328 * // - It may require correct/in-range values for request initialization. 329 * // - It may require specifying regional endpoints when creating the service client as shown in 330 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 331 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 332 * UploadModelRequest request = 333 * UploadModelRequest.newBuilder() 334 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 335 * .setParentModel("parentModel998431903") 336 * .setModelId("modelId1226956324") 337 * .setModel(Model.newBuilder().build()) 338 * .setServiceAccount("serviceAccount1079137720") 339 * .build(); 340 * ApiFuture<Operation> future = modelServiceClient.uploadModelCallable().futureCall(request); 341 * // Do something. 342 * Operation response = future.get(); 343 * } 344 * }</pre> 345 */ uploadModelCallable()346 public final UnaryCallable<UploadModelRequest, Operation> uploadModelCallable() { 347 return stub.uploadModelCallable(); 348 } 349 350 // AUTO-GENERATED DOCUMENTATION AND METHOD. 351 /** 352 * Gets a Model. 353 * 354 * <p>Sample code: 355 * 356 * <pre>{@code 357 * // This snippet has been automatically generated and should be regarded as a code template only. 358 * // It will require modifications to work: 359 * // - It may require correct/in-range values for request initialization. 360 * // - It may require specifying regional endpoints when creating the service client as shown in 361 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 362 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 363 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 364 * Model response = modelServiceClient.getModel(name); 365 * } 366 * }</pre> 367 * 368 * @param name Required. The name of the Model resource. Format: 369 * `projects/{project}/locations/{location}/models/{model}` 370 * <p>In order to retrieve a specific version of the model, also provide the version ID or 371 * version alias. Example: 372 * `projects/{project}/locations/{location}/models/{model}{@literal @}2` or 373 * `projects/{project}/locations/{location}/models/{model}{@literal @}golden` If no version ID 374 * or alias is specified, the "default" version will be returned. The "default" version alias 375 * is created for the first version of the model, and can be moved to other versions later on. 376 * There will be exactly one default version. 377 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 378 */ getModel(ModelName name)379 public final Model getModel(ModelName name) { 380 GetModelRequest request = 381 GetModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 382 return getModel(request); 383 } 384 385 // AUTO-GENERATED DOCUMENTATION AND METHOD. 386 /** 387 * Gets a Model. 388 * 389 * <p>Sample code: 390 * 391 * <pre>{@code 392 * // This snippet has been automatically generated and should be regarded as a code template only. 393 * // It will require modifications to work: 394 * // - It may require correct/in-range values for request initialization. 395 * // - It may require specifying regional endpoints when creating the service client as shown in 396 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 397 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 398 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 399 * Model response = modelServiceClient.getModel(name); 400 * } 401 * }</pre> 402 * 403 * @param name Required. The name of the Model resource. Format: 404 * `projects/{project}/locations/{location}/models/{model}` 405 * <p>In order to retrieve a specific version of the model, also provide the version ID or 406 * version alias. Example: 407 * `projects/{project}/locations/{location}/models/{model}{@literal @}2` or 408 * `projects/{project}/locations/{location}/models/{model}{@literal @}golden` If no version ID 409 * or alias is specified, the "default" version will be returned. The "default" version alias 410 * is created for the first version of the model, and can be moved to other versions later on. 411 * There will be exactly one default version. 412 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 413 */ getModel(String name)414 public final Model getModel(String name) { 415 GetModelRequest request = GetModelRequest.newBuilder().setName(name).build(); 416 return getModel(request); 417 } 418 419 // AUTO-GENERATED DOCUMENTATION AND METHOD. 420 /** 421 * Gets a Model. 422 * 423 * <p>Sample code: 424 * 425 * <pre>{@code 426 * // This snippet has been automatically generated and should be regarded as a code template only. 427 * // It will require modifications to work: 428 * // - It may require correct/in-range values for request initialization. 429 * // - It may require specifying regional endpoints when creating the service client as shown in 430 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 431 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 432 * GetModelRequest request = 433 * GetModelRequest.newBuilder() 434 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 435 * .build(); 436 * Model response = modelServiceClient.getModel(request); 437 * } 438 * }</pre> 439 * 440 * @param request The request object containing all of the parameters for the API call. 441 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 442 */ getModel(GetModelRequest request)443 public final Model getModel(GetModelRequest request) { 444 return getModelCallable().call(request); 445 } 446 447 // AUTO-GENERATED DOCUMENTATION AND METHOD. 448 /** 449 * Gets a Model. 450 * 451 * <p>Sample code: 452 * 453 * <pre>{@code 454 * // This snippet has been automatically generated and should be regarded as a code template only. 455 * // It will require modifications to work: 456 * // - It may require correct/in-range values for request initialization. 457 * // - It may require specifying regional endpoints when creating the service client as shown in 458 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 459 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 460 * GetModelRequest request = 461 * GetModelRequest.newBuilder() 462 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 463 * .build(); 464 * ApiFuture<Model> future = modelServiceClient.getModelCallable().futureCall(request); 465 * // Do something. 466 * Model response = future.get(); 467 * } 468 * }</pre> 469 */ getModelCallable()470 public final UnaryCallable<GetModelRequest, Model> getModelCallable() { 471 return stub.getModelCallable(); 472 } 473 474 // AUTO-GENERATED DOCUMENTATION AND METHOD. 475 /** 476 * Lists Models in a Location. 477 * 478 * <p>Sample code: 479 * 480 * <pre>{@code 481 * // This snippet has been automatically generated and should be regarded as a code template only. 482 * // It will require modifications to work: 483 * // - It may require correct/in-range values for request initialization. 484 * // - It may require specifying regional endpoints when creating the service client as shown in 485 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 486 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 487 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 488 * for (Model element : modelServiceClient.listModels(parent).iterateAll()) { 489 * // doThingsWith(element); 490 * } 491 * } 492 * }</pre> 493 * 494 * @param parent Required. The resource name of the Location to list the Models from. Format: 495 * `projects/{project}/locations/{location}` 496 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 497 */ listModels(LocationName parent)498 public final ListModelsPagedResponse listModels(LocationName parent) { 499 ListModelsRequest request = 500 ListModelsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); 501 return listModels(request); 502 } 503 504 // AUTO-GENERATED DOCUMENTATION AND METHOD. 505 /** 506 * Lists Models in a Location. 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 517 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 518 * for (Model element : modelServiceClient.listModels(parent).iterateAll()) { 519 * // doThingsWith(element); 520 * } 521 * } 522 * }</pre> 523 * 524 * @param parent Required. The resource name of the Location to list the Models from. Format: 525 * `projects/{project}/locations/{location}` 526 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 527 */ listModels(String parent)528 public final ListModelsPagedResponse listModels(String parent) { 529 ListModelsRequest request = ListModelsRequest.newBuilder().setParent(parent).build(); 530 return listModels(request); 531 } 532 533 // AUTO-GENERATED DOCUMENTATION AND METHOD. 534 /** 535 * Lists Models in a Location. 536 * 537 * <p>Sample code: 538 * 539 * <pre>{@code 540 * // This snippet has been automatically generated and should be regarded as a code template only. 541 * // It will require modifications to work: 542 * // - It may require correct/in-range values for request initialization. 543 * // - It may require specifying regional endpoints when creating the service client as shown in 544 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 545 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 546 * ListModelsRequest request = 547 * ListModelsRequest.newBuilder() 548 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 549 * .setFilter("filter-1274492040") 550 * .setPageSize(883849137) 551 * .setPageToken("pageToken873572522") 552 * .setReadMask(FieldMask.newBuilder().build()) 553 * .build(); 554 * for (Model element : modelServiceClient.listModels(request).iterateAll()) { 555 * // doThingsWith(element); 556 * } 557 * } 558 * }</pre> 559 * 560 * @param request The request object containing all of the parameters for the API call. 561 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 562 */ listModels(ListModelsRequest request)563 public final ListModelsPagedResponse listModels(ListModelsRequest request) { 564 return listModelsPagedCallable().call(request); 565 } 566 567 // AUTO-GENERATED DOCUMENTATION AND METHOD. 568 /** 569 * Lists Models in a Location. 570 * 571 * <p>Sample code: 572 * 573 * <pre>{@code 574 * // This snippet has been automatically generated and should be regarded as a code template only. 575 * // It will require modifications to work: 576 * // - It may require correct/in-range values for request initialization. 577 * // - It may require specifying regional endpoints when creating the service client as shown in 578 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 579 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 580 * ListModelsRequest request = 581 * ListModelsRequest.newBuilder() 582 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 583 * .setFilter("filter-1274492040") 584 * .setPageSize(883849137) 585 * .setPageToken("pageToken873572522") 586 * .setReadMask(FieldMask.newBuilder().build()) 587 * .build(); 588 * ApiFuture<Model> future = modelServiceClient.listModelsPagedCallable().futureCall(request); 589 * // Do something. 590 * for (Model element : future.get().iterateAll()) { 591 * // doThingsWith(element); 592 * } 593 * } 594 * }</pre> 595 */ listModelsPagedCallable()596 public final UnaryCallable<ListModelsRequest, ListModelsPagedResponse> listModelsPagedCallable() { 597 return stub.listModelsPagedCallable(); 598 } 599 600 // AUTO-GENERATED DOCUMENTATION AND METHOD. 601 /** 602 * Lists Models in a Location. 603 * 604 * <p>Sample code: 605 * 606 * <pre>{@code 607 * // This snippet has been automatically generated and should be regarded as a code template only. 608 * // It will require modifications to work: 609 * // - It may require correct/in-range values for request initialization. 610 * // - It may require specifying regional endpoints when creating the service client as shown in 611 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 612 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 613 * ListModelsRequest request = 614 * ListModelsRequest.newBuilder() 615 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 616 * .setFilter("filter-1274492040") 617 * .setPageSize(883849137) 618 * .setPageToken("pageToken873572522") 619 * .setReadMask(FieldMask.newBuilder().build()) 620 * .build(); 621 * while (true) { 622 * ListModelsResponse response = modelServiceClient.listModelsCallable().call(request); 623 * for (Model element : response.getModelsList()) { 624 * // doThingsWith(element); 625 * } 626 * String nextPageToken = response.getNextPageToken(); 627 * if (!Strings.isNullOrEmpty(nextPageToken)) { 628 * request = request.toBuilder().setPageToken(nextPageToken).build(); 629 * } else { 630 * break; 631 * } 632 * } 633 * } 634 * }</pre> 635 */ listModelsCallable()636 public final UnaryCallable<ListModelsRequest, ListModelsResponse> listModelsCallable() { 637 return stub.listModelsCallable(); 638 } 639 640 // AUTO-GENERATED DOCUMENTATION AND METHOD. 641 /** 642 * Lists versions of the specified model. 643 * 644 * <p>Sample code: 645 * 646 * <pre>{@code 647 * // This snippet has been automatically generated and should be regarded as a code template only. 648 * // It will require modifications to work: 649 * // - It may require correct/in-range values for request initialization. 650 * // - It may require specifying regional endpoints when creating the service client as shown in 651 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 652 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 653 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 654 * for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { 655 * // doThingsWith(element); 656 * } 657 * } 658 * }</pre> 659 * 660 * @param name Required. The name of the model to list versions for. 661 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 662 */ listModelVersions(ModelName name)663 public final ListModelVersionsPagedResponse listModelVersions(ModelName name) { 664 ListModelVersionsRequest request = 665 ListModelVersionsRequest.newBuilder() 666 .setName(name == null ? null : name.toString()) 667 .build(); 668 return listModelVersions(request); 669 } 670 671 // AUTO-GENERATED DOCUMENTATION AND METHOD. 672 /** 673 * Lists versions of the specified model. 674 * 675 * <p>Sample code: 676 * 677 * <pre>{@code 678 * // This snippet has been automatically generated and should be regarded as a code template only. 679 * // It will require modifications to work: 680 * // - It may require correct/in-range values for request initialization. 681 * // - It may require specifying regional endpoints when creating the service client as shown in 682 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 683 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 684 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 685 * for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { 686 * // doThingsWith(element); 687 * } 688 * } 689 * }</pre> 690 * 691 * @param name Required. The name of the model to list versions for. 692 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 693 */ listModelVersions(String name)694 public final ListModelVersionsPagedResponse listModelVersions(String name) { 695 ListModelVersionsRequest request = ListModelVersionsRequest.newBuilder().setName(name).build(); 696 return listModelVersions(request); 697 } 698 699 // AUTO-GENERATED DOCUMENTATION AND METHOD. 700 /** 701 * Lists versions of the specified model. 702 * 703 * <p>Sample code: 704 * 705 * <pre>{@code 706 * // This snippet has been automatically generated and should be regarded as a code template only. 707 * // It will require modifications to work: 708 * // - It may require correct/in-range values for request initialization. 709 * // - It may require specifying regional endpoints when creating the service client as shown in 710 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 711 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 712 * ListModelVersionsRequest request = 713 * ListModelVersionsRequest.newBuilder() 714 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 715 * .setPageSize(883849137) 716 * .setPageToken("pageToken873572522") 717 * .setFilter("filter-1274492040") 718 * .setReadMask(FieldMask.newBuilder().build()) 719 * .setOrderBy("orderBy-1207110587") 720 * .build(); 721 * for (Model element : modelServiceClient.listModelVersions(request).iterateAll()) { 722 * // doThingsWith(element); 723 * } 724 * } 725 * }</pre> 726 * 727 * @param request The request object containing all of the parameters for the API call. 728 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 729 */ listModelVersions(ListModelVersionsRequest request)730 public final ListModelVersionsPagedResponse listModelVersions(ListModelVersionsRequest request) { 731 return listModelVersionsPagedCallable().call(request); 732 } 733 734 // AUTO-GENERATED DOCUMENTATION AND METHOD. 735 /** 736 * Lists versions of the specified model. 737 * 738 * <p>Sample code: 739 * 740 * <pre>{@code 741 * // This snippet has been automatically generated and should be regarded as a code template only. 742 * // It will require modifications to work: 743 * // - It may require correct/in-range values for request initialization. 744 * // - It may require specifying regional endpoints when creating the service client as shown in 745 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 746 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 747 * ListModelVersionsRequest request = 748 * ListModelVersionsRequest.newBuilder() 749 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 750 * .setPageSize(883849137) 751 * .setPageToken("pageToken873572522") 752 * .setFilter("filter-1274492040") 753 * .setReadMask(FieldMask.newBuilder().build()) 754 * .setOrderBy("orderBy-1207110587") 755 * .build(); 756 * ApiFuture<Model> future = 757 * modelServiceClient.listModelVersionsPagedCallable().futureCall(request); 758 * // Do something. 759 * for (Model element : future.get().iterateAll()) { 760 * // doThingsWith(element); 761 * } 762 * } 763 * }</pre> 764 */ 765 public final UnaryCallable<ListModelVersionsRequest, ListModelVersionsPagedResponse> listModelVersionsPagedCallable()766 listModelVersionsPagedCallable() { 767 return stub.listModelVersionsPagedCallable(); 768 } 769 770 // AUTO-GENERATED DOCUMENTATION AND METHOD. 771 /** 772 * Lists versions of the specified model. 773 * 774 * <p>Sample code: 775 * 776 * <pre>{@code 777 * // This snippet has been automatically generated and should be regarded as a code template only. 778 * // It will require modifications to work: 779 * // - It may require correct/in-range values for request initialization. 780 * // - It may require specifying regional endpoints when creating the service client as shown in 781 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 782 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 783 * ListModelVersionsRequest request = 784 * ListModelVersionsRequest.newBuilder() 785 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 786 * .setPageSize(883849137) 787 * .setPageToken("pageToken873572522") 788 * .setFilter("filter-1274492040") 789 * .setReadMask(FieldMask.newBuilder().build()) 790 * .setOrderBy("orderBy-1207110587") 791 * .build(); 792 * while (true) { 793 * ListModelVersionsResponse response = 794 * modelServiceClient.listModelVersionsCallable().call(request); 795 * for (Model element : response.getModelsList()) { 796 * // doThingsWith(element); 797 * } 798 * String nextPageToken = response.getNextPageToken(); 799 * if (!Strings.isNullOrEmpty(nextPageToken)) { 800 * request = request.toBuilder().setPageToken(nextPageToken).build(); 801 * } else { 802 * break; 803 * } 804 * } 805 * } 806 * }</pre> 807 */ 808 public final UnaryCallable<ListModelVersionsRequest, ListModelVersionsResponse> listModelVersionsCallable()809 listModelVersionsCallable() { 810 return stub.listModelVersionsCallable(); 811 } 812 813 // AUTO-GENERATED DOCUMENTATION AND METHOD. 814 /** 815 * Updates a Model. 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 826 * Model model = Model.newBuilder().build(); 827 * FieldMask updateMask = FieldMask.newBuilder().build(); 828 * Model response = modelServiceClient.updateModel(model, updateMask); 829 * } 830 * }</pre> 831 * 832 * @param model Required. The Model which replaces the resource on the server. When Model 833 * Versioning is enabled, the model.name will be used to determine whether to update the model 834 * or model version. 1. model.name with the {@literal @} value, e.g. models/123{@literal @}1, 835 * refers to a version specific update. 2. model.name without the {@literal @} value, e.g. 836 * models/123, refers to a model update. 3. model.name with {@literal @}-, e.g. 837 * models/123{@literal @}-, refers to a model update. 4. Supported model fields: display_name, 838 * description; supported version-specific fields: version_description. Labels are supported 839 * in both scenarios. Both the model labels and the version labels are merged when a model is 840 * returned. When updating labels, if the request is for model-specific update, model label 841 * gets updated. Otherwise, version labels get updated. 5. A model name or model version name 842 * fields update mismatch will cause a precondition error. 6. One request cannot update both 843 * the model and the version fields. You must update them separately. 844 * @param updateMask Required. The update mask applies to the resource. For the `FieldMask` 845 * definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask]. 846 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 847 */ updateModel(Model model, FieldMask updateMask)848 public final Model updateModel(Model model, FieldMask updateMask) { 849 UpdateModelRequest request = 850 UpdateModelRequest.newBuilder().setModel(model).setUpdateMask(updateMask).build(); 851 return updateModel(request); 852 } 853 854 // AUTO-GENERATED DOCUMENTATION AND METHOD. 855 /** 856 * Updates a Model. 857 * 858 * <p>Sample code: 859 * 860 * <pre>{@code 861 * // This snippet has been automatically generated and should be regarded as a code template only. 862 * // It will require modifications to work: 863 * // - It may require correct/in-range values for request initialization. 864 * // - It may require specifying regional endpoints when creating the service client as shown in 865 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 866 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 867 * UpdateModelRequest request = 868 * UpdateModelRequest.newBuilder() 869 * .setModel(Model.newBuilder().build()) 870 * .setUpdateMask(FieldMask.newBuilder().build()) 871 * .build(); 872 * Model response = modelServiceClient.updateModel(request); 873 * } 874 * }</pre> 875 * 876 * @param request The request object containing all of the parameters for the API call. 877 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 878 */ updateModel(UpdateModelRequest request)879 public final Model updateModel(UpdateModelRequest request) { 880 return updateModelCallable().call(request); 881 } 882 883 // AUTO-GENERATED DOCUMENTATION AND METHOD. 884 /** 885 * Updates a Model. 886 * 887 * <p>Sample code: 888 * 889 * <pre>{@code 890 * // This snippet has been automatically generated and should be regarded as a code template only. 891 * // It will require modifications to work: 892 * // - It may require correct/in-range values for request initialization. 893 * // - It may require specifying regional endpoints when creating the service client as shown in 894 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 895 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 896 * UpdateModelRequest request = 897 * UpdateModelRequest.newBuilder() 898 * .setModel(Model.newBuilder().build()) 899 * .setUpdateMask(FieldMask.newBuilder().build()) 900 * .build(); 901 * ApiFuture<Model> future = modelServiceClient.updateModelCallable().futureCall(request); 902 * // Do something. 903 * Model response = future.get(); 904 * } 905 * }</pre> 906 */ updateModelCallable()907 public final UnaryCallable<UpdateModelRequest, Model> updateModelCallable() { 908 return stub.updateModelCallable(); 909 } 910 911 // AUTO-GENERATED DOCUMENTATION AND METHOD. 912 /** 913 * Incrementally update the dataset used for an examples model. 914 * 915 * <p>Sample code: 916 * 917 * <pre>{@code 918 * // This snippet has been automatically generated and should be regarded as a code template only. 919 * // It will require modifications to work: 920 * // - It may require correct/in-range values for request initialization. 921 * // - It may require specifying regional endpoints when creating the service client as shown in 922 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 923 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 924 * ModelName model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 925 * UpdateExplanationDatasetResponse response = 926 * modelServiceClient.updateExplanationDatasetAsync(model).get(); 927 * } 928 * }</pre> 929 * 930 * @param model Required. The resource name of the Model to update. Format: 931 * `projects/{project}/locations/{location}/models/{model}` 932 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 933 */ 934 public final OperationFuture< 935 UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(ModelName model)936 updateExplanationDatasetAsync(ModelName model) { 937 UpdateExplanationDatasetRequest request = 938 UpdateExplanationDatasetRequest.newBuilder() 939 .setModel(model == null ? null : model.toString()) 940 .build(); 941 return updateExplanationDatasetAsync(request); 942 } 943 944 // AUTO-GENERATED DOCUMENTATION AND METHOD. 945 /** 946 * Incrementally update the dataset used for an examples model. 947 * 948 * <p>Sample code: 949 * 950 * <pre>{@code 951 * // This snippet has been automatically generated and should be regarded as a code template only. 952 * // It will require modifications to work: 953 * // - It may require correct/in-range values for request initialization. 954 * // - It may require specifying regional endpoints when creating the service client as shown in 955 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 956 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 957 * String model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 958 * UpdateExplanationDatasetResponse response = 959 * modelServiceClient.updateExplanationDatasetAsync(model).get(); 960 * } 961 * }</pre> 962 * 963 * @param model Required. The resource name of the Model to update. Format: 964 * `projects/{project}/locations/{location}/models/{model}` 965 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 966 */ 967 public final OperationFuture< 968 UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(String model)969 updateExplanationDatasetAsync(String model) { 970 UpdateExplanationDatasetRequest request = 971 UpdateExplanationDatasetRequest.newBuilder().setModel(model).build(); 972 return updateExplanationDatasetAsync(request); 973 } 974 975 // AUTO-GENERATED DOCUMENTATION AND METHOD. 976 /** 977 * Incrementally update the dataset used for an examples model. 978 * 979 * <p>Sample code: 980 * 981 * <pre>{@code 982 * // This snippet has been automatically generated and should be regarded as a code template only. 983 * // It will require modifications to work: 984 * // - It may require correct/in-range values for request initialization. 985 * // - It may require specifying regional endpoints when creating the service client as shown in 986 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 987 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 988 * UpdateExplanationDatasetRequest request = 989 * UpdateExplanationDatasetRequest.newBuilder() 990 * .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 991 * .setExamples(Examples.newBuilder().build()) 992 * .build(); 993 * UpdateExplanationDatasetResponse response = 994 * modelServiceClient.updateExplanationDatasetAsync(request).get(); 995 * } 996 * }</pre> 997 * 998 * @param request The request object containing all of the parameters for the API call. 999 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1000 */ 1001 public final OperationFuture< 1002 UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(UpdateExplanationDatasetRequest request)1003 updateExplanationDatasetAsync(UpdateExplanationDatasetRequest request) { 1004 return updateExplanationDatasetOperationCallable().futureCall(request); 1005 } 1006 1007 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1008 /** 1009 * Incrementally update the dataset used for an examples model. 1010 * 1011 * <p>Sample code: 1012 * 1013 * <pre>{@code 1014 * // This snippet has been automatically generated and should be regarded as a code template only. 1015 * // It will require modifications to work: 1016 * // - It may require correct/in-range values for request initialization. 1017 * // - It may require specifying regional endpoints when creating the service client as shown in 1018 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1019 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1020 * UpdateExplanationDatasetRequest request = 1021 * UpdateExplanationDatasetRequest.newBuilder() 1022 * .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1023 * .setExamples(Examples.newBuilder().build()) 1024 * .build(); 1025 * OperationFuture<UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> 1026 * future = 1027 * modelServiceClient.updateExplanationDatasetOperationCallable().futureCall(request); 1028 * // Do something. 1029 * UpdateExplanationDatasetResponse response = future.get(); 1030 * } 1031 * }</pre> 1032 */ 1033 public final OperationCallable< 1034 UpdateExplanationDatasetRequest, 1035 UpdateExplanationDatasetResponse, 1036 UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetOperationCallable()1037 updateExplanationDatasetOperationCallable() { 1038 return stub.updateExplanationDatasetOperationCallable(); 1039 } 1040 1041 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1042 /** 1043 * Incrementally update the dataset used for an examples model. 1044 * 1045 * <p>Sample code: 1046 * 1047 * <pre>{@code 1048 * // This snippet has been automatically generated and should be regarded as a code template only. 1049 * // It will require modifications to work: 1050 * // - It may require correct/in-range values for request initialization. 1051 * // - It may require specifying regional endpoints when creating the service client as shown in 1052 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1053 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1054 * UpdateExplanationDatasetRequest request = 1055 * UpdateExplanationDatasetRequest.newBuilder() 1056 * .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1057 * .setExamples(Examples.newBuilder().build()) 1058 * .build(); 1059 * ApiFuture<Operation> future = 1060 * modelServiceClient.updateExplanationDatasetCallable().futureCall(request); 1061 * // Do something. 1062 * Operation response = future.get(); 1063 * } 1064 * }</pre> 1065 */ 1066 public final UnaryCallable<UpdateExplanationDatasetRequest, Operation> updateExplanationDatasetCallable()1067 updateExplanationDatasetCallable() { 1068 return stub.updateExplanationDatasetCallable(); 1069 } 1070 1071 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1072 /** 1073 * Deletes a Model. 1074 * 1075 * <p>A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] 1076 * resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the 1077 * model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. 1078 * 1079 * <p>Sample code: 1080 * 1081 * <pre>{@code 1082 * // This snippet has been automatically generated and should be regarded as a code template only. 1083 * // It will require modifications to work: 1084 * // - It may require correct/in-range values for request initialization. 1085 * // - It may require specifying regional endpoints when creating the service client as shown in 1086 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1087 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1088 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1089 * modelServiceClient.deleteModelAsync(name).get(); 1090 * } 1091 * }</pre> 1092 * 1093 * @param name Required. The name of the Model resource to be deleted. Format: 1094 * `projects/{project}/locations/{location}/models/{model}` 1095 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1096 */ deleteModelAsync(ModelName name)1097 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelAsync(ModelName name) { 1098 DeleteModelRequest request = 1099 DeleteModelRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 1100 return deleteModelAsync(request); 1101 } 1102 1103 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1104 /** 1105 * Deletes a Model. 1106 * 1107 * <p>A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] 1108 * resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the 1109 * model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. 1110 * 1111 * <p>Sample code: 1112 * 1113 * <pre>{@code 1114 * // This snippet has been automatically generated and should be regarded as a code template only. 1115 * // It will require modifications to work: 1116 * // - It may require correct/in-range values for request initialization. 1117 * // - It may require specifying regional endpoints when creating the service client as shown in 1118 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1119 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1120 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1121 * modelServiceClient.deleteModelAsync(name).get(); 1122 * } 1123 * }</pre> 1124 * 1125 * @param name Required. The name of the Model resource to be deleted. Format: 1126 * `projects/{project}/locations/{location}/models/{model}` 1127 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1128 */ deleteModelAsync(String name)1129 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelAsync(String name) { 1130 DeleteModelRequest request = DeleteModelRequest.newBuilder().setName(name).build(); 1131 return deleteModelAsync(request); 1132 } 1133 1134 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1135 /** 1136 * Deletes a Model. 1137 * 1138 * <p>A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] 1139 * resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the 1140 * model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. 1141 * 1142 * <p>Sample code: 1143 * 1144 * <pre>{@code 1145 * // This snippet has been automatically generated and should be regarded as a code template only. 1146 * // It will require modifications to work: 1147 * // - It may require correct/in-range values for request initialization. 1148 * // - It may require specifying regional endpoints when creating the service client as shown in 1149 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1150 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1151 * DeleteModelRequest request = 1152 * DeleteModelRequest.newBuilder() 1153 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1154 * .build(); 1155 * modelServiceClient.deleteModelAsync(request).get(); 1156 * } 1157 * }</pre> 1158 * 1159 * @param request The request object containing all of the parameters for the API call. 1160 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1161 */ deleteModelAsync( DeleteModelRequest request)1162 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelAsync( 1163 DeleteModelRequest request) { 1164 return deleteModelOperationCallable().futureCall(request); 1165 } 1166 1167 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1168 /** 1169 * Deletes a Model. 1170 * 1171 * <p>A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] 1172 * resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the 1173 * model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. 1174 * 1175 * <p>Sample code: 1176 * 1177 * <pre>{@code 1178 * // This snippet has been automatically generated and should be regarded as a code template only. 1179 * // It will require modifications to work: 1180 * // - It may require correct/in-range values for request initialization. 1181 * // - It may require specifying regional endpoints when creating the service client as shown in 1182 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1183 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1184 * DeleteModelRequest request = 1185 * DeleteModelRequest.newBuilder() 1186 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1187 * .build(); 1188 * OperationFuture<Empty, DeleteOperationMetadata> future = 1189 * modelServiceClient.deleteModelOperationCallable().futureCall(request); 1190 * // Do something. 1191 * future.get(); 1192 * } 1193 * }</pre> 1194 */ 1195 public final OperationCallable<DeleteModelRequest, Empty, DeleteOperationMetadata> deleteModelOperationCallable()1196 deleteModelOperationCallable() { 1197 return stub.deleteModelOperationCallable(); 1198 } 1199 1200 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1201 /** 1202 * Deletes a Model. 1203 * 1204 * <p>A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] 1205 * resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the 1206 * model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. 1207 * 1208 * <p>Sample code: 1209 * 1210 * <pre>{@code 1211 * // This snippet has been automatically generated and should be regarded as a code template only. 1212 * // It will require modifications to work: 1213 * // - It may require correct/in-range values for request initialization. 1214 * // - It may require specifying regional endpoints when creating the service client as shown in 1215 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1216 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1217 * DeleteModelRequest request = 1218 * DeleteModelRequest.newBuilder() 1219 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1220 * .build(); 1221 * ApiFuture<Operation> future = modelServiceClient.deleteModelCallable().futureCall(request); 1222 * // Do something. 1223 * future.get(); 1224 * } 1225 * }</pre> 1226 */ deleteModelCallable()1227 public final UnaryCallable<DeleteModelRequest, Operation> deleteModelCallable() { 1228 return stub.deleteModelCallable(); 1229 } 1230 1231 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1232 /** 1233 * Deletes a Model version. 1234 * 1235 * <p>Model version can only be deleted if there are no 1236 * [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the 1237 * only version in the Model is not allowed. Use 1238 * [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model 1239 * instead. 1240 * 1241 * <p>Sample code: 1242 * 1243 * <pre>{@code 1244 * // This snippet has been automatically generated and should be regarded as a code template only. 1245 * // It will require modifications to work: 1246 * // - It may require correct/in-range values for request initialization. 1247 * // - It may require specifying regional endpoints when creating the service client as shown in 1248 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1249 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1250 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1251 * modelServiceClient.deleteModelVersionAsync(name).get(); 1252 * } 1253 * }</pre> 1254 * 1255 * @param name Required. The name of the model version to be deleted, with a version ID explicitly 1256 * included. 1257 * <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234` 1258 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1259 */ deleteModelVersionAsync( ModelName name)1260 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelVersionAsync( 1261 ModelName name) { 1262 DeleteModelVersionRequest request = 1263 DeleteModelVersionRequest.newBuilder() 1264 .setName(name == null ? null : name.toString()) 1265 .build(); 1266 return deleteModelVersionAsync(request); 1267 } 1268 1269 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1270 /** 1271 * Deletes a Model version. 1272 * 1273 * <p>Model version can only be deleted if there are no 1274 * [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the 1275 * only version in the Model is not allowed. Use 1276 * [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model 1277 * instead. 1278 * 1279 * <p>Sample code: 1280 * 1281 * <pre>{@code 1282 * // This snippet has been automatically generated and should be regarded as a code template only. 1283 * // It will require modifications to work: 1284 * // - It may require correct/in-range values for request initialization. 1285 * // - It may require specifying regional endpoints when creating the service client as shown in 1286 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1287 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1288 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1289 * modelServiceClient.deleteModelVersionAsync(name).get(); 1290 * } 1291 * }</pre> 1292 * 1293 * @param name Required. The name of the model version to be deleted, with a version ID explicitly 1294 * included. 1295 * <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234` 1296 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1297 */ deleteModelVersionAsync( String name)1298 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelVersionAsync( 1299 String name) { 1300 DeleteModelVersionRequest request = 1301 DeleteModelVersionRequest.newBuilder().setName(name).build(); 1302 return deleteModelVersionAsync(request); 1303 } 1304 1305 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1306 /** 1307 * Deletes a Model version. 1308 * 1309 * <p>Model version can only be deleted if there are no 1310 * [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the 1311 * only version in the Model is not allowed. Use 1312 * [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model 1313 * instead. 1314 * 1315 * <p>Sample code: 1316 * 1317 * <pre>{@code 1318 * // This snippet has been automatically generated and should be regarded as a code template only. 1319 * // It will require modifications to work: 1320 * // - It may require correct/in-range values for request initialization. 1321 * // - It may require specifying regional endpoints when creating the service client as shown in 1322 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1323 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1324 * DeleteModelVersionRequest request = 1325 * DeleteModelVersionRequest.newBuilder() 1326 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1327 * .build(); 1328 * modelServiceClient.deleteModelVersionAsync(request).get(); 1329 * } 1330 * }</pre> 1331 * 1332 * @param request The request object containing all of the parameters for the API call. 1333 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1334 */ deleteModelVersionAsync( DeleteModelVersionRequest request)1335 public final OperationFuture<Empty, DeleteOperationMetadata> deleteModelVersionAsync( 1336 DeleteModelVersionRequest request) { 1337 return deleteModelVersionOperationCallable().futureCall(request); 1338 } 1339 1340 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1341 /** 1342 * Deletes a Model version. 1343 * 1344 * <p>Model version can only be deleted if there are no 1345 * [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the 1346 * only version in the Model is not allowed. Use 1347 * [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model 1348 * instead. 1349 * 1350 * <p>Sample code: 1351 * 1352 * <pre>{@code 1353 * // This snippet has been automatically generated and should be regarded as a code template only. 1354 * // It will require modifications to work: 1355 * // - It may require correct/in-range values for request initialization. 1356 * // - It may require specifying regional endpoints when creating the service client as shown in 1357 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1358 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1359 * DeleteModelVersionRequest request = 1360 * DeleteModelVersionRequest.newBuilder() 1361 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1362 * .build(); 1363 * OperationFuture<Empty, DeleteOperationMetadata> future = 1364 * modelServiceClient.deleteModelVersionOperationCallable().futureCall(request); 1365 * // Do something. 1366 * future.get(); 1367 * } 1368 * }</pre> 1369 */ 1370 public final OperationCallable<DeleteModelVersionRequest, Empty, DeleteOperationMetadata> deleteModelVersionOperationCallable()1371 deleteModelVersionOperationCallable() { 1372 return stub.deleteModelVersionOperationCallable(); 1373 } 1374 1375 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1376 /** 1377 * Deletes a Model version. 1378 * 1379 * <p>Model version can only be deleted if there are no 1380 * [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the 1381 * only version in the Model is not allowed. Use 1382 * [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model 1383 * instead. 1384 * 1385 * <p>Sample code: 1386 * 1387 * <pre>{@code 1388 * // This snippet has been automatically generated and should be regarded as a code template only. 1389 * // It will require modifications to work: 1390 * // - It may require correct/in-range values for request initialization. 1391 * // - It may require specifying regional endpoints when creating the service client as shown in 1392 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1393 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1394 * DeleteModelVersionRequest request = 1395 * DeleteModelVersionRequest.newBuilder() 1396 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1397 * .build(); 1398 * ApiFuture<Operation> future = 1399 * modelServiceClient.deleteModelVersionCallable().futureCall(request); 1400 * // Do something. 1401 * future.get(); 1402 * } 1403 * }</pre> 1404 */ deleteModelVersionCallable()1405 public final UnaryCallable<DeleteModelVersionRequest, Operation> deleteModelVersionCallable() { 1406 return stub.deleteModelVersionCallable(); 1407 } 1408 1409 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1410 /** 1411 * Merges a set of aliases for a Model version. 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1422 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1423 * List<String> versionAliases = new ArrayList<>(); 1424 * Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); 1425 * } 1426 * }</pre> 1427 * 1428 * @param name Required. The name of the model version to merge aliases, with a version ID 1429 * explicitly included. 1430 * <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234` 1431 * @param versionAliases Required. The set of version aliases to merge. The alias should be at 1432 * most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to 1433 * an alias means removing that alias from the version. `-` is NOT counted in the 128 1434 * characters. Example: `-golden` means removing the `golden` alias from the version. 1435 * <p>There is NO ordering in aliases, which means 1) The aliases returned from GetModel API 1436 * might not have the exactly same order from this MergeVersionAliases API. 2) Adding and 1437 * deleting the same alias in the request is not recommended, and the 2 operations will be 1438 * cancelled out. 1439 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1440 */ mergeVersionAliases(ModelName name, List<String> versionAliases)1441 public final Model mergeVersionAliases(ModelName name, List<String> versionAliases) { 1442 MergeVersionAliasesRequest request = 1443 MergeVersionAliasesRequest.newBuilder() 1444 .setName(name == null ? null : name.toString()) 1445 .addAllVersionAliases(versionAliases) 1446 .build(); 1447 return mergeVersionAliases(request); 1448 } 1449 1450 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1451 /** 1452 * Merges a set of aliases for a Model version. 1453 * 1454 * <p>Sample code: 1455 * 1456 * <pre>{@code 1457 * // This snippet has been automatically generated and should be regarded as a code template only. 1458 * // It will require modifications to work: 1459 * // - It may require correct/in-range values for request initialization. 1460 * // - It may require specifying regional endpoints when creating the service client as shown in 1461 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1462 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1463 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1464 * List<String> versionAliases = new ArrayList<>(); 1465 * Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); 1466 * } 1467 * }</pre> 1468 * 1469 * @param name Required. The name of the model version to merge aliases, with a version ID 1470 * explicitly included. 1471 * <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234` 1472 * @param versionAliases Required. The set of version aliases to merge. The alias should be at 1473 * most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to 1474 * an alias means removing that alias from the version. `-` is NOT counted in the 128 1475 * characters. Example: `-golden` means removing the `golden` alias from the version. 1476 * <p>There is NO ordering in aliases, which means 1) The aliases returned from GetModel API 1477 * might not have the exactly same order from this MergeVersionAliases API. 2) Adding and 1478 * deleting the same alias in the request is not recommended, and the 2 operations will be 1479 * cancelled out. 1480 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1481 */ mergeVersionAliases(String name, List<String> versionAliases)1482 public final Model mergeVersionAliases(String name, List<String> versionAliases) { 1483 MergeVersionAliasesRequest request = 1484 MergeVersionAliasesRequest.newBuilder() 1485 .setName(name) 1486 .addAllVersionAliases(versionAliases) 1487 .build(); 1488 return mergeVersionAliases(request); 1489 } 1490 1491 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1492 /** 1493 * Merges a set of aliases for a Model version. 1494 * 1495 * <p>Sample code: 1496 * 1497 * <pre>{@code 1498 * // This snippet has been automatically generated and should be regarded as a code template only. 1499 * // It will require modifications to work: 1500 * // - It may require correct/in-range values for request initialization. 1501 * // - It may require specifying regional endpoints when creating the service client as shown in 1502 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1503 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1504 * MergeVersionAliasesRequest request = 1505 * MergeVersionAliasesRequest.newBuilder() 1506 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1507 * .addAllVersionAliases(new ArrayList<String>()) 1508 * .build(); 1509 * Model response = modelServiceClient.mergeVersionAliases(request); 1510 * } 1511 * }</pre> 1512 * 1513 * @param request The request object containing all of the parameters for the API call. 1514 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1515 */ mergeVersionAliases(MergeVersionAliasesRequest request)1516 public final Model mergeVersionAliases(MergeVersionAliasesRequest request) { 1517 return mergeVersionAliasesCallable().call(request); 1518 } 1519 1520 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1521 /** 1522 * Merges a set of aliases for a Model version. 1523 * 1524 * <p>Sample code: 1525 * 1526 * <pre>{@code 1527 * // This snippet has been automatically generated and should be regarded as a code template only. 1528 * // It will require modifications to work: 1529 * // - It may require correct/in-range values for request initialization. 1530 * // - It may require specifying regional endpoints when creating the service client as shown in 1531 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1532 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1533 * MergeVersionAliasesRequest request = 1534 * MergeVersionAliasesRequest.newBuilder() 1535 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1536 * .addAllVersionAliases(new ArrayList<String>()) 1537 * .build(); 1538 * ApiFuture<Model> future = 1539 * modelServiceClient.mergeVersionAliasesCallable().futureCall(request); 1540 * // Do something. 1541 * Model response = future.get(); 1542 * } 1543 * }</pre> 1544 */ mergeVersionAliasesCallable()1545 public final UnaryCallable<MergeVersionAliasesRequest, Model> mergeVersionAliasesCallable() { 1546 return stub.mergeVersionAliasesCallable(); 1547 } 1548 1549 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1550 /** 1551 * Exports a trained, exportable Model to a location specified by the user. A Model is considered 1552 * to be exportable if it has at least one [supported export 1553 * format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. 1554 * 1555 * <p>Sample code: 1556 * 1557 * <pre>{@code 1558 * // This snippet has been automatically generated and should be regarded as a code template only. 1559 * // It will require modifications to work: 1560 * // - It may require correct/in-range values for request initialization. 1561 * // - It may require specifying regional endpoints when creating the service client as shown in 1562 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1563 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1564 * ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1565 * ExportModelRequest.OutputConfig outputConfig = 1566 * ExportModelRequest.OutputConfig.newBuilder().build(); 1567 * ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); 1568 * } 1569 * }</pre> 1570 * 1571 * @param name Required. The resource name of the Model to export. The resource name may contain 1572 * version id or version alias to specify the version, if no version is specified, the default 1573 * version will be exported. 1574 * @param outputConfig Required. The desired output location and configuration. 1575 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1576 */ exportModelAsync( ModelName name, ExportModelRequest.OutputConfig outputConfig)1577 public final OperationFuture<ExportModelResponse, ExportModelOperationMetadata> exportModelAsync( 1578 ModelName name, ExportModelRequest.OutputConfig outputConfig) { 1579 ExportModelRequest request = 1580 ExportModelRequest.newBuilder() 1581 .setName(name == null ? null : name.toString()) 1582 .setOutputConfig(outputConfig) 1583 .build(); 1584 return exportModelAsync(request); 1585 } 1586 1587 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1588 /** 1589 * Exports a trained, exportable Model to a location specified by the user. A Model is considered 1590 * to be exportable if it has at least one [supported export 1591 * format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. 1592 * 1593 * <p>Sample code: 1594 * 1595 * <pre>{@code 1596 * // This snippet has been automatically generated and should be regarded as a code template only. 1597 * // It will require modifications to work: 1598 * // - It may require correct/in-range values for request initialization. 1599 * // - It may require specifying regional endpoints when creating the service client as shown in 1600 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1601 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1602 * String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1603 * ExportModelRequest.OutputConfig outputConfig = 1604 * ExportModelRequest.OutputConfig.newBuilder().build(); 1605 * ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); 1606 * } 1607 * }</pre> 1608 * 1609 * @param name Required. The resource name of the Model to export. The resource name may contain 1610 * version id or version alias to specify the version, if no version is specified, the default 1611 * version will be exported. 1612 * @param outputConfig Required. The desired output location and configuration. 1613 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1614 */ exportModelAsync( String name, ExportModelRequest.OutputConfig outputConfig)1615 public final OperationFuture<ExportModelResponse, ExportModelOperationMetadata> exportModelAsync( 1616 String name, ExportModelRequest.OutputConfig outputConfig) { 1617 ExportModelRequest request = 1618 ExportModelRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build(); 1619 return exportModelAsync(request); 1620 } 1621 1622 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1623 /** 1624 * Exports a trained, exportable Model to a location specified by the user. A Model is considered 1625 * to be exportable if it has at least one [supported export 1626 * format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. 1627 * 1628 * <p>Sample code: 1629 * 1630 * <pre>{@code 1631 * // This snippet has been automatically generated and should be regarded as a code template only. 1632 * // It will require modifications to work: 1633 * // - It may require correct/in-range values for request initialization. 1634 * // - It may require specifying regional endpoints when creating the service client as shown in 1635 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1636 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1637 * ExportModelRequest request = 1638 * ExportModelRequest.newBuilder() 1639 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1640 * .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) 1641 * .build(); 1642 * ExportModelResponse response = modelServiceClient.exportModelAsync(request).get(); 1643 * } 1644 * }</pre> 1645 * 1646 * @param request The request object containing all of the parameters for the API call. 1647 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1648 */ exportModelAsync( ExportModelRequest request)1649 public final OperationFuture<ExportModelResponse, ExportModelOperationMetadata> exportModelAsync( 1650 ExportModelRequest request) { 1651 return exportModelOperationCallable().futureCall(request); 1652 } 1653 1654 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1655 /** 1656 * Exports a trained, exportable Model to a location specified by the user. A Model is considered 1657 * to be exportable if it has at least one [supported export 1658 * format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. 1659 * 1660 * <p>Sample code: 1661 * 1662 * <pre>{@code 1663 * // This snippet has been automatically generated and should be regarded as a code template only. 1664 * // It will require modifications to work: 1665 * // - It may require correct/in-range values for request initialization. 1666 * // - It may require specifying regional endpoints when creating the service client as shown in 1667 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1668 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1669 * ExportModelRequest request = 1670 * ExportModelRequest.newBuilder() 1671 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1672 * .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) 1673 * .build(); 1674 * OperationFuture<ExportModelResponse, ExportModelOperationMetadata> future = 1675 * modelServiceClient.exportModelOperationCallable().futureCall(request); 1676 * // Do something. 1677 * ExportModelResponse response = future.get(); 1678 * } 1679 * }</pre> 1680 */ 1681 public final OperationCallable< 1682 ExportModelRequest, ExportModelResponse, ExportModelOperationMetadata> exportModelOperationCallable()1683 exportModelOperationCallable() { 1684 return stub.exportModelOperationCallable(); 1685 } 1686 1687 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1688 /** 1689 * Exports a trained, exportable Model to a location specified by the user. A Model is considered 1690 * to be exportable if it has at least one [supported export 1691 * format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. 1692 * 1693 * <p>Sample code: 1694 * 1695 * <pre>{@code 1696 * // This snippet has been automatically generated and should be regarded as a code template only. 1697 * // It will require modifications to work: 1698 * // - It may require correct/in-range values for request initialization. 1699 * // - It may require specifying regional endpoints when creating the service client as shown in 1700 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1701 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1702 * ExportModelRequest request = 1703 * ExportModelRequest.newBuilder() 1704 * .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1705 * .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) 1706 * .build(); 1707 * ApiFuture<Operation> future = modelServiceClient.exportModelCallable().futureCall(request); 1708 * // Do something. 1709 * Operation response = future.get(); 1710 * } 1711 * }</pre> 1712 */ exportModelCallable()1713 public final UnaryCallable<ExportModelRequest, Operation> exportModelCallable() { 1714 return stub.exportModelCallable(); 1715 } 1716 1717 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1718 /** 1719 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1720 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1721 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1722 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1723 * 1724 * <p>Sample code: 1725 * 1726 * <pre>{@code 1727 * // This snippet has been automatically generated and should be regarded as a code template only. 1728 * // It will require modifications to work: 1729 * // - It may require correct/in-range values for request initialization. 1730 * // - It may require specifying regional endpoints when creating the service client as shown in 1731 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1732 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1733 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1734 * ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1735 * CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); 1736 * } 1737 * }</pre> 1738 * 1739 * @param parent Required. The resource name of the Location into which to copy the Model. Format: 1740 * `projects/{project}/locations/{location}` 1741 * @param sourceModel Required. The resource name of the Model to copy. That Model must be in the 1742 * same Project. Format: `projects/{project}/locations/{location}/models/{model}` 1743 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1744 */ copyModelAsync( LocationName parent, ModelName sourceModel)1745 public final OperationFuture<CopyModelResponse, CopyModelOperationMetadata> copyModelAsync( 1746 LocationName parent, ModelName sourceModel) { 1747 CopyModelRequest request = 1748 CopyModelRequest.newBuilder() 1749 .setParent(parent == null ? null : parent.toString()) 1750 .setSourceModel(sourceModel == null ? null : sourceModel.toString()) 1751 .build(); 1752 return copyModelAsync(request); 1753 } 1754 1755 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1756 /** 1757 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1758 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1759 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1760 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1761 * 1762 * <p>Sample code: 1763 * 1764 * <pre>{@code 1765 * // This snippet has been automatically generated and should be regarded as a code template only. 1766 * // It will require modifications to work: 1767 * // - It may require correct/in-range values for request initialization. 1768 * // - It may require specifying regional endpoints when creating the service client as shown in 1769 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1770 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1771 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1772 * String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1773 * CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); 1774 * } 1775 * }</pre> 1776 * 1777 * @param parent Required. The resource name of the Location into which to copy the Model. Format: 1778 * `projects/{project}/locations/{location}` 1779 * @param sourceModel Required. The resource name of the Model to copy. That Model must be in the 1780 * same Project. Format: `projects/{project}/locations/{location}/models/{model}` 1781 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1782 */ copyModelAsync( LocationName parent, String sourceModel)1783 public final OperationFuture<CopyModelResponse, CopyModelOperationMetadata> copyModelAsync( 1784 LocationName parent, String sourceModel) { 1785 CopyModelRequest request = 1786 CopyModelRequest.newBuilder() 1787 .setParent(parent == null ? null : parent.toString()) 1788 .setSourceModel(sourceModel) 1789 .build(); 1790 return copyModelAsync(request); 1791 } 1792 1793 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1794 /** 1795 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1796 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1797 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1798 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1799 * 1800 * <p>Sample code: 1801 * 1802 * <pre>{@code 1803 * // This snippet has been automatically generated and should be regarded as a code template only. 1804 * // It will require modifications to work: 1805 * // - It may require correct/in-range values for request initialization. 1806 * // - It may require specifying regional endpoints when creating the service client as shown in 1807 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1808 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1809 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 1810 * ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1811 * CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); 1812 * } 1813 * }</pre> 1814 * 1815 * @param parent Required. The resource name of the Location into which to copy the Model. Format: 1816 * `projects/{project}/locations/{location}` 1817 * @param sourceModel Required. The resource name of the Model to copy. That Model must be in the 1818 * same Project. Format: `projects/{project}/locations/{location}/models/{model}` 1819 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1820 */ copyModelAsync( String parent, ModelName sourceModel)1821 public final OperationFuture<CopyModelResponse, CopyModelOperationMetadata> copyModelAsync( 1822 String parent, ModelName sourceModel) { 1823 CopyModelRequest request = 1824 CopyModelRequest.newBuilder() 1825 .setParent(parent) 1826 .setSourceModel(sourceModel == null ? null : sourceModel.toString()) 1827 .build(); 1828 return copyModelAsync(request); 1829 } 1830 1831 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1832 /** 1833 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1834 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1835 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1836 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1837 * 1838 * <p>Sample code: 1839 * 1840 * <pre>{@code 1841 * // This snippet has been automatically generated and should be regarded as a code template only. 1842 * // It will require modifications to work: 1843 * // - It may require correct/in-range values for request initialization. 1844 * // - It may require specifying regional endpoints when creating the service client as shown in 1845 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1846 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1847 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 1848 * String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 1849 * CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); 1850 * } 1851 * }</pre> 1852 * 1853 * @param parent Required. The resource name of the Location into which to copy the Model. Format: 1854 * `projects/{project}/locations/{location}` 1855 * @param sourceModel Required. The resource name of the Model to copy. That Model must be in the 1856 * same Project. Format: `projects/{project}/locations/{location}/models/{model}` 1857 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1858 */ copyModelAsync( String parent, String sourceModel)1859 public final OperationFuture<CopyModelResponse, CopyModelOperationMetadata> copyModelAsync( 1860 String parent, String sourceModel) { 1861 CopyModelRequest request = 1862 CopyModelRequest.newBuilder().setParent(parent).setSourceModel(sourceModel).build(); 1863 return copyModelAsync(request); 1864 } 1865 1866 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1867 /** 1868 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1869 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1870 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1871 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1872 * 1873 * <p>Sample code: 1874 * 1875 * <pre>{@code 1876 * // This snippet has been automatically generated and should be regarded as a code template only. 1877 * // It will require modifications to work: 1878 * // - It may require correct/in-range values for request initialization. 1879 * // - It may require specifying regional endpoints when creating the service client as shown in 1880 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1881 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1882 * CopyModelRequest request = 1883 * CopyModelRequest.newBuilder() 1884 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1885 * .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1886 * .setEncryptionSpec(EncryptionSpec.newBuilder().build()) 1887 * .build(); 1888 * CopyModelResponse response = modelServiceClient.copyModelAsync(request).get(); 1889 * } 1890 * }</pre> 1891 * 1892 * @param request The request object containing all of the parameters for the API call. 1893 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1894 */ copyModelAsync( CopyModelRequest request)1895 public final OperationFuture<CopyModelResponse, CopyModelOperationMetadata> copyModelAsync( 1896 CopyModelRequest request) { 1897 return copyModelOperationCallable().futureCall(request); 1898 } 1899 1900 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1901 /** 1902 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1903 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1904 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1905 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1906 * 1907 * <p>Sample code: 1908 * 1909 * <pre>{@code 1910 * // This snippet has been automatically generated and should be regarded as a code template only. 1911 * // It will require modifications to work: 1912 * // - It may require correct/in-range values for request initialization. 1913 * // - It may require specifying regional endpoints when creating the service client as shown in 1914 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1915 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1916 * CopyModelRequest request = 1917 * CopyModelRequest.newBuilder() 1918 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1919 * .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1920 * .setEncryptionSpec(EncryptionSpec.newBuilder().build()) 1921 * .build(); 1922 * OperationFuture<CopyModelResponse, CopyModelOperationMetadata> future = 1923 * modelServiceClient.copyModelOperationCallable().futureCall(request); 1924 * // Do something. 1925 * CopyModelResponse response = future.get(); 1926 * } 1927 * }</pre> 1928 */ 1929 public final OperationCallable<CopyModelRequest, CopyModelResponse, CopyModelOperationMetadata> copyModelOperationCallable()1930 copyModelOperationCallable() { 1931 return stub.copyModelOperationCallable(); 1932 } 1933 1934 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1935 /** 1936 * Copies an already existing Vertex AI Model into the specified Location. The source Model must 1937 * exist in the same Project. When copying custom Models, the users themselves are responsible for 1938 * [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, 1939 * as well as making sure that any resources (e.g. files) it depends on remain accessible. 1940 * 1941 * <p>Sample code: 1942 * 1943 * <pre>{@code 1944 * // This snippet has been automatically generated and should be regarded as a code template only. 1945 * // It will require modifications to work: 1946 * // - It may require correct/in-range values for request initialization. 1947 * // - It may require specifying regional endpoints when creating the service client as shown in 1948 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1949 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1950 * CopyModelRequest request = 1951 * CopyModelRequest.newBuilder() 1952 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1953 * .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 1954 * .setEncryptionSpec(EncryptionSpec.newBuilder().build()) 1955 * .build(); 1956 * ApiFuture<Operation> future = modelServiceClient.copyModelCallable().futureCall(request); 1957 * // Do something. 1958 * Operation response = future.get(); 1959 * } 1960 * }</pre> 1961 */ copyModelCallable()1962 public final UnaryCallable<CopyModelRequest, Operation> copyModelCallable() { 1963 return stub.copyModelCallable(); 1964 } 1965 1966 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1967 /** 1968 * Imports an externally generated ModelEvaluation. 1969 * 1970 * <p>Sample code: 1971 * 1972 * <pre>{@code 1973 * // This snippet has been automatically generated and should be regarded as a code template only. 1974 * // It will require modifications to work: 1975 * // - It may require correct/in-range values for request initialization. 1976 * // - It may require specifying regional endpoints when creating the service client as shown in 1977 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1978 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 1979 * ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 1980 * ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); 1981 * ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); 1982 * } 1983 * }</pre> 1984 * 1985 * @param parent Required. The name of the parent model resource. Format: 1986 * `projects/{project}/locations/{location}/models/{model}` 1987 * @param modelEvaluation Required. Model evaluation resource to be imported. 1988 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1989 */ importModelEvaluation( ModelName parent, ModelEvaluation modelEvaluation)1990 public final ModelEvaluation importModelEvaluation( 1991 ModelName parent, ModelEvaluation modelEvaluation) { 1992 ImportModelEvaluationRequest request = 1993 ImportModelEvaluationRequest.newBuilder() 1994 .setParent(parent == null ? null : parent.toString()) 1995 .setModelEvaluation(modelEvaluation) 1996 .build(); 1997 return importModelEvaluation(request); 1998 } 1999 2000 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2001 /** 2002 * Imports an externally generated ModelEvaluation. 2003 * 2004 * <p>Sample code: 2005 * 2006 * <pre>{@code 2007 * // This snippet has been automatically generated and should be regarded as a code template only. 2008 * // It will require modifications to work: 2009 * // - It may require correct/in-range values for request initialization. 2010 * // - It may require specifying regional endpoints when creating the service client as shown in 2011 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2012 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2013 * String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2014 * ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); 2015 * ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); 2016 * } 2017 * }</pre> 2018 * 2019 * @param parent Required. The name of the parent model resource. Format: 2020 * `projects/{project}/locations/{location}/models/{model}` 2021 * @param modelEvaluation Required. Model evaluation resource to be imported. 2022 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2023 */ importModelEvaluation( String parent, ModelEvaluation modelEvaluation)2024 public final ModelEvaluation importModelEvaluation( 2025 String parent, ModelEvaluation modelEvaluation) { 2026 ImportModelEvaluationRequest request = 2027 ImportModelEvaluationRequest.newBuilder() 2028 .setParent(parent) 2029 .setModelEvaluation(modelEvaluation) 2030 .build(); 2031 return importModelEvaluation(request); 2032 } 2033 2034 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2035 /** 2036 * Imports an externally generated ModelEvaluation. 2037 * 2038 * <p>Sample code: 2039 * 2040 * <pre>{@code 2041 * // This snippet has been automatically generated and should be regarded as a code template only. 2042 * // It will require modifications to work: 2043 * // - It may require correct/in-range values for request initialization. 2044 * // - It may require specifying regional endpoints when creating the service client as shown in 2045 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2046 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2047 * ImportModelEvaluationRequest request = 2048 * ImportModelEvaluationRequest.newBuilder() 2049 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2050 * .setModelEvaluation(ModelEvaluation.newBuilder().build()) 2051 * .build(); 2052 * ModelEvaluation response = modelServiceClient.importModelEvaluation(request); 2053 * } 2054 * }</pre> 2055 * 2056 * @param request The request object containing all of the parameters for the API call. 2057 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2058 */ importModelEvaluation(ImportModelEvaluationRequest request)2059 public final ModelEvaluation importModelEvaluation(ImportModelEvaluationRequest request) { 2060 return importModelEvaluationCallable().call(request); 2061 } 2062 2063 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2064 /** 2065 * Imports an externally generated ModelEvaluation. 2066 * 2067 * <p>Sample code: 2068 * 2069 * <pre>{@code 2070 * // This snippet has been automatically generated and should be regarded as a code template only. 2071 * // It will require modifications to work: 2072 * // - It may require correct/in-range values for request initialization. 2073 * // - It may require specifying regional endpoints when creating the service client as shown in 2074 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2075 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2076 * ImportModelEvaluationRequest request = 2077 * ImportModelEvaluationRequest.newBuilder() 2078 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2079 * .setModelEvaluation(ModelEvaluation.newBuilder().build()) 2080 * .build(); 2081 * ApiFuture<ModelEvaluation> future = 2082 * modelServiceClient.importModelEvaluationCallable().futureCall(request); 2083 * // Do something. 2084 * ModelEvaluation response = future.get(); 2085 * } 2086 * }</pre> 2087 */ 2088 public final UnaryCallable<ImportModelEvaluationRequest, ModelEvaluation> importModelEvaluationCallable()2089 importModelEvaluationCallable() { 2090 return stub.importModelEvaluationCallable(); 2091 } 2092 2093 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2094 /** 2095 * Imports a list of externally generated ModelEvaluationSlice. 2096 * 2097 * <p>Sample code: 2098 * 2099 * <pre>{@code 2100 * // This snippet has been automatically generated and should be regarded as a code template only. 2101 * // It will require modifications to work: 2102 * // - It may require correct/in-range values for request initialization. 2103 * // - It may require specifying regional endpoints when creating the service client as shown in 2104 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2105 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2106 * ModelEvaluationName parent = 2107 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); 2108 * List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>(); 2109 * BatchImportModelEvaluationSlicesResponse response = 2110 * modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); 2111 * } 2112 * }</pre> 2113 * 2114 * @param parent Required. The name of the parent ModelEvaluation resource. Format: 2115 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2116 * @param modelEvaluationSlices Required. Model evaluation slice resource to be imported. 2117 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2118 */ batchImportModelEvaluationSlices( ModelEvaluationName parent, List<ModelEvaluationSlice> modelEvaluationSlices)2119 public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices( 2120 ModelEvaluationName parent, List<ModelEvaluationSlice> modelEvaluationSlices) { 2121 BatchImportModelEvaluationSlicesRequest request = 2122 BatchImportModelEvaluationSlicesRequest.newBuilder() 2123 .setParent(parent == null ? null : parent.toString()) 2124 .addAllModelEvaluationSlices(modelEvaluationSlices) 2125 .build(); 2126 return batchImportModelEvaluationSlices(request); 2127 } 2128 2129 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2130 /** 2131 * Imports a list of externally generated ModelEvaluationSlice. 2132 * 2133 * <p>Sample code: 2134 * 2135 * <pre>{@code 2136 * // This snippet has been automatically generated and should be regarded as a code template only. 2137 * // It will require modifications to work: 2138 * // - It may require correct/in-range values for request initialization. 2139 * // - It may require specifying regional endpoints when creating the service client as shown in 2140 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2141 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2142 * String parent = 2143 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); 2144 * List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>(); 2145 * BatchImportModelEvaluationSlicesResponse response = 2146 * modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); 2147 * } 2148 * }</pre> 2149 * 2150 * @param parent Required. The name of the parent ModelEvaluation resource. Format: 2151 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2152 * @param modelEvaluationSlices Required. Model evaluation slice resource to be imported. 2153 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2154 */ batchImportModelEvaluationSlices( String parent, List<ModelEvaluationSlice> modelEvaluationSlices)2155 public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices( 2156 String parent, List<ModelEvaluationSlice> modelEvaluationSlices) { 2157 BatchImportModelEvaluationSlicesRequest request = 2158 BatchImportModelEvaluationSlicesRequest.newBuilder() 2159 .setParent(parent) 2160 .addAllModelEvaluationSlices(modelEvaluationSlices) 2161 .build(); 2162 return batchImportModelEvaluationSlices(request); 2163 } 2164 2165 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2166 /** 2167 * Imports a list of externally generated ModelEvaluationSlice. 2168 * 2169 * <p>Sample code: 2170 * 2171 * <pre>{@code 2172 * // This snippet has been automatically generated and should be regarded as a code template only. 2173 * // It will require modifications to work: 2174 * // - It may require correct/in-range values for request initialization. 2175 * // - It may require specifying regional endpoints when creating the service client as shown in 2176 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2177 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2178 * BatchImportModelEvaluationSlicesRequest request = 2179 * BatchImportModelEvaluationSlicesRequest.newBuilder() 2180 * .setParent( 2181 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2182 * .toString()) 2183 * .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>()) 2184 * .build(); 2185 * BatchImportModelEvaluationSlicesResponse response = 2186 * modelServiceClient.batchImportModelEvaluationSlices(request); 2187 * } 2188 * }</pre> 2189 * 2190 * @param request The request object containing all of the parameters for the API call. 2191 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2192 */ batchImportModelEvaluationSlices( BatchImportModelEvaluationSlicesRequest request)2193 public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices( 2194 BatchImportModelEvaluationSlicesRequest request) { 2195 return batchImportModelEvaluationSlicesCallable().call(request); 2196 } 2197 2198 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2199 /** 2200 * Imports a list of externally generated ModelEvaluationSlice. 2201 * 2202 * <p>Sample code: 2203 * 2204 * <pre>{@code 2205 * // This snippet has been automatically generated and should be regarded as a code template only. 2206 * // It will require modifications to work: 2207 * // - It may require correct/in-range values for request initialization. 2208 * // - It may require specifying regional endpoints when creating the service client as shown in 2209 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2210 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2211 * BatchImportModelEvaluationSlicesRequest request = 2212 * BatchImportModelEvaluationSlicesRequest.newBuilder() 2213 * .setParent( 2214 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2215 * .toString()) 2216 * .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>()) 2217 * .build(); 2218 * ApiFuture<BatchImportModelEvaluationSlicesResponse> future = 2219 * modelServiceClient.batchImportModelEvaluationSlicesCallable().futureCall(request); 2220 * // Do something. 2221 * BatchImportModelEvaluationSlicesResponse response = future.get(); 2222 * } 2223 * }</pre> 2224 */ 2225 public final UnaryCallable< 2226 BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse> batchImportModelEvaluationSlicesCallable()2227 batchImportModelEvaluationSlicesCallable() { 2228 return stub.batchImportModelEvaluationSlicesCallable(); 2229 } 2230 2231 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2232 /** 2233 * Imports a list of externally generated EvaluatedAnnotations. 2234 * 2235 * <p>Sample code: 2236 * 2237 * <pre>{@code 2238 * // This snippet has been automatically generated and should be regarded as a code template only. 2239 * // It will require modifications to work: 2240 * // - It may require correct/in-range values for request initialization. 2241 * // - It may require specifying regional endpoints when creating the service client as shown in 2242 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2243 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2244 * ModelEvaluationSliceName parent = 2245 * ModelEvaluationSliceName.of( 2246 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); 2247 * List<EvaluatedAnnotation> evaluatedAnnotations = new ArrayList<>(); 2248 * BatchImportEvaluatedAnnotationsResponse response = 2249 * modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); 2250 * } 2251 * }</pre> 2252 * 2253 * @param parent Required. The name of the parent ModelEvaluationSlice resource. Format: 2254 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` 2255 * @param evaluatedAnnotations Required. Evaluated annotations resource to be imported. 2256 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2257 */ batchImportEvaluatedAnnotations( ModelEvaluationSliceName parent, List<EvaluatedAnnotation> evaluatedAnnotations)2258 public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations( 2259 ModelEvaluationSliceName parent, List<EvaluatedAnnotation> evaluatedAnnotations) { 2260 BatchImportEvaluatedAnnotationsRequest request = 2261 BatchImportEvaluatedAnnotationsRequest.newBuilder() 2262 .setParent(parent == null ? null : parent.toString()) 2263 .addAllEvaluatedAnnotations(evaluatedAnnotations) 2264 .build(); 2265 return batchImportEvaluatedAnnotations(request); 2266 } 2267 2268 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2269 /** 2270 * Imports a list of externally generated EvaluatedAnnotations. 2271 * 2272 * <p>Sample code: 2273 * 2274 * <pre>{@code 2275 * // This snippet has been automatically generated and should be regarded as a code template only. 2276 * // It will require modifications to work: 2277 * // - It may require correct/in-range values for request initialization. 2278 * // - It may require specifying regional endpoints when creating the service client as shown in 2279 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2280 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2281 * String parent = 2282 * ModelEvaluationSliceName.of( 2283 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2284 * .toString(); 2285 * List<EvaluatedAnnotation> evaluatedAnnotations = new ArrayList<>(); 2286 * BatchImportEvaluatedAnnotationsResponse response = 2287 * modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); 2288 * } 2289 * }</pre> 2290 * 2291 * @param parent Required. The name of the parent ModelEvaluationSlice resource. Format: 2292 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` 2293 * @param evaluatedAnnotations Required. Evaluated annotations resource to be imported. 2294 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2295 */ batchImportEvaluatedAnnotations( String parent, List<EvaluatedAnnotation> evaluatedAnnotations)2296 public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations( 2297 String parent, List<EvaluatedAnnotation> evaluatedAnnotations) { 2298 BatchImportEvaluatedAnnotationsRequest request = 2299 BatchImportEvaluatedAnnotationsRequest.newBuilder() 2300 .setParent(parent) 2301 .addAllEvaluatedAnnotations(evaluatedAnnotations) 2302 .build(); 2303 return batchImportEvaluatedAnnotations(request); 2304 } 2305 2306 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2307 /** 2308 * Imports a list of externally generated EvaluatedAnnotations. 2309 * 2310 * <p>Sample code: 2311 * 2312 * <pre>{@code 2313 * // This snippet has been automatically generated and should be regarded as a code template only. 2314 * // It will require modifications to work: 2315 * // - It may require correct/in-range values for request initialization. 2316 * // - It may require specifying regional endpoints when creating the service client as shown in 2317 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2318 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2319 * BatchImportEvaluatedAnnotationsRequest request = 2320 * BatchImportEvaluatedAnnotationsRequest.newBuilder() 2321 * .setParent( 2322 * ModelEvaluationSliceName.of( 2323 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2324 * .toString()) 2325 * .addAllEvaluatedAnnotations(new ArrayList<EvaluatedAnnotation>()) 2326 * .build(); 2327 * BatchImportEvaluatedAnnotationsResponse response = 2328 * modelServiceClient.batchImportEvaluatedAnnotations(request); 2329 * } 2330 * }</pre> 2331 * 2332 * @param request The request object containing all of the parameters for the API call. 2333 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2334 */ batchImportEvaluatedAnnotations( BatchImportEvaluatedAnnotationsRequest request)2335 public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations( 2336 BatchImportEvaluatedAnnotationsRequest request) { 2337 return batchImportEvaluatedAnnotationsCallable().call(request); 2338 } 2339 2340 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2341 /** 2342 * Imports a list of externally generated EvaluatedAnnotations. 2343 * 2344 * <p>Sample code: 2345 * 2346 * <pre>{@code 2347 * // This snippet has been automatically generated and should be regarded as a code template only. 2348 * // It will require modifications to work: 2349 * // - It may require correct/in-range values for request initialization. 2350 * // - It may require specifying regional endpoints when creating the service client as shown in 2351 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2352 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2353 * BatchImportEvaluatedAnnotationsRequest request = 2354 * BatchImportEvaluatedAnnotationsRequest.newBuilder() 2355 * .setParent( 2356 * ModelEvaluationSliceName.of( 2357 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2358 * .toString()) 2359 * .addAllEvaluatedAnnotations(new ArrayList<EvaluatedAnnotation>()) 2360 * .build(); 2361 * ApiFuture<BatchImportEvaluatedAnnotationsResponse> future = 2362 * modelServiceClient.batchImportEvaluatedAnnotationsCallable().futureCall(request); 2363 * // Do something. 2364 * BatchImportEvaluatedAnnotationsResponse response = future.get(); 2365 * } 2366 * }</pre> 2367 */ 2368 public final UnaryCallable< 2369 BatchImportEvaluatedAnnotationsRequest, BatchImportEvaluatedAnnotationsResponse> batchImportEvaluatedAnnotationsCallable()2370 batchImportEvaluatedAnnotationsCallable() { 2371 return stub.batchImportEvaluatedAnnotationsCallable(); 2372 } 2373 2374 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2375 /** 2376 * Gets a ModelEvaluation. 2377 * 2378 * <p>Sample code: 2379 * 2380 * <pre>{@code 2381 * // This snippet has been automatically generated and should be regarded as a code template only. 2382 * // It will require modifications to work: 2383 * // - It may require correct/in-range values for request initialization. 2384 * // - It may require specifying regional endpoints when creating the service client as shown in 2385 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2386 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2387 * ModelEvaluationName name = 2388 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); 2389 * ModelEvaluation response = modelServiceClient.getModelEvaluation(name); 2390 * } 2391 * }</pre> 2392 * 2393 * @param name Required. The name of the ModelEvaluation resource. Format: 2394 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2395 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2396 */ getModelEvaluation(ModelEvaluationName name)2397 public final ModelEvaluation getModelEvaluation(ModelEvaluationName name) { 2398 GetModelEvaluationRequest request = 2399 GetModelEvaluationRequest.newBuilder() 2400 .setName(name == null ? null : name.toString()) 2401 .build(); 2402 return getModelEvaluation(request); 2403 } 2404 2405 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2406 /** 2407 * Gets a ModelEvaluation. 2408 * 2409 * <p>Sample code: 2410 * 2411 * <pre>{@code 2412 * // This snippet has been automatically generated and should be regarded as a code template only. 2413 * // It will require modifications to work: 2414 * // - It may require correct/in-range values for request initialization. 2415 * // - It may require specifying regional endpoints when creating the service client as shown in 2416 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2417 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2418 * String name = 2419 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); 2420 * ModelEvaluation response = modelServiceClient.getModelEvaluation(name); 2421 * } 2422 * }</pre> 2423 * 2424 * @param name Required. The name of the ModelEvaluation resource. Format: 2425 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2426 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2427 */ getModelEvaluation(String name)2428 public final ModelEvaluation getModelEvaluation(String name) { 2429 GetModelEvaluationRequest request = 2430 GetModelEvaluationRequest.newBuilder().setName(name).build(); 2431 return getModelEvaluation(request); 2432 } 2433 2434 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2435 /** 2436 * Gets a ModelEvaluation. 2437 * 2438 * <p>Sample code: 2439 * 2440 * <pre>{@code 2441 * // This snippet has been automatically generated and should be regarded as a code template only. 2442 * // It will require modifications to work: 2443 * // - It may require correct/in-range values for request initialization. 2444 * // - It may require specifying regional endpoints when creating the service client as shown in 2445 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2446 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2447 * GetModelEvaluationRequest request = 2448 * GetModelEvaluationRequest.newBuilder() 2449 * .setName( 2450 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2451 * .toString()) 2452 * .build(); 2453 * ModelEvaluation response = modelServiceClient.getModelEvaluation(request); 2454 * } 2455 * }</pre> 2456 * 2457 * @param request The request object containing all of the parameters for the API call. 2458 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2459 */ getModelEvaluation(GetModelEvaluationRequest request)2460 public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest request) { 2461 return getModelEvaluationCallable().call(request); 2462 } 2463 2464 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2465 /** 2466 * Gets a ModelEvaluation. 2467 * 2468 * <p>Sample code: 2469 * 2470 * <pre>{@code 2471 * // This snippet has been automatically generated and should be regarded as a code template only. 2472 * // It will require modifications to work: 2473 * // - It may require correct/in-range values for request initialization. 2474 * // - It may require specifying regional endpoints when creating the service client as shown in 2475 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2476 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2477 * GetModelEvaluationRequest request = 2478 * GetModelEvaluationRequest.newBuilder() 2479 * .setName( 2480 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2481 * .toString()) 2482 * .build(); 2483 * ApiFuture<ModelEvaluation> future = 2484 * modelServiceClient.getModelEvaluationCallable().futureCall(request); 2485 * // Do something. 2486 * ModelEvaluation response = future.get(); 2487 * } 2488 * }</pre> 2489 */ 2490 public final UnaryCallable<GetModelEvaluationRequest, ModelEvaluation> getModelEvaluationCallable()2491 getModelEvaluationCallable() { 2492 return stub.getModelEvaluationCallable(); 2493 } 2494 2495 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2496 /** 2497 * Lists ModelEvaluations in a Model. 2498 * 2499 * <p>Sample code: 2500 * 2501 * <pre>{@code 2502 * // This snippet has been automatically generated and should be regarded as a code template only. 2503 * // It will require modifications to work: 2504 * // - It may require correct/in-range values for request initialization. 2505 * // - It may require specifying regional endpoints when creating the service client as shown in 2506 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2507 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2508 * ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); 2509 * for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { 2510 * // doThingsWith(element); 2511 * } 2512 * } 2513 * }</pre> 2514 * 2515 * @param parent Required. The resource name of the Model to list the ModelEvaluations from. 2516 * Format: `projects/{project}/locations/{location}/models/{model}` 2517 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2518 */ listModelEvaluations(ModelName parent)2519 public final ListModelEvaluationsPagedResponse listModelEvaluations(ModelName parent) { 2520 ListModelEvaluationsRequest request = 2521 ListModelEvaluationsRequest.newBuilder() 2522 .setParent(parent == null ? null : parent.toString()) 2523 .build(); 2524 return listModelEvaluations(request); 2525 } 2526 2527 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2528 /** 2529 * Lists ModelEvaluations in a Model. 2530 * 2531 * <p>Sample code: 2532 * 2533 * <pre>{@code 2534 * // This snippet has been automatically generated and should be regarded as a code template only. 2535 * // It will require modifications to work: 2536 * // - It may require correct/in-range values for request initialization. 2537 * // - It may require specifying regional endpoints when creating the service client as shown in 2538 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2539 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2540 * String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); 2541 * for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { 2542 * // doThingsWith(element); 2543 * } 2544 * } 2545 * }</pre> 2546 * 2547 * @param parent Required. The resource name of the Model to list the ModelEvaluations from. 2548 * Format: `projects/{project}/locations/{location}/models/{model}` 2549 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2550 */ listModelEvaluations(String parent)2551 public final ListModelEvaluationsPagedResponse listModelEvaluations(String parent) { 2552 ListModelEvaluationsRequest request = 2553 ListModelEvaluationsRequest.newBuilder().setParent(parent).build(); 2554 return listModelEvaluations(request); 2555 } 2556 2557 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2558 /** 2559 * Lists ModelEvaluations in a Model. 2560 * 2561 * <p>Sample code: 2562 * 2563 * <pre>{@code 2564 * // This snippet has been automatically generated and should be regarded as a code template only. 2565 * // It will require modifications to work: 2566 * // - It may require correct/in-range values for request initialization. 2567 * // - It may require specifying regional endpoints when creating the service client as shown in 2568 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2569 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2570 * ListModelEvaluationsRequest request = 2571 * ListModelEvaluationsRequest.newBuilder() 2572 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2573 * .setFilter("filter-1274492040") 2574 * .setPageSize(883849137) 2575 * .setPageToken("pageToken873572522") 2576 * .setReadMask(FieldMask.newBuilder().build()) 2577 * .build(); 2578 * for (ModelEvaluation element : 2579 * modelServiceClient.listModelEvaluations(request).iterateAll()) { 2580 * // doThingsWith(element); 2581 * } 2582 * } 2583 * }</pre> 2584 * 2585 * @param request The request object containing all of the parameters for the API call. 2586 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2587 */ listModelEvaluations( ListModelEvaluationsRequest request)2588 public final ListModelEvaluationsPagedResponse listModelEvaluations( 2589 ListModelEvaluationsRequest request) { 2590 return listModelEvaluationsPagedCallable().call(request); 2591 } 2592 2593 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2594 /** 2595 * Lists ModelEvaluations in a Model. 2596 * 2597 * <p>Sample code: 2598 * 2599 * <pre>{@code 2600 * // This snippet has been automatically generated and should be regarded as a code template only. 2601 * // It will require modifications to work: 2602 * // - It may require correct/in-range values for request initialization. 2603 * // - It may require specifying regional endpoints when creating the service client as shown in 2604 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2605 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2606 * ListModelEvaluationsRequest request = 2607 * ListModelEvaluationsRequest.newBuilder() 2608 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2609 * .setFilter("filter-1274492040") 2610 * .setPageSize(883849137) 2611 * .setPageToken("pageToken873572522") 2612 * .setReadMask(FieldMask.newBuilder().build()) 2613 * .build(); 2614 * ApiFuture<ModelEvaluation> future = 2615 * modelServiceClient.listModelEvaluationsPagedCallable().futureCall(request); 2616 * // Do something. 2617 * for (ModelEvaluation element : future.get().iterateAll()) { 2618 * // doThingsWith(element); 2619 * } 2620 * } 2621 * }</pre> 2622 */ 2623 public final UnaryCallable<ListModelEvaluationsRequest, ListModelEvaluationsPagedResponse> listModelEvaluationsPagedCallable()2624 listModelEvaluationsPagedCallable() { 2625 return stub.listModelEvaluationsPagedCallable(); 2626 } 2627 2628 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2629 /** 2630 * Lists ModelEvaluations in a Model. 2631 * 2632 * <p>Sample code: 2633 * 2634 * <pre>{@code 2635 * // This snippet has been automatically generated and should be regarded as a code template only. 2636 * // It will require modifications to work: 2637 * // - It may require correct/in-range values for request initialization. 2638 * // - It may require specifying regional endpoints when creating the service client as shown in 2639 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2640 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2641 * ListModelEvaluationsRequest request = 2642 * ListModelEvaluationsRequest.newBuilder() 2643 * .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) 2644 * .setFilter("filter-1274492040") 2645 * .setPageSize(883849137) 2646 * .setPageToken("pageToken873572522") 2647 * .setReadMask(FieldMask.newBuilder().build()) 2648 * .build(); 2649 * while (true) { 2650 * ListModelEvaluationsResponse response = 2651 * modelServiceClient.listModelEvaluationsCallable().call(request); 2652 * for (ModelEvaluation element : response.getModelEvaluationsList()) { 2653 * // doThingsWith(element); 2654 * } 2655 * String nextPageToken = response.getNextPageToken(); 2656 * if (!Strings.isNullOrEmpty(nextPageToken)) { 2657 * request = request.toBuilder().setPageToken(nextPageToken).build(); 2658 * } else { 2659 * break; 2660 * } 2661 * } 2662 * } 2663 * }</pre> 2664 */ 2665 public final UnaryCallable<ListModelEvaluationsRequest, ListModelEvaluationsResponse> listModelEvaluationsCallable()2666 listModelEvaluationsCallable() { 2667 return stub.listModelEvaluationsCallable(); 2668 } 2669 2670 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2671 /** 2672 * Gets a ModelEvaluationSlice. 2673 * 2674 * <p>Sample code: 2675 * 2676 * <pre>{@code 2677 * // This snippet has been automatically generated and should be regarded as a code template only. 2678 * // It will require modifications to work: 2679 * // - It may require correct/in-range values for request initialization. 2680 * // - It may require specifying regional endpoints when creating the service client as shown in 2681 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2682 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2683 * ModelEvaluationSliceName name = 2684 * ModelEvaluationSliceName.of( 2685 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); 2686 * ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); 2687 * } 2688 * }</pre> 2689 * 2690 * @param name Required. The name of the ModelEvaluationSlice resource. Format: 2691 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` 2692 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2693 */ getModelEvaluationSlice(ModelEvaluationSliceName name)2694 public final ModelEvaluationSlice getModelEvaluationSlice(ModelEvaluationSliceName name) { 2695 GetModelEvaluationSliceRequest request = 2696 GetModelEvaluationSliceRequest.newBuilder() 2697 .setName(name == null ? null : name.toString()) 2698 .build(); 2699 return getModelEvaluationSlice(request); 2700 } 2701 2702 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2703 /** 2704 * Gets a ModelEvaluationSlice. 2705 * 2706 * <p>Sample code: 2707 * 2708 * <pre>{@code 2709 * // This snippet has been automatically generated and should be regarded as a code template only. 2710 * // It will require modifications to work: 2711 * // - It may require correct/in-range values for request initialization. 2712 * // - It may require specifying regional endpoints when creating the service client as shown in 2713 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2714 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2715 * String name = 2716 * ModelEvaluationSliceName.of( 2717 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2718 * .toString(); 2719 * ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); 2720 * } 2721 * }</pre> 2722 * 2723 * @param name Required. The name of the ModelEvaluationSlice resource. Format: 2724 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}` 2725 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2726 */ getModelEvaluationSlice(String name)2727 public final ModelEvaluationSlice getModelEvaluationSlice(String name) { 2728 GetModelEvaluationSliceRequest request = 2729 GetModelEvaluationSliceRequest.newBuilder().setName(name).build(); 2730 return getModelEvaluationSlice(request); 2731 } 2732 2733 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2734 /** 2735 * Gets a ModelEvaluationSlice. 2736 * 2737 * <p>Sample code: 2738 * 2739 * <pre>{@code 2740 * // This snippet has been automatically generated and should be regarded as a code template only. 2741 * // It will require modifications to work: 2742 * // - It may require correct/in-range values for request initialization. 2743 * // - It may require specifying regional endpoints when creating the service client as shown in 2744 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2745 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2746 * GetModelEvaluationSliceRequest request = 2747 * GetModelEvaluationSliceRequest.newBuilder() 2748 * .setName( 2749 * ModelEvaluationSliceName.of( 2750 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2751 * .toString()) 2752 * .build(); 2753 * ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(request); 2754 * } 2755 * }</pre> 2756 * 2757 * @param request The request object containing all of the parameters for the API call. 2758 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2759 */ getModelEvaluationSlice( GetModelEvaluationSliceRequest request)2760 public final ModelEvaluationSlice getModelEvaluationSlice( 2761 GetModelEvaluationSliceRequest request) { 2762 return getModelEvaluationSliceCallable().call(request); 2763 } 2764 2765 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2766 /** 2767 * Gets a ModelEvaluationSlice. 2768 * 2769 * <p>Sample code: 2770 * 2771 * <pre>{@code 2772 * // This snippet has been automatically generated and should be regarded as a code template only. 2773 * // It will require modifications to work: 2774 * // - It may require correct/in-range values for request initialization. 2775 * // - It may require specifying regional endpoints when creating the service client as shown in 2776 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2777 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2778 * GetModelEvaluationSliceRequest request = 2779 * GetModelEvaluationSliceRequest.newBuilder() 2780 * .setName( 2781 * ModelEvaluationSliceName.of( 2782 * "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") 2783 * .toString()) 2784 * .build(); 2785 * ApiFuture<ModelEvaluationSlice> future = 2786 * modelServiceClient.getModelEvaluationSliceCallable().futureCall(request); 2787 * // Do something. 2788 * ModelEvaluationSlice response = future.get(); 2789 * } 2790 * }</pre> 2791 */ 2792 public final UnaryCallable<GetModelEvaluationSliceRequest, ModelEvaluationSlice> getModelEvaluationSliceCallable()2793 getModelEvaluationSliceCallable() { 2794 return stub.getModelEvaluationSliceCallable(); 2795 } 2796 2797 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2798 /** 2799 * Lists ModelEvaluationSlices in a ModelEvaluation. 2800 * 2801 * <p>Sample code: 2802 * 2803 * <pre>{@code 2804 * // This snippet has been automatically generated and should be regarded as a code template only. 2805 * // It will require modifications to work: 2806 * // - It may require correct/in-range values for request initialization. 2807 * // - It may require specifying regional endpoints when creating the service client as shown in 2808 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2809 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2810 * ModelEvaluationName parent = 2811 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); 2812 * for (ModelEvaluationSlice element : 2813 * modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { 2814 * // doThingsWith(element); 2815 * } 2816 * } 2817 * }</pre> 2818 * 2819 * @param parent Required. The resource name of the ModelEvaluation to list the 2820 * ModelEvaluationSlices from. Format: 2821 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2822 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2823 */ listModelEvaluationSlices( ModelEvaluationName parent)2824 public final ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices( 2825 ModelEvaluationName parent) { 2826 ListModelEvaluationSlicesRequest request = 2827 ListModelEvaluationSlicesRequest.newBuilder() 2828 .setParent(parent == null ? null : parent.toString()) 2829 .build(); 2830 return listModelEvaluationSlices(request); 2831 } 2832 2833 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2834 /** 2835 * Lists ModelEvaluationSlices in a ModelEvaluation. 2836 * 2837 * <p>Sample code: 2838 * 2839 * <pre>{@code 2840 * // This snippet has been automatically generated and should be regarded as a code template only. 2841 * // It will require modifications to work: 2842 * // - It may require correct/in-range values for request initialization. 2843 * // - It may require specifying regional endpoints when creating the service client as shown in 2844 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2845 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2846 * String parent = 2847 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); 2848 * for (ModelEvaluationSlice element : 2849 * modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { 2850 * // doThingsWith(element); 2851 * } 2852 * } 2853 * }</pre> 2854 * 2855 * @param parent Required. The resource name of the ModelEvaluation to list the 2856 * ModelEvaluationSlices from. Format: 2857 * `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}` 2858 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2859 */ listModelEvaluationSlices(String parent)2860 public final ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(String parent) { 2861 ListModelEvaluationSlicesRequest request = 2862 ListModelEvaluationSlicesRequest.newBuilder().setParent(parent).build(); 2863 return listModelEvaluationSlices(request); 2864 } 2865 2866 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2867 /** 2868 * Lists ModelEvaluationSlices in a ModelEvaluation. 2869 * 2870 * <p>Sample code: 2871 * 2872 * <pre>{@code 2873 * // This snippet has been automatically generated and should be regarded as a code template only. 2874 * // It will require modifications to work: 2875 * // - It may require correct/in-range values for request initialization. 2876 * // - It may require specifying regional endpoints when creating the service client as shown in 2877 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2878 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2879 * ListModelEvaluationSlicesRequest request = 2880 * ListModelEvaluationSlicesRequest.newBuilder() 2881 * .setParent( 2882 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2883 * .toString()) 2884 * .setFilter("filter-1274492040") 2885 * .setPageSize(883849137) 2886 * .setPageToken("pageToken873572522") 2887 * .setReadMask(FieldMask.newBuilder().build()) 2888 * .build(); 2889 * for (ModelEvaluationSlice element : 2890 * modelServiceClient.listModelEvaluationSlices(request).iterateAll()) { 2891 * // doThingsWith(element); 2892 * } 2893 * } 2894 * }</pre> 2895 * 2896 * @param request The request object containing all of the parameters for the API call. 2897 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2898 */ listModelEvaluationSlices( ListModelEvaluationSlicesRequest request)2899 public final ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices( 2900 ListModelEvaluationSlicesRequest request) { 2901 return listModelEvaluationSlicesPagedCallable().call(request); 2902 } 2903 2904 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2905 /** 2906 * Lists ModelEvaluationSlices in a ModelEvaluation. 2907 * 2908 * <p>Sample code: 2909 * 2910 * <pre>{@code 2911 * // This snippet has been automatically generated and should be regarded as a code template only. 2912 * // It will require modifications to work: 2913 * // - It may require correct/in-range values for request initialization. 2914 * // - It may require specifying regional endpoints when creating the service client as shown in 2915 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2916 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2917 * ListModelEvaluationSlicesRequest request = 2918 * ListModelEvaluationSlicesRequest.newBuilder() 2919 * .setParent( 2920 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2921 * .toString()) 2922 * .setFilter("filter-1274492040") 2923 * .setPageSize(883849137) 2924 * .setPageToken("pageToken873572522") 2925 * .setReadMask(FieldMask.newBuilder().build()) 2926 * .build(); 2927 * ApiFuture<ModelEvaluationSlice> future = 2928 * modelServiceClient.listModelEvaluationSlicesPagedCallable().futureCall(request); 2929 * // Do something. 2930 * for (ModelEvaluationSlice element : future.get().iterateAll()) { 2931 * // doThingsWith(element); 2932 * } 2933 * } 2934 * }</pre> 2935 */ 2936 public final UnaryCallable< 2937 ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesPagedResponse> listModelEvaluationSlicesPagedCallable()2938 listModelEvaluationSlicesPagedCallable() { 2939 return stub.listModelEvaluationSlicesPagedCallable(); 2940 } 2941 2942 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2943 /** 2944 * Lists ModelEvaluationSlices in a ModelEvaluation. 2945 * 2946 * <p>Sample code: 2947 * 2948 * <pre>{@code 2949 * // This snippet has been automatically generated and should be regarded as a code template only. 2950 * // It will require modifications to work: 2951 * // - It may require correct/in-range values for request initialization. 2952 * // - It may require specifying regional endpoints when creating the service client as shown in 2953 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2954 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2955 * ListModelEvaluationSlicesRequest request = 2956 * ListModelEvaluationSlicesRequest.newBuilder() 2957 * .setParent( 2958 * ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") 2959 * .toString()) 2960 * .setFilter("filter-1274492040") 2961 * .setPageSize(883849137) 2962 * .setPageToken("pageToken873572522") 2963 * .setReadMask(FieldMask.newBuilder().build()) 2964 * .build(); 2965 * while (true) { 2966 * ListModelEvaluationSlicesResponse response = 2967 * modelServiceClient.listModelEvaluationSlicesCallable().call(request); 2968 * for (ModelEvaluationSlice element : response.getModelEvaluationSlicesList()) { 2969 * // doThingsWith(element); 2970 * } 2971 * String nextPageToken = response.getNextPageToken(); 2972 * if (!Strings.isNullOrEmpty(nextPageToken)) { 2973 * request = request.toBuilder().setPageToken(nextPageToken).build(); 2974 * } else { 2975 * break; 2976 * } 2977 * } 2978 * } 2979 * }</pre> 2980 */ 2981 public final UnaryCallable<ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse> listModelEvaluationSlicesCallable()2982 listModelEvaluationSlicesCallable() { 2983 return stub.listModelEvaluationSlicesCallable(); 2984 } 2985 2986 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2987 /** 2988 * Lists information about the supported locations for this service. 2989 * 2990 * <p>Sample code: 2991 * 2992 * <pre>{@code 2993 * // This snippet has been automatically generated and should be regarded as a code template only. 2994 * // It will require modifications to work: 2995 * // - It may require correct/in-range values for request initialization. 2996 * // - It may require specifying regional endpoints when creating the service client as shown in 2997 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2998 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 2999 * ListLocationsRequest request = 3000 * ListLocationsRequest.newBuilder() 3001 * .setName("name3373707") 3002 * .setFilter("filter-1274492040") 3003 * .setPageSize(883849137) 3004 * .setPageToken("pageToken873572522") 3005 * .build(); 3006 * for (Location element : modelServiceClient.listLocations(request).iterateAll()) { 3007 * // doThingsWith(element); 3008 * } 3009 * } 3010 * }</pre> 3011 * 3012 * @param request The request object containing all of the parameters for the API call. 3013 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3014 */ listLocations(ListLocationsRequest request)3015 public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { 3016 return listLocationsPagedCallable().call(request); 3017 } 3018 3019 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3020 /** 3021 * Lists information about the supported locations for this service. 3022 * 3023 * <p>Sample code: 3024 * 3025 * <pre>{@code 3026 * // This snippet has been automatically generated and should be regarded as a code template only. 3027 * // It will require modifications to work: 3028 * // - It may require correct/in-range values for request initialization. 3029 * // - It may require specifying regional endpoints when creating the service client as shown in 3030 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3031 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3032 * ListLocationsRequest request = 3033 * ListLocationsRequest.newBuilder() 3034 * .setName("name3373707") 3035 * .setFilter("filter-1274492040") 3036 * .setPageSize(883849137) 3037 * .setPageToken("pageToken873572522") 3038 * .build(); 3039 * ApiFuture<Location> future = 3040 * modelServiceClient.listLocationsPagedCallable().futureCall(request); 3041 * // Do something. 3042 * for (Location element : future.get().iterateAll()) { 3043 * // doThingsWith(element); 3044 * } 3045 * } 3046 * }</pre> 3047 */ 3048 public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()3049 listLocationsPagedCallable() { 3050 return stub.listLocationsPagedCallable(); 3051 } 3052 3053 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3054 /** 3055 * Lists information about the supported locations for this service. 3056 * 3057 * <p>Sample code: 3058 * 3059 * <pre>{@code 3060 * // This snippet has been automatically generated and should be regarded as a code template only. 3061 * // It will require modifications to work: 3062 * // - It may require correct/in-range values for request initialization. 3063 * // - It may require specifying regional endpoints when creating the service client as shown in 3064 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3065 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3066 * ListLocationsRequest request = 3067 * ListLocationsRequest.newBuilder() 3068 * .setName("name3373707") 3069 * .setFilter("filter-1274492040") 3070 * .setPageSize(883849137) 3071 * .setPageToken("pageToken873572522") 3072 * .build(); 3073 * while (true) { 3074 * ListLocationsResponse response = modelServiceClient.listLocationsCallable().call(request); 3075 * for (Location element : response.getLocationsList()) { 3076 * // doThingsWith(element); 3077 * } 3078 * String nextPageToken = response.getNextPageToken(); 3079 * if (!Strings.isNullOrEmpty(nextPageToken)) { 3080 * request = request.toBuilder().setPageToken(nextPageToken).build(); 3081 * } else { 3082 * break; 3083 * } 3084 * } 3085 * } 3086 * }</pre> 3087 */ listLocationsCallable()3088 public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 3089 return stub.listLocationsCallable(); 3090 } 3091 3092 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3093 /** 3094 * Gets information about a location. 3095 * 3096 * <p>Sample code: 3097 * 3098 * <pre>{@code 3099 * // This snippet has been automatically generated and should be regarded as a code template only. 3100 * // It will require modifications to work: 3101 * // - It may require correct/in-range values for request initialization. 3102 * // - It may require specifying regional endpoints when creating the service client as shown in 3103 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3104 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3105 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 3106 * Location response = modelServiceClient.getLocation(request); 3107 * } 3108 * }</pre> 3109 * 3110 * @param request The request object containing all of the parameters for the API call. 3111 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3112 */ getLocation(GetLocationRequest request)3113 public final Location getLocation(GetLocationRequest request) { 3114 return getLocationCallable().call(request); 3115 } 3116 3117 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3118 /** 3119 * Gets information about a location. 3120 * 3121 * <p>Sample code: 3122 * 3123 * <pre>{@code 3124 * // This snippet has been automatically generated and should be regarded as a code template only. 3125 * // It will require modifications to work: 3126 * // - It may require correct/in-range values for request initialization. 3127 * // - It may require specifying regional endpoints when creating the service client as shown in 3128 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3129 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3130 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 3131 * ApiFuture<Location> future = modelServiceClient.getLocationCallable().futureCall(request); 3132 * // Do something. 3133 * Location response = future.get(); 3134 * } 3135 * }</pre> 3136 */ getLocationCallable()3137 public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 3138 return stub.getLocationCallable(); 3139 } 3140 3141 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3142 /** 3143 * Sets the access control policy on the specified resource. Replacesany existing policy. 3144 * 3145 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 3146 * 3147 * <p>Sample code: 3148 * 3149 * <pre>{@code 3150 * // This snippet has been automatically generated and should be regarded as a code template only. 3151 * // It will require modifications to work: 3152 * // - It may require correct/in-range values for request initialization. 3153 * // - It may require specifying regional endpoints when creating the service client as shown in 3154 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3155 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3156 * SetIamPolicyRequest request = 3157 * SetIamPolicyRequest.newBuilder() 3158 * .setResource( 3159 * EndpointName.ofProjectLocationEndpointName( 3160 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3161 * .toString()) 3162 * .setPolicy(Policy.newBuilder().build()) 3163 * .setUpdateMask(FieldMask.newBuilder().build()) 3164 * .build(); 3165 * Policy response = modelServiceClient.setIamPolicy(request); 3166 * } 3167 * }</pre> 3168 * 3169 * @param request The request object containing all of the parameters for the API call. 3170 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3171 */ setIamPolicy(SetIamPolicyRequest request)3172 public final Policy setIamPolicy(SetIamPolicyRequest request) { 3173 return setIamPolicyCallable().call(request); 3174 } 3175 3176 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3177 /** 3178 * Sets the access control policy on the specified resource. Replacesany existing policy. 3179 * 3180 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 3181 * 3182 * <p>Sample code: 3183 * 3184 * <pre>{@code 3185 * // This snippet has been automatically generated and should be regarded as a code template only. 3186 * // It will require modifications to work: 3187 * // - It may require correct/in-range values for request initialization. 3188 * // - It may require specifying regional endpoints when creating the service client as shown in 3189 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3190 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3191 * SetIamPolicyRequest request = 3192 * SetIamPolicyRequest.newBuilder() 3193 * .setResource( 3194 * EndpointName.ofProjectLocationEndpointName( 3195 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3196 * .toString()) 3197 * .setPolicy(Policy.newBuilder().build()) 3198 * .setUpdateMask(FieldMask.newBuilder().build()) 3199 * .build(); 3200 * ApiFuture<Policy> future = modelServiceClient.setIamPolicyCallable().futureCall(request); 3201 * // Do something. 3202 * Policy response = future.get(); 3203 * } 3204 * }</pre> 3205 */ setIamPolicyCallable()3206 public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { 3207 return stub.setIamPolicyCallable(); 3208 } 3209 3210 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3211 /** 3212 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 3213 * and does not have a policy set. 3214 * 3215 * <p>Sample code: 3216 * 3217 * <pre>{@code 3218 * // This snippet has been automatically generated and should be regarded as a code template only. 3219 * // It will require modifications to work: 3220 * // - It may require correct/in-range values for request initialization. 3221 * // - It may require specifying regional endpoints when creating the service client as shown in 3222 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3223 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3224 * GetIamPolicyRequest request = 3225 * GetIamPolicyRequest.newBuilder() 3226 * .setResource( 3227 * EndpointName.ofProjectLocationEndpointName( 3228 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3229 * .toString()) 3230 * .setOptions(GetPolicyOptions.newBuilder().build()) 3231 * .build(); 3232 * Policy response = modelServiceClient.getIamPolicy(request); 3233 * } 3234 * }</pre> 3235 * 3236 * @param request The request object containing all of the parameters for the API call. 3237 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3238 */ getIamPolicy(GetIamPolicyRequest request)3239 public final Policy getIamPolicy(GetIamPolicyRequest request) { 3240 return getIamPolicyCallable().call(request); 3241 } 3242 3243 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3244 /** 3245 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 3246 * and does not have a policy set. 3247 * 3248 * <p>Sample code: 3249 * 3250 * <pre>{@code 3251 * // This snippet has been automatically generated and should be regarded as a code template only. 3252 * // It will require modifications to work: 3253 * // - It may require correct/in-range values for request initialization. 3254 * // - It may require specifying regional endpoints when creating the service client as shown in 3255 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3256 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3257 * GetIamPolicyRequest request = 3258 * GetIamPolicyRequest.newBuilder() 3259 * .setResource( 3260 * EndpointName.ofProjectLocationEndpointName( 3261 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3262 * .toString()) 3263 * .setOptions(GetPolicyOptions.newBuilder().build()) 3264 * .build(); 3265 * ApiFuture<Policy> future = modelServiceClient.getIamPolicyCallable().futureCall(request); 3266 * // Do something. 3267 * Policy response = future.get(); 3268 * } 3269 * }</pre> 3270 */ getIamPolicyCallable()3271 public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { 3272 return stub.getIamPolicyCallable(); 3273 } 3274 3275 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3276 /** 3277 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 3278 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 3279 * 3280 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 3281 * command-line tools, not for authorizationchecking. This operation may "fail open" without 3282 * warning. 3283 * 3284 * <p>Sample code: 3285 * 3286 * <pre>{@code 3287 * // This snippet has been automatically generated and should be regarded as a code template only. 3288 * // It will require modifications to work: 3289 * // - It may require correct/in-range values for request initialization. 3290 * // - It may require specifying regional endpoints when creating the service client as shown in 3291 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3292 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3293 * TestIamPermissionsRequest request = 3294 * TestIamPermissionsRequest.newBuilder() 3295 * .setResource( 3296 * EndpointName.ofProjectLocationEndpointName( 3297 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3298 * .toString()) 3299 * .addAllPermissions(new ArrayList<String>()) 3300 * .build(); 3301 * TestIamPermissionsResponse response = modelServiceClient.testIamPermissions(request); 3302 * } 3303 * }</pre> 3304 * 3305 * @param request The request object containing all of the parameters for the API call. 3306 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3307 */ testIamPermissions(TestIamPermissionsRequest request)3308 public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { 3309 return testIamPermissionsCallable().call(request); 3310 } 3311 3312 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3313 /** 3314 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 3315 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 3316 * 3317 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 3318 * command-line tools, not for authorizationchecking. This operation may "fail open" without 3319 * warning. 3320 * 3321 * <p>Sample code: 3322 * 3323 * <pre>{@code 3324 * // This snippet has been automatically generated and should be regarded as a code template only. 3325 * // It will require modifications to work: 3326 * // - It may require correct/in-range values for request initialization. 3327 * // - It may require specifying regional endpoints when creating the service client as shown in 3328 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3329 * try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { 3330 * TestIamPermissionsRequest request = 3331 * TestIamPermissionsRequest.newBuilder() 3332 * .setResource( 3333 * EndpointName.ofProjectLocationEndpointName( 3334 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 3335 * .toString()) 3336 * .addAllPermissions(new ArrayList<String>()) 3337 * .build(); 3338 * ApiFuture<TestIamPermissionsResponse> future = 3339 * modelServiceClient.testIamPermissionsCallable().futureCall(request); 3340 * // Do something. 3341 * TestIamPermissionsResponse response = future.get(); 3342 * } 3343 * }</pre> 3344 */ 3345 public final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable()3346 testIamPermissionsCallable() { 3347 return stub.testIamPermissionsCallable(); 3348 } 3349 3350 @Override close()3351 public final void close() { 3352 stub.close(); 3353 } 3354 3355 @Override shutdown()3356 public void shutdown() { 3357 stub.shutdown(); 3358 } 3359 3360 @Override isShutdown()3361 public boolean isShutdown() { 3362 return stub.isShutdown(); 3363 } 3364 3365 @Override isTerminated()3366 public boolean isTerminated() { 3367 return stub.isTerminated(); 3368 } 3369 3370 @Override shutdownNow()3371 public void shutdownNow() { 3372 stub.shutdownNow(); 3373 } 3374 3375 @Override awaitTermination(long duration, TimeUnit unit)3376 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 3377 return stub.awaitTermination(duration, unit); 3378 } 3379 3380 public static class ListModelsPagedResponse 3381 extends AbstractPagedListResponse< 3382 ListModelsRequest, 3383 ListModelsResponse, 3384 Model, 3385 ListModelsPage, 3386 ListModelsFixedSizeCollection> { 3387 createAsync( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ApiFuture<ListModelsResponse> futureResponse)3388 public static ApiFuture<ListModelsPagedResponse> createAsync( 3389 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 3390 ApiFuture<ListModelsResponse> futureResponse) { 3391 ApiFuture<ListModelsPage> futurePage = 3392 ListModelsPage.createEmptyPage().createPageAsync(context, futureResponse); 3393 return ApiFutures.transform( 3394 futurePage, input -> new ListModelsPagedResponse(input), MoreExecutors.directExecutor()); 3395 } 3396 ListModelsPagedResponse(ListModelsPage page)3397 private ListModelsPagedResponse(ListModelsPage page) { 3398 super(page, ListModelsFixedSizeCollection.createEmptyCollection()); 3399 } 3400 } 3401 3402 public static class ListModelsPage 3403 extends AbstractPage<ListModelsRequest, ListModelsResponse, Model, ListModelsPage> { 3404 ListModelsPage( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ListModelsResponse response)3405 private ListModelsPage( 3406 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 3407 ListModelsResponse response) { 3408 super(context, response); 3409 } 3410 createEmptyPage()3411 private static ListModelsPage createEmptyPage() { 3412 return new ListModelsPage(null, null); 3413 } 3414 3415 @Override createPage( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ListModelsResponse response)3416 protected ListModelsPage createPage( 3417 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 3418 ListModelsResponse response) { 3419 return new ListModelsPage(context, response); 3420 } 3421 3422 @Override createPageAsync( PageContext<ListModelsRequest, ListModelsResponse, Model> context, ApiFuture<ListModelsResponse> futureResponse)3423 public ApiFuture<ListModelsPage> createPageAsync( 3424 PageContext<ListModelsRequest, ListModelsResponse, Model> context, 3425 ApiFuture<ListModelsResponse> futureResponse) { 3426 return super.createPageAsync(context, futureResponse); 3427 } 3428 } 3429 3430 public static class ListModelsFixedSizeCollection 3431 extends AbstractFixedSizeCollection< 3432 ListModelsRequest, 3433 ListModelsResponse, 3434 Model, 3435 ListModelsPage, 3436 ListModelsFixedSizeCollection> { 3437 ListModelsFixedSizeCollection(List<ListModelsPage> pages, int collectionSize)3438 private ListModelsFixedSizeCollection(List<ListModelsPage> pages, int collectionSize) { 3439 super(pages, collectionSize); 3440 } 3441 createEmptyCollection()3442 private static ListModelsFixedSizeCollection createEmptyCollection() { 3443 return new ListModelsFixedSizeCollection(null, 0); 3444 } 3445 3446 @Override createCollection( List<ListModelsPage> pages, int collectionSize)3447 protected ListModelsFixedSizeCollection createCollection( 3448 List<ListModelsPage> pages, int collectionSize) { 3449 return new ListModelsFixedSizeCollection(pages, collectionSize); 3450 } 3451 } 3452 3453 public static class ListModelVersionsPagedResponse 3454 extends AbstractPagedListResponse< 3455 ListModelVersionsRequest, 3456 ListModelVersionsResponse, 3457 Model, 3458 ListModelVersionsPage, 3459 ListModelVersionsFixedSizeCollection> { 3460 createAsync( PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, ApiFuture<ListModelVersionsResponse> futureResponse)3461 public static ApiFuture<ListModelVersionsPagedResponse> createAsync( 3462 PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, 3463 ApiFuture<ListModelVersionsResponse> futureResponse) { 3464 ApiFuture<ListModelVersionsPage> futurePage = 3465 ListModelVersionsPage.createEmptyPage().createPageAsync(context, futureResponse); 3466 return ApiFutures.transform( 3467 futurePage, 3468 input -> new ListModelVersionsPagedResponse(input), 3469 MoreExecutors.directExecutor()); 3470 } 3471 ListModelVersionsPagedResponse(ListModelVersionsPage page)3472 private ListModelVersionsPagedResponse(ListModelVersionsPage page) { 3473 super(page, ListModelVersionsFixedSizeCollection.createEmptyCollection()); 3474 } 3475 } 3476 3477 public static class ListModelVersionsPage 3478 extends AbstractPage< 3479 ListModelVersionsRequest, ListModelVersionsResponse, Model, ListModelVersionsPage> { 3480 ListModelVersionsPage( PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, ListModelVersionsResponse response)3481 private ListModelVersionsPage( 3482 PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, 3483 ListModelVersionsResponse response) { 3484 super(context, response); 3485 } 3486 createEmptyPage()3487 private static ListModelVersionsPage createEmptyPage() { 3488 return new ListModelVersionsPage(null, null); 3489 } 3490 3491 @Override createPage( PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, ListModelVersionsResponse response)3492 protected ListModelVersionsPage createPage( 3493 PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, 3494 ListModelVersionsResponse response) { 3495 return new ListModelVersionsPage(context, response); 3496 } 3497 3498 @Override createPageAsync( PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, ApiFuture<ListModelVersionsResponse> futureResponse)3499 public ApiFuture<ListModelVersionsPage> createPageAsync( 3500 PageContext<ListModelVersionsRequest, ListModelVersionsResponse, Model> context, 3501 ApiFuture<ListModelVersionsResponse> futureResponse) { 3502 return super.createPageAsync(context, futureResponse); 3503 } 3504 } 3505 3506 public static class ListModelVersionsFixedSizeCollection 3507 extends AbstractFixedSizeCollection< 3508 ListModelVersionsRequest, 3509 ListModelVersionsResponse, 3510 Model, 3511 ListModelVersionsPage, 3512 ListModelVersionsFixedSizeCollection> { 3513 ListModelVersionsFixedSizeCollection( List<ListModelVersionsPage> pages, int collectionSize)3514 private ListModelVersionsFixedSizeCollection( 3515 List<ListModelVersionsPage> pages, int collectionSize) { 3516 super(pages, collectionSize); 3517 } 3518 createEmptyCollection()3519 private static ListModelVersionsFixedSizeCollection createEmptyCollection() { 3520 return new ListModelVersionsFixedSizeCollection(null, 0); 3521 } 3522 3523 @Override createCollection( List<ListModelVersionsPage> pages, int collectionSize)3524 protected ListModelVersionsFixedSizeCollection createCollection( 3525 List<ListModelVersionsPage> pages, int collectionSize) { 3526 return new ListModelVersionsFixedSizeCollection(pages, collectionSize); 3527 } 3528 } 3529 3530 public static class ListModelEvaluationsPagedResponse 3531 extends AbstractPagedListResponse< 3532 ListModelEvaluationsRequest, 3533 ListModelEvaluationsResponse, 3534 ModelEvaluation, 3535 ListModelEvaluationsPage, 3536 ListModelEvaluationsFixedSizeCollection> { 3537 createAsync( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ApiFuture<ListModelEvaluationsResponse> futureResponse)3538 public static ApiFuture<ListModelEvaluationsPagedResponse> createAsync( 3539 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3540 context, 3541 ApiFuture<ListModelEvaluationsResponse> futureResponse) { 3542 ApiFuture<ListModelEvaluationsPage> futurePage = 3543 ListModelEvaluationsPage.createEmptyPage().createPageAsync(context, futureResponse); 3544 return ApiFutures.transform( 3545 futurePage, 3546 input -> new ListModelEvaluationsPagedResponse(input), 3547 MoreExecutors.directExecutor()); 3548 } 3549 ListModelEvaluationsPagedResponse(ListModelEvaluationsPage page)3550 private ListModelEvaluationsPagedResponse(ListModelEvaluationsPage page) { 3551 super(page, ListModelEvaluationsFixedSizeCollection.createEmptyCollection()); 3552 } 3553 } 3554 3555 public static class ListModelEvaluationsPage 3556 extends AbstractPage< 3557 ListModelEvaluationsRequest, 3558 ListModelEvaluationsResponse, 3559 ModelEvaluation, 3560 ListModelEvaluationsPage> { 3561 ListModelEvaluationsPage( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ListModelEvaluationsResponse response)3562 private ListModelEvaluationsPage( 3563 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3564 context, 3565 ListModelEvaluationsResponse response) { 3566 super(context, response); 3567 } 3568 createEmptyPage()3569 private static ListModelEvaluationsPage createEmptyPage() { 3570 return new ListModelEvaluationsPage(null, null); 3571 } 3572 3573 @Override createPage( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ListModelEvaluationsResponse response)3574 protected ListModelEvaluationsPage createPage( 3575 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3576 context, 3577 ListModelEvaluationsResponse response) { 3578 return new ListModelEvaluationsPage(context, response); 3579 } 3580 3581 @Override createPageAsync( PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> context, ApiFuture<ListModelEvaluationsResponse> futureResponse)3582 public ApiFuture<ListModelEvaluationsPage> createPageAsync( 3583 PageContext<ListModelEvaluationsRequest, ListModelEvaluationsResponse, ModelEvaluation> 3584 context, 3585 ApiFuture<ListModelEvaluationsResponse> futureResponse) { 3586 return super.createPageAsync(context, futureResponse); 3587 } 3588 } 3589 3590 public static class ListModelEvaluationsFixedSizeCollection 3591 extends AbstractFixedSizeCollection< 3592 ListModelEvaluationsRequest, 3593 ListModelEvaluationsResponse, 3594 ModelEvaluation, 3595 ListModelEvaluationsPage, 3596 ListModelEvaluationsFixedSizeCollection> { 3597 ListModelEvaluationsFixedSizeCollection( List<ListModelEvaluationsPage> pages, int collectionSize)3598 private ListModelEvaluationsFixedSizeCollection( 3599 List<ListModelEvaluationsPage> pages, int collectionSize) { 3600 super(pages, collectionSize); 3601 } 3602 createEmptyCollection()3603 private static ListModelEvaluationsFixedSizeCollection createEmptyCollection() { 3604 return new ListModelEvaluationsFixedSizeCollection(null, 0); 3605 } 3606 3607 @Override createCollection( List<ListModelEvaluationsPage> pages, int collectionSize)3608 protected ListModelEvaluationsFixedSizeCollection createCollection( 3609 List<ListModelEvaluationsPage> pages, int collectionSize) { 3610 return new ListModelEvaluationsFixedSizeCollection(pages, collectionSize); 3611 } 3612 } 3613 3614 public static class ListModelEvaluationSlicesPagedResponse 3615 extends AbstractPagedListResponse< 3616 ListModelEvaluationSlicesRequest, 3617 ListModelEvaluationSlicesResponse, 3618 ModelEvaluationSlice, 3619 ListModelEvaluationSlicesPage, 3620 ListModelEvaluationSlicesFixedSizeCollection> { 3621 createAsync( PageContext< ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse, ModelEvaluationSlice> context, ApiFuture<ListModelEvaluationSlicesResponse> futureResponse)3622 public static ApiFuture<ListModelEvaluationSlicesPagedResponse> createAsync( 3623 PageContext< 3624 ListModelEvaluationSlicesRequest, 3625 ListModelEvaluationSlicesResponse, 3626 ModelEvaluationSlice> 3627 context, 3628 ApiFuture<ListModelEvaluationSlicesResponse> futureResponse) { 3629 ApiFuture<ListModelEvaluationSlicesPage> futurePage = 3630 ListModelEvaluationSlicesPage.createEmptyPage().createPageAsync(context, futureResponse); 3631 return ApiFutures.transform( 3632 futurePage, 3633 input -> new ListModelEvaluationSlicesPagedResponse(input), 3634 MoreExecutors.directExecutor()); 3635 } 3636 ListModelEvaluationSlicesPagedResponse(ListModelEvaluationSlicesPage page)3637 private ListModelEvaluationSlicesPagedResponse(ListModelEvaluationSlicesPage page) { 3638 super(page, ListModelEvaluationSlicesFixedSizeCollection.createEmptyCollection()); 3639 } 3640 } 3641 3642 public static class ListModelEvaluationSlicesPage 3643 extends AbstractPage< 3644 ListModelEvaluationSlicesRequest, 3645 ListModelEvaluationSlicesResponse, 3646 ModelEvaluationSlice, 3647 ListModelEvaluationSlicesPage> { 3648 ListModelEvaluationSlicesPage( PageContext< ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse, ModelEvaluationSlice> context, ListModelEvaluationSlicesResponse response)3649 private ListModelEvaluationSlicesPage( 3650 PageContext< 3651 ListModelEvaluationSlicesRequest, 3652 ListModelEvaluationSlicesResponse, 3653 ModelEvaluationSlice> 3654 context, 3655 ListModelEvaluationSlicesResponse response) { 3656 super(context, response); 3657 } 3658 createEmptyPage()3659 private static ListModelEvaluationSlicesPage createEmptyPage() { 3660 return new ListModelEvaluationSlicesPage(null, null); 3661 } 3662 3663 @Override createPage( PageContext< ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse, ModelEvaluationSlice> context, ListModelEvaluationSlicesResponse response)3664 protected ListModelEvaluationSlicesPage createPage( 3665 PageContext< 3666 ListModelEvaluationSlicesRequest, 3667 ListModelEvaluationSlicesResponse, 3668 ModelEvaluationSlice> 3669 context, 3670 ListModelEvaluationSlicesResponse response) { 3671 return new ListModelEvaluationSlicesPage(context, response); 3672 } 3673 3674 @Override createPageAsync( PageContext< ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse, ModelEvaluationSlice> context, ApiFuture<ListModelEvaluationSlicesResponse> futureResponse)3675 public ApiFuture<ListModelEvaluationSlicesPage> createPageAsync( 3676 PageContext< 3677 ListModelEvaluationSlicesRequest, 3678 ListModelEvaluationSlicesResponse, 3679 ModelEvaluationSlice> 3680 context, 3681 ApiFuture<ListModelEvaluationSlicesResponse> futureResponse) { 3682 return super.createPageAsync(context, futureResponse); 3683 } 3684 } 3685 3686 public static class ListModelEvaluationSlicesFixedSizeCollection 3687 extends AbstractFixedSizeCollection< 3688 ListModelEvaluationSlicesRequest, 3689 ListModelEvaluationSlicesResponse, 3690 ModelEvaluationSlice, 3691 ListModelEvaluationSlicesPage, 3692 ListModelEvaluationSlicesFixedSizeCollection> { 3693 ListModelEvaluationSlicesFixedSizeCollection( List<ListModelEvaluationSlicesPage> pages, int collectionSize)3694 private ListModelEvaluationSlicesFixedSizeCollection( 3695 List<ListModelEvaluationSlicesPage> pages, int collectionSize) { 3696 super(pages, collectionSize); 3697 } 3698 createEmptyCollection()3699 private static ListModelEvaluationSlicesFixedSizeCollection createEmptyCollection() { 3700 return new ListModelEvaluationSlicesFixedSizeCollection(null, 0); 3701 } 3702 3703 @Override createCollection( List<ListModelEvaluationSlicesPage> pages, int collectionSize)3704 protected ListModelEvaluationSlicesFixedSizeCollection createCollection( 3705 List<ListModelEvaluationSlicesPage> pages, int collectionSize) { 3706 return new ListModelEvaluationSlicesFixedSizeCollection(pages, collectionSize); 3707 } 3708 } 3709 3710 public static class ListLocationsPagedResponse 3711 extends AbstractPagedListResponse< 3712 ListLocationsRequest, 3713 ListLocationsResponse, 3714 Location, 3715 ListLocationsPage, 3716 ListLocationsFixedSizeCollection> { 3717 createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)3718 public static ApiFuture<ListLocationsPagedResponse> createAsync( 3719 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 3720 ApiFuture<ListLocationsResponse> futureResponse) { 3721 ApiFuture<ListLocationsPage> futurePage = 3722 ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); 3723 return ApiFutures.transform( 3724 futurePage, 3725 input -> new ListLocationsPagedResponse(input), 3726 MoreExecutors.directExecutor()); 3727 } 3728 ListLocationsPagedResponse(ListLocationsPage page)3729 private ListLocationsPagedResponse(ListLocationsPage page) { 3730 super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); 3731 } 3732 } 3733 3734 public static class ListLocationsPage 3735 extends AbstractPage< 3736 ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { 3737 ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)3738 private ListLocationsPage( 3739 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 3740 ListLocationsResponse response) { 3741 super(context, response); 3742 } 3743 createEmptyPage()3744 private static ListLocationsPage createEmptyPage() { 3745 return new ListLocationsPage(null, null); 3746 } 3747 3748 @Override createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)3749 protected ListLocationsPage createPage( 3750 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 3751 ListLocationsResponse response) { 3752 return new ListLocationsPage(context, response); 3753 } 3754 3755 @Override createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)3756 public ApiFuture<ListLocationsPage> createPageAsync( 3757 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 3758 ApiFuture<ListLocationsResponse> futureResponse) { 3759 return super.createPageAsync(context, futureResponse); 3760 } 3761 } 3762 3763 public static class ListLocationsFixedSizeCollection 3764 extends AbstractFixedSizeCollection< 3765 ListLocationsRequest, 3766 ListLocationsResponse, 3767 Location, 3768 ListLocationsPage, 3769 ListLocationsFixedSizeCollection> { 3770 ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)3771 private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { 3772 super(pages, collectionSize); 3773 } 3774 createEmptyCollection()3775 private static ListLocationsFixedSizeCollection createEmptyCollection() { 3776 return new ListLocationsFixedSizeCollection(null, 0); 3777 } 3778 3779 @Override createCollection( List<ListLocationsPage> pages, int collectionSize)3780 protected ListLocationsFixedSizeCollection createCollection( 3781 List<ListLocationsPage> pages, int collectionSize) { 3782 return new ListLocationsFixedSizeCollection(pages, collectionSize); 3783 } 3784 } 3785 } 3786