• 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.HealthChecksStub;
31 import com.google.cloud.compute.v1.stub.HealthChecksStubSettings;
32 import com.google.common.util.concurrent.MoreExecutors;
33 import java.io.IOException;
34 import java.util.List;
35 import java.util.Map;
36 import java.util.concurrent.TimeUnit;
37 import javax.annotation.Generated;
38 
39 // AUTO-GENERATED DOCUMENTATION AND CLASS.
40 /**
41  * Service Description: The HealthChecks API.
42  *
43  * <p>This class provides the ability to make remote calls to the backing service through method
44  * calls that map to API methods. Sample code to get started:
45  *
46  * <pre>{@code
47  * // This snippet has been automatically generated and should be regarded as a code template only.
48  * // It will require modifications to work:
49  * // - It may require correct/in-range values for request initialization.
50  * // - It may require specifying regional endpoints when creating the service client as shown in
51  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
52  * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
53  *   String project = "project-309310695";
54  *   String healthCheck = "healthCheck-1938093044";
55  *   HealthCheck response = healthChecksClient.get(project, healthCheck);
56  * }
57  * }</pre>
58  *
59  * <p>Note: close() needs to be called on the HealthChecksClient object to clean up resources such
60  * as threads. In the example above, try-with-resources is used, which automatically calls close().
61  *
62  * <p>The surface of this class includes several types of Java methods for each of the API's
63  * methods:
64  *
65  * <ol>
66  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
67  *       converted into function parameters. It may be the case that not all fields are available as
68  *       parameters, and not every API method will have a flattened method entry point.
69  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
70  *       which must be constructed before the call. Not every API method will have a request object
71  *       method.
72  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
73  *       callable object, which can be used to initiate calls to the service.
74  * </ol>
75  *
76  * <p>See the individual methods for example code.
77  *
78  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
79  * these names, this class includes a format method for each type of name, and additionally a parse
80  * method to extract the individual identifiers contained within names that are returned.
81  *
82  * <p>This class can be customized by passing in a custom instance of HealthChecksSettings to
83  * create(). For example:
84  *
85  * <p>To customize credentials:
86  *
87  * <pre>{@code
88  * // This snippet has been automatically generated and should be regarded as a code template only.
89  * // It will require modifications to work:
90  * // - It may require correct/in-range values for request initialization.
91  * // - It may require specifying regional endpoints when creating the service client as shown in
92  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
93  * HealthChecksSettings healthChecksSettings =
94  *     HealthChecksSettings.newBuilder()
95  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
96  *         .build();
97  * HealthChecksClient healthChecksClient = HealthChecksClient.create(healthChecksSettings);
98  * }</pre>
99  *
100  * <p>To customize the endpoint:
101  *
102  * <pre>{@code
103  * // This snippet has been automatically generated and should be regarded as a code template only.
104  * // It will require modifications to work:
105  * // - It may require correct/in-range values for request initialization.
106  * // - It may require specifying regional endpoints when creating the service client as shown in
107  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
108  * HealthChecksSettings healthChecksSettings =
109  *     HealthChecksSettings.newBuilder().setEndpoint(myEndpoint).build();
110  * HealthChecksClient healthChecksClient = HealthChecksClient.create(healthChecksSettings);
111  * }</pre>
112  *
113  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
114  */
115 @Generated("by gapic-generator-java")
116 public class HealthChecksClient implements BackgroundResource {
117   private final HealthChecksSettings settings;
118   private final HealthChecksStub stub;
119 
120   /** Constructs an instance of HealthChecksClient with default settings. */
create()121   public static final HealthChecksClient create() throws IOException {
122     return create(HealthChecksSettings.newBuilder().build());
123   }
124 
125   /**
126    * Constructs an instance of HealthChecksClient, using the given settings. The channels are
127    * created based on the settings passed in, or defaults for any settings that are not set.
128    */
create(HealthChecksSettings settings)129   public static final HealthChecksClient create(HealthChecksSettings settings) throws IOException {
130     return new HealthChecksClient(settings);
131   }
132 
133   /**
134    * Constructs an instance of HealthChecksClient, using the given stub for making calls. This is
135    * for advanced usage - prefer using create(HealthChecksSettings).
136    */
create(HealthChecksStub stub)137   public static final HealthChecksClient create(HealthChecksStub stub) {
138     return new HealthChecksClient(stub);
139   }
140 
141   /**
142    * Constructs an instance of HealthChecksClient, using the given settings. This is protected so
143    * that it is easy to make a subclass, but otherwise, the static factory methods should be
144    * preferred.
145    */
HealthChecksClient(HealthChecksSettings settings)146   protected HealthChecksClient(HealthChecksSettings settings) throws IOException {
147     this.settings = settings;
148     this.stub = ((HealthChecksStubSettings) settings.getStubSettings()).createStub();
149   }
150 
HealthChecksClient(HealthChecksStub stub)151   protected HealthChecksClient(HealthChecksStub stub) {
152     this.settings = null;
153     this.stub = stub;
154   }
155 
getSettings()156   public final HealthChecksSettings getSettings() {
157     return settings;
158   }
159 
getStub()160   public HealthChecksStub getStub() {
161     return stub;
162   }
163 
164   // AUTO-GENERATED DOCUMENTATION AND METHOD.
165   /**
166    * Retrieves the list of all HealthCheck resources, regional and global, available to the
167    * specified project.
168    *
169    * <p>Sample code:
170    *
171    * <pre>{@code
172    * // This snippet has been automatically generated and should be regarded as a code template only.
173    * // It will require modifications to work:
174    * // - It may require correct/in-range values for request initialization.
175    * // - It may require specifying regional endpoints when creating the service client as shown in
176    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
177    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
178    *   String project = "project-309310695";
179    *   for (Map.Entry<String, HealthChecksScopedList> element :
180    *       healthChecksClient.aggregatedList(project).iterateAll()) {
181    *     // doThingsWith(element);
182    *   }
183    * }
184    * }</pre>
185    *
186    * @param project Name of the project scoping this request.
187    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
188    */
aggregatedList(String project)189   public final AggregatedListPagedResponse aggregatedList(String project) {
190     AggregatedListHealthChecksRequest request =
191         AggregatedListHealthChecksRequest.newBuilder().setProject(project).build();
192     return aggregatedList(request);
193   }
194 
195   // AUTO-GENERATED DOCUMENTATION AND METHOD.
196   /**
197    * Retrieves the list of all HealthCheck resources, regional and global, available to the
198    * specified project.
199    *
200    * <p>Sample code:
201    *
202    * <pre>{@code
203    * // This snippet has been automatically generated and should be regarded as a code template only.
204    * // It will require modifications to work:
205    * // - It may require correct/in-range values for request initialization.
206    * // - It may require specifying regional endpoints when creating the service client as shown in
207    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
208    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
209    *   AggregatedListHealthChecksRequest request =
210    *       AggregatedListHealthChecksRequest.newBuilder()
211    *           .setFilter("filter-1274492040")
212    *           .setIncludeAllScopes(true)
213    *           .setMaxResults(1128457243)
214    *           .setOrderBy("orderBy-1207110587")
215    *           .setPageToken("pageToken873572522")
216    *           .setProject("project-309310695")
217    *           .setReturnPartialSuccess(true)
218    *           .build();
219    *   for (Map.Entry<String, HealthChecksScopedList> element :
220    *       healthChecksClient.aggregatedList(request).iterateAll()) {
221    *     // doThingsWith(element);
222    *   }
223    * }
224    * }</pre>
225    *
226    * @param request The request object containing all of the parameters for the API call.
227    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
228    */
aggregatedList( AggregatedListHealthChecksRequest request)229   public final AggregatedListPagedResponse aggregatedList(
230       AggregatedListHealthChecksRequest request) {
231     return aggregatedListPagedCallable().call(request);
232   }
233 
234   // AUTO-GENERATED DOCUMENTATION AND METHOD.
235   /**
236    * Retrieves the list of all HealthCheck resources, regional and global, available to the
237    * specified project.
238    *
239    * <p>Sample code:
240    *
241    * <pre>{@code
242    * // This snippet has been automatically generated and should be regarded as a code template only.
243    * // It will require modifications to work:
244    * // - It may require correct/in-range values for request initialization.
245    * // - It may require specifying regional endpoints when creating the service client as shown in
246    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
247    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
248    *   AggregatedListHealthChecksRequest request =
249    *       AggregatedListHealthChecksRequest.newBuilder()
250    *           .setFilter("filter-1274492040")
251    *           .setIncludeAllScopes(true)
252    *           .setMaxResults(1128457243)
253    *           .setOrderBy("orderBy-1207110587")
254    *           .setPageToken("pageToken873572522")
255    *           .setProject("project-309310695")
256    *           .setReturnPartialSuccess(true)
257    *           .build();
258    *   ApiFuture<Map.Entry<String, HealthChecksScopedList>> future =
259    *       healthChecksClient.aggregatedListPagedCallable().futureCall(request);
260    *   // Do something.
261    *   for (Map.Entry<String, HealthChecksScopedList> element : future.get().iterateAll()) {
262    *     // doThingsWith(element);
263    *   }
264    * }
265    * }</pre>
266    */
267   public final UnaryCallable<AggregatedListHealthChecksRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()268       aggregatedListPagedCallable() {
269     return stub.aggregatedListPagedCallable();
270   }
271 
272   // AUTO-GENERATED DOCUMENTATION AND METHOD.
273   /**
274    * Retrieves the list of all HealthCheck resources, regional and global, available to the
275    * specified project.
276    *
277    * <p>Sample code:
278    *
279    * <pre>{@code
280    * // This snippet has been automatically generated and should be regarded as a code template only.
281    * // It will require modifications to work:
282    * // - It may require correct/in-range values for request initialization.
283    * // - It may require specifying regional endpoints when creating the service client as shown in
284    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
285    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
286    *   AggregatedListHealthChecksRequest request =
287    *       AggregatedListHealthChecksRequest.newBuilder()
288    *           .setFilter("filter-1274492040")
289    *           .setIncludeAllScopes(true)
290    *           .setMaxResults(1128457243)
291    *           .setOrderBy("orderBy-1207110587")
292    *           .setPageToken("pageToken873572522")
293    *           .setProject("project-309310695")
294    *           .setReturnPartialSuccess(true)
295    *           .build();
296    *   while (true) {
297    *     HealthChecksAggregatedList response =
298    *         healthChecksClient.aggregatedListCallable().call(request);
299    *     for (Map.Entry<String, HealthChecksScopedList> element : response.getItemsList()) {
300    *       // doThingsWith(element);
301    *     }
302    *     String nextPageToken = response.getNextPageToken();
303    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
304    *       request = request.toBuilder().setPageToken(nextPageToken).build();
305    *     } else {
306    *       break;
307    *     }
308    *   }
309    * }
310    * }</pre>
311    */
312   public final UnaryCallable<AggregatedListHealthChecksRequest, HealthChecksAggregatedList>
aggregatedListCallable()313       aggregatedListCallable() {
314     return stub.aggregatedListCallable();
315   }
316 
317   // AUTO-GENERATED DOCUMENTATION AND METHOD.
318   /**
319    * Deletes the specified HealthCheck resource.
320    *
321    * <p>Sample code:
322    *
323    * <pre>{@code
324    * // This snippet has been automatically generated and should be regarded as a code template only.
325    * // It will require modifications to work:
326    * // - It may require correct/in-range values for request initialization.
327    * // - It may require specifying regional endpoints when creating the service client as shown in
328    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
329    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
330    *   String project = "project-309310695";
331    *   String healthCheck = "healthCheck-1938093044";
332    *   Operation response = healthChecksClient.deleteAsync(project, healthCheck).get();
333    * }
334    * }</pre>
335    *
336    * @param project Project ID for this request.
337    * @param healthCheck Name of the HealthCheck resource to delete.
338    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
339    */
deleteAsync( String project, String healthCheck)340   public final OperationFuture<Operation, Operation> deleteAsync(
341       String project, String healthCheck) {
342     DeleteHealthCheckRequest request =
343         DeleteHealthCheckRequest.newBuilder()
344             .setProject(project)
345             .setHealthCheck(healthCheck)
346             .build();
347     return deleteAsync(request);
348   }
349 
350   // AUTO-GENERATED DOCUMENTATION AND METHOD.
351   /**
352    * Deletes the specified HealthCheck resource.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
363    *   DeleteHealthCheckRequest request =
364    *       DeleteHealthCheckRequest.newBuilder()
365    *           .setHealthCheck("healthCheck-1938093044")
366    *           .setProject("project-309310695")
367    *           .setRequestId("requestId693933066")
368    *           .build();
369    *   Operation response = healthChecksClient.deleteAsync(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    */
376   @BetaApi(
377       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync(DeleteHealthCheckRequest request)378   public final OperationFuture<Operation, Operation> deleteAsync(DeleteHealthCheckRequest request) {
379     return deleteOperationCallable().futureCall(request);
380   }
381 
382   // AUTO-GENERATED DOCUMENTATION AND METHOD.
383   /**
384    * Deletes the specified HealthCheck resource.
385    *
386    * <p>Sample code:
387    *
388    * <pre>{@code
389    * // This snippet has been automatically generated and should be regarded as a code template only.
390    * // It will require modifications to work:
391    * // - It may require correct/in-range values for request initialization.
392    * // - It may require specifying regional endpoints when creating the service client as shown in
393    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
394    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
395    *   DeleteHealthCheckRequest request =
396    *       DeleteHealthCheckRequest.newBuilder()
397    *           .setHealthCheck("healthCheck-1938093044")
398    *           .setProject("project-309310695")
399    *           .setRequestId("requestId693933066")
400    *           .build();
401    *   OperationFuture<Operation, Operation> future =
402    *       healthChecksClient.deleteOperationCallable().futureCall(request);
403    *   // Do something.
404    *   Operation response = future.get();
405    * }
406    * }</pre>
407    */
408   public final OperationCallable<DeleteHealthCheckRequest, Operation, Operation>
deleteOperationCallable()409       deleteOperationCallable() {
410     return stub.deleteOperationCallable();
411   }
412 
413   // AUTO-GENERATED DOCUMENTATION AND METHOD.
414   /**
415    * Deletes the specified HealthCheck resource.
416    *
417    * <p>Sample code:
418    *
419    * <pre>{@code
420    * // This snippet has been automatically generated and should be regarded as a code template only.
421    * // It will require modifications to work:
422    * // - It may require correct/in-range values for request initialization.
423    * // - It may require specifying regional endpoints when creating the service client as shown in
424    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
425    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
426    *   DeleteHealthCheckRequest request =
427    *       DeleteHealthCheckRequest.newBuilder()
428    *           .setHealthCheck("healthCheck-1938093044")
429    *           .setProject("project-309310695")
430    *           .setRequestId("requestId693933066")
431    *           .build();
432    *   ApiFuture<Operation> future = healthChecksClient.deleteCallable().futureCall(request);
433    *   // Do something.
434    *   Operation response = future.get();
435    * }
436    * }</pre>
437    */
deleteCallable()438   public final UnaryCallable<DeleteHealthCheckRequest, Operation> deleteCallable() {
439     return stub.deleteCallable();
440   }
441 
442   // AUTO-GENERATED DOCUMENTATION AND METHOD.
443   /**
444    * Returns the specified HealthCheck resource.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
455    *   String project = "project-309310695";
456    *   String healthCheck = "healthCheck-1938093044";
457    *   HealthCheck response = healthChecksClient.get(project, healthCheck);
458    * }
459    * }</pre>
460    *
461    * @param project Project ID for this request.
462    * @param healthCheck Name of the HealthCheck resource to return.
463    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
464    */
get(String project, String healthCheck)465   public final HealthCheck get(String project, String healthCheck) {
466     GetHealthCheckRequest request =
467         GetHealthCheckRequest.newBuilder().setProject(project).setHealthCheck(healthCheck).build();
468     return get(request);
469   }
470 
471   // AUTO-GENERATED DOCUMENTATION AND METHOD.
472   /**
473    * Returns the specified HealthCheck resource.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
484    *   GetHealthCheckRequest request =
485    *       GetHealthCheckRequest.newBuilder()
486    *           .setHealthCheck("healthCheck-1938093044")
487    *           .setProject("project-309310695")
488    *           .build();
489    *   HealthCheck response = healthChecksClient.get(request);
490    * }
491    * }</pre>
492    *
493    * @param request The request object containing all of the parameters for the API call.
494    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
495    */
get(GetHealthCheckRequest request)496   public final HealthCheck get(GetHealthCheckRequest request) {
497     return getCallable().call(request);
498   }
499 
500   // AUTO-GENERATED DOCUMENTATION AND METHOD.
501   /**
502    * Returns the specified HealthCheck resource.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
513    *   GetHealthCheckRequest request =
514    *       GetHealthCheckRequest.newBuilder()
515    *           .setHealthCheck("healthCheck-1938093044")
516    *           .setProject("project-309310695")
517    *           .build();
518    *   ApiFuture<HealthCheck> future = healthChecksClient.getCallable().futureCall(request);
519    *   // Do something.
520    *   HealthCheck response = future.get();
521    * }
522    * }</pre>
523    */
getCallable()524   public final UnaryCallable<GetHealthCheckRequest, HealthCheck> getCallable() {
525     return stub.getCallable();
526   }
527 
528   // AUTO-GENERATED DOCUMENTATION AND METHOD.
529   /**
530    * Creates a HealthCheck resource in the specified project using the data included in the request.
531    *
532    * <p>Sample code:
533    *
534    * <pre>{@code
535    * // This snippet has been automatically generated and should be regarded as a code template only.
536    * // It will require modifications to work:
537    * // - It may require correct/in-range values for request initialization.
538    * // - It may require specifying regional endpoints when creating the service client as shown in
539    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
540    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
541    *   String project = "project-309310695";
542    *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
543    *   Operation response = healthChecksClient.insertAsync(project, healthCheckResource).get();
544    * }
545    * }</pre>
546    *
547    * @param project Project ID for this request.
548    * @param healthCheckResource The body resource for this request
549    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
550    */
insertAsync( String project, HealthCheck healthCheckResource)551   public final OperationFuture<Operation, Operation> insertAsync(
552       String project, HealthCheck healthCheckResource) {
553     InsertHealthCheckRequest request =
554         InsertHealthCheckRequest.newBuilder()
555             .setProject(project)
556             .setHealthCheckResource(healthCheckResource)
557             .build();
558     return insertAsync(request);
559   }
560 
561   // AUTO-GENERATED DOCUMENTATION AND METHOD.
562   /**
563    * Creates a HealthCheck resource in the specified project using the data included in the request.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
574    *   InsertHealthCheckRequest request =
575    *       InsertHealthCheckRequest.newBuilder()
576    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
577    *           .setProject("project-309310695")
578    *           .setRequestId("requestId693933066")
579    *           .build();
580    *   Operation response = healthChecksClient.insertAsync(request).get();
581    * }
582    * }</pre>
583    *
584    * @param request The request object containing all of the parameters for the API call.
585    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
586    */
587   @BetaApi(
588       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync(InsertHealthCheckRequest request)589   public final OperationFuture<Operation, Operation> insertAsync(InsertHealthCheckRequest request) {
590     return insertOperationCallable().futureCall(request);
591   }
592 
593   // AUTO-GENERATED DOCUMENTATION AND METHOD.
594   /**
595    * Creates a HealthCheck resource in the specified project using the data included in the request.
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 (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
606    *   InsertHealthCheckRequest request =
607    *       InsertHealthCheckRequest.newBuilder()
608    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
609    *           .setProject("project-309310695")
610    *           .setRequestId("requestId693933066")
611    *           .build();
612    *   OperationFuture<Operation, Operation> future =
613    *       healthChecksClient.insertOperationCallable().futureCall(request);
614    *   // Do something.
615    *   Operation response = future.get();
616    * }
617    * }</pre>
618    */
619   public final OperationCallable<InsertHealthCheckRequest, Operation, Operation>
insertOperationCallable()620       insertOperationCallable() {
621     return stub.insertOperationCallable();
622   }
623 
624   // AUTO-GENERATED DOCUMENTATION AND METHOD.
625   /**
626    * Creates a HealthCheck resource in the specified project using the data included in the request.
627    *
628    * <p>Sample code:
629    *
630    * <pre>{@code
631    * // This snippet has been automatically generated and should be regarded as a code template only.
632    * // It will require modifications to work:
633    * // - It may require correct/in-range values for request initialization.
634    * // - It may require specifying regional endpoints when creating the service client as shown in
635    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
636    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
637    *   InsertHealthCheckRequest request =
638    *       InsertHealthCheckRequest.newBuilder()
639    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
640    *           .setProject("project-309310695")
641    *           .setRequestId("requestId693933066")
642    *           .build();
643    *   ApiFuture<Operation> future = healthChecksClient.insertCallable().futureCall(request);
644    *   // Do something.
645    *   Operation response = future.get();
646    * }
647    * }</pre>
648    */
insertCallable()649   public final UnaryCallable<InsertHealthCheckRequest, Operation> insertCallable() {
650     return stub.insertCallable();
651   }
652 
653   // AUTO-GENERATED DOCUMENTATION AND METHOD.
654   /**
655    * Retrieves the list of HealthCheck resources available to the specified project.
656    *
657    * <p>Sample code:
658    *
659    * <pre>{@code
660    * // This snippet has been automatically generated and should be regarded as a code template only.
661    * // It will require modifications to work:
662    * // - It may require correct/in-range values for request initialization.
663    * // - It may require specifying regional endpoints when creating the service client as shown in
664    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
665    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
666    *   String project = "project-309310695";
667    *   for (HealthCheck element : healthChecksClient.list(project).iterateAll()) {
668    *     // doThingsWith(element);
669    *   }
670    * }
671    * }</pre>
672    *
673    * @param project Project ID for this request.
674    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
675    */
list(String project)676   public final ListPagedResponse list(String project) {
677     ListHealthChecksRequest request =
678         ListHealthChecksRequest.newBuilder().setProject(project).build();
679     return list(request);
680   }
681 
682   // AUTO-GENERATED DOCUMENTATION AND METHOD.
683   /**
684    * Retrieves the list of HealthCheck resources available to the specified project.
685    *
686    * <p>Sample code:
687    *
688    * <pre>{@code
689    * // This snippet has been automatically generated and should be regarded as a code template only.
690    * // It will require modifications to work:
691    * // - It may require correct/in-range values for request initialization.
692    * // - It may require specifying regional endpoints when creating the service client as shown in
693    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
694    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
695    *   ListHealthChecksRequest request =
696    *       ListHealthChecksRequest.newBuilder()
697    *           .setFilter("filter-1274492040")
698    *           .setMaxResults(1128457243)
699    *           .setOrderBy("orderBy-1207110587")
700    *           .setPageToken("pageToken873572522")
701    *           .setProject("project-309310695")
702    *           .setReturnPartialSuccess(true)
703    *           .build();
704    *   for (HealthCheck element : healthChecksClient.list(request).iterateAll()) {
705    *     // doThingsWith(element);
706    *   }
707    * }
708    * }</pre>
709    *
710    * @param request The request object containing all of the parameters for the API call.
711    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
712    */
list(ListHealthChecksRequest request)713   public final ListPagedResponse list(ListHealthChecksRequest request) {
714     return listPagedCallable().call(request);
715   }
716 
717   // AUTO-GENERATED DOCUMENTATION AND METHOD.
718   /**
719    * Retrieves the list of HealthCheck resources available to the specified project.
720    *
721    * <p>Sample code:
722    *
723    * <pre>{@code
724    * // This snippet has been automatically generated and should be regarded as a code template only.
725    * // It will require modifications to work:
726    * // - It may require correct/in-range values for request initialization.
727    * // - It may require specifying regional endpoints when creating the service client as shown in
728    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
729    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
730    *   ListHealthChecksRequest request =
731    *       ListHealthChecksRequest.newBuilder()
732    *           .setFilter("filter-1274492040")
733    *           .setMaxResults(1128457243)
734    *           .setOrderBy("orderBy-1207110587")
735    *           .setPageToken("pageToken873572522")
736    *           .setProject("project-309310695")
737    *           .setReturnPartialSuccess(true)
738    *           .build();
739    *   ApiFuture<HealthCheck> future = healthChecksClient.listPagedCallable().futureCall(request);
740    *   // Do something.
741    *   for (HealthCheck element : future.get().iterateAll()) {
742    *     // doThingsWith(element);
743    *   }
744    * }
745    * }</pre>
746    */
listPagedCallable()747   public final UnaryCallable<ListHealthChecksRequest, ListPagedResponse> listPagedCallable() {
748     return stub.listPagedCallable();
749   }
750 
751   // AUTO-GENERATED DOCUMENTATION AND METHOD.
752   /**
753    * Retrieves the list of HealthCheck resources available to the specified project.
754    *
755    * <p>Sample code:
756    *
757    * <pre>{@code
758    * // This snippet has been automatically generated and should be regarded as a code template only.
759    * // It will require modifications to work:
760    * // - It may require correct/in-range values for request initialization.
761    * // - It may require specifying regional endpoints when creating the service client as shown in
762    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
763    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
764    *   ListHealthChecksRequest request =
765    *       ListHealthChecksRequest.newBuilder()
766    *           .setFilter("filter-1274492040")
767    *           .setMaxResults(1128457243)
768    *           .setOrderBy("orderBy-1207110587")
769    *           .setPageToken("pageToken873572522")
770    *           .setProject("project-309310695")
771    *           .setReturnPartialSuccess(true)
772    *           .build();
773    *   while (true) {
774    *     HealthCheckList response = healthChecksClient.listCallable().call(request);
775    *     for (HealthCheck element : response.getItemsList()) {
776    *       // doThingsWith(element);
777    *     }
778    *     String nextPageToken = response.getNextPageToken();
779    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
780    *       request = request.toBuilder().setPageToken(nextPageToken).build();
781    *     } else {
782    *       break;
783    *     }
784    *   }
785    * }
786    * }</pre>
787    */
listCallable()788   public final UnaryCallable<ListHealthChecksRequest, HealthCheckList> listCallable() {
789     return stub.listCallable();
790   }
791 
792   // AUTO-GENERATED DOCUMENTATION AND METHOD.
793   /**
794    * Updates a HealthCheck resource in the specified project using the data included in the request.
795    * This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
796    *
797    * <p>Sample code:
798    *
799    * <pre>{@code
800    * // This snippet has been automatically generated and should be regarded as a code template only.
801    * // It will require modifications to work:
802    * // - It may require correct/in-range values for request initialization.
803    * // - It may require specifying regional endpoints when creating the service client as shown in
804    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
805    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
806    *   String project = "project-309310695";
807    *   String healthCheck = "healthCheck-1938093044";
808    *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
809    *   Operation response =
810    *       healthChecksClient.patchAsync(project, healthCheck, healthCheckResource).get();
811    * }
812    * }</pre>
813    *
814    * @param project Project ID for this request.
815    * @param healthCheck Name of the HealthCheck resource to patch.
816    * @param healthCheckResource The body resource for this request
817    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
818    */
patchAsync( String project, String healthCheck, HealthCheck healthCheckResource)819   public final OperationFuture<Operation, Operation> patchAsync(
820       String project, String healthCheck, HealthCheck healthCheckResource) {
821     PatchHealthCheckRequest request =
822         PatchHealthCheckRequest.newBuilder()
823             .setProject(project)
824             .setHealthCheck(healthCheck)
825             .setHealthCheckResource(healthCheckResource)
826             .build();
827     return patchAsync(request);
828   }
829 
830   // AUTO-GENERATED DOCUMENTATION AND METHOD.
831   /**
832    * Updates a HealthCheck resource in the specified project using the data included in the request.
833    * This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
834    *
835    * <p>Sample code:
836    *
837    * <pre>{@code
838    * // This snippet has been automatically generated and should be regarded as a code template only.
839    * // It will require modifications to work:
840    * // - It may require correct/in-range values for request initialization.
841    * // - It may require specifying regional endpoints when creating the service client as shown in
842    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
843    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
844    *   PatchHealthCheckRequest request =
845    *       PatchHealthCheckRequest.newBuilder()
846    *           .setHealthCheck("healthCheck-1938093044")
847    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
848    *           .setProject("project-309310695")
849    *           .setRequestId("requestId693933066")
850    *           .build();
851    *   Operation response = healthChecksClient.patchAsync(request).get();
852    * }
853    * }</pre>
854    *
855    * @param request The request object containing all of the parameters for the API call.
856    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
857    */
858   @BetaApi(
859       "The surface for long-running operations is not stable yet and may change in the future.")
patchAsync(PatchHealthCheckRequest request)860   public final OperationFuture<Operation, Operation> patchAsync(PatchHealthCheckRequest request) {
861     return patchOperationCallable().futureCall(request);
862   }
863 
864   // AUTO-GENERATED DOCUMENTATION AND METHOD.
865   /**
866    * Updates a HealthCheck resource in the specified project using the data included in the request.
867    * This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
868    *
869    * <p>Sample code:
870    *
871    * <pre>{@code
872    * // This snippet has been automatically generated and should be regarded as a code template only.
873    * // It will require modifications to work:
874    * // - It may require correct/in-range values for request initialization.
875    * // - It may require specifying regional endpoints when creating the service client as shown in
876    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
877    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
878    *   PatchHealthCheckRequest request =
879    *       PatchHealthCheckRequest.newBuilder()
880    *           .setHealthCheck("healthCheck-1938093044")
881    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
882    *           .setProject("project-309310695")
883    *           .setRequestId("requestId693933066")
884    *           .build();
885    *   OperationFuture<Operation, Operation> future =
886    *       healthChecksClient.patchOperationCallable().futureCall(request);
887    *   // Do something.
888    *   Operation response = future.get();
889    * }
890    * }</pre>
891    */
892   public final OperationCallable<PatchHealthCheckRequest, Operation, Operation>
patchOperationCallable()893       patchOperationCallable() {
894     return stub.patchOperationCallable();
895   }
896 
897   // AUTO-GENERATED DOCUMENTATION AND METHOD.
898   /**
899    * Updates a HealthCheck resource in the specified project using the data included in the request.
900    * This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
901    *
902    * <p>Sample code:
903    *
904    * <pre>{@code
905    * // This snippet has been automatically generated and should be regarded as a code template only.
906    * // It will require modifications to work:
907    * // - It may require correct/in-range values for request initialization.
908    * // - It may require specifying regional endpoints when creating the service client as shown in
909    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
910    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
911    *   PatchHealthCheckRequest request =
912    *       PatchHealthCheckRequest.newBuilder()
913    *           .setHealthCheck("healthCheck-1938093044")
914    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
915    *           .setProject("project-309310695")
916    *           .setRequestId("requestId693933066")
917    *           .build();
918    *   ApiFuture<Operation> future = healthChecksClient.patchCallable().futureCall(request);
919    *   // Do something.
920    *   Operation response = future.get();
921    * }
922    * }</pre>
923    */
patchCallable()924   public final UnaryCallable<PatchHealthCheckRequest, Operation> patchCallable() {
925     return stub.patchCallable();
926   }
927 
928   // AUTO-GENERATED DOCUMENTATION AND METHOD.
929   /**
930    * Updates a HealthCheck resource in the specified project using the data included in the request.
931    *
932    * <p>Sample code:
933    *
934    * <pre>{@code
935    * // This snippet has been automatically generated and should be regarded as a code template only.
936    * // It will require modifications to work:
937    * // - It may require correct/in-range values for request initialization.
938    * // - It may require specifying regional endpoints when creating the service client as shown in
939    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
940    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
941    *   String project = "project-309310695";
942    *   String healthCheck = "healthCheck-1938093044";
943    *   HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
944    *   Operation response =
945    *       healthChecksClient.updateAsync(project, healthCheck, healthCheckResource).get();
946    * }
947    * }</pre>
948    *
949    * @param project Project ID for this request.
950    * @param healthCheck Name of the HealthCheck resource to update.
951    * @param healthCheckResource The body resource for this request
952    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
953    */
updateAsync( String project, String healthCheck, HealthCheck healthCheckResource)954   public final OperationFuture<Operation, Operation> updateAsync(
955       String project, String healthCheck, HealthCheck healthCheckResource) {
956     UpdateHealthCheckRequest request =
957         UpdateHealthCheckRequest.newBuilder()
958             .setProject(project)
959             .setHealthCheck(healthCheck)
960             .setHealthCheckResource(healthCheckResource)
961             .build();
962     return updateAsync(request);
963   }
964 
965   // AUTO-GENERATED DOCUMENTATION AND METHOD.
966   /**
967    * Updates a HealthCheck resource in the specified project using the data included in the request.
968    *
969    * <p>Sample code:
970    *
971    * <pre>{@code
972    * // This snippet has been automatically generated and should be regarded as a code template only.
973    * // It will require modifications to work:
974    * // - It may require correct/in-range values for request initialization.
975    * // - It may require specifying regional endpoints when creating the service client as shown in
976    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
977    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
978    *   UpdateHealthCheckRequest request =
979    *       UpdateHealthCheckRequest.newBuilder()
980    *           .setHealthCheck("healthCheck-1938093044")
981    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
982    *           .setProject("project-309310695")
983    *           .setRequestId("requestId693933066")
984    *           .build();
985    *   Operation response = healthChecksClient.updateAsync(request).get();
986    * }
987    * }</pre>
988    *
989    * @param request The request object containing all of the parameters for the API call.
990    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
991    */
992   @BetaApi(
993       "The surface for long-running operations is not stable yet and may change in the future.")
updateAsync(UpdateHealthCheckRequest request)994   public final OperationFuture<Operation, Operation> updateAsync(UpdateHealthCheckRequest request) {
995     return updateOperationCallable().futureCall(request);
996   }
997 
998   // AUTO-GENERATED DOCUMENTATION AND METHOD.
999   /**
1000    * Updates a HealthCheck resource in the specified project using the data included in the request.
1001    *
1002    * <p>Sample code:
1003    *
1004    * <pre>{@code
1005    * // This snippet has been automatically generated and should be regarded as a code template only.
1006    * // It will require modifications to work:
1007    * // - It may require correct/in-range values for request initialization.
1008    * // - It may require specifying regional endpoints when creating the service client as shown in
1009    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1010    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
1011    *   UpdateHealthCheckRequest request =
1012    *       UpdateHealthCheckRequest.newBuilder()
1013    *           .setHealthCheck("healthCheck-1938093044")
1014    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
1015    *           .setProject("project-309310695")
1016    *           .setRequestId("requestId693933066")
1017    *           .build();
1018    *   OperationFuture<Operation, Operation> future =
1019    *       healthChecksClient.updateOperationCallable().futureCall(request);
1020    *   // Do something.
1021    *   Operation response = future.get();
1022    * }
1023    * }</pre>
1024    */
1025   public final OperationCallable<UpdateHealthCheckRequest, Operation, Operation>
updateOperationCallable()1026       updateOperationCallable() {
1027     return stub.updateOperationCallable();
1028   }
1029 
1030   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1031   /**
1032    * Updates a HealthCheck resource in the specified project using the data included in the request.
1033    *
1034    * <p>Sample code:
1035    *
1036    * <pre>{@code
1037    * // This snippet has been automatically generated and should be regarded as a code template only.
1038    * // It will require modifications to work:
1039    * // - It may require correct/in-range values for request initialization.
1040    * // - It may require specifying regional endpoints when creating the service client as shown in
1041    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1042    * try (HealthChecksClient healthChecksClient = HealthChecksClient.create()) {
1043    *   UpdateHealthCheckRequest request =
1044    *       UpdateHealthCheckRequest.newBuilder()
1045    *           .setHealthCheck("healthCheck-1938093044")
1046    *           .setHealthCheckResource(HealthCheck.newBuilder().build())
1047    *           .setProject("project-309310695")
1048    *           .setRequestId("requestId693933066")
1049    *           .build();
1050    *   ApiFuture<Operation> future = healthChecksClient.updateCallable().futureCall(request);
1051    *   // Do something.
1052    *   Operation response = future.get();
1053    * }
1054    * }</pre>
1055    */
updateCallable()1056   public final UnaryCallable<UpdateHealthCheckRequest, Operation> updateCallable() {
1057     return stub.updateCallable();
1058   }
1059 
1060   @Override
close()1061   public final void close() {
1062     stub.close();
1063   }
1064 
1065   @Override
shutdown()1066   public void shutdown() {
1067     stub.shutdown();
1068   }
1069 
1070   @Override
isShutdown()1071   public boolean isShutdown() {
1072     return stub.isShutdown();
1073   }
1074 
1075   @Override
isTerminated()1076   public boolean isTerminated() {
1077     return stub.isTerminated();
1078   }
1079 
1080   @Override
shutdownNow()1081   public void shutdownNow() {
1082     stub.shutdownNow();
1083   }
1084 
1085   @Override
awaitTermination(long duration, TimeUnit unit)1086   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1087     return stub.awaitTermination(duration, unit);
1088   }
1089 
1090   public static class AggregatedListPagedResponse
1091       extends AbstractPagedListResponse<
1092           AggregatedListHealthChecksRequest,
1093           HealthChecksAggregatedList,
1094           Map.Entry<String, HealthChecksScopedList>,
1095           AggregatedListPage,
1096           AggregatedListFixedSizeCollection> {
1097 
createAsync( PageContext< AggregatedListHealthChecksRequest, HealthChecksAggregatedList, Map.Entry<String, HealthChecksScopedList>> context, ApiFuture<HealthChecksAggregatedList> futureResponse)1098     public static ApiFuture<AggregatedListPagedResponse> createAsync(
1099         PageContext<
1100                 AggregatedListHealthChecksRequest,
1101                 HealthChecksAggregatedList,
1102                 Map.Entry<String, HealthChecksScopedList>>
1103             context,
1104         ApiFuture<HealthChecksAggregatedList> futureResponse) {
1105       ApiFuture<AggregatedListPage> futurePage =
1106           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
1107       return ApiFutures.transform(
1108           futurePage,
1109           input -> new AggregatedListPagedResponse(input),
1110           MoreExecutors.directExecutor());
1111     }
1112 
AggregatedListPagedResponse(AggregatedListPage page)1113     private AggregatedListPagedResponse(AggregatedListPage page) {
1114       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
1115     }
1116   }
1117 
1118   public static class AggregatedListPage
1119       extends AbstractPage<
1120           AggregatedListHealthChecksRequest,
1121           HealthChecksAggregatedList,
1122           Map.Entry<String, HealthChecksScopedList>,
1123           AggregatedListPage> {
1124 
AggregatedListPage( PageContext< AggregatedListHealthChecksRequest, HealthChecksAggregatedList, Map.Entry<String, HealthChecksScopedList>> context, HealthChecksAggregatedList response)1125     private AggregatedListPage(
1126         PageContext<
1127                 AggregatedListHealthChecksRequest,
1128                 HealthChecksAggregatedList,
1129                 Map.Entry<String, HealthChecksScopedList>>
1130             context,
1131         HealthChecksAggregatedList response) {
1132       super(context, response);
1133     }
1134 
createEmptyPage()1135     private static AggregatedListPage createEmptyPage() {
1136       return new AggregatedListPage(null, null);
1137     }
1138 
1139     @Override
createPage( PageContext< AggregatedListHealthChecksRequest, HealthChecksAggregatedList, Map.Entry<String, HealthChecksScopedList>> context, HealthChecksAggregatedList response)1140     protected AggregatedListPage createPage(
1141         PageContext<
1142                 AggregatedListHealthChecksRequest,
1143                 HealthChecksAggregatedList,
1144                 Map.Entry<String, HealthChecksScopedList>>
1145             context,
1146         HealthChecksAggregatedList response) {
1147       return new AggregatedListPage(context, response);
1148     }
1149 
1150     @Override
createPageAsync( PageContext< AggregatedListHealthChecksRequest, HealthChecksAggregatedList, Map.Entry<String, HealthChecksScopedList>> context, ApiFuture<HealthChecksAggregatedList> futureResponse)1151     public ApiFuture<AggregatedListPage> createPageAsync(
1152         PageContext<
1153                 AggregatedListHealthChecksRequest,
1154                 HealthChecksAggregatedList,
1155                 Map.Entry<String, HealthChecksScopedList>>
1156             context,
1157         ApiFuture<HealthChecksAggregatedList> futureResponse) {
1158       return super.createPageAsync(context, futureResponse);
1159     }
1160   }
1161 
1162   public static class AggregatedListFixedSizeCollection
1163       extends AbstractFixedSizeCollection<
1164           AggregatedListHealthChecksRequest,
1165           HealthChecksAggregatedList,
1166           Map.Entry<String, HealthChecksScopedList>,
1167           AggregatedListPage,
1168           AggregatedListFixedSizeCollection> {
1169 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1170     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
1171       super(pages, collectionSize);
1172     }
1173 
createEmptyCollection()1174     private static AggregatedListFixedSizeCollection createEmptyCollection() {
1175       return new AggregatedListFixedSizeCollection(null, 0);
1176     }
1177 
1178     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)1179     protected AggregatedListFixedSizeCollection createCollection(
1180         List<AggregatedListPage> pages, int collectionSize) {
1181       return new AggregatedListFixedSizeCollection(pages, collectionSize);
1182     }
1183   }
1184 
1185   public static class ListPagedResponse
1186       extends AbstractPagedListResponse<
1187           ListHealthChecksRequest,
1188           HealthCheckList,
1189           HealthCheck,
1190           ListPage,
1191           ListFixedSizeCollection> {
1192 
createAsync( PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context, ApiFuture<HealthCheckList> futureResponse)1193     public static ApiFuture<ListPagedResponse> createAsync(
1194         PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context,
1195         ApiFuture<HealthCheckList> futureResponse) {
1196       ApiFuture<ListPage> futurePage =
1197           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
1198       return ApiFutures.transform(
1199           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
1200     }
1201 
ListPagedResponse(ListPage page)1202     private ListPagedResponse(ListPage page) {
1203       super(page, ListFixedSizeCollection.createEmptyCollection());
1204     }
1205   }
1206 
1207   public static class ListPage
1208       extends AbstractPage<ListHealthChecksRequest, HealthCheckList, HealthCheck, ListPage> {
1209 
ListPage( PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context, HealthCheckList response)1210     private ListPage(
1211         PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context,
1212         HealthCheckList response) {
1213       super(context, response);
1214     }
1215 
createEmptyPage()1216     private static ListPage createEmptyPage() {
1217       return new ListPage(null, null);
1218     }
1219 
1220     @Override
createPage( PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context, HealthCheckList response)1221     protected ListPage createPage(
1222         PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context,
1223         HealthCheckList response) {
1224       return new ListPage(context, response);
1225     }
1226 
1227     @Override
createPageAsync( PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context, ApiFuture<HealthCheckList> futureResponse)1228     public ApiFuture<ListPage> createPageAsync(
1229         PageContext<ListHealthChecksRequest, HealthCheckList, HealthCheck> context,
1230         ApiFuture<HealthCheckList> futureResponse) {
1231       return super.createPageAsync(context, futureResponse);
1232     }
1233   }
1234 
1235   public static class ListFixedSizeCollection
1236       extends AbstractFixedSizeCollection<
1237           ListHealthChecksRequest,
1238           HealthCheckList,
1239           HealthCheck,
1240           ListPage,
1241           ListFixedSizeCollection> {
1242 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1243     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
1244       super(pages, collectionSize);
1245     }
1246 
createEmptyCollection()1247     private static ListFixedSizeCollection createEmptyCollection() {
1248       return new ListFixedSizeCollection(null, 0);
1249     }
1250 
1251     @Override
createCollection(List<ListPage> pages, int collectionSize)1252     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1253       return new ListFixedSizeCollection(pages, collectionSize);
1254     }
1255   }
1256 }
1257