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