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.EndpointServiceStub; 30 import com.google.cloud.aiplatform.v1.stub.EndpointServiceStubSettings; 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.Map; 48 import java.util.concurrent.TimeUnit; 49 import javax.annotation.Generated; 50 51 // AUTO-GENERATED DOCUMENTATION AND CLASS. 52 /** 53 * Service Description: A service for managing Vertex AI's Endpoints. 54 * 55 * <p>This class provides the ability to make remote calls to the backing service through method 56 * calls that map to API methods. Sample code to get started: 57 * 58 * <pre>{@code 59 * // This snippet has been automatically generated and should be regarded as a code template only. 60 * // It will require modifications to work: 61 * // - It may require correct/in-range values for request initialization. 62 * // - It may require specifying regional endpoints when creating the service client as shown in 63 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 64 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 65 * EndpointName name = 66 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 67 * Endpoint response = endpointServiceClient.getEndpoint(name); 68 * } 69 * }</pre> 70 * 71 * <p>Note: close() needs to be called on the EndpointServiceClient object to clean up resources 72 * such as threads. In the example above, try-with-resources is used, which automatically calls 73 * close(). 74 * 75 * <p>The surface of this class includes several types of Java methods for each of the API's 76 * methods: 77 * 78 * <ol> 79 * <li>A "flattened" method. With this type of method, the fields of the request type have been 80 * converted into function parameters. It may be the case that not all fields are available as 81 * parameters, and not every API method will have a flattened method entry point. 82 * <li>A "request object" method. This type of method only takes one parameter, a request object, 83 * which must be constructed before the call. Not every API method will have a request object 84 * method. 85 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 86 * callable object, which can be used to initiate calls to the service. 87 * </ol> 88 * 89 * <p>See the individual methods for example code. 90 * 91 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 92 * these names, this class includes a format method for each type of name, and additionally a parse 93 * method to extract the individual identifiers contained within names that are returned. 94 * 95 * <p>This class can be customized by passing in a custom instance of EndpointServiceSettings to 96 * create(). For example: 97 * 98 * <p>To customize credentials: 99 * 100 * <pre>{@code 101 * // This snippet has been automatically generated and should be regarded as a code template only. 102 * // It will require modifications to work: 103 * // - It may require correct/in-range values for request initialization. 104 * // - It may require specifying regional endpoints when creating the service client as shown in 105 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 106 * EndpointServiceSettings endpointServiceSettings = 107 * EndpointServiceSettings.newBuilder() 108 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 109 * .build(); 110 * EndpointServiceClient endpointServiceClient = 111 * EndpointServiceClient.create(endpointServiceSettings); 112 * }</pre> 113 * 114 * <p>To customize the endpoint: 115 * 116 * <pre>{@code 117 * // This snippet has been automatically generated and should be regarded as a code template only. 118 * // It will require modifications to work: 119 * // - It may require correct/in-range values for request initialization. 120 * // - It may require specifying regional endpoints when creating the service client as shown in 121 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 122 * EndpointServiceSettings endpointServiceSettings = 123 * EndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 124 * EndpointServiceClient endpointServiceClient = 125 * EndpointServiceClient.create(endpointServiceSettings); 126 * }</pre> 127 * 128 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 129 */ 130 @Generated("by gapic-generator-java") 131 public class EndpointServiceClient implements BackgroundResource { 132 private final EndpointServiceSettings settings; 133 private final EndpointServiceStub stub; 134 private final OperationsClient operationsClient; 135 136 /** Constructs an instance of EndpointServiceClient with default settings. */ create()137 public static final EndpointServiceClient create() throws IOException { 138 return create(EndpointServiceSettings.newBuilder().build()); 139 } 140 141 /** 142 * Constructs an instance of EndpointServiceClient, using the given settings. The channels are 143 * created based on the settings passed in, or defaults for any settings that are not set. 144 */ create(EndpointServiceSettings settings)145 public static final EndpointServiceClient create(EndpointServiceSettings settings) 146 throws IOException { 147 return new EndpointServiceClient(settings); 148 } 149 150 /** 151 * Constructs an instance of EndpointServiceClient, using the given stub for making calls. This is 152 * for advanced usage - prefer using create(EndpointServiceSettings). 153 */ create(EndpointServiceStub stub)154 public static final EndpointServiceClient create(EndpointServiceStub stub) { 155 return new EndpointServiceClient(stub); 156 } 157 158 /** 159 * Constructs an instance of EndpointServiceClient, using the given settings. This is protected so 160 * that it is easy to make a subclass, but otherwise, the static factory methods should be 161 * preferred. 162 */ EndpointServiceClient(EndpointServiceSettings settings)163 protected EndpointServiceClient(EndpointServiceSettings settings) throws IOException { 164 this.settings = settings; 165 this.stub = ((EndpointServiceStubSettings) settings.getStubSettings()).createStub(); 166 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 167 } 168 EndpointServiceClient(EndpointServiceStub stub)169 protected EndpointServiceClient(EndpointServiceStub stub) { 170 this.settings = null; 171 this.stub = stub; 172 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 173 } 174 getSettings()175 public final EndpointServiceSettings getSettings() { 176 return settings; 177 } 178 getStub()179 public EndpointServiceStub getStub() { 180 return stub; 181 } 182 183 /** 184 * Returns the OperationsClient that can be used to query the status of a long-running operation 185 * returned by another API method call. 186 */ getOperationsClient()187 public final OperationsClient getOperationsClient() { 188 return operationsClient; 189 } 190 191 // AUTO-GENERATED DOCUMENTATION AND METHOD. 192 /** 193 * Creates an Endpoint. 194 * 195 * <p>Sample code: 196 * 197 * <pre>{@code 198 * // This snippet has been automatically generated and should be regarded as a code template only. 199 * // It will require modifications to work: 200 * // - It may require correct/in-range values for request initialization. 201 * // - It may require specifying regional endpoints when creating the service client as shown in 202 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 203 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 204 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 205 * Endpoint endpoint = Endpoint.newBuilder().build(); 206 * Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); 207 * } 208 * }</pre> 209 * 210 * @param parent Required. The resource name of the Location to create the Endpoint in. Format: 211 * `projects/{project}/locations/{location}` 212 * @param endpoint Required. The Endpoint to create. 213 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 214 */ createEndpointAsync( LocationName parent, Endpoint endpoint)215 public final OperationFuture<Endpoint, CreateEndpointOperationMetadata> createEndpointAsync( 216 LocationName parent, Endpoint endpoint) { 217 CreateEndpointRequest request = 218 CreateEndpointRequest.newBuilder() 219 .setParent(parent == null ? null : parent.toString()) 220 .setEndpoint(endpoint) 221 .build(); 222 return createEndpointAsync(request); 223 } 224 225 // AUTO-GENERATED DOCUMENTATION AND METHOD. 226 /** 227 * Creates an Endpoint. 228 * 229 * <p>Sample code: 230 * 231 * <pre>{@code 232 * // This snippet has been automatically generated and should be regarded as a code template only. 233 * // It will require modifications to work: 234 * // - It may require correct/in-range values for request initialization. 235 * // - It may require specifying regional endpoints when creating the service client as shown in 236 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 237 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 238 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 239 * Endpoint endpoint = Endpoint.newBuilder().build(); 240 * Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get(); 241 * } 242 * }</pre> 243 * 244 * @param parent Required. The resource name of the Location to create the Endpoint in. Format: 245 * `projects/{project}/locations/{location}` 246 * @param endpoint Required. The Endpoint to create. 247 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 248 */ createEndpointAsync( String parent, Endpoint endpoint)249 public final OperationFuture<Endpoint, CreateEndpointOperationMetadata> createEndpointAsync( 250 String parent, Endpoint endpoint) { 251 CreateEndpointRequest request = 252 CreateEndpointRequest.newBuilder().setParent(parent).setEndpoint(endpoint).build(); 253 return createEndpointAsync(request); 254 } 255 256 // AUTO-GENERATED DOCUMENTATION AND METHOD. 257 /** 258 * Creates an Endpoint. 259 * 260 * <p>Sample code: 261 * 262 * <pre>{@code 263 * // This snippet has been automatically generated and should be regarded as a code template only. 264 * // It will require modifications to work: 265 * // - It may require correct/in-range values for request initialization. 266 * // - It may require specifying regional endpoints when creating the service client as shown in 267 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 268 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 269 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 270 * Endpoint endpoint = Endpoint.newBuilder().build(); 271 * String endpointId = "endpointId-1837754992"; 272 * Endpoint response = 273 * endpointServiceClient.createEndpointAsync(parent, endpoint, endpointId).get(); 274 * } 275 * }</pre> 276 * 277 * @param parent Required. The resource name of the Location to create the Endpoint in. Format: 278 * `projects/{project}/locations/{location}` 279 * @param endpoint Required. The Endpoint to create. 280 * @param endpointId Immutable. The ID to use for endpoint, which will become the final component 281 * of the endpoint resource name. If not provided, Vertex AI will generate a value for this 282 * ID. 283 * <p>If the first character is a letter, this value may be up to 63 characters, and valid 284 * characters are `[a-z0-9-]`. The last character must be a letter or number. 285 * <p>If the first character is a number, this value may be up to 9 characters, and valid 286 * characters are `[0-9]` with no leading zeros. 287 * <p>When using HTTP/JSON, this field is populated based on a query string argument, such as 288 * `?endpoint_id=12345`. This is the fallback for fields that are not included in either the 289 * URI or the body. 290 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 291 */ createEndpointAsync( LocationName parent, Endpoint endpoint, String endpointId)292 public final OperationFuture<Endpoint, CreateEndpointOperationMetadata> createEndpointAsync( 293 LocationName parent, Endpoint endpoint, String endpointId) { 294 CreateEndpointRequest request = 295 CreateEndpointRequest.newBuilder() 296 .setParent(parent == null ? null : parent.toString()) 297 .setEndpoint(endpoint) 298 .setEndpointId(endpointId) 299 .build(); 300 return createEndpointAsync(request); 301 } 302 303 // AUTO-GENERATED DOCUMENTATION AND METHOD. 304 /** 305 * Creates an Endpoint. 306 * 307 * <p>Sample code: 308 * 309 * <pre>{@code 310 * // This snippet has been automatically generated and should be regarded as a code template only. 311 * // It will require modifications to work: 312 * // - It may require correct/in-range values for request initialization. 313 * // - It may require specifying regional endpoints when creating the service client as shown in 314 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 315 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 316 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 317 * Endpoint endpoint = Endpoint.newBuilder().build(); 318 * String endpointId = "endpointId-1837754992"; 319 * Endpoint response = 320 * endpointServiceClient.createEndpointAsync(parent, endpoint, endpointId).get(); 321 * } 322 * }</pre> 323 * 324 * @param parent Required. The resource name of the Location to create the Endpoint in. Format: 325 * `projects/{project}/locations/{location}` 326 * @param endpoint Required. The Endpoint to create. 327 * @param endpointId Immutable. The ID to use for endpoint, which will become the final component 328 * of the endpoint resource name. If not provided, Vertex AI will generate a value for this 329 * ID. 330 * <p>If the first character is a letter, this value may be up to 63 characters, and valid 331 * characters are `[a-z0-9-]`. The last character must be a letter or number. 332 * <p>If the first character is a number, this value may be up to 9 characters, and valid 333 * characters are `[0-9]` with no leading zeros. 334 * <p>When using HTTP/JSON, this field is populated based on a query string argument, such as 335 * `?endpoint_id=12345`. This is the fallback for fields that are not included in either the 336 * URI or the body. 337 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 338 */ createEndpointAsync( String parent, Endpoint endpoint, String endpointId)339 public final OperationFuture<Endpoint, CreateEndpointOperationMetadata> createEndpointAsync( 340 String parent, Endpoint endpoint, String endpointId) { 341 CreateEndpointRequest request = 342 CreateEndpointRequest.newBuilder() 343 .setParent(parent) 344 .setEndpoint(endpoint) 345 .setEndpointId(endpointId) 346 .build(); 347 return createEndpointAsync(request); 348 } 349 350 // AUTO-GENERATED DOCUMENTATION AND METHOD. 351 /** 352 * Creates an Endpoint. 353 * 354 * <p>Sample code: 355 * 356 * <pre>{@code 357 * // This snippet has been automatically generated and should be regarded as a code template only. 358 * // It will require modifications to work: 359 * // - It may require correct/in-range values for request initialization. 360 * // - It may require specifying regional endpoints when creating the service client as shown in 361 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 362 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 363 * CreateEndpointRequest request = 364 * CreateEndpointRequest.newBuilder() 365 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 366 * .setEndpoint(Endpoint.newBuilder().build()) 367 * .setEndpointId("endpointId-1837754992") 368 * .build(); 369 * Endpoint response = endpointServiceClient.createEndpointAsync(request).get(); 370 * } 371 * }</pre> 372 * 373 * @param request The request object containing all of the parameters for the API call. 374 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 375 */ createEndpointAsync( CreateEndpointRequest request)376 public final OperationFuture<Endpoint, CreateEndpointOperationMetadata> createEndpointAsync( 377 CreateEndpointRequest request) { 378 return createEndpointOperationCallable().futureCall(request); 379 } 380 381 // AUTO-GENERATED DOCUMENTATION AND METHOD. 382 /** 383 * Creates an Endpoint. 384 * 385 * <p>Sample code: 386 * 387 * <pre>{@code 388 * // This snippet has been automatically generated and should be regarded as a code template only. 389 * // It will require modifications to work: 390 * // - It may require correct/in-range values for request initialization. 391 * // - It may require specifying regional endpoints when creating the service client as shown in 392 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 393 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 394 * CreateEndpointRequest request = 395 * CreateEndpointRequest.newBuilder() 396 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 397 * .setEndpoint(Endpoint.newBuilder().build()) 398 * .setEndpointId("endpointId-1837754992") 399 * .build(); 400 * OperationFuture<Endpoint, CreateEndpointOperationMetadata> future = 401 * endpointServiceClient.createEndpointOperationCallable().futureCall(request); 402 * // Do something. 403 * Endpoint response = future.get(); 404 * } 405 * }</pre> 406 */ 407 public final OperationCallable<CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationCallable()408 createEndpointOperationCallable() { 409 return stub.createEndpointOperationCallable(); 410 } 411 412 // AUTO-GENERATED DOCUMENTATION AND METHOD. 413 /** 414 * Creates an Endpoint. 415 * 416 * <p>Sample code: 417 * 418 * <pre>{@code 419 * // This snippet has been automatically generated and should be regarded as a code template only. 420 * // It will require modifications to work: 421 * // - It may require correct/in-range values for request initialization. 422 * // - It may require specifying regional endpoints when creating the service client as shown in 423 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 424 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 425 * CreateEndpointRequest request = 426 * CreateEndpointRequest.newBuilder() 427 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 428 * .setEndpoint(Endpoint.newBuilder().build()) 429 * .setEndpointId("endpointId-1837754992") 430 * .build(); 431 * ApiFuture<Operation> future = 432 * endpointServiceClient.createEndpointCallable().futureCall(request); 433 * // Do something. 434 * Operation response = future.get(); 435 * } 436 * }</pre> 437 */ createEndpointCallable()438 public final UnaryCallable<CreateEndpointRequest, Operation> createEndpointCallable() { 439 return stub.createEndpointCallable(); 440 } 441 442 // AUTO-GENERATED DOCUMENTATION AND METHOD. 443 /** 444 * Gets an Endpoint. 445 * 446 * <p>Sample code: 447 * 448 * <pre>{@code 449 * // This snippet has been automatically generated and should be regarded as a code template only. 450 * // It will require modifications to work: 451 * // - It may require correct/in-range values for request initialization. 452 * // - It may require specifying regional endpoints when creating the service client as shown in 453 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 454 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 455 * EndpointName name = 456 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 457 * Endpoint response = endpointServiceClient.getEndpoint(name); 458 * } 459 * }</pre> 460 * 461 * @param name Required. The name of the Endpoint resource. Format: 462 * `projects/{project}/locations/{location}/endpoints/{endpoint}` 463 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 464 */ getEndpoint(EndpointName name)465 public final Endpoint getEndpoint(EndpointName name) { 466 GetEndpointRequest request = 467 GetEndpointRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 468 return getEndpoint(request); 469 } 470 471 // AUTO-GENERATED DOCUMENTATION AND METHOD. 472 /** 473 * Gets an Endpoint. 474 * 475 * <p>Sample code: 476 * 477 * <pre>{@code 478 * // This snippet has been automatically generated and should be regarded as a code template only. 479 * // It will require modifications to work: 480 * // - It may require correct/in-range values for request initialization. 481 * // - It may require specifying regional endpoints when creating the service client as shown in 482 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 483 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 484 * String name = 485 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") 486 * .toString(); 487 * Endpoint response = endpointServiceClient.getEndpoint(name); 488 * } 489 * }</pre> 490 * 491 * @param name Required. The name of the Endpoint resource. Format: 492 * `projects/{project}/locations/{location}/endpoints/{endpoint}` 493 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 494 */ getEndpoint(String name)495 public final Endpoint getEndpoint(String name) { 496 GetEndpointRequest request = GetEndpointRequest.newBuilder().setName(name).build(); 497 return getEndpoint(request); 498 } 499 500 // AUTO-GENERATED DOCUMENTATION AND METHOD. 501 /** 502 * Gets an Endpoint. 503 * 504 * <p>Sample code: 505 * 506 * <pre>{@code 507 * // This snippet has been automatically generated and should be regarded as a code template only. 508 * // It will require modifications to work: 509 * // - It may require correct/in-range values for request initialization. 510 * // - It may require specifying regional endpoints when creating the service client as shown in 511 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 512 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 513 * GetEndpointRequest request = 514 * GetEndpointRequest.newBuilder() 515 * .setName( 516 * EndpointName.ofProjectLocationEndpointName( 517 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 518 * .toString()) 519 * .build(); 520 * Endpoint response = endpointServiceClient.getEndpoint(request); 521 * } 522 * }</pre> 523 * 524 * @param request The request object containing all of the parameters for the API call. 525 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 526 */ getEndpoint(GetEndpointRequest request)527 public final Endpoint getEndpoint(GetEndpointRequest request) { 528 return getEndpointCallable().call(request); 529 } 530 531 // AUTO-GENERATED DOCUMENTATION AND METHOD. 532 /** 533 * Gets an Endpoint. 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 544 * GetEndpointRequest request = 545 * GetEndpointRequest.newBuilder() 546 * .setName( 547 * EndpointName.ofProjectLocationEndpointName( 548 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 549 * .toString()) 550 * .build(); 551 * ApiFuture<Endpoint> future = endpointServiceClient.getEndpointCallable().futureCall(request); 552 * // Do something. 553 * Endpoint response = future.get(); 554 * } 555 * }</pre> 556 */ getEndpointCallable()557 public final UnaryCallable<GetEndpointRequest, Endpoint> getEndpointCallable() { 558 return stub.getEndpointCallable(); 559 } 560 561 // AUTO-GENERATED DOCUMENTATION AND METHOD. 562 /** 563 * Lists Endpoints in a Location. 564 * 565 * <p>Sample code: 566 * 567 * <pre>{@code 568 * // This snippet has been automatically generated and should be regarded as a code template only. 569 * // It will require modifications to work: 570 * // - It may require correct/in-range values for request initialization. 571 * // - It may require specifying regional endpoints when creating the service client as shown in 572 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 573 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 574 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 575 * for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { 576 * // doThingsWith(element); 577 * } 578 * } 579 * }</pre> 580 * 581 * @param parent Required. The resource name of the Location from which to list the Endpoints. 582 * Format: `projects/{project}/locations/{location}` 583 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 584 */ listEndpoints(LocationName parent)585 public final ListEndpointsPagedResponse listEndpoints(LocationName parent) { 586 ListEndpointsRequest request = 587 ListEndpointsRequest.newBuilder() 588 .setParent(parent == null ? null : parent.toString()) 589 .build(); 590 return listEndpoints(request); 591 } 592 593 // AUTO-GENERATED DOCUMENTATION AND METHOD. 594 /** 595 * Lists Endpoints in a Location. 596 * 597 * <p>Sample code: 598 * 599 * <pre>{@code 600 * // This snippet has been automatically generated and should be regarded as a code template only. 601 * // It will require modifications to work: 602 * // - It may require correct/in-range values for request initialization. 603 * // - It may require specifying regional endpoints when creating the service client as shown in 604 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 605 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 606 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 607 * for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) { 608 * // doThingsWith(element); 609 * } 610 * } 611 * }</pre> 612 * 613 * @param parent Required. The resource name of the Location from which to list the Endpoints. 614 * Format: `projects/{project}/locations/{location}` 615 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 616 */ listEndpoints(String parent)617 public final ListEndpointsPagedResponse listEndpoints(String parent) { 618 ListEndpointsRequest request = ListEndpointsRequest.newBuilder().setParent(parent).build(); 619 return listEndpoints(request); 620 } 621 622 // AUTO-GENERATED DOCUMENTATION AND METHOD. 623 /** 624 * Lists Endpoints in a Location. 625 * 626 * <p>Sample code: 627 * 628 * <pre>{@code 629 * // This snippet has been automatically generated and should be regarded as a code template only. 630 * // It will require modifications to work: 631 * // - It may require correct/in-range values for request initialization. 632 * // - It may require specifying regional endpoints when creating the service client as shown in 633 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 634 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 635 * ListEndpointsRequest request = 636 * ListEndpointsRequest.newBuilder() 637 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 638 * .setFilter("filter-1274492040") 639 * .setPageSize(883849137) 640 * .setPageToken("pageToken873572522") 641 * .setReadMask(FieldMask.newBuilder().build()) 642 * .setOrderBy("orderBy-1207110587") 643 * .build(); 644 * for (Endpoint element : endpointServiceClient.listEndpoints(request).iterateAll()) { 645 * // doThingsWith(element); 646 * } 647 * } 648 * }</pre> 649 * 650 * @param request The request object containing all of the parameters for the API call. 651 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 652 */ listEndpoints(ListEndpointsRequest request)653 public final ListEndpointsPagedResponse listEndpoints(ListEndpointsRequest request) { 654 return listEndpointsPagedCallable().call(request); 655 } 656 657 // AUTO-GENERATED DOCUMENTATION AND METHOD. 658 /** 659 * Lists Endpoints in a Location. 660 * 661 * <p>Sample code: 662 * 663 * <pre>{@code 664 * // This snippet has been automatically generated and should be regarded as a code template only. 665 * // It will require modifications to work: 666 * // - It may require correct/in-range values for request initialization. 667 * // - It may require specifying regional endpoints when creating the service client as shown in 668 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 669 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 670 * ListEndpointsRequest request = 671 * ListEndpointsRequest.newBuilder() 672 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 673 * .setFilter("filter-1274492040") 674 * .setPageSize(883849137) 675 * .setPageToken("pageToken873572522") 676 * .setReadMask(FieldMask.newBuilder().build()) 677 * .setOrderBy("orderBy-1207110587") 678 * .build(); 679 * ApiFuture<Endpoint> future = 680 * endpointServiceClient.listEndpointsPagedCallable().futureCall(request); 681 * // Do something. 682 * for (Endpoint element : future.get().iterateAll()) { 683 * // doThingsWith(element); 684 * } 685 * } 686 * }</pre> 687 */ 688 public final UnaryCallable<ListEndpointsRequest, ListEndpointsPagedResponse> listEndpointsPagedCallable()689 listEndpointsPagedCallable() { 690 return stub.listEndpointsPagedCallable(); 691 } 692 693 // AUTO-GENERATED DOCUMENTATION AND METHOD. 694 /** 695 * Lists Endpoints in a Location. 696 * 697 * <p>Sample code: 698 * 699 * <pre>{@code 700 * // This snippet has been automatically generated and should be regarded as a code template only. 701 * // It will require modifications to work: 702 * // - It may require correct/in-range values for request initialization. 703 * // - It may require specifying regional endpoints when creating the service client as shown in 704 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 705 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 706 * ListEndpointsRequest request = 707 * ListEndpointsRequest.newBuilder() 708 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 709 * .setFilter("filter-1274492040") 710 * .setPageSize(883849137) 711 * .setPageToken("pageToken873572522") 712 * .setReadMask(FieldMask.newBuilder().build()) 713 * .setOrderBy("orderBy-1207110587") 714 * .build(); 715 * while (true) { 716 * ListEndpointsResponse response = 717 * endpointServiceClient.listEndpointsCallable().call(request); 718 * for (Endpoint element : response.getEndpointsList()) { 719 * // doThingsWith(element); 720 * } 721 * String nextPageToken = response.getNextPageToken(); 722 * if (!Strings.isNullOrEmpty(nextPageToken)) { 723 * request = request.toBuilder().setPageToken(nextPageToken).build(); 724 * } else { 725 * break; 726 * } 727 * } 728 * } 729 * }</pre> 730 */ listEndpointsCallable()731 public final UnaryCallable<ListEndpointsRequest, ListEndpointsResponse> listEndpointsCallable() { 732 return stub.listEndpointsCallable(); 733 } 734 735 // AUTO-GENERATED DOCUMENTATION AND METHOD. 736 /** 737 * Updates an Endpoint. 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 748 * Endpoint endpoint = Endpoint.newBuilder().build(); 749 * FieldMask updateMask = FieldMask.newBuilder().build(); 750 * Endpoint response = endpointServiceClient.updateEndpoint(endpoint, updateMask); 751 * } 752 * }</pre> 753 * 754 * @param endpoint Required. The Endpoint which replaces the resource on the server. 755 * @param updateMask Required. The update mask applies to the resource. See 756 * [google.protobuf.FieldMask][google.protobuf.FieldMask]. 757 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 758 */ updateEndpoint(Endpoint endpoint, FieldMask updateMask)759 public final Endpoint updateEndpoint(Endpoint endpoint, FieldMask updateMask) { 760 UpdateEndpointRequest request = 761 UpdateEndpointRequest.newBuilder().setEndpoint(endpoint).setUpdateMask(updateMask).build(); 762 return updateEndpoint(request); 763 } 764 765 // AUTO-GENERATED DOCUMENTATION AND METHOD. 766 /** 767 * Updates an Endpoint. 768 * 769 * <p>Sample code: 770 * 771 * <pre>{@code 772 * // This snippet has been automatically generated and should be regarded as a code template only. 773 * // It will require modifications to work: 774 * // - It may require correct/in-range values for request initialization. 775 * // - It may require specifying regional endpoints when creating the service client as shown in 776 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 777 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 778 * UpdateEndpointRequest request = 779 * UpdateEndpointRequest.newBuilder() 780 * .setEndpoint(Endpoint.newBuilder().build()) 781 * .setUpdateMask(FieldMask.newBuilder().build()) 782 * .build(); 783 * Endpoint response = endpointServiceClient.updateEndpoint(request); 784 * } 785 * }</pre> 786 * 787 * @param request The request object containing all of the parameters for the API call. 788 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 789 */ updateEndpoint(UpdateEndpointRequest request)790 public final Endpoint updateEndpoint(UpdateEndpointRequest request) { 791 return updateEndpointCallable().call(request); 792 } 793 794 // AUTO-GENERATED DOCUMENTATION AND METHOD. 795 /** 796 * Updates an Endpoint. 797 * 798 * <p>Sample code: 799 * 800 * <pre>{@code 801 * // This snippet has been automatically generated and should be regarded as a code template only. 802 * // It will require modifications to work: 803 * // - It may require correct/in-range values for request initialization. 804 * // - It may require specifying regional endpoints when creating the service client as shown in 805 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 806 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 807 * UpdateEndpointRequest request = 808 * UpdateEndpointRequest.newBuilder() 809 * .setEndpoint(Endpoint.newBuilder().build()) 810 * .setUpdateMask(FieldMask.newBuilder().build()) 811 * .build(); 812 * ApiFuture<Endpoint> future = 813 * endpointServiceClient.updateEndpointCallable().futureCall(request); 814 * // Do something. 815 * Endpoint response = future.get(); 816 * } 817 * }</pre> 818 */ updateEndpointCallable()819 public final UnaryCallable<UpdateEndpointRequest, Endpoint> updateEndpointCallable() { 820 return stub.updateEndpointCallable(); 821 } 822 823 // AUTO-GENERATED DOCUMENTATION AND METHOD. 824 /** 825 * Deletes an Endpoint. 826 * 827 * <p>Sample code: 828 * 829 * <pre>{@code 830 * // This snippet has been automatically generated and should be regarded as a code template only. 831 * // It will require modifications to work: 832 * // - It may require correct/in-range values for request initialization. 833 * // - It may require specifying regional endpoints when creating the service client as shown in 834 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 835 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 836 * EndpointName name = 837 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 838 * endpointServiceClient.deleteEndpointAsync(name).get(); 839 * } 840 * }</pre> 841 * 842 * @param name Required. The name of the Endpoint resource to be deleted. Format: 843 * `projects/{project}/locations/{location}/endpoints/{endpoint}` 844 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 845 */ deleteEndpointAsync( EndpointName name)846 public final OperationFuture<Empty, DeleteOperationMetadata> deleteEndpointAsync( 847 EndpointName name) { 848 DeleteEndpointRequest request = 849 DeleteEndpointRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 850 return deleteEndpointAsync(request); 851 } 852 853 // AUTO-GENERATED DOCUMENTATION AND METHOD. 854 /** 855 * Deletes an Endpoint. 856 * 857 * <p>Sample code: 858 * 859 * <pre>{@code 860 * // This snippet has been automatically generated and should be regarded as a code template only. 861 * // It will require modifications to work: 862 * // - It may require correct/in-range values for request initialization. 863 * // - It may require specifying regional endpoints when creating the service client as shown in 864 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 865 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 866 * String name = 867 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") 868 * .toString(); 869 * endpointServiceClient.deleteEndpointAsync(name).get(); 870 * } 871 * }</pre> 872 * 873 * @param name Required. The name of the Endpoint resource to be deleted. Format: 874 * `projects/{project}/locations/{location}/endpoints/{endpoint}` 875 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 876 */ deleteEndpointAsync(String name)877 public final OperationFuture<Empty, DeleteOperationMetadata> deleteEndpointAsync(String name) { 878 DeleteEndpointRequest request = DeleteEndpointRequest.newBuilder().setName(name).build(); 879 return deleteEndpointAsync(request); 880 } 881 882 // AUTO-GENERATED DOCUMENTATION AND METHOD. 883 /** 884 * Deletes an Endpoint. 885 * 886 * <p>Sample code: 887 * 888 * <pre>{@code 889 * // This snippet has been automatically generated and should be regarded as a code template only. 890 * // It will require modifications to work: 891 * // - It may require correct/in-range values for request initialization. 892 * // - It may require specifying regional endpoints when creating the service client as shown in 893 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 894 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 895 * DeleteEndpointRequest request = 896 * DeleteEndpointRequest.newBuilder() 897 * .setName( 898 * EndpointName.ofProjectLocationEndpointName( 899 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 900 * .toString()) 901 * .build(); 902 * endpointServiceClient.deleteEndpointAsync(request).get(); 903 * } 904 * }</pre> 905 * 906 * @param request The request object containing all of the parameters for the API call. 907 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 908 */ deleteEndpointAsync( DeleteEndpointRequest request)909 public final OperationFuture<Empty, DeleteOperationMetadata> deleteEndpointAsync( 910 DeleteEndpointRequest request) { 911 return deleteEndpointOperationCallable().futureCall(request); 912 } 913 914 // AUTO-GENERATED DOCUMENTATION AND METHOD. 915 /** 916 * Deletes an Endpoint. 917 * 918 * <p>Sample code: 919 * 920 * <pre>{@code 921 * // This snippet has been automatically generated and should be regarded as a code template only. 922 * // It will require modifications to work: 923 * // - It may require correct/in-range values for request initialization. 924 * // - It may require specifying regional endpoints when creating the service client as shown in 925 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 926 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 927 * DeleteEndpointRequest request = 928 * DeleteEndpointRequest.newBuilder() 929 * .setName( 930 * EndpointName.ofProjectLocationEndpointName( 931 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 932 * .toString()) 933 * .build(); 934 * OperationFuture<Empty, DeleteOperationMetadata> future = 935 * endpointServiceClient.deleteEndpointOperationCallable().futureCall(request); 936 * // Do something. 937 * future.get(); 938 * } 939 * }</pre> 940 */ 941 public final OperationCallable<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationCallable()942 deleteEndpointOperationCallable() { 943 return stub.deleteEndpointOperationCallable(); 944 } 945 946 // AUTO-GENERATED DOCUMENTATION AND METHOD. 947 /** 948 * Deletes an Endpoint. 949 * 950 * <p>Sample code: 951 * 952 * <pre>{@code 953 * // This snippet has been automatically generated and should be regarded as a code template only. 954 * // It will require modifications to work: 955 * // - It may require correct/in-range values for request initialization. 956 * // - It may require specifying regional endpoints when creating the service client as shown in 957 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 958 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 959 * DeleteEndpointRequest request = 960 * DeleteEndpointRequest.newBuilder() 961 * .setName( 962 * EndpointName.ofProjectLocationEndpointName( 963 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 964 * .toString()) 965 * .build(); 966 * ApiFuture<Operation> future = 967 * endpointServiceClient.deleteEndpointCallable().futureCall(request); 968 * // Do something. 969 * future.get(); 970 * } 971 * }</pre> 972 */ deleteEndpointCallable()973 public final UnaryCallable<DeleteEndpointRequest, Operation> deleteEndpointCallable() { 974 return stub.deleteEndpointCallable(); 975 } 976 977 // AUTO-GENERATED DOCUMENTATION AND METHOD. 978 /** 979 * Deploys a Model into this Endpoint, creating a DeployedModel within it. 980 * 981 * <p>Sample code: 982 * 983 * <pre>{@code 984 * // This snippet has been automatically generated and should be regarded as a code template only. 985 * // It will require modifications to work: 986 * // - It may require correct/in-range values for request initialization. 987 * // - It may require specifying regional endpoints when creating the service client as shown in 988 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 989 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 990 * EndpointName endpoint = 991 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 992 * DeployedModel deployedModel = DeployedModel.newBuilder().build(); 993 * Map<String, Integer> trafficSplit = new HashMap<>(); 994 * DeployModelResponse response = 995 * endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); 996 * } 997 * }</pre> 998 * 999 * @param endpoint Required. The name of the Endpoint resource into which to deploy a Model. 1000 * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1001 * @param deployedModel Required. The DeployedModel to be created within the Endpoint. Note that 1002 * [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] must be updated 1003 * for the DeployedModel to start receiving traffic, either as part of this call, or via 1004 * [EndpointService.UpdateEndpoint][google.cloud.aiplatform.v1.EndpointService.UpdateEndpoint]. 1005 * @param trafficSplit A map from a DeployedModel's ID to the percentage of this Endpoint's 1006 * traffic that should be forwarded to that DeployedModel. 1007 * <p>If this field is non-empty, then the Endpoint's 1008 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with 1009 * it. To refer to the ID of the just being deployed Model, a "0" should be used, and the 1010 * actual ID of the new DeployedModel will be filled in its place by this method. The traffic 1011 * percentage values must add up to 100. 1012 * <p>If this field is empty, then the Endpoint's 1013 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] is not updated. 1014 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1015 */ deployModelAsync( EndpointName endpoint, DeployedModel deployedModel, Map<String, Integer> trafficSplit)1016 public final OperationFuture<DeployModelResponse, DeployModelOperationMetadata> deployModelAsync( 1017 EndpointName endpoint, DeployedModel deployedModel, Map<String, Integer> trafficSplit) { 1018 DeployModelRequest request = 1019 DeployModelRequest.newBuilder() 1020 .setEndpoint(endpoint == null ? null : endpoint.toString()) 1021 .setDeployedModel(deployedModel) 1022 .putAllTrafficSplit(trafficSplit) 1023 .build(); 1024 return deployModelAsync(request); 1025 } 1026 1027 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1028 /** 1029 * Deploys a Model into this Endpoint, creating a DeployedModel within it. 1030 * 1031 * <p>Sample code: 1032 * 1033 * <pre>{@code 1034 * // This snippet has been automatically generated and should be regarded as a code template only. 1035 * // It will require modifications to work: 1036 * // - It may require correct/in-range values for request initialization. 1037 * // - It may require specifying regional endpoints when creating the service client as shown in 1038 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1039 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1040 * String endpoint = 1041 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1042 * .toString(); 1043 * DeployedModel deployedModel = DeployedModel.newBuilder().build(); 1044 * Map<String, Integer> trafficSplit = new HashMap<>(); 1045 * DeployModelResponse response = 1046 * endpointServiceClient.deployModelAsync(endpoint, deployedModel, trafficSplit).get(); 1047 * } 1048 * }</pre> 1049 * 1050 * @param endpoint Required. The name of the Endpoint resource into which to deploy a Model. 1051 * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1052 * @param deployedModel Required. The DeployedModel to be created within the Endpoint. Note that 1053 * [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] must be updated 1054 * for the DeployedModel to start receiving traffic, either as part of this call, or via 1055 * [EndpointService.UpdateEndpoint][google.cloud.aiplatform.v1.EndpointService.UpdateEndpoint]. 1056 * @param trafficSplit A map from a DeployedModel's ID to the percentage of this Endpoint's 1057 * traffic that should be forwarded to that DeployedModel. 1058 * <p>If this field is non-empty, then the Endpoint's 1059 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with 1060 * it. To refer to the ID of the just being deployed Model, a "0" should be used, and the 1061 * actual ID of the new DeployedModel will be filled in its place by this method. The traffic 1062 * percentage values must add up to 100. 1063 * <p>If this field is empty, then the Endpoint's 1064 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] is not updated. 1065 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1066 */ deployModelAsync( String endpoint, DeployedModel deployedModel, Map<String, Integer> trafficSplit)1067 public final OperationFuture<DeployModelResponse, DeployModelOperationMetadata> deployModelAsync( 1068 String endpoint, DeployedModel deployedModel, Map<String, Integer> trafficSplit) { 1069 DeployModelRequest request = 1070 DeployModelRequest.newBuilder() 1071 .setEndpoint(endpoint) 1072 .setDeployedModel(deployedModel) 1073 .putAllTrafficSplit(trafficSplit) 1074 .build(); 1075 return deployModelAsync(request); 1076 } 1077 1078 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1079 /** 1080 * Deploys a Model into this Endpoint, creating a DeployedModel within it. 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1091 * DeployModelRequest request = 1092 * DeployModelRequest.newBuilder() 1093 * .setEndpoint( 1094 * EndpointName.ofProjectLocationEndpointName( 1095 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1096 * .toString()) 1097 * .setDeployedModel(DeployedModel.newBuilder().build()) 1098 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1099 * .build(); 1100 * DeployModelResponse response = endpointServiceClient.deployModelAsync(request).get(); 1101 * } 1102 * }</pre> 1103 * 1104 * @param request The request object containing all of the parameters for the API call. 1105 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1106 */ deployModelAsync( DeployModelRequest request)1107 public final OperationFuture<DeployModelResponse, DeployModelOperationMetadata> deployModelAsync( 1108 DeployModelRequest request) { 1109 return deployModelOperationCallable().futureCall(request); 1110 } 1111 1112 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1113 /** 1114 * Deploys a Model into this Endpoint, creating a DeployedModel within it. 1115 * 1116 * <p>Sample code: 1117 * 1118 * <pre>{@code 1119 * // This snippet has been automatically generated and should be regarded as a code template only. 1120 * // It will require modifications to work: 1121 * // - It may require correct/in-range values for request initialization. 1122 * // - It may require specifying regional endpoints when creating the service client as shown in 1123 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1124 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1125 * DeployModelRequest request = 1126 * DeployModelRequest.newBuilder() 1127 * .setEndpoint( 1128 * EndpointName.ofProjectLocationEndpointName( 1129 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1130 * .toString()) 1131 * .setDeployedModel(DeployedModel.newBuilder().build()) 1132 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1133 * .build(); 1134 * OperationFuture<DeployModelResponse, DeployModelOperationMetadata> future = 1135 * endpointServiceClient.deployModelOperationCallable().futureCall(request); 1136 * // Do something. 1137 * DeployModelResponse response = future.get(); 1138 * } 1139 * }</pre> 1140 */ 1141 public final OperationCallable< 1142 DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationCallable()1143 deployModelOperationCallable() { 1144 return stub.deployModelOperationCallable(); 1145 } 1146 1147 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1148 /** 1149 * Deploys a Model into this Endpoint, creating a DeployedModel within it. 1150 * 1151 * <p>Sample code: 1152 * 1153 * <pre>{@code 1154 * // This snippet has been automatically generated and should be regarded as a code template only. 1155 * // It will require modifications to work: 1156 * // - It may require correct/in-range values for request initialization. 1157 * // - It may require specifying regional endpoints when creating the service client as shown in 1158 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1159 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1160 * DeployModelRequest request = 1161 * DeployModelRequest.newBuilder() 1162 * .setEndpoint( 1163 * EndpointName.ofProjectLocationEndpointName( 1164 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1165 * .toString()) 1166 * .setDeployedModel(DeployedModel.newBuilder().build()) 1167 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1168 * .build(); 1169 * ApiFuture<Operation> future = endpointServiceClient.deployModelCallable().futureCall(request); 1170 * // Do something. 1171 * Operation response = future.get(); 1172 * } 1173 * }</pre> 1174 */ deployModelCallable()1175 public final UnaryCallable<DeployModelRequest, Operation> deployModelCallable() { 1176 return stub.deployModelCallable(); 1177 } 1178 1179 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1180 /** 1181 * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources 1182 * it's using. 1183 * 1184 * <p>Sample code: 1185 * 1186 * <pre>{@code 1187 * // This snippet has been automatically generated and should be regarded as a code template only. 1188 * // It will require modifications to work: 1189 * // - It may require correct/in-range values for request initialization. 1190 * // - It may require specifying regional endpoints when creating the service client as shown in 1191 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1192 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1193 * EndpointName endpoint = 1194 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 1195 * String deployedModelId = "deployedModelId-1817547906"; 1196 * Map<String, Integer> trafficSplit = new HashMap<>(); 1197 * UndeployModelResponse response = 1198 * endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); 1199 * } 1200 * }</pre> 1201 * 1202 * @param endpoint Required. The name of the Endpoint resource from which to undeploy a Model. 1203 * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1204 * @param deployedModelId Required. The ID of the DeployedModel to be undeployed from the 1205 * Endpoint. 1206 * @param trafficSplit If this field is provided, then the Endpoint's 1207 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with 1208 * it. If last DeployedModel is being undeployed from the Endpoint, the 1209 * [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel 1210 * will be successfully undeployed only if it doesn't have any traffic assigned to it when 1211 * this method executes, or if this field unassigns any traffic to it. 1212 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1213 */ 1214 public final OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> undeployModelAsync( EndpointName endpoint, String deployedModelId, Map<String, Integer> trafficSplit)1215 undeployModelAsync( 1216 EndpointName endpoint, String deployedModelId, Map<String, Integer> trafficSplit) { 1217 UndeployModelRequest request = 1218 UndeployModelRequest.newBuilder() 1219 .setEndpoint(endpoint == null ? null : endpoint.toString()) 1220 .setDeployedModelId(deployedModelId) 1221 .putAllTrafficSplit(trafficSplit) 1222 .build(); 1223 return undeployModelAsync(request); 1224 } 1225 1226 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1227 /** 1228 * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources 1229 * it's using. 1230 * 1231 * <p>Sample code: 1232 * 1233 * <pre>{@code 1234 * // This snippet has been automatically generated and should be regarded as a code template only. 1235 * // It will require modifications to work: 1236 * // - It may require correct/in-range values for request initialization. 1237 * // - It may require specifying regional endpoints when creating the service client as shown in 1238 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1239 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1240 * String endpoint = 1241 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1242 * .toString(); 1243 * String deployedModelId = "deployedModelId-1817547906"; 1244 * Map<String, Integer> trafficSplit = new HashMap<>(); 1245 * UndeployModelResponse response = 1246 * endpointServiceClient.undeployModelAsync(endpoint, deployedModelId, trafficSplit).get(); 1247 * } 1248 * }</pre> 1249 * 1250 * @param endpoint Required. The name of the Endpoint resource from which to undeploy a Model. 1251 * Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1252 * @param deployedModelId Required. The ID of the DeployedModel to be undeployed from the 1253 * Endpoint. 1254 * @param trafficSplit If this field is provided, then the Endpoint's 1255 * [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with 1256 * it. If last DeployedModel is being undeployed from the Endpoint, the 1257 * [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel 1258 * will be successfully undeployed only if it doesn't have any traffic assigned to it when 1259 * this method executes, or if this field unassigns any traffic to it. 1260 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1261 */ 1262 public final OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> undeployModelAsync( String endpoint, String deployedModelId, Map<String, Integer> trafficSplit)1263 undeployModelAsync( 1264 String endpoint, String deployedModelId, Map<String, Integer> trafficSplit) { 1265 UndeployModelRequest request = 1266 UndeployModelRequest.newBuilder() 1267 .setEndpoint(endpoint) 1268 .setDeployedModelId(deployedModelId) 1269 .putAllTrafficSplit(trafficSplit) 1270 .build(); 1271 return undeployModelAsync(request); 1272 } 1273 1274 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1275 /** 1276 * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources 1277 * it's using. 1278 * 1279 * <p>Sample code: 1280 * 1281 * <pre>{@code 1282 * // This snippet has been automatically generated and should be regarded as a code template only. 1283 * // It will require modifications to work: 1284 * // - It may require correct/in-range values for request initialization. 1285 * // - It may require specifying regional endpoints when creating the service client as shown in 1286 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1287 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1288 * UndeployModelRequest request = 1289 * UndeployModelRequest.newBuilder() 1290 * .setEndpoint( 1291 * EndpointName.ofProjectLocationEndpointName( 1292 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1293 * .toString()) 1294 * .setDeployedModelId("deployedModelId-1817547906") 1295 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1296 * .build(); 1297 * UndeployModelResponse response = endpointServiceClient.undeployModelAsync(request).get(); 1298 * } 1299 * }</pre> 1300 * 1301 * @param request The request object containing all of the parameters for the API call. 1302 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1303 */ 1304 public final OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> undeployModelAsync(UndeployModelRequest request)1305 undeployModelAsync(UndeployModelRequest request) { 1306 return undeployModelOperationCallable().futureCall(request); 1307 } 1308 1309 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1310 /** 1311 * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources 1312 * it's using. 1313 * 1314 * <p>Sample code: 1315 * 1316 * <pre>{@code 1317 * // This snippet has been automatically generated and should be regarded as a code template only. 1318 * // It will require modifications to work: 1319 * // - It may require correct/in-range values for request initialization. 1320 * // - It may require specifying regional endpoints when creating the service client as shown in 1321 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1322 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1323 * UndeployModelRequest request = 1324 * UndeployModelRequest.newBuilder() 1325 * .setEndpoint( 1326 * EndpointName.ofProjectLocationEndpointName( 1327 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1328 * .toString()) 1329 * .setDeployedModelId("deployedModelId-1817547906") 1330 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1331 * .build(); 1332 * OperationFuture<UndeployModelResponse, UndeployModelOperationMetadata> future = 1333 * endpointServiceClient.undeployModelOperationCallable().futureCall(request); 1334 * // Do something. 1335 * UndeployModelResponse response = future.get(); 1336 * } 1337 * }</pre> 1338 */ 1339 public final OperationCallable< 1340 UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationCallable()1341 undeployModelOperationCallable() { 1342 return stub.undeployModelOperationCallable(); 1343 } 1344 1345 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1346 /** 1347 * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources 1348 * it's using. 1349 * 1350 * <p>Sample code: 1351 * 1352 * <pre>{@code 1353 * // This snippet has been automatically generated and should be regarded as a code template only. 1354 * // It will require modifications to work: 1355 * // - It may require correct/in-range values for request initialization. 1356 * // - It may require specifying regional endpoints when creating the service client as shown in 1357 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1358 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1359 * UndeployModelRequest request = 1360 * UndeployModelRequest.newBuilder() 1361 * .setEndpoint( 1362 * EndpointName.ofProjectLocationEndpointName( 1363 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1364 * .toString()) 1365 * .setDeployedModelId("deployedModelId-1817547906") 1366 * .putAllTrafficSplit(new HashMap<String, Integer>()) 1367 * .build(); 1368 * ApiFuture<Operation> future = 1369 * endpointServiceClient.undeployModelCallable().futureCall(request); 1370 * // Do something. 1371 * Operation response = future.get(); 1372 * } 1373 * }</pre> 1374 */ undeployModelCallable()1375 public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallable() { 1376 return stub.undeployModelCallable(); 1377 } 1378 1379 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1380 /** 1381 * Updates an existing deployed model. Updatable fields include `min_replica_count`, 1382 * `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and 1383 * `enable_container_logging` (v1beta1 only). 1384 * 1385 * <p>Sample code: 1386 * 1387 * <pre>{@code 1388 * // This snippet has been automatically generated and should be regarded as a code template only. 1389 * // It will require modifications to work: 1390 * // - It may require correct/in-range values for request initialization. 1391 * // - It may require specifying regional endpoints when creating the service client as shown in 1392 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1393 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1394 * EndpointName endpoint = 1395 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]"); 1396 * DeployedModel deployedModel = DeployedModel.newBuilder().build(); 1397 * FieldMask updateMask = FieldMask.newBuilder().build(); 1398 * MutateDeployedModelResponse response = 1399 * endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); 1400 * } 1401 * }</pre> 1402 * 1403 * @param endpoint Required. The name of the Endpoint resource into which to mutate a 1404 * DeployedModel. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1405 * @param deployedModel Required. The DeployedModel to be mutated within the Endpoint. Only the 1406 * following fields can be mutated: 1407 * <ul> 1408 * <li>`min_replica_count` in either 1409 * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or 1410 * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] 1411 * <li>`max_replica_count` in either 1412 * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or 1413 * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] 1414 * <li>[autoscaling_metric_specs][google.cloud.aiplatform.v1.DedicatedResources.autoscaling_metric_specs] 1415 * <li>`disable_container_logging` (v1 only) 1416 * <li>`enable_container_logging` (v1beta1 only) 1417 * </ul> 1418 * 1419 * @param updateMask Required. The update mask applies to the resource. See 1420 * [google.protobuf.FieldMask][google.protobuf.FieldMask]. 1421 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1422 */ 1423 public final OperationFuture<MutateDeployedModelResponse, MutateDeployedModelOperationMetadata> mutateDeployedModelAsync( EndpointName endpoint, DeployedModel deployedModel, FieldMask updateMask)1424 mutateDeployedModelAsync( 1425 EndpointName endpoint, DeployedModel deployedModel, FieldMask updateMask) { 1426 MutateDeployedModelRequest request = 1427 MutateDeployedModelRequest.newBuilder() 1428 .setEndpoint(endpoint == null ? null : endpoint.toString()) 1429 .setDeployedModel(deployedModel) 1430 .setUpdateMask(updateMask) 1431 .build(); 1432 return mutateDeployedModelAsync(request); 1433 } 1434 1435 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1436 /** 1437 * Updates an existing deployed model. Updatable fields include `min_replica_count`, 1438 * `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and 1439 * `enable_container_logging` (v1beta1 only). 1440 * 1441 * <p>Sample code: 1442 * 1443 * <pre>{@code 1444 * // This snippet has been automatically generated and should be regarded as a code template only. 1445 * // It will require modifications to work: 1446 * // - It may require correct/in-range values for request initialization. 1447 * // - It may require specifying regional endpoints when creating the service client as shown in 1448 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1449 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1450 * String endpoint = 1451 * EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1452 * .toString(); 1453 * DeployedModel deployedModel = DeployedModel.newBuilder().build(); 1454 * FieldMask updateMask = FieldMask.newBuilder().build(); 1455 * MutateDeployedModelResponse response = 1456 * endpointServiceClient.mutateDeployedModelAsync(endpoint, deployedModel, updateMask).get(); 1457 * } 1458 * }</pre> 1459 * 1460 * @param endpoint Required. The name of the Endpoint resource into which to mutate a 1461 * DeployedModel. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` 1462 * @param deployedModel Required. The DeployedModel to be mutated within the Endpoint. Only the 1463 * following fields can be mutated: 1464 * <ul> 1465 * <li>`min_replica_count` in either 1466 * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or 1467 * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] 1468 * <li>`max_replica_count` in either 1469 * [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or 1470 * [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources] 1471 * <li>[autoscaling_metric_specs][google.cloud.aiplatform.v1.DedicatedResources.autoscaling_metric_specs] 1472 * <li>`disable_container_logging` (v1 only) 1473 * <li>`enable_container_logging` (v1beta1 only) 1474 * </ul> 1475 * 1476 * @param updateMask Required. The update mask applies to the resource. See 1477 * [google.protobuf.FieldMask][google.protobuf.FieldMask]. 1478 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1479 */ 1480 public final OperationFuture<MutateDeployedModelResponse, MutateDeployedModelOperationMetadata> mutateDeployedModelAsync(String endpoint, DeployedModel deployedModel, FieldMask updateMask)1481 mutateDeployedModelAsync(String endpoint, DeployedModel deployedModel, FieldMask updateMask) { 1482 MutateDeployedModelRequest request = 1483 MutateDeployedModelRequest.newBuilder() 1484 .setEndpoint(endpoint) 1485 .setDeployedModel(deployedModel) 1486 .setUpdateMask(updateMask) 1487 .build(); 1488 return mutateDeployedModelAsync(request); 1489 } 1490 1491 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1492 /** 1493 * Updates an existing deployed model. Updatable fields include `min_replica_count`, 1494 * `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and 1495 * `enable_container_logging` (v1beta1 only). 1496 * 1497 * <p>Sample code: 1498 * 1499 * <pre>{@code 1500 * // This snippet has been automatically generated and should be regarded as a code template only. 1501 * // It will require modifications to work: 1502 * // - It may require correct/in-range values for request initialization. 1503 * // - It may require specifying regional endpoints when creating the service client as shown in 1504 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1505 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1506 * MutateDeployedModelRequest request = 1507 * MutateDeployedModelRequest.newBuilder() 1508 * .setEndpoint( 1509 * EndpointName.ofProjectLocationEndpointName( 1510 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1511 * .toString()) 1512 * .setDeployedModel(DeployedModel.newBuilder().build()) 1513 * .setUpdateMask(FieldMask.newBuilder().build()) 1514 * .build(); 1515 * MutateDeployedModelResponse response = 1516 * endpointServiceClient.mutateDeployedModelAsync(request).get(); 1517 * } 1518 * }</pre> 1519 * 1520 * @param request The request object containing all of the parameters for the API call. 1521 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1522 */ 1523 public final OperationFuture<MutateDeployedModelResponse, MutateDeployedModelOperationMetadata> mutateDeployedModelAsync(MutateDeployedModelRequest request)1524 mutateDeployedModelAsync(MutateDeployedModelRequest request) { 1525 return mutateDeployedModelOperationCallable().futureCall(request); 1526 } 1527 1528 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1529 /** 1530 * Updates an existing deployed model. Updatable fields include `min_replica_count`, 1531 * `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and 1532 * `enable_container_logging` (v1beta1 only). 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1543 * MutateDeployedModelRequest request = 1544 * MutateDeployedModelRequest.newBuilder() 1545 * .setEndpoint( 1546 * EndpointName.ofProjectLocationEndpointName( 1547 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1548 * .toString()) 1549 * .setDeployedModel(DeployedModel.newBuilder().build()) 1550 * .setUpdateMask(FieldMask.newBuilder().build()) 1551 * .build(); 1552 * OperationFuture<MutateDeployedModelResponse, MutateDeployedModelOperationMetadata> future = 1553 * endpointServiceClient.mutateDeployedModelOperationCallable().futureCall(request); 1554 * // Do something. 1555 * MutateDeployedModelResponse response = future.get(); 1556 * } 1557 * }</pre> 1558 */ 1559 public final OperationCallable< 1560 MutateDeployedModelRequest, 1561 MutateDeployedModelResponse, 1562 MutateDeployedModelOperationMetadata> mutateDeployedModelOperationCallable()1563 mutateDeployedModelOperationCallable() { 1564 return stub.mutateDeployedModelOperationCallable(); 1565 } 1566 1567 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1568 /** 1569 * Updates an existing deployed model. Updatable fields include `min_replica_count`, 1570 * `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and 1571 * `enable_container_logging` (v1beta1 only). 1572 * 1573 * <p>Sample code: 1574 * 1575 * <pre>{@code 1576 * // This snippet has been automatically generated and should be regarded as a code template only. 1577 * // It will require modifications to work: 1578 * // - It may require correct/in-range values for request initialization. 1579 * // - It may require specifying regional endpoints when creating the service client as shown in 1580 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1581 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1582 * MutateDeployedModelRequest request = 1583 * MutateDeployedModelRequest.newBuilder() 1584 * .setEndpoint( 1585 * EndpointName.ofProjectLocationEndpointName( 1586 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1587 * .toString()) 1588 * .setDeployedModel(DeployedModel.newBuilder().build()) 1589 * .setUpdateMask(FieldMask.newBuilder().build()) 1590 * .build(); 1591 * ApiFuture<Operation> future = 1592 * endpointServiceClient.mutateDeployedModelCallable().futureCall(request); 1593 * // Do something. 1594 * Operation response = future.get(); 1595 * } 1596 * }</pre> 1597 */ mutateDeployedModelCallable()1598 public final UnaryCallable<MutateDeployedModelRequest, Operation> mutateDeployedModelCallable() { 1599 return stub.mutateDeployedModelCallable(); 1600 } 1601 1602 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1603 /** 1604 * Lists information about the supported locations for this service. 1605 * 1606 * <p>Sample code: 1607 * 1608 * <pre>{@code 1609 * // This snippet has been automatically generated and should be regarded as a code template only. 1610 * // It will require modifications to work: 1611 * // - It may require correct/in-range values for request initialization. 1612 * // - It may require specifying regional endpoints when creating the service client as shown in 1613 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1614 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1615 * ListLocationsRequest request = 1616 * ListLocationsRequest.newBuilder() 1617 * .setName("name3373707") 1618 * .setFilter("filter-1274492040") 1619 * .setPageSize(883849137) 1620 * .setPageToken("pageToken873572522") 1621 * .build(); 1622 * for (Location element : endpointServiceClient.listLocations(request).iterateAll()) { 1623 * // doThingsWith(element); 1624 * } 1625 * } 1626 * }</pre> 1627 * 1628 * @param request The request object containing all of the parameters for the API call. 1629 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1630 */ listLocations(ListLocationsRequest request)1631 public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { 1632 return listLocationsPagedCallable().call(request); 1633 } 1634 1635 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1636 /** 1637 * Lists information about the supported locations for this service. 1638 * 1639 * <p>Sample code: 1640 * 1641 * <pre>{@code 1642 * // This snippet has been automatically generated and should be regarded as a code template only. 1643 * // It will require modifications to work: 1644 * // - It may require correct/in-range values for request initialization. 1645 * // - It may require specifying regional endpoints when creating the service client as shown in 1646 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1647 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1648 * ListLocationsRequest request = 1649 * ListLocationsRequest.newBuilder() 1650 * .setName("name3373707") 1651 * .setFilter("filter-1274492040") 1652 * .setPageSize(883849137) 1653 * .setPageToken("pageToken873572522") 1654 * .build(); 1655 * ApiFuture<Location> future = 1656 * endpointServiceClient.listLocationsPagedCallable().futureCall(request); 1657 * // Do something. 1658 * for (Location element : future.get().iterateAll()) { 1659 * // doThingsWith(element); 1660 * } 1661 * } 1662 * }</pre> 1663 */ 1664 public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()1665 listLocationsPagedCallable() { 1666 return stub.listLocationsPagedCallable(); 1667 } 1668 1669 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1670 /** 1671 * Lists information about the supported locations for this service. 1672 * 1673 * <p>Sample code: 1674 * 1675 * <pre>{@code 1676 * // This snippet has been automatically generated and should be regarded as a code template only. 1677 * // It will require modifications to work: 1678 * // - It may require correct/in-range values for request initialization. 1679 * // - It may require specifying regional endpoints when creating the service client as shown in 1680 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1681 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1682 * ListLocationsRequest request = 1683 * ListLocationsRequest.newBuilder() 1684 * .setName("name3373707") 1685 * .setFilter("filter-1274492040") 1686 * .setPageSize(883849137) 1687 * .setPageToken("pageToken873572522") 1688 * .build(); 1689 * while (true) { 1690 * ListLocationsResponse response = 1691 * endpointServiceClient.listLocationsCallable().call(request); 1692 * for (Location element : response.getLocationsList()) { 1693 * // doThingsWith(element); 1694 * } 1695 * String nextPageToken = response.getNextPageToken(); 1696 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1697 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1698 * } else { 1699 * break; 1700 * } 1701 * } 1702 * } 1703 * }</pre> 1704 */ listLocationsCallable()1705 public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 1706 return stub.listLocationsCallable(); 1707 } 1708 1709 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1710 /** 1711 * Gets information about a location. 1712 * 1713 * <p>Sample code: 1714 * 1715 * <pre>{@code 1716 * // This snippet has been automatically generated and should be regarded as a code template only. 1717 * // It will require modifications to work: 1718 * // - It may require correct/in-range values for request initialization. 1719 * // - It may require specifying regional endpoints when creating the service client as shown in 1720 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1721 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1722 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1723 * Location response = endpointServiceClient.getLocation(request); 1724 * } 1725 * }</pre> 1726 * 1727 * @param request The request object containing all of the parameters for the API call. 1728 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1729 */ getLocation(GetLocationRequest request)1730 public final Location getLocation(GetLocationRequest request) { 1731 return getLocationCallable().call(request); 1732 } 1733 1734 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1735 /** 1736 * Gets information about a location. 1737 * 1738 * <p>Sample code: 1739 * 1740 * <pre>{@code 1741 * // This snippet has been automatically generated and should be regarded as a code template only. 1742 * // It will require modifications to work: 1743 * // - It may require correct/in-range values for request initialization. 1744 * // - It may require specifying regional endpoints when creating the service client as shown in 1745 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1746 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1747 * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); 1748 * ApiFuture<Location> future = endpointServiceClient.getLocationCallable().futureCall(request); 1749 * // Do something. 1750 * Location response = future.get(); 1751 * } 1752 * }</pre> 1753 */ getLocationCallable()1754 public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 1755 return stub.getLocationCallable(); 1756 } 1757 1758 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1759 /** 1760 * Sets the access control policy on the specified resource. Replacesany existing policy. 1761 * 1762 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 1763 * 1764 * <p>Sample code: 1765 * 1766 * <pre>{@code 1767 * // This snippet has been automatically generated and should be regarded as a code template only. 1768 * // It will require modifications to work: 1769 * // - It may require correct/in-range values for request initialization. 1770 * // - It may require specifying regional endpoints when creating the service client as shown in 1771 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1772 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1773 * SetIamPolicyRequest request = 1774 * SetIamPolicyRequest.newBuilder() 1775 * .setResource( 1776 * EndpointName.ofProjectLocationEndpointName( 1777 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1778 * .toString()) 1779 * .setPolicy(Policy.newBuilder().build()) 1780 * .setUpdateMask(FieldMask.newBuilder().build()) 1781 * .build(); 1782 * Policy response = endpointServiceClient.setIamPolicy(request); 1783 * } 1784 * }</pre> 1785 * 1786 * @param request The request object containing all of the parameters for the API call. 1787 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1788 */ setIamPolicy(SetIamPolicyRequest request)1789 public final Policy setIamPolicy(SetIamPolicyRequest request) { 1790 return setIamPolicyCallable().call(request); 1791 } 1792 1793 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1794 /** 1795 * Sets the access control policy on the specified resource. Replacesany existing policy. 1796 * 1797 * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. 1798 * 1799 * <p>Sample code: 1800 * 1801 * <pre>{@code 1802 * // This snippet has been automatically generated and should be regarded as a code template only. 1803 * // It will require modifications to work: 1804 * // - It may require correct/in-range values for request initialization. 1805 * // - It may require specifying regional endpoints when creating the service client as shown in 1806 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1807 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1808 * SetIamPolicyRequest request = 1809 * SetIamPolicyRequest.newBuilder() 1810 * .setResource( 1811 * EndpointName.ofProjectLocationEndpointName( 1812 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1813 * .toString()) 1814 * .setPolicy(Policy.newBuilder().build()) 1815 * .setUpdateMask(FieldMask.newBuilder().build()) 1816 * .build(); 1817 * ApiFuture<Policy> future = endpointServiceClient.setIamPolicyCallable().futureCall(request); 1818 * // Do something. 1819 * Policy response = future.get(); 1820 * } 1821 * }</pre> 1822 */ setIamPolicyCallable()1823 public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { 1824 return stub.setIamPolicyCallable(); 1825 } 1826 1827 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1828 /** 1829 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 1830 * and does not have a policy set. 1831 * 1832 * <p>Sample code: 1833 * 1834 * <pre>{@code 1835 * // This snippet has been automatically generated and should be regarded as a code template only. 1836 * // It will require modifications to work: 1837 * // - It may require correct/in-range values for request initialization. 1838 * // - It may require specifying regional endpoints when creating the service client as shown in 1839 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1840 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1841 * GetIamPolicyRequest request = 1842 * GetIamPolicyRequest.newBuilder() 1843 * .setResource( 1844 * EndpointName.ofProjectLocationEndpointName( 1845 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1846 * .toString()) 1847 * .setOptions(GetPolicyOptions.newBuilder().build()) 1848 * .build(); 1849 * Policy response = endpointServiceClient.getIamPolicy(request); 1850 * } 1851 * }</pre> 1852 * 1853 * @param request The request object containing all of the parameters for the API call. 1854 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1855 */ getIamPolicy(GetIamPolicyRequest request)1856 public final Policy getIamPolicy(GetIamPolicyRequest request) { 1857 return getIamPolicyCallable().call(request); 1858 } 1859 1860 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1861 /** 1862 * Gets the access control policy for a resource. Returns an empty policyif the resource exists 1863 * and does not have a policy set. 1864 * 1865 * <p>Sample code: 1866 * 1867 * <pre>{@code 1868 * // This snippet has been automatically generated and should be regarded as a code template only. 1869 * // It will require modifications to work: 1870 * // - It may require correct/in-range values for request initialization. 1871 * // - It may require specifying regional endpoints when creating the service client as shown in 1872 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1873 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1874 * GetIamPolicyRequest request = 1875 * GetIamPolicyRequest.newBuilder() 1876 * .setResource( 1877 * EndpointName.ofProjectLocationEndpointName( 1878 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1879 * .toString()) 1880 * .setOptions(GetPolicyOptions.newBuilder().build()) 1881 * .build(); 1882 * ApiFuture<Policy> future = endpointServiceClient.getIamPolicyCallable().futureCall(request); 1883 * // Do something. 1884 * Policy response = future.get(); 1885 * } 1886 * }</pre> 1887 */ getIamPolicyCallable()1888 public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { 1889 return stub.getIamPolicyCallable(); 1890 } 1891 1892 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1893 /** 1894 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 1895 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 1896 * 1897 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 1898 * command-line tools, not for authorizationchecking. This operation may "fail open" without 1899 * warning. 1900 * 1901 * <p>Sample code: 1902 * 1903 * <pre>{@code 1904 * // This snippet has been automatically generated and should be regarded as a code template only. 1905 * // It will require modifications to work: 1906 * // - It may require correct/in-range values for request initialization. 1907 * // - It may require specifying regional endpoints when creating the service client as shown in 1908 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1909 * try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1910 * TestIamPermissionsRequest request = 1911 * TestIamPermissionsRequest.newBuilder() 1912 * .setResource( 1913 * EndpointName.ofProjectLocationEndpointName( 1914 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1915 * .toString()) 1916 * .addAllPermissions(new ArrayList<String>()) 1917 * .build(); 1918 * TestIamPermissionsResponse response = endpointServiceClient.testIamPermissions(request); 1919 * } 1920 * }</pre> 1921 * 1922 * @param request The request object containing all of the parameters for the API call. 1923 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1924 */ testIamPermissions(TestIamPermissionsRequest request)1925 public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { 1926 return testIamPermissionsCallable().call(request); 1927 } 1928 1929 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1930 /** 1931 * Returns permissions that a caller has on the specified resource. If theresource does not exist, 1932 * this will return an empty set ofpermissions, not a `NOT_FOUND` error. 1933 * 1934 * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and 1935 * command-line tools, not for authorizationchecking. This operation may "fail open" without 1936 * warning. 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 (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) { 1947 * TestIamPermissionsRequest request = 1948 * TestIamPermissionsRequest.newBuilder() 1949 * .setResource( 1950 * EndpointName.ofProjectLocationEndpointName( 1951 * "[PROJECT]", "[LOCATION]", "[ENDPOINT]") 1952 * .toString()) 1953 * .addAllPermissions(new ArrayList<String>()) 1954 * .build(); 1955 * ApiFuture<TestIamPermissionsResponse> future = 1956 * endpointServiceClient.testIamPermissionsCallable().futureCall(request); 1957 * // Do something. 1958 * TestIamPermissionsResponse response = future.get(); 1959 * } 1960 * }</pre> 1961 */ 1962 public final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable()1963 testIamPermissionsCallable() { 1964 return stub.testIamPermissionsCallable(); 1965 } 1966 1967 @Override close()1968 public final void close() { 1969 stub.close(); 1970 } 1971 1972 @Override shutdown()1973 public void shutdown() { 1974 stub.shutdown(); 1975 } 1976 1977 @Override isShutdown()1978 public boolean isShutdown() { 1979 return stub.isShutdown(); 1980 } 1981 1982 @Override isTerminated()1983 public boolean isTerminated() { 1984 return stub.isTerminated(); 1985 } 1986 1987 @Override shutdownNow()1988 public void shutdownNow() { 1989 stub.shutdownNow(); 1990 } 1991 1992 @Override awaitTermination(long duration, TimeUnit unit)1993 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1994 return stub.awaitTermination(duration, unit); 1995 } 1996 1997 public static class ListEndpointsPagedResponse 1998 extends AbstractPagedListResponse< 1999 ListEndpointsRequest, 2000 ListEndpointsResponse, 2001 Endpoint, 2002 ListEndpointsPage, 2003 ListEndpointsFixedSizeCollection> { 2004 createAsync( PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, ApiFuture<ListEndpointsResponse> futureResponse)2005 public static ApiFuture<ListEndpointsPagedResponse> createAsync( 2006 PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, 2007 ApiFuture<ListEndpointsResponse> futureResponse) { 2008 ApiFuture<ListEndpointsPage> futurePage = 2009 ListEndpointsPage.createEmptyPage().createPageAsync(context, futureResponse); 2010 return ApiFutures.transform( 2011 futurePage, 2012 input -> new ListEndpointsPagedResponse(input), 2013 MoreExecutors.directExecutor()); 2014 } 2015 ListEndpointsPagedResponse(ListEndpointsPage page)2016 private ListEndpointsPagedResponse(ListEndpointsPage page) { 2017 super(page, ListEndpointsFixedSizeCollection.createEmptyCollection()); 2018 } 2019 } 2020 2021 public static class ListEndpointsPage 2022 extends AbstractPage< 2023 ListEndpointsRequest, ListEndpointsResponse, Endpoint, ListEndpointsPage> { 2024 ListEndpointsPage( PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, ListEndpointsResponse response)2025 private ListEndpointsPage( 2026 PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, 2027 ListEndpointsResponse response) { 2028 super(context, response); 2029 } 2030 createEmptyPage()2031 private static ListEndpointsPage createEmptyPage() { 2032 return new ListEndpointsPage(null, null); 2033 } 2034 2035 @Override createPage( PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, ListEndpointsResponse response)2036 protected ListEndpointsPage createPage( 2037 PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, 2038 ListEndpointsResponse response) { 2039 return new ListEndpointsPage(context, response); 2040 } 2041 2042 @Override createPageAsync( PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, ApiFuture<ListEndpointsResponse> futureResponse)2043 public ApiFuture<ListEndpointsPage> createPageAsync( 2044 PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> context, 2045 ApiFuture<ListEndpointsResponse> futureResponse) { 2046 return super.createPageAsync(context, futureResponse); 2047 } 2048 } 2049 2050 public static class ListEndpointsFixedSizeCollection 2051 extends AbstractFixedSizeCollection< 2052 ListEndpointsRequest, 2053 ListEndpointsResponse, 2054 Endpoint, 2055 ListEndpointsPage, 2056 ListEndpointsFixedSizeCollection> { 2057 ListEndpointsFixedSizeCollection(List<ListEndpointsPage> pages, int collectionSize)2058 private ListEndpointsFixedSizeCollection(List<ListEndpointsPage> pages, int collectionSize) { 2059 super(pages, collectionSize); 2060 } 2061 createEmptyCollection()2062 private static ListEndpointsFixedSizeCollection createEmptyCollection() { 2063 return new ListEndpointsFixedSizeCollection(null, 0); 2064 } 2065 2066 @Override createCollection( List<ListEndpointsPage> pages, int collectionSize)2067 protected ListEndpointsFixedSizeCollection createCollection( 2068 List<ListEndpointsPage> pages, int collectionSize) { 2069 return new ListEndpointsFixedSizeCollection(pages, collectionSize); 2070 } 2071 } 2072 2073 public static class ListLocationsPagedResponse 2074 extends AbstractPagedListResponse< 2075 ListLocationsRequest, 2076 ListLocationsResponse, 2077 Location, 2078 ListLocationsPage, 2079 ListLocationsFixedSizeCollection> { 2080 createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2081 public static ApiFuture<ListLocationsPagedResponse> createAsync( 2082 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2083 ApiFuture<ListLocationsResponse> futureResponse) { 2084 ApiFuture<ListLocationsPage> futurePage = 2085 ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); 2086 return ApiFutures.transform( 2087 futurePage, 2088 input -> new ListLocationsPagedResponse(input), 2089 MoreExecutors.directExecutor()); 2090 } 2091 ListLocationsPagedResponse(ListLocationsPage page)2092 private ListLocationsPagedResponse(ListLocationsPage page) { 2093 super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); 2094 } 2095 } 2096 2097 public static class ListLocationsPage 2098 extends AbstractPage< 2099 ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { 2100 ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2101 private ListLocationsPage( 2102 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2103 ListLocationsResponse response) { 2104 super(context, response); 2105 } 2106 createEmptyPage()2107 private static ListLocationsPage createEmptyPage() { 2108 return new ListLocationsPage(null, null); 2109 } 2110 2111 @Override createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2112 protected ListLocationsPage createPage( 2113 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2114 ListLocationsResponse response) { 2115 return new ListLocationsPage(context, response); 2116 } 2117 2118 @Override createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2119 public ApiFuture<ListLocationsPage> createPageAsync( 2120 PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, 2121 ApiFuture<ListLocationsResponse> futureResponse) { 2122 return super.createPageAsync(context, futureResponse); 2123 } 2124 } 2125 2126 public static class ListLocationsFixedSizeCollection 2127 extends AbstractFixedSizeCollection< 2128 ListLocationsRequest, 2129 ListLocationsResponse, 2130 Location, 2131 ListLocationsPage, 2132 ListLocationsFixedSizeCollection> { 2133 ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)2134 private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { 2135 super(pages, collectionSize); 2136 } 2137 createEmptyCollection()2138 private static ListLocationsFixedSizeCollection createEmptyCollection() { 2139 return new ListLocationsFixedSizeCollection(null, 0); 2140 } 2141 2142 @Override createCollection( List<ListLocationsPage> pages, int collectionSize)2143 protected ListLocationsFixedSizeCollection createCollection( 2144 List<ListLocationsPage> pages, int collectionSize) { 2145 return new ListLocationsFixedSizeCollection(pages, collectionSize); 2146 } 2147 } 2148 } 2149