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