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.appengine.v1; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.appengine.v1.stub.DomainMappingsStub; 32 import com.google.appengine.v1.stub.DomainMappingsStubSettings; 33 import com.google.common.util.concurrent.MoreExecutors; 34 import com.google.longrunning.Operation; 35 import com.google.protobuf.Empty; 36 import java.io.IOException; 37 import java.util.List; 38 import java.util.concurrent.TimeUnit; 39 import javax.annotation.Generated; 40 41 // AUTO-GENERATED DOCUMENTATION AND CLASS. 42 /** 43 * Service Description: Manages domains serving an application. 44 * 45 * <p>This class provides the ability to make remote calls to the backing service through method 46 * calls that map to API methods. Sample code to get started: 47 * 48 * <pre>{@code 49 * // This snippet has been automatically generated and should be regarded as a code template only. 50 * // It will require modifications to work: 51 * // - It may require correct/in-range values for request initialization. 52 * // - It may require specifying regional endpoints when creating the service client as shown in 53 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 54 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 55 * GetDomainMappingRequest request = 56 * GetDomainMappingRequest.newBuilder().setName("name3373707").build(); 57 * DomainMapping response = domainMappingsClient.getDomainMapping(request); 58 * } 59 * }</pre> 60 * 61 * <p>Note: close() needs to be called on the DomainMappingsClient object to clean up resources such 62 * as threads. In the example above, try-with-resources is used, which automatically calls close(). 63 * 64 * <p>The surface of this class includes several types of Java methods for each of the API's 65 * methods: 66 * 67 * <ol> 68 * <li>A "flattened" method. With this type of method, the fields of the request type have been 69 * converted into function parameters. It may be the case that not all fields are available as 70 * parameters, and not every API method will have a flattened method entry point. 71 * <li>A "request object" method. This type of method only takes one parameter, a request object, 72 * which must be constructed before the call. Not every API method will have a request object 73 * method. 74 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 75 * callable object, which can be used to initiate calls to the service. 76 * </ol> 77 * 78 * <p>See the individual methods for example code. 79 * 80 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 81 * these names, this class includes a format method for each type of name, and additionally a parse 82 * method to extract the individual identifiers contained within names that are returned. 83 * 84 * <p>This class can be customized by passing in a custom instance of DomainMappingsSettings to 85 * create(). For example: 86 * 87 * <p>To customize credentials: 88 * 89 * <pre>{@code 90 * // This snippet has been automatically generated and should be regarded as a code template only. 91 * // It will require modifications to work: 92 * // - It may require correct/in-range values for request initialization. 93 * // - It may require specifying regional endpoints when creating the service client as shown in 94 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 95 * DomainMappingsSettings domainMappingsSettings = 96 * DomainMappingsSettings.newBuilder() 97 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 98 * .build(); 99 * DomainMappingsClient domainMappingsClient = DomainMappingsClient.create(domainMappingsSettings); 100 * }</pre> 101 * 102 * <p>To customize the endpoint: 103 * 104 * <pre>{@code 105 * // This snippet has been automatically generated and should be regarded as a code template only. 106 * // It will require modifications to work: 107 * // - It may require correct/in-range values for request initialization. 108 * // - It may require specifying regional endpoints when creating the service client as shown in 109 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 110 * DomainMappingsSettings domainMappingsSettings = 111 * DomainMappingsSettings.newBuilder().setEndpoint(myEndpoint).build(); 112 * DomainMappingsClient domainMappingsClient = DomainMappingsClient.create(domainMappingsSettings); 113 * }</pre> 114 * 115 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 116 * the wire: 117 * 118 * <pre>{@code 119 * // This snippet has been automatically generated and should be regarded as a code template only. 120 * // It will require modifications to work: 121 * // - It may require correct/in-range values for request initialization. 122 * // - It may require specifying regional endpoints when creating the service client as shown in 123 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 124 * DomainMappingsSettings domainMappingsSettings = 125 * DomainMappingsSettings.newHttpJsonBuilder().build(); 126 * DomainMappingsClient domainMappingsClient = DomainMappingsClient.create(domainMappingsSettings); 127 * }</pre> 128 * 129 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 130 */ 131 @Generated("by gapic-generator-java") 132 public class DomainMappingsClient implements BackgroundResource { 133 private final DomainMappingsSettings settings; 134 private final DomainMappingsStub stub; 135 private final OperationsClient httpJsonOperationsClient; 136 private final com.google.longrunning.OperationsClient operationsClient; 137 138 /** Constructs an instance of DomainMappingsClient with default settings. */ create()139 public static final DomainMappingsClient create() throws IOException { 140 return create(DomainMappingsSettings.newBuilder().build()); 141 } 142 143 /** 144 * Constructs an instance of DomainMappingsClient, using the given settings. The channels are 145 * created based on the settings passed in, or defaults for any settings that are not set. 146 */ create(DomainMappingsSettings settings)147 public static final DomainMappingsClient create(DomainMappingsSettings settings) 148 throws IOException { 149 return new DomainMappingsClient(settings); 150 } 151 152 /** 153 * Constructs an instance of DomainMappingsClient, using the given stub for making calls. This is 154 * for advanced usage - prefer using create(DomainMappingsSettings). 155 */ create(DomainMappingsStub stub)156 public static final DomainMappingsClient create(DomainMappingsStub stub) { 157 return new DomainMappingsClient(stub); 158 } 159 160 /** 161 * Constructs an instance of DomainMappingsClient, using the given settings. This is protected so 162 * that it is easy to make a subclass, but otherwise, the static factory methods should be 163 * preferred. 164 */ DomainMappingsClient(DomainMappingsSettings settings)165 protected DomainMappingsClient(DomainMappingsSettings settings) throws IOException { 166 this.settings = settings; 167 this.stub = ((DomainMappingsStubSettings) settings.getStubSettings()).createStub(); 168 this.operationsClient = 169 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 170 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 171 } 172 DomainMappingsClient(DomainMappingsStub stub)173 protected DomainMappingsClient(DomainMappingsStub stub) { 174 this.settings = null; 175 this.stub = stub; 176 this.operationsClient = 177 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 178 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 179 } 180 getSettings()181 public final DomainMappingsSettings getSettings() { 182 return settings; 183 } 184 getStub()185 public DomainMappingsStub getStub() { 186 return stub; 187 } 188 189 /** 190 * Returns the OperationsClient that can be used to query the status of a long-running operation 191 * returned by another API method call. 192 */ getOperationsClient()193 public final com.google.longrunning.OperationsClient getOperationsClient() { 194 return operationsClient; 195 } 196 197 /** 198 * Returns the OperationsClient that can be used to query the status of a long-running operation 199 * returned by another API method call. 200 */ 201 @BetaApi getHttpJsonOperationsClient()202 public final OperationsClient getHttpJsonOperationsClient() { 203 return httpJsonOperationsClient; 204 } 205 206 // AUTO-GENERATED DOCUMENTATION AND METHOD. 207 /** 208 * Lists the domain mappings on an application. 209 * 210 * <p>Sample code: 211 * 212 * <pre>{@code 213 * // This snippet has been automatically generated and should be regarded as a code template only. 214 * // It will require modifications to work: 215 * // - It may require correct/in-range values for request initialization. 216 * // - It may require specifying regional endpoints when creating the service client as shown in 217 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 218 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 219 * ListDomainMappingsRequest request = 220 * ListDomainMappingsRequest.newBuilder() 221 * .setParent("parent-995424086") 222 * .setPageSize(883849137) 223 * .setPageToken("pageToken873572522") 224 * .build(); 225 * for (DomainMapping element : domainMappingsClient.listDomainMappings(request).iterateAll()) { 226 * // doThingsWith(element); 227 * } 228 * } 229 * }</pre> 230 * 231 * @param request The request object containing all of the parameters for the API call. 232 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 233 */ listDomainMappings( ListDomainMappingsRequest request)234 public final ListDomainMappingsPagedResponse listDomainMappings( 235 ListDomainMappingsRequest request) { 236 return listDomainMappingsPagedCallable().call(request); 237 } 238 239 // AUTO-GENERATED DOCUMENTATION AND METHOD. 240 /** 241 * Lists the domain mappings on an application. 242 * 243 * <p>Sample code: 244 * 245 * <pre>{@code 246 * // This snippet has been automatically generated and should be regarded as a code template only. 247 * // It will require modifications to work: 248 * // - It may require correct/in-range values for request initialization. 249 * // - It may require specifying regional endpoints when creating the service client as shown in 250 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 251 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 252 * ListDomainMappingsRequest request = 253 * ListDomainMappingsRequest.newBuilder() 254 * .setParent("parent-995424086") 255 * .setPageSize(883849137) 256 * .setPageToken("pageToken873572522") 257 * .build(); 258 * ApiFuture<DomainMapping> future = 259 * domainMappingsClient.listDomainMappingsPagedCallable().futureCall(request); 260 * // Do something. 261 * for (DomainMapping element : future.get().iterateAll()) { 262 * // doThingsWith(element); 263 * } 264 * } 265 * }</pre> 266 */ 267 public final UnaryCallable<ListDomainMappingsRequest, ListDomainMappingsPagedResponse> listDomainMappingsPagedCallable()268 listDomainMappingsPagedCallable() { 269 return stub.listDomainMappingsPagedCallable(); 270 } 271 272 // AUTO-GENERATED DOCUMENTATION AND METHOD. 273 /** 274 * Lists the domain mappings on an application. 275 * 276 * <p>Sample code: 277 * 278 * <pre>{@code 279 * // This snippet has been automatically generated and should be regarded as a code template only. 280 * // It will require modifications to work: 281 * // - It may require correct/in-range values for request initialization. 282 * // - It may require specifying regional endpoints when creating the service client as shown in 283 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 284 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 285 * ListDomainMappingsRequest request = 286 * ListDomainMappingsRequest.newBuilder() 287 * .setParent("parent-995424086") 288 * .setPageSize(883849137) 289 * .setPageToken("pageToken873572522") 290 * .build(); 291 * while (true) { 292 * ListDomainMappingsResponse response = 293 * domainMappingsClient.listDomainMappingsCallable().call(request); 294 * for (DomainMapping element : response.getDomainMappingsList()) { 295 * // doThingsWith(element); 296 * } 297 * String nextPageToken = response.getNextPageToken(); 298 * if (!Strings.isNullOrEmpty(nextPageToken)) { 299 * request = request.toBuilder().setPageToken(nextPageToken).build(); 300 * } else { 301 * break; 302 * } 303 * } 304 * } 305 * }</pre> 306 */ 307 public final UnaryCallable<ListDomainMappingsRequest, ListDomainMappingsResponse> listDomainMappingsCallable()308 listDomainMappingsCallable() { 309 return stub.listDomainMappingsCallable(); 310 } 311 312 // AUTO-GENERATED DOCUMENTATION AND METHOD. 313 /** 314 * Gets the specified domain mapping. 315 * 316 * <p>Sample code: 317 * 318 * <pre>{@code 319 * // This snippet has been automatically generated and should be regarded as a code template only. 320 * // It will require modifications to work: 321 * // - It may require correct/in-range values for request initialization. 322 * // - It may require specifying regional endpoints when creating the service client as shown in 323 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 324 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 325 * GetDomainMappingRequest request = 326 * GetDomainMappingRequest.newBuilder().setName("name3373707").build(); 327 * DomainMapping response = domainMappingsClient.getDomainMapping(request); 328 * } 329 * }</pre> 330 * 331 * @param request The request object containing all of the parameters for the API call. 332 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 333 */ getDomainMapping(GetDomainMappingRequest request)334 public final DomainMapping getDomainMapping(GetDomainMappingRequest request) { 335 return getDomainMappingCallable().call(request); 336 } 337 338 // AUTO-GENERATED DOCUMENTATION AND METHOD. 339 /** 340 * Gets the specified domain mapping. 341 * 342 * <p>Sample code: 343 * 344 * <pre>{@code 345 * // This snippet has been automatically generated and should be regarded as a code template only. 346 * // It will require modifications to work: 347 * // - It may require correct/in-range values for request initialization. 348 * // - It may require specifying regional endpoints when creating the service client as shown in 349 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 350 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 351 * GetDomainMappingRequest request = 352 * GetDomainMappingRequest.newBuilder().setName("name3373707").build(); 353 * ApiFuture<DomainMapping> future = 354 * domainMappingsClient.getDomainMappingCallable().futureCall(request); 355 * // Do something. 356 * DomainMapping response = future.get(); 357 * } 358 * }</pre> 359 */ getDomainMappingCallable()360 public final UnaryCallable<GetDomainMappingRequest, DomainMapping> getDomainMappingCallable() { 361 return stub.getDomainMappingCallable(); 362 } 363 364 // AUTO-GENERATED DOCUMENTATION AND METHOD. 365 /** 366 * Maps a domain to an application. A user must be authorized to administer a domain in order to 367 * map it to an application. For a list of available authorized domains, see 368 * [`AuthorizedDomains.ListAuthorizedDomains`](). 369 * 370 * <p>Sample code: 371 * 372 * <pre>{@code 373 * // This snippet has been automatically generated and should be regarded as a code template only. 374 * // It will require modifications to work: 375 * // - It may require correct/in-range values for request initialization. 376 * // - It may require specifying regional endpoints when creating the service client as shown in 377 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 378 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 379 * CreateDomainMappingRequest request = 380 * CreateDomainMappingRequest.newBuilder() 381 * .setParent("parent-995424086") 382 * .setDomainMapping(DomainMapping.newBuilder().build()) 383 * .setOverrideStrategy(DomainOverrideStrategy.forNumber(0)) 384 * .build(); 385 * DomainMapping response = domainMappingsClient.createDomainMappingAsync(request).get(); 386 * } 387 * }</pre> 388 * 389 * @param request The request object containing all of the parameters for the API call. 390 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 391 */ createDomainMappingAsync( CreateDomainMappingRequest request)392 public final OperationFuture<DomainMapping, OperationMetadataV1> createDomainMappingAsync( 393 CreateDomainMappingRequest request) { 394 return createDomainMappingOperationCallable().futureCall(request); 395 } 396 397 // AUTO-GENERATED DOCUMENTATION AND METHOD. 398 /** 399 * Maps a domain to an application. A user must be authorized to administer a domain in order to 400 * map it to an application. For a list of available authorized domains, see 401 * [`AuthorizedDomains.ListAuthorizedDomains`](). 402 * 403 * <p>Sample code: 404 * 405 * <pre>{@code 406 * // This snippet has been automatically generated and should be regarded as a code template only. 407 * // It will require modifications to work: 408 * // - It may require correct/in-range values for request initialization. 409 * // - It may require specifying regional endpoints when creating the service client as shown in 410 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 411 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 412 * CreateDomainMappingRequest request = 413 * CreateDomainMappingRequest.newBuilder() 414 * .setParent("parent-995424086") 415 * .setDomainMapping(DomainMapping.newBuilder().build()) 416 * .setOverrideStrategy(DomainOverrideStrategy.forNumber(0)) 417 * .build(); 418 * OperationFuture<DomainMapping, OperationMetadataV1> future = 419 * domainMappingsClient.createDomainMappingOperationCallable().futureCall(request); 420 * // Do something. 421 * DomainMapping response = future.get(); 422 * } 423 * }</pre> 424 */ 425 public final OperationCallable<CreateDomainMappingRequest, DomainMapping, OperationMetadataV1> createDomainMappingOperationCallable()426 createDomainMappingOperationCallable() { 427 return stub.createDomainMappingOperationCallable(); 428 } 429 430 // AUTO-GENERATED DOCUMENTATION AND METHOD. 431 /** 432 * Maps a domain to an application. A user must be authorized to administer a domain in order to 433 * map it to an application. For a list of available authorized domains, see 434 * [`AuthorizedDomains.ListAuthorizedDomains`](). 435 * 436 * <p>Sample code: 437 * 438 * <pre>{@code 439 * // This snippet has been automatically generated and should be regarded as a code template only. 440 * // It will require modifications to work: 441 * // - It may require correct/in-range values for request initialization. 442 * // - It may require specifying regional endpoints when creating the service client as shown in 443 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 444 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 445 * CreateDomainMappingRequest request = 446 * CreateDomainMappingRequest.newBuilder() 447 * .setParent("parent-995424086") 448 * .setDomainMapping(DomainMapping.newBuilder().build()) 449 * .setOverrideStrategy(DomainOverrideStrategy.forNumber(0)) 450 * .build(); 451 * ApiFuture<Operation> future = 452 * domainMappingsClient.createDomainMappingCallable().futureCall(request); 453 * // Do something. 454 * Operation response = future.get(); 455 * } 456 * }</pre> 457 */ createDomainMappingCallable()458 public final UnaryCallable<CreateDomainMappingRequest, Operation> createDomainMappingCallable() { 459 return stub.createDomainMappingCallable(); 460 } 461 462 // AUTO-GENERATED DOCUMENTATION AND METHOD. 463 /** 464 * Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update 465 * `certificate_id` to point to an `AuthorizedCertificate` resource. A user must be authorized to 466 * administer the associated domain in order to update a `DomainMapping` resource. 467 * 468 * <p>Sample code: 469 * 470 * <pre>{@code 471 * // This snippet has been automatically generated and should be regarded as a code template only. 472 * // It will require modifications to work: 473 * // - It may require correct/in-range values for request initialization. 474 * // - It may require specifying regional endpoints when creating the service client as shown in 475 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 476 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 477 * UpdateDomainMappingRequest request = 478 * UpdateDomainMappingRequest.newBuilder() 479 * .setName("name3373707") 480 * .setDomainMapping(DomainMapping.newBuilder().build()) 481 * .setUpdateMask(FieldMask.newBuilder().build()) 482 * .build(); 483 * DomainMapping response = domainMappingsClient.updateDomainMappingAsync(request).get(); 484 * } 485 * }</pre> 486 * 487 * @param request The request object containing all of the parameters for the API call. 488 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 489 */ updateDomainMappingAsync( UpdateDomainMappingRequest request)490 public final OperationFuture<DomainMapping, OperationMetadataV1> updateDomainMappingAsync( 491 UpdateDomainMappingRequest request) { 492 return updateDomainMappingOperationCallable().futureCall(request); 493 } 494 495 // AUTO-GENERATED DOCUMENTATION AND METHOD. 496 /** 497 * Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update 498 * `certificate_id` to point to an `AuthorizedCertificate` resource. A user must be authorized to 499 * administer the associated domain in order to update a `DomainMapping` resource. 500 * 501 * <p>Sample code: 502 * 503 * <pre>{@code 504 * // This snippet has been automatically generated and should be regarded as a code template only. 505 * // It will require modifications to work: 506 * // - It may require correct/in-range values for request initialization. 507 * // - It may require specifying regional endpoints when creating the service client as shown in 508 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 509 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 510 * UpdateDomainMappingRequest request = 511 * UpdateDomainMappingRequest.newBuilder() 512 * .setName("name3373707") 513 * .setDomainMapping(DomainMapping.newBuilder().build()) 514 * .setUpdateMask(FieldMask.newBuilder().build()) 515 * .build(); 516 * OperationFuture<DomainMapping, OperationMetadataV1> future = 517 * domainMappingsClient.updateDomainMappingOperationCallable().futureCall(request); 518 * // Do something. 519 * DomainMapping response = future.get(); 520 * } 521 * }</pre> 522 */ 523 public final OperationCallable<UpdateDomainMappingRequest, DomainMapping, OperationMetadataV1> updateDomainMappingOperationCallable()524 updateDomainMappingOperationCallable() { 525 return stub.updateDomainMappingOperationCallable(); 526 } 527 528 // AUTO-GENERATED DOCUMENTATION AND METHOD. 529 /** 530 * Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update 531 * `certificate_id` to point to an `AuthorizedCertificate` resource. A user must be authorized to 532 * administer the associated domain in order to update a `DomainMapping` resource. 533 * 534 * <p>Sample code: 535 * 536 * <pre>{@code 537 * // This snippet has been automatically generated and should be regarded as a code template only. 538 * // It will require modifications to work: 539 * // - It may require correct/in-range values for request initialization. 540 * // - It may require specifying regional endpoints when creating the service client as shown in 541 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 542 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 543 * UpdateDomainMappingRequest request = 544 * UpdateDomainMappingRequest.newBuilder() 545 * .setName("name3373707") 546 * .setDomainMapping(DomainMapping.newBuilder().build()) 547 * .setUpdateMask(FieldMask.newBuilder().build()) 548 * .build(); 549 * ApiFuture<Operation> future = 550 * domainMappingsClient.updateDomainMappingCallable().futureCall(request); 551 * // Do something. 552 * Operation response = future.get(); 553 * } 554 * }</pre> 555 */ updateDomainMappingCallable()556 public final UnaryCallable<UpdateDomainMappingRequest, Operation> updateDomainMappingCallable() { 557 return stub.updateDomainMappingCallable(); 558 } 559 560 // AUTO-GENERATED DOCUMENTATION AND METHOD. 561 /** 562 * Deletes the specified domain mapping. A user must be authorized to administer the associated 563 * domain in order to delete a `DomainMapping` resource. 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 (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 574 * DeleteDomainMappingRequest request = 575 * DeleteDomainMappingRequest.newBuilder().setName("name3373707").build(); 576 * domainMappingsClient.deleteDomainMappingAsync(request).get(); 577 * } 578 * }</pre> 579 * 580 * @param request The request object containing all of the parameters for the API call. 581 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 582 */ deleteDomainMappingAsync( DeleteDomainMappingRequest request)583 public final OperationFuture<Empty, OperationMetadataV1> deleteDomainMappingAsync( 584 DeleteDomainMappingRequest request) { 585 return deleteDomainMappingOperationCallable().futureCall(request); 586 } 587 588 // AUTO-GENERATED DOCUMENTATION AND METHOD. 589 /** 590 * Deletes the specified domain mapping. A user must be authorized to administer the associated 591 * domain in order to delete a `DomainMapping` resource. 592 * 593 * <p>Sample code: 594 * 595 * <pre>{@code 596 * // This snippet has been automatically generated and should be regarded as a code template only. 597 * // It will require modifications to work: 598 * // - It may require correct/in-range values for request initialization. 599 * // - It may require specifying regional endpoints when creating the service client as shown in 600 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 601 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 602 * DeleteDomainMappingRequest request = 603 * DeleteDomainMappingRequest.newBuilder().setName("name3373707").build(); 604 * OperationFuture<Empty, OperationMetadataV1> future = 605 * domainMappingsClient.deleteDomainMappingOperationCallable().futureCall(request); 606 * // Do something. 607 * future.get(); 608 * } 609 * }</pre> 610 */ 611 public final OperationCallable<DeleteDomainMappingRequest, Empty, OperationMetadataV1> deleteDomainMappingOperationCallable()612 deleteDomainMappingOperationCallable() { 613 return stub.deleteDomainMappingOperationCallable(); 614 } 615 616 // AUTO-GENERATED DOCUMENTATION AND METHOD. 617 /** 618 * Deletes the specified domain mapping. A user must be authorized to administer the associated 619 * domain in order to delete a `DomainMapping` resource. 620 * 621 * <p>Sample code: 622 * 623 * <pre>{@code 624 * // This snippet has been automatically generated and should be regarded as a code template only. 625 * // It will require modifications to work: 626 * // - It may require correct/in-range values for request initialization. 627 * // - It may require specifying regional endpoints when creating the service client as shown in 628 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 629 * try (DomainMappingsClient domainMappingsClient = DomainMappingsClient.create()) { 630 * DeleteDomainMappingRequest request = 631 * DeleteDomainMappingRequest.newBuilder().setName("name3373707").build(); 632 * ApiFuture<Operation> future = 633 * domainMappingsClient.deleteDomainMappingCallable().futureCall(request); 634 * // Do something. 635 * future.get(); 636 * } 637 * }</pre> 638 */ deleteDomainMappingCallable()639 public final UnaryCallable<DeleteDomainMappingRequest, Operation> deleteDomainMappingCallable() { 640 return stub.deleteDomainMappingCallable(); 641 } 642 643 @Override close()644 public final void close() { 645 stub.close(); 646 } 647 648 @Override shutdown()649 public void shutdown() { 650 stub.shutdown(); 651 } 652 653 @Override isShutdown()654 public boolean isShutdown() { 655 return stub.isShutdown(); 656 } 657 658 @Override isTerminated()659 public boolean isTerminated() { 660 return stub.isTerminated(); 661 } 662 663 @Override shutdownNow()664 public void shutdownNow() { 665 stub.shutdownNow(); 666 } 667 668 @Override awaitTermination(long duration, TimeUnit unit)669 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 670 return stub.awaitTermination(duration, unit); 671 } 672 673 public static class ListDomainMappingsPagedResponse 674 extends AbstractPagedListResponse< 675 ListDomainMappingsRequest, 676 ListDomainMappingsResponse, 677 DomainMapping, 678 ListDomainMappingsPage, 679 ListDomainMappingsFixedSizeCollection> { 680 createAsync( PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, ApiFuture<ListDomainMappingsResponse> futureResponse)681 public static ApiFuture<ListDomainMappingsPagedResponse> createAsync( 682 PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, 683 ApiFuture<ListDomainMappingsResponse> futureResponse) { 684 ApiFuture<ListDomainMappingsPage> futurePage = 685 ListDomainMappingsPage.createEmptyPage().createPageAsync(context, futureResponse); 686 return ApiFutures.transform( 687 futurePage, 688 input -> new ListDomainMappingsPagedResponse(input), 689 MoreExecutors.directExecutor()); 690 } 691 ListDomainMappingsPagedResponse(ListDomainMappingsPage page)692 private ListDomainMappingsPagedResponse(ListDomainMappingsPage page) { 693 super(page, ListDomainMappingsFixedSizeCollection.createEmptyCollection()); 694 } 695 } 696 697 public static class ListDomainMappingsPage 698 extends AbstractPage< 699 ListDomainMappingsRequest, 700 ListDomainMappingsResponse, 701 DomainMapping, 702 ListDomainMappingsPage> { 703 ListDomainMappingsPage( PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, ListDomainMappingsResponse response)704 private ListDomainMappingsPage( 705 PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, 706 ListDomainMappingsResponse response) { 707 super(context, response); 708 } 709 createEmptyPage()710 private static ListDomainMappingsPage createEmptyPage() { 711 return new ListDomainMappingsPage(null, null); 712 } 713 714 @Override createPage( PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, ListDomainMappingsResponse response)715 protected ListDomainMappingsPage createPage( 716 PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, 717 ListDomainMappingsResponse response) { 718 return new ListDomainMappingsPage(context, response); 719 } 720 721 @Override createPageAsync( PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, ApiFuture<ListDomainMappingsResponse> futureResponse)722 public ApiFuture<ListDomainMappingsPage> createPageAsync( 723 PageContext<ListDomainMappingsRequest, ListDomainMappingsResponse, DomainMapping> context, 724 ApiFuture<ListDomainMappingsResponse> futureResponse) { 725 return super.createPageAsync(context, futureResponse); 726 } 727 } 728 729 public static class ListDomainMappingsFixedSizeCollection 730 extends AbstractFixedSizeCollection< 731 ListDomainMappingsRequest, 732 ListDomainMappingsResponse, 733 DomainMapping, 734 ListDomainMappingsPage, 735 ListDomainMappingsFixedSizeCollection> { 736 ListDomainMappingsFixedSizeCollection( List<ListDomainMappingsPage> pages, int collectionSize)737 private ListDomainMappingsFixedSizeCollection( 738 List<ListDomainMappingsPage> pages, int collectionSize) { 739 super(pages, collectionSize); 740 } 741 createEmptyCollection()742 private static ListDomainMappingsFixedSizeCollection createEmptyCollection() { 743 return new ListDomainMappingsFixedSizeCollection(null, 0); 744 } 745 746 @Override createCollection( List<ListDomainMappingsPage> pages, int collectionSize)747 protected ListDomainMappingsFixedSizeCollection createCollection( 748 List<ListDomainMappingsPage> pages, int collectionSize) { 749 return new ListDomainMappingsFixedSizeCollection(pages, collectionSize); 750 } 751 } 752 } 753