• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.compute.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.longrunning.OperationFuture;
24 import com.google.api.gax.paging.AbstractFixedSizeCollection;
25 import com.google.api.gax.paging.AbstractPage;
26 import com.google.api.gax.paging.AbstractPagedListResponse;
27 import com.google.api.gax.rpc.OperationCallable;
28 import com.google.api.gax.rpc.PageContext;
29 import com.google.api.gax.rpc.UnaryCallable;
30 import com.google.cloud.compute.v1.stub.RegionHealthCheckServicesStub;
31 import com.google.cloud.compute.v1.stub.RegionHealthCheckServicesStubSettings;
32 import com.google.common.util.concurrent.MoreExecutors;
33 import java.io.IOException;
34 import java.util.List;
35 import java.util.concurrent.TimeUnit;
36 import javax.annotation.Generated;
37 
38 // AUTO-GENERATED DOCUMENTATION AND CLASS.
39 /**
40  * Service Description: The RegionHealthCheckServices API.
41  *
42  * <p>This class provides the ability to make remote calls to the backing service through method
43  * calls that map to API methods. Sample code to get started:
44  *
45  * <pre>{@code
46  * // This snippet has been automatically generated and should be regarded as a code template only.
47  * // It will require modifications to work:
48  * // - It may require correct/in-range values for request initialization.
49  * // - It may require specifying regional endpoints when creating the service client as shown in
50  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
51  * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
52  *     RegionHealthCheckServicesClient.create()) {
53  *   String project = "project-309310695";
54  *   String region = "region-934795532";
55  *   String healthCheckService = "healthCheckService-917902071";
56  *   HealthCheckService response =
57  *       regionHealthCheckServicesClient.get(project, region, healthCheckService);
58  * }
59  * }</pre>
60  *
61  * <p>Note: close() needs to be called on the RegionHealthCheckServicesClient object to clean up
62  * resources such as threads. In the example above, try-with-resources is used, which automatically
63  * calls close().
64  *
65  * <p>The surface of this class includes several types of Java methods for each of the API's
66  * methods:
67  *
68  * <ol>
69  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
70  *       converted into function parameters. It may be the case that not all fields are available as
71  *       parameters, and not every API method will have a flattened method entry point.
72  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
73  *       which must be constructed before the call. Not every API method will have a request object
74  *       method.
75  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
76  *       callable object, which can be used to initiate calls to the service.
77  * </ol>
78  *
79  * <p>See the individual methods for example code.
80  *
81  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
82  * these names, this class includes a format method for each type of name, and additionally a parse
83  * method to extract the individual identifiers contained within names that are returned.
84  *
85  * <p>This class can be customized by passing in a custom instance of
86  * RegionHealthCheckServicesSettings to create(). For example:
87  *
88  * <p>To customize credentials:
89  *
90  * <pre>{@code
91  * // This snippet has been automatically generated and should be regarded as a code template only.
92  * // It will require modifications to work:
93  * // - It may require correct/in-range values for request initialization.
94  * // - It may require specifying regional endpoints when creating the service client as shown in
95  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
96  * RegionHealthCheckServicesSettings regionHealthCheckServicesSettings =
97  *     RegionHealthCheckServicesSettings.newBuilder()
98  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
99  *         .build();
100  * RegionHealthCheckServicesClient regionHealthCheckServicesClient =
101  *     RegionHealthCheckServicesClient.create(regionHealthCheckServicesSettings);
102  * }</pre>
103  *
104  * <p>To customize the endpoint:
105  *
106  * <pre>{@code
107  * // This snippet has been automatically generated and should be regarded as a code template only.
108  * // It will require modifications to work:
109  * // - It may require correct/in-range values for request initialization.
110  * // - It may require specifying regional endpoints when creating the service client as shown in
111  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
112  * RegionHealthCheckServicesSettings regionHealthCheckServicesSettings =
113  *     RegionHealthCheckServicesSettings.newBuilder().setEndpoint(myEndpoint).build();
114  * RegionHealthCheckServicesClient regionHealthCheckServicesClient =
115  *     RegionHealthCheckServicesClient.create(regionHealthCheckServicesSettings);
116  * }</pre>
117  *
118  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
119  */
120 @Generated("by gapic-generator-java")
121 public class RegionHealthCheckServicesClient implements BackgroundResource {
122   private final RegionHealthCheckServicesSettings settings;
123   private final RegionHealthCheckServicesStub stub;
124 
125   /** Constructs an instance of RegionHealthCheckServicesClient with default settings. */
create()126   public static final RegionHealthCheckServicesClient create() throws IOException {
127     return create(RegionHealthCheckServicesSettings.newBuilder().build());
128   }
129 
130   /**
131    * Constructs an instance of RegionHealthCheckServicesClient, using the given settings. The
132    * channels are created based on the settings passed in, or defaults for any settings that are not
133    * set.
134    */
create( RegionHealthCheckServicesSettings settings)135   public static final RegionHealthCheckServicesClient create(
136       RegionHealthCheckServicesSettings settings) throws IOException {
137     return new RegionHealthCheckServicesClient(settings);
138   }
139 
140   /**
141    * Constructs an instance of RegionHealthCheckServicesClient, using the given stub for making
142    * calls. This is for advanced usage - prefer using create(RegionHealthCheckServicesSettings).
143    */
create(RegionHealthCheckServicesStub stub)144   public static final RegionHealthCheckServicesClient create(RegionHealthCheckServicesStub stub) {
145     return new RegionHealthCheckServicesClient(stub);
146   }
147 
148   /**
149    * Constructs an instance of RegionHealthCheckServicesClient, using the given settings. This is
150    * protected so that it is easy to make a subclass, but otherwise, the static factory methods
151    * should be preferred.
152    */
RegionHealthCheckServicesClient(RegionHealthCheckServicesSettings settings)153   protected RegionHealthCheckServicesClient(RegionHealthCheckServicesSettings settings)
154       throws IOException {
155     this.settings = settings;
156     this.stub = ((RegionHealthCheckServicesStubSettings) settings.getStubSettings()).createStub();
157   }
158 
RegionHealthCheckServicesClient(RegionHealthCheckServicesStub stub)159   protected RegionHealthCheckServicesClient(RegionHealthCheckServicesStub stub) {
160     this.settings = null;
161     this.stub = stub;
162   }
163 
getSettings()164   public final RegionHealthCheckServicesSettings getSettings() {
165     return settings;
166   }
167 
getStub()168   public RegionHealthCheckServicesStub getStub() {
169     return stub;
170   }
171 
172   // AUTO-GENERATED DOCUMENTATION AND METHOD.
173   /**
174    * Deletes the specified regional HealthCheckService.
175    *
176    * <p>Sample code:
177    *
178    * <pre>{@code
179    * // This snippet has been automatically generated and should be regarded as a code template only.
180    * // It will require modifications to work:
181    * // - It may require correct/in-range values for request initialization.
182    * // - It may require specifying regional endpoints when creating the service client as shown in
183    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
184    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
185    *     RegionHealthCheckServicesClient.create()) {
186    *   String project = "project-309310695";
187    *   String region = "region-934795532";
188    *   String healthCheckService = "healthCheckService-917902071";
189    *   Operation response =
190    *       regionHealthCheckServicesClient.deleteAsync(project, region, healthCheckService).get();
191    * }
192    * }</pre>
193    *
194    * @param project Project ID for this request.
195    * @param region Name of the region scoping this request.
196    * @param healthCheckService Name of the HealthCheckService to delete. The name must be 1-63
197    *     characters long, and comply with RFC1035.
198    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
199    */
deleteAsync( String project, String region, String healthCheckService)200   public final OperationFuture<Operation, Operation> deleteAsync(
201       String project, String region, String healthCheckService) {
202     DeleteRegionHealthCheckServiceRequest request =
203         DeleteRegionHealthCheckServiceRequest.newBuilder()
204             .setProject(project)
205             .setRegion(region)
206             .setHealthCheckService(healthCheckService)
207             .build();
208     return deleteAsync(request);
209   }
210 
211   // AUTO-GENERATED DOCUMENTATION AND METHOD.
212   /**
213    * Deletes the specified regional HealthCheckService.
214    *
215    * <p>Sample code:
216    *
217    * <pre>{@code
218    * // This snippet has been automatically generated and should be regarded as a code template only.
219    * // It will require modifications to work:
220    * // - It may require correct/in-range values for request initialization.
221    * // - It may require specifying regional endpoints when creating the service client as shown in
222    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
223    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
224    *     RegionHealthCheckServicesClient.create()) {
225    *   DeleteRegionHealthCheckServiceRequest request =
226    *       DeleteRegionHealthCheckServiceRequest.newBuilder()
227    *           .setHealthCheckService("healthCheckService-917902071")
228    *           .setProject("project-309310695")
229    *           .setRegion("region-934795532")
230    *           .setRequestId("requestId693933066")
231    *           .build();
232    *   Operation response = regionHealthCheckServicesClient.deleteAsync(request).get();
233    * }
234    * }</pre>
235    *
236    * @param request The request object containing all of the parameters for the API call.
237    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
238    */
239   @BetaApi(
240       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteRegionHealthCheckServiceRequest request)241   public final OperationFuture<Operation, Operation> deleteAsync(
242       DeleteRegionHealthCheckServiceRequest request) {
243     return deleteOperationCallable().futureCall(request);
244   }
245 
246   // AUTO-GENERATED DOCUMENTATION AND METHOD.
247   /**
248    * Deletes the specified regional HealthCheckService.
249    *
250    * <p>Sample code:
251    *
252    * <pre>{@code
253    * // This snippet has been automatically generated and should be regarded as a code template only.
254    * // It will require modifications to work:
255    * // - It may require correct/in-range values for request initialization.
256    * // - It may require specifying regional endpoints when creating the service client as shown in
257    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
258    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
259    *     RegionHealthCheckServicesClient.create()) {
260    *   DeleteRegionHealthCheckServiceRequest request =
261    *       DeleteRegionHealthCheckServiceRequest.newBuilder()
262    *           .setHealthCheckService("healthCheckService-917902071")
263    *           .setProject("project-309310695")
264    *           .setRegion("region-934795532")
265    *           .setRequestId("requestId693933066")
266    *           .build();
267    *   OperationFuture<Operation, Operation> future =
268    *       regionHealthCheckServicesClient.deleteOperationCallable().futureCall(request);
269    *   // Do something.
270    *   Operation response = future.get();
271    * }
272    * }</pre>
273    */
274   public final OperationCallable<DeleteRegionHealthCheckServiceRequest, Operation, Operation>
deleteOperationCallable()275       deleteOperationCallable() {
276     return stub.deleteOperationCallable();
277   }
278 
279   // AUTO-GENERATED DOCUMENTATION AND METHOD.
280   /**
281    * Deletes the specified regional HealthCheckService.
282    *
283    * <p>Sample code:
284    *
285    * <pre>{@code
286    * // This snippet has been automatically generated and should be regarded as a code template only.
287    * // It will require modifications to work:
288    * // - It may require correct/in-range values for request initialization.
289    * // - It may require specifying regional endpoints when creating the service client as shown in
290    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
291    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
292    *     RegionHealthCheckServicesClient.create()) {
293    *   DeleteRegionHealthCheckServiceRequest request =
294    *       DeleteRegionHealthCheckServiceRequest.newBuilder()
295    *           .setHealthCheckService("healthCheckService-917902071")
296    *           .setProject("project-309310695")
297    *           .setRegion("region-934795532")
298    *           .setRequestId("requestId693933066")
299    *           .build();
300    *   ApiFuture<Operation> future =
301    *       regionHealthCheckServicesClient.deleteCallable().futureCall(request);
302    *   // Do something.
303    *   Operation response = future.get();
304    * }
305    * }</pre>
306    */
deleteCallable()307   public final UnaryCallable<DeleteRegionHealthCheckServiceRequest, Operation> deleteCallable() {
308     return stub.deleteCallable();
309   }
310 
311   // AUTO-GENERATED DOCUMENTATION AND METHOD.
312   /**
313    * Returns the specified regional HealthCheckService resource.
314    *
315    * <p>Sample code:
316    *
317    * <pre>{@code
318    * // This snippet has been automatically generated and should be regarded as a code template only.
319    * // It will require modifications to work:
320    * // - It may require correct/in-range values for request initialization.
321    * // - It may require specifying regional endpoints when creating the service client as shown in
322    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
323    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
324    *     RegionHealthCheckServicesClient.create()) {
325    *   String project = "project-309310695";
326    *   String region = "region-934795532";
327    *   String healthCheckService = "healthCheckService-917902071";
328    *   HealthCheckService response =
329    *       regionHealthCheckServicesClient.get(project, region, healthCheckService);
330    * }
331    * }</pre>
332    *
333    * @param project Project ID for this request.
334    * @param region Name of the region scoping this request.
335    * @param healthCheckService Name of the HealthCheckService to update. The name must be 1-63
336    *     characters long, and comply with RFC1035.
337    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
338    */
get(String project, String region, String healthCheckService)339   public final HealthCheckService get(String project, String region, String healthCheckService) {
340     GetRegionHealthCheckServiceRequest request =
341         GetRegionHealthCheckServiceRequest.newBuilder()
342             .setProject(project)
343             .setRegion(region)
344             .setHealthCheckService(healthCheckService)
345             .build();
346     return get(request);
347   }
348 
349   // AUTO-GENERATED DOCUMENTATION AND METHOD.
350   /**
351    * Returns the specified regional HealthCheckService resource.
352    *
353    * <p>Sample code:
354    *
355    * <pre>{@code
356    * // This snippet has been automatically generated and should be regarded as a code template only.
357    * // It will require modifications to work:
358    * // - It may require correct/in-range values for request initialization.
359    * // - It may require specifying regional endpoints when creating the service client as shown in
360    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
361    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
362    *     RegionHealthCheckServicesClient.create()) {
363    *   GetRegionHealthCheckServiceRequest request =
364    *       GetRegionHealthCheckServiceRequest.newBuilder()
365    *           .setHealthCheckService("healthCheckService-917902071")
366    *           .setProject("project-309310695")
367    *           .setRegion("region-934795532")
368    *           .build();
369    *   HealthCheckService response = regionHealthCheckServicesClient.get(request);
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    */
get(GetRegionHealthCheckServiceRequest request)376   public final HealthCheckService get(GetRegionHealthCheckServiceRequest request) {
377     return getCallable().call(request);
378   }
379 
380   // AUTO-GENERATED DOCUMENTATION AND METHOD.
381   /**
382    * Returns the specified regional HealthCheckService resource.
383    *
384    * <p>Sample code:
385    *
386    * <pre>{@code
387    * // This snippet has been automatically generated and should be regarded as a code template only.
388    * // It will require modifications to work:
389    * // - It may require correct/in-range values for request initialization.
390    * // - It may require specifying regional endpoints when creating the service client as shown in
391    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
392    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
393    *     RegionHealthCheckServicesClient.create()) {
394    *   GetRegionHealthCheckServiceRequest request =
395    *       GetRegionHealthCheckServiceRequest.newBuilder()
396    *           .setHealthCheckService("healthCheckService-917902071")
397    *           .setProject("project-309310695")
398    *           .setRegion("region-934795532")
399    *           .build();
400    *   ApiFuture<HealthCheckService> future =
401    *       regionHealthCheckServicesClient.getCallable().futureCall(request);
402    *   // Do something.
403    *   HealthCheckService response = future.get();
404    * }
405    * }</pre>
406    */
getCallable()407   public final UnaryCallable<GetRegionHealthCheckServiceRequest, HealthCheckService> getCallable() {
408     return stub.getCallable();
409   }
410 
411   // AUTO-GENERATED DOCUMENTATION AND METHOD.
412   /**
413    * Creates a regional HealthCheckService resource in the specified project and region using the
414    * data included in the request.
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 (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
425    *     RegionHealthCheckServicesClient.create()) {
426    *   String project = "project-309310695";
427    *   String region = "region-934795532";
428    *   HealthCheckService healthCheckServiceResource = HealthCheckService.newBuilder().build();
429    *   Operation response =
430    *       regionHealthCheckServicesClient
431    *           .insertAsync(project, region, healthCheckServiceResource)
432    *           .get();
433    * }
434    * }</pre>
435    *
436    * @param project Project ID for this request.
437    * @param region Name of the region scoping this request.
438    * @param healthCheckServiceResource The body resource for this request
439    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
440    */
insertAsync( String project, String region, HealthCheckService healthCheckServiceResource)441   public final OperationFuture<Operation, Operation> insertAsync(
442       String project, String region, HealthCheckService healthCheckServiceResource) {
443     InsertRegionHealthCheckServiceRequest request =
444         InsertRegionHealthCheckServiceRequest.newBuilder()
445             .setProject(project)
446             .setRegion(region)
447             .setHealthCheckServiceResource(healthCheckServiceResource)
448             .build();
449     return insertAsync(request);
450   }
451 
452   // AUTO-GENERATED DOCUMENTATION AND METHOD.
453   /**
454    * Creates a regional HealthCheckService resource in the specified project and region using the
455    * data included in the request.
456    *
457    * <p>Sample code:
458    *
459    * <pre>{@code
460    * // This snippet has been automatically generated and should be regarded as a code template only.
461    * // It will require modifications to work:
462    * // - It may require correct/in-range values for request initialization.
463    * // - It may require specifying regional endpoints when creating the service client as shown in
464    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
465    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
466    *     RegionHealthCheckServicesClient.create()) {
467    *   InsertRegionHealthCheckServiceRequest request =
468    *       InsertRegionHealthCheckServiceRequest.newBuilder()
469    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
470    *           .setProject("project-309310695")
471    *           .setRegion("region-934795532")
472    *           .setRequestId("requestId693933066")
473    *           .build();
474    *   Operation response = regionHealthCheckServicesClient.insertAsync(request).get();
475    * }
476    * }</pre>
477    *
478    * @param request The request object containing all of the parameters for the API call.
479    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
480    */
481   @BetaApi(
482       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertRegionHealthCheckServiceRequest request)483   public final OperationFuture<Operation, Operation> insertAsync(
484       InsertRegionHealthCheckServiceRequest request) {
485     return insertOperationCallable().futureCall(request);
486   }
487 
488   // AUTO-GENERATED DOCUMENTATION AND METHOD.
489   /**
490    * Creates a regional HealthCheckService resource in the specified project and region using the
491    * data included in the request.
492    *
493    * <p>Sample code:
494    *
495    * <pre>{@code
496    * // This snippet has been automatically generated and should be regarded as a code template only.
497    * // It will require modifications to work:
498    * // - It may require correct/in-range values for request initialization.
499    * // - It may require specifying regional endpoints when creating the service client as shown in
500    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
501    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
502    *     RegionHealthCheckServicesClient.create()) {
503    *   InsertRegionHealthCheckServiceRequest request =
504    *       InsertRegionHealthCheckServiceRequest.newBuilder()
505    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
506    *           .setProject("project-309310695")
507    *           .setRegion("region-934795532")
508    *           .setRequestId("requestId693933066")
509    *           .build();
510    *   OperationFuture<Operation, Operation> future =
511    *       regionHealthCheckServicesClient.insertOperationCallable().futureCall(request);
512    *   // Do something.
513    *   Operation response = future.get();
514    * }
515    * }</pre>
516    */
517   public final OperationCallable<InsertRegionHealthCheckServiceRequest, Operation, Operation>
insertOperationCallable()518       insertOperationCallable() {
519     return stub.insertOperationCallable();
520   }
521 
522   // AUTO-GENERATED DOCUMENTATION AND METHOD.
523   /**
524    * Creates a regional HealthCheckService resource in the specified project and region using the
525    * data included in the request.
526    *
527    * <p>Sample code:
528    *
529    * <pre>{@code
530    * // This snippet has been automatically generated and should be regarded as a code template only.
531    * // It will require modifications to work:
532    * // - It may require correct/in-range values for request initialization.
533    * // - It may require specifying regional endpoints when creating the service client as shown in
534    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
535    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
536    *     RegionHealthCheckServicesClient.create()) {
537    *   InsertRegionHealthCheckServiceRequest request =
538    *       InsertRegionHealthCheckServiceRequest.newBuilder()
539    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
540    *           .setProject("project-309310695")
541    *           .setRegion("region-934795532")
542    *           .setRequestId("requestId693933066")
543    *           .build();
544    *   ApiFuture<Operation> future =
545    *       regionHealthCheckServicesClient.insertCallable().futureCall(request);
546    *   // Do something.
547    *   Operation response = future.get();
548    * }
549    * }</pre>
550    */
insertCallable()551   public final UnaryCallable<InsertRegionHealthCheckServiceRequest, Operation> insertCallable() {
552     return stub.insertCallable();
553   }
554 
555   // AUTO-GENERATED DOCUMENTATION AND METHOD.
556   /**
557    * Lists all the HealthCheckService resources that have been configured for the specified project
558    * in the given region.
559    *
560    * <p>Sample code:
561    *
562    * <pre>{@code
563    * // This snippet has been automatically generated and should be regarded as a code template only.
564    * // It will require modifications to work:
565    * // - It may require correct/in-range values for request initialization.
566    * // - It may require specifying regional endpoints when creating the service client as shown in
567    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
568    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
569    *     RegionHealthCheckServicesClient.create()) {
570    *   String project = "project-309310695";
571    *   String region = "region-934795532";
572    *   for (HealthCheckService element :
573    *       regionHealthCheckServicesClient.list(project, region).iterateAll()) {
574    *     // doThingsWith(element);
575    *   }
576    * }
577    * }</pre>
578    *
579    * @param project Project ID for this request.
580    * @param region Name of the region scoping this request.
581    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
582    */
list(String project, String region)583   public final ListPagedResponse list(String project, String region) {
584     ListRegionHealthCheckServicesRequest request =
585         ListRegionHealthCheckServicesRequest.newBuilder()
586             .setProject(project)
587             .setRegion(region)
588             .build();
589     return list(request);
590   }
591 
592   // AUTO-GENERATED DOCUMENTATION AND METHOD.
593   /**
594    * Lists all the HealthCheckService resources that have been configured for the specified project
595    * in the given region.
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 (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
606    *     RegionHealthCheckServicesClient.create()) {
607    *   ListRegionHealthCheckServicesRequest request =
608    *       ListRegionHealthCheckServicesRequest.newBuilder()
609    *           .setFilter("filter-1274492040")
610    *           .setMaxResults(1128457243)
611    *           .setOrderBy("orderBy-1207110587")
612    *           .setPageToken("pageToken873572522")
613    *           .setProject("project-309310695")
614    *           .setRegion("region-934795532")
615    *           .setReturnPartialSuccess(true)
616    *           .build();
617    *   for (HealthCheckService element :
618    *       regionHealthCheckServicesClient.list(request).iterateAll()) {
619    *     // doThingsWith(element);
620    *   }
621    * }
622    * }</pre>
623    *
624    * @param request The request object containing all of the parameters for the API call.
625    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
626    */
list(ListRegionHealthCheckServicesRequest request)627   public final ListPagedResponse list(ListRegionHealthCheckServicesRequest request) {
628     return listPagedCallable().call(request);
629   }
630 
631   // AUTO-GENERATED DOCUMENTATION AND METHOD.
632   /**
633    * Lists all the HealthCheckService resources that have been configured for the specified project
634    * in the given region.
635    *
636    * <p>Sample code:
637    *
638    * <pre>{@code
639    * // This snippet has been automatically generated and should be regarded as a code template only.
640    * // It will require modifications to work:
641    * // - It may require correct/in-range values for request initialization.
642    * // - It may require specifying regional endpoints when creating the service client as shown in
643    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
644    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
645    *     RegionHealthCheckServicesClient.create()) {
646    *   ListRegionHealthCheckServicesRequest request =
647    *       ListRegionHealthCheckServicesRequest.newBuilder()
648    *           .setFilter("filter-1274492040")
649    *           .setMaxResults(1128457243)
650    *           .setOrderBy("orderBy-1207110587")
651    *           .setPageToken("pageToken873572522")
652    *           .setProject("project-309310695")
653    *           .setRegion("region-934795532")
654    *           .setReturnPartialSuccess(true)
655    *           .build();
656    *   ApiFuture<HealthCheckService> future =
657    *       regionHealthCheckServicesClient.listPagedCallable().futureCall(request);
658    *   // Do something.
659    *   for (HealthCheckService element : future.get().iterateAll()) {
660    *     // doThingsWith(element);
661    *   }
662    * }
663    * }</pre>
664    */
665   public final UnaryCallable<ListRegionHealthCheckServicesRequest, ListPagedResponse>
listPagedCallable()666       listPagedCallable() {
667     return stub.listPagedCallable();
668   }
669 
670   // AUTO-GENERATED DOCUMENTATION AND METHOD.
671   /**
672    * Lists all the HealthCheckService resources that have been configured for the specified project
673    * in the given region.
674    *
675    * <p>Sample code:
676    *
677    * <pre>{@code
678    * // This snippet has been automatically generated and should be regarded as a code template only.
679    * // It will require modifications to work:
680    * // - It may require correct/in-range values for request initialization.
681    * // - It may require specifying regional endpoints when creating the service client as shown in
682    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
683    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
684    *     RegionHealthCheckServicesClient.create()) {
685    *   ListRegionHealthCheckServicesRequest request =
686    *       ListRegionHealthCheckServicesRequest.newBuilder()
687    *           .setFilter("filter-1274492040")
688    *           .setMaxResults(1128457243)
689    *           .setOrderBy("orderBy-1207110587")
690    *           .setPageToken("pageToken873572522")
691    *           .setProject("project-309310695")
692    *           .setRegion("region-934795532")
693    *           .setReturnPartialSuccess(true)
694    *           .build();
695    *   while (true) {
696    *     HealthCheckServicesList response =
697    *         regionHealthCheckServicesClient.listCallable().call(request);
698    *     for (HealthCheckService element : response.getItemsList()) {
699    *       // doThingsWith(element);
700    *     }
701    *     String nextPageToken = response.getNextPageToken();
702    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
703    *       request = request.toBuilder().setPageToken(nextPageToken).build();
704    *     } else {
705    *       break;
706    *     }
707    *   }
708    * }
709    * }</pre>
710    */
711   public final UnaryCallable<ListRegionHealthCheckServicesRequest, HealthCheckServicesList>
listCallable()712       listCallable() {
713     return stub.listCallable();
714   }
715 
716   // AUTO-GENERATED DOCUMENTATION AND METHOD.
717   /**
718    * Updates the specified regional HealthCheckService resource with the data included in the
719    * request. This method supports PATCH semantics and uses the JSON merge patch format and
720    * processing rules.
721    *
722    * <p>Sample code:
723    *
724    * <pre>{@code
725    * // This snippet has been automatically generated and should be regarded as a code template only.
726    * // It will require modifications to work:
727    * // - It may require correct/in-range values for request initialization.
728    * // - It may require specifying regional endpoints when creating the service client as shown in
729    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
730    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
731    *     RegionHealthCheckServicesClient.create()) {
732    *   String project = "project-309310695";
733    *   String region = "region-934795532";
734    *   String healthCheckService = "healthCheckService-917902071";
735    *   HealthCheckService healthCheckServiceResource = HealthCheckService.newBuilder().build();
736    *   Operation response =
737    *       regionHealthCheckServicesClient
738    *           .patchAsync(project, region, healthCheckService, healthCheckServiceResource)
739    *           .get();
740    * }
741    * }</pre>
742    *
743    * @param project Project ID for this request.
744    * @param region Name of the region scoping this request.
745    * @param healthCheckService Name of the HealthCheckService to update. The name must be 1-63
746    *     characters long, and comply with RFC1035.
747    * @param healthCheckServiceResource The body resource for this request
748    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
749    */
patchAsync( String project, String region, String healthCheckService, HealthCheckService healthCheckServiceResource)750   public final OperationFuture<Operation, Operation> patchAsync(
751       String project,
752       String region,
753       String healthCheckService,
754       HealthCheckService healthCheckServiceResource) {
755     PatchRegionHealthCheckServiceRequest request =
756         PatchRegionHealthCheckServiceRequest.newBuilder()
757             .setProject(project)
758             .setRegion(region)
759             .setHealthCheckService(healthCheckService)
760             .setHealthCheckServiceResource(healthCheckServiceResource)
761             .build();
762     return patchAsync(request);
763   }
764 
765   // AUTO-GENERATED DOCUMENTATION AND METHOD.
766   /**
767    * Updates the specified regional HealthCheckService resource with the data included in the
768    * request. This method supports PATCH semantics and uses the JSON merge patch format and
769    * processing rules.
770    *
771    * <p>Sample code:
772    *
773    * <pre>{@code
774    * // This snippet has been automatically generated and should be regarded as a code template only.
775    * // It will require modifications to work:
776    * // - It may require correct/in-range values for request initialization.
777    * // - It may require specifying regional endpoints when creating the service client as shown in
778    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
779    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
780    *     RegionHealthCheckServicesClient.create()) {
781    *   PatchRegionHealthCheckServiceRequest request =
782    *       PatchRegionHealthCheckServiceRequest.newBuilder()
783    *           .setHealthCheckService("healthCheckService-917902071")
784    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
785    *           .setProject("project-309310695")
786    *           .setRegion("region-934795532")
787    *           .setRequestId("requestId693933066")
788    *           .build();
789    *   Operation response = regionHealthCheckServicesClient.patchAsync(request).get();
790    * }
791    * }</pre>
792    *
793    * @param request The request object containing all of the parameters for the API call.
794    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
795    */
796   @BetaApi(
797       "The surface for long-running operations is not stable yet and may change in the future.")
patchAsync( PatchRegionHealthCheckServiceRequest request)798   public final OperationFuture<Operation, Operation> patchAsync(
799       PatchRegionHealthCheckServiceRequest request) {
800     return patchOperationCallable().futureCall(request);
801   }
802 
803   // AUTO-GENERATED DOCUMENTATION AND METHOD.
804   /**
805    * Updates the specified regional HealthCheckService resource with the data included in the
806    * request. This method supports PATCH semantics and uses the JSON merge patch format and
807    * processing rules.
808    *
809    * <p>Sample code:
810    *
811    * <pre>{@code
812    * // This snippet has been automatically generated and should be regarded as a code template only.
813    * // It will require modifications to work:
814    * // - It may require correct/in-range values for request initialization.
815    * // - It may require specifying regional endpoints when creating the service client as shown in
816    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
817    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
818    *     RegionHealthCheckServicesClient.create()) {
819    *   PatchRegionHealthCheckServiceRequest request =
820    *       PatchRegionHealthCheckServiceRequest.newBuilder()
821    *           .setHealthCheckService("healthCheckService-917902071")
822    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
823    *           .setProject("project-309310695")
824    *           .setRegion("region-934795532")
825    *           .setRequestId("requestId693933066")
826    *           .build();
827    *   OperationFuture<Operation, Operation> future =
828    *       regionHealthCheckServicesClient.patchOperationCallable().futureCall(request);
829    *   // Do something.
830    *   Operation response = future.get();
831    * }
832    * }</pre>
833    */
834   public final OperationCallable<PatchRegionHealthCheckServiceRequest, Operation, Operation>
patchOperationCallable()835       patchOperationCallable() {
836     return stub.patchOperationCallable();
837   }
838 
839   // AUTO-GENERATED DOCUMENTATION AND METHOD.
840   /**
841    * Updates the specified regional HealthCheckService resource with the data included in the
842    * request. This method supports PATCH semantics and uses the JSON merge patch format and
843    * processing rules.
844    *
845    * <p>Sample code:
846    *
847    * <pre>{@code
848    * // This snippet has been automatically generated and should be regarded as a code template only.
849    * // It will require modifications to work:
850    * // - It may require correct/in-range values for request initialization.
851    * // - It may require specifying regional endpoints when creating the service client as shown in
852    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
853    * try (RegionHealthCheckServicesClient regionHealthCheckServicesClient =
854    *     RegionHealthCheckServicesClient.create()) {
855    *   PatchRegionHealthCheckServiceRequest request =
856    *       PatchRegionHealthCheckServiceRequest.newBuilder()
857    *           .setHealthCheckService("healthCheckService-917902071")
858    *           .setHealthCheckServiceResource(HealthCheckService.newBuilder().build())
859    *           .setProject("project-309310695")
860    *           .setRegion("region-934795532")
861    *           .setRequestId("requestId693933066")
862    *           .build();
863    *   ApiFuture<Operation> future =
864    *       regionHealthCheckServicesClient.patchCallable().futureCall(request);
865    *   // Do something.
866    *   Operation response = future.get();
867    * }
868    * }</pre>
869    */
patchCallable()870   public final UnaryCallable<PatchRegionHealthCheckServiceRequest, Operation> patchCallable() {
871     return stub.patchCallable();
872   }
873 
874   @Override
close()875   public final void close() {
876     stub.close();
877   }
878 
879   @Override
shutdown()880   public void shutdown() {
881     stub.shutdown();
882   }
883 
884   @Override
isShutdown()885   public boolean isShutdown() {
886     return stub.isShutdown();
887   }
888 
889   @Override
isTerminated()890   public boolean isTerminated() {
891     return stub.isTerminated();
892   }
893 
894   @Override
shutdownNow()895   public void shutdownNow() {
896     stub.shutdownNow();
897   }
898 
899   @Override
awaitTermination(long duration, TimeUnit unit)900   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
901     return stub.awaitTermination(duration, unit);
902   }
903 
904   public static class ListPagedResponse
905       extends AbstractPagedListResponse<
906           ListRegionHealthCheckServicesRequest,
907           HealthCheckServicesList,
908           HealthCheckService,
909           ListPage,
910           ListFixedSizeCollection> {
911 
createAsync( PageContext< ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService> context, ApiFuture<HealthCheckServicesList> futureResponse)912     public static ApiFuture<ListPagedResponse> createAsync(
913         PageContext<
914                 ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService>
915             context,
916         ApiFuture<HealthCheckServicesList> futureResponse) {
917       ApiFuture<ListPage> futurePage =
918           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
919       return ApiFutures.transform(
920           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
921     }
922 
ListPagedResponse(ListPage page)923     private ListPagedResponse(ListPage page) {
924       super(page, ListFixedSizeCollection.createEmptyCollection());
925     }
926   }
927 
928   public static class ListPage
929       extends AbstractPage<
930           ListRegionHealthCheckServicesRequest,
931           HealthCheckServicesList,
932           HealthCheckService,
933           ListPage> {
934 
ListPage( PageContext< ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService> context, HealthCheckServicesList response)935     private ListPage(
936         PageContext<
937                 ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService>
938             context,
939         HealthCheckServicesList response) {
940       super(context, response);
941     }
942 
createEmptyPage()943     private static ListPage createEmptyPage() {
944       return new ListPage(null, null);
945     }
946 
947     @Override
createPage( PageContext< ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService> context, HealthCheckServicesList response)948     protected ListPage createPage(
949         PageContext<
950                 ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService>
951             context,
952         HealthCheckServicesList response) {
953       return new ListPage(context, response);
954     }
955 
956     @Override
createPageAsync( PageContext< ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService> context, ApiFuture<HealthCheckServicesList> futureResponse)957     public ApiFuture<ListPage> createPageAsync(
958         PageContext<
959                 ListRegionHealthCheckServicesRequest, HealthCheckServicesList, HealthCheckService>
960             context,
961         ApiFuture<HealthCheckServicesList> futureResponse) {
962       return super.createPageAsync(context, futureResponse);
963     }
964   }
965 
966   public static class ListFixedSizeCollection
967       extends AbstractFixedSizeCollection<
968           ListRegionHealthCheckServicesRequest,
969           HealthCheckServicesList,
970           HealthCheckService,
971           ListPage,
972           ListFixedSizeCollection> {
973 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)974     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
975       super(pages, collectionSize);
976     }
977 
createEmptyCollection()978     private static ListFixedSizeCollection createEmptyCollection() {
979       return new ListFixedSizeCollection(null, 0);
980     }
981 
982     @Override
createCollection(List<ListPage> pages, int collectionSize)983     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
984       return new ListFixedSizeCollection(pages, collectionSize);
985     }
986   }
987 }
988