• 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.InstanceGroupsStub;
31 import com.google.cloud.compute.v1.stub.InstanceGroupsStubSettings;
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 InstanceGroups 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
53  *   String project = "project-309310695";
54  *   String zone = "zone3744684";
55  *   String instanceGroup = "instanceGroup-1404696854";
56  *   InstanceGroup response = instanceGroupsClient.get(project, zone, instanceGroup);
57  * }
58  * }</pre>
59  *
60  * <p>Note: close() needs to be called on the InstanceGroupsClient object to clean up resources such
61  * as threads. In the example above, try-with-resources is used, which automatically calls close().
62  *
63  * <p>The surface of this class includes several types of Java methods for each of the API's
64  * methods:
65  *
66  * <ol>
67  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
68  *       converted into function parameters. It may be the case that not all fields are available as
69  *       parameters, and not every API method will have a flattened method entry point.
70  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
71  *       which must be constructed before the call. Not every API method will have a request object
72  *       method.
73  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
74  *       callable object, which can be used to initiate calls to the service.
75  * </ol>
76  *
77  * <p>See the individual methods for example code.
78  *
79  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
80  * these names, this class includes a format method for each type of name, and additionally a parse
81  * method to extract the individual identifiers contained within names that are returned.
82  *
83  * <p>This class can be customized by passing in a custom instance of InstanceGroupsSettings to
84  * create(). For example:
85  *
86  * <p>To customize credentials:
87  *
88  * <pre>{@code
89  * // This snippet has been automatically generated and should be regarded as a code template only.
90  * // It will require modifications to work:
91  * // - It may require correct/in-range values for request initialization.
92  * // - It may require specifying regional endpoints when creating the service client as shown in
93  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
94  * InstanceGroupsSettings instanceGroupsSettings =
95  *     InstanceGroupsSettings.newBuilder()
96  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
97  *         .build();
98  * InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
99  * }</pre>
100  *
101  * <p>To customize the endpoint:
102  *
103  * <pre>{@code
104  * // This snippet has been automatically generated and should be regarded as a code template only.
105  * // It will require modifications to work:
106  * // - It may require correct/in-range values for request initialization.
107  * // - It may require specifying regional endpoints when creating the service client as shown in
108  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
109  * InstanceGroupsSettings instanceGroupsSettings =
110  *     InstanceGroupsSettings.newBuilder().setEndpoint(myEndpoint).build();
111  * InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
112  * }</pre>
113  *
114  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
115  */
116 @Generated("by gapic-generator-java")
117 public class InstanceGroupsClient implements BackgroundResource {
118   private final InstanceGroupsSettings settings;
119   private final InstanceGroupsStub stub;
120 
121   /** Constructs an instance of InstanceGroupsClient with default settings. */
create()122   public static final InstanceGroupsClient create() throws IOException {
123     return create(InstanceGroupsSettings.newBuilder().build());
124   }
125 
126   /**
127    * Constructs an instance of InstanceGroupsClient, using the given settings. The channels are
128    * created based on the settings passed in, or defaults for any settings that are not set.
129    */
create(InstanceGroupsSettings settings)130   public static final InstanceGroupsClient create(InstanceGroupsSettings settings)
131       throws IOException {
132     return new InstanceGroupsClient(settings);
133   }
134 
135   /**
136    * Constructs an instance of InstanceGroupsClient, using the given stub for making calls. This is
137    * for advanced usage - prefer using create(InstanceGroupsSettings).
138    */
create(InstanceGroupsStub stub)139   public static final InstanceGroupsClient create(InstanceGroupsStub stub) {
140     return new InstanceGroupsClient(stub);
141   }
142 
143   /**
144    * Constructs an instance of InstanceGroupsClient, using the given settings. This is protected so
145    * that it is easy to make a subclass, but otherwise, the static factory methods should be
146    * preferred.
147    */
InstanceGroupsClient(InstanceGroupsSettings settings)148   protected InstanceGroupsClient(InstanceGroupsSettings settings) throws IOException {
149     this.settings = settings;
150     this.stub = ((InstanceGroupsStubSettings) settings.getStubSettings()).createStub();
151   }
152 
InstanceGroupsClient(InstanceGroupsStub stub)153   protected InstanceGroupsClient(InstanceGroupsStub stub) {
154     this.settings = null;
155     this.stub = stub;
156   }
157 
getSettings()158   public final InstanceGroupsSettings getSettings() {
159     return settings;
160   }
161 
getStub()162   public InstanceGroupsStub getStub() {
163     return stub;
164   }
165 
166   // AUTO-GENERATED DOCUMENTATION AND METHOD.
167   /**
168    * Adds a list of instances to the specified instance group. All of the instances in the instance
169    * group must be in the same network/subnetwork. Read Adding instances for more information.
170    *
171    * <p>Sample code:
172    *
173    * <pre>{@code
174    * // This snippet has been automatically generated and should be regarded as a code template only.
175    * // It will require modifications to work:
176    * // - It may require correct/in-range values for request initialization.
177    * // - It may require specifying regional endpoints when creating the service client as shown in
178    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
179    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
180    *   String project = "project-309310695";
181    *   String zone = "zone3744684";
182    *   String instanceGroup = "instanceGroup-1404696854";
183    *   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource =
184    *       InstanceGroupsAddInstancesRequest.newBuilder().build();
185    *   Operation response =
186    *       instanceGroupsClient
187    *           .addInstancesAsync(
188    *               project, zone, instanceGroup, instanceGroupsAddInstancesRequestResource)
189    *           .get();
190    * }
191    * }</pre>
192    *
193    * @param project Project ID for this request.
194    * @param zone The name of the zone where the instance group is located.
195    * @param instanceGroup The name of the instance group where you are adding instances.
196    * @param instanceGroupsAddInstancesRequestResource The body resource for this request
197    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
198    */
addInstancesAsync( String project, String zone, String instanceGroup, InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)199   public final OperationFuture<Operation, Operation> addInstancesAsync(
200       String project,
201       String zone,
202       String instanceGroup,
203       InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource) {
204     AddInstancesInstanceGroupRequest request =
205         AddInstancesInstanceGroupRequest.newBuilder()
206             .setProject(project)
207             .setZone(zone)
208             .setInstanceGroup(instanceGroup)
209             .setInstanceGroupsAddInstancesRequestResource(instanceGroupsAddInstancesRequestResource)
210             .build();
211     return addInstancesAsync(request);
212   }
213 
214   // AUTO-GENERATED DOCUMENTATION AND METHOD.
215   /**
216    * Adds a list of instances to the specified instance group. All of the instances in the instance
217    * group must be in the same network/subnetwork. Read Adding instances for more information.
218    *
219    * <p>Sample code:
220    *
221    * <pre>{@code
222    * // This snippet has been automatically generated and should be regarded as a code template only.
223    * // It will require modifications to work:
224    * // - It may require correct/in-range values for request initialization.
225    * // - It may require specifying regional endpoints when creating the service client as shown in
226    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
227    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
228    *   AddInstancesInstanceGroupRequest request =
229    *       AddInstancesInstanceGroupRequest.newBuilder()
230    *           .setInstanceGroup("instanceGroup-1404696854")
231    *           .setInstanceGroupsAddInstancesRequestResource(
232    *               InstanceGroupsAddInstancesRequest.newBuilder().build())
233    *           .setProject("project-309310695")
234    *           .setRequestId("requestId693933066")
235    *           .setZone("zone3744684")
236    *           .build();
237    *   Operation response = instanceGroupsClient.addInstancesAsync(request).get();
238    * }
239    * }</pre>
240    *
241    * @param request The request object containing all of the parameters for the API call.
242    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
243    */
244   @BetaApi(
245       "The surface for long-running operations is not stable yet and may change in the future.")
addInstancesAsync( AddInstancesInstanceGroupRequest request)246   public final OperationFuture<Operation, Operation> addInstancesAsync(
247       AddInstancesInstanceGroupRequest request) {
248     return addInstancesOperationCallable().futureCall(request);
249   }
250 
251   // AUTO-GENERATED DOCUMENTATION AND METHOD.
252   /**
253    * Adds a list of instances to the specified instance group. All of the instances in the instance
254    * group must be in the same network/subnetwork. Read Adding instances for more information.
255    *
256    * <p>Sample code:
257    *
258    * <pre>{@code
259    * // This snippet has been automatically generated and should be regarded as a code template only.
260    * // It will require modifications to work:
261    * // - It may require correct/in-range values for request initialization.
262    * // - It may require specifying regional endpoints when creating the service client as shown in
263    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
264    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
265    *   AddInstancesInstanceGroupRequest request =
266    *       AddInstancesInstanceGroupRequest.newBuilder()
267    *           .setInstanceGroup("instanceGroup-1404696854")
268    *           .setInstanceGroupsAddInstancesRequestResource(
269    *               InstanceGroupsAddInstancesRequest.newBuilder().build())
270    *           .setProject("project-309310695")
271    *           .setRequestId("requestId693933066")
272    *           .setZone("zone3744684")
273    *           .build();
274    *   OperationFuture<Operation, Operation> future =
275    *       instanceGroupsClient.addInstancesOperationCallable().futureCall(request);
276    *   // Do something.
277    *   Operation response = future.get();
278    * }
279    * }</pre>
280    */
281   public final OperationCallable<AddInstancesInstanceGroupRequest, Operation, Operation>
addInstancesOperationCallable()282       addInstancesOperationCallable() {
283     return stub.addInstancesOperationCallable();
284   }
285 
286   // AUTO-GENERATED DOCUMENTATION AND METHOD.
287   /**
288    * Adds a list of instances to the specified instance group. All of the instances in the instance
289    * group must be in the same network/subnetwork. Read Adding instances for more information.
290    *
291    * <p>Sample code:
292    *
293    * <pre>{@code
294    * // This snippet has been automatically generated and should be regarded as a code template only.
295    * // It will require modifications to work:
296    * // - It may require correct/in-range values for request initialization.
297    * // - It may require specifying regional endpoints when creating the service client as shown in
298    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
299    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
300    *   AddInstancesInstanceGroupRequest request =
301    *       AddInstancesInstanceGroupRequest.newBuilder()
302    *           .setInstanceGroup("instanceGroup-1404696854")
303    *           .setInstanceGroupsAddInstancesRequestResource(
304    *               InstanceGroupsAddInstancesRequest.newBuilder().build())
305    *           .setProject("project-309310695")
306    *           .setRequestId("requestId693933066")
307    *           .setZone("zone3744684")
308    *           .build();
309    *   ApiFuture<Operation> future = instanceGroupsClient.addInstancesCallable().futureCall(request);
310    *   // Do something.
311    *   Operation response = future.get();
312    * }
313    * }</pre>
314    */
addInstancesCallable()315   public final UnaryCallable<AddInstancesInstanceGroupRequest, Operation> addInstancesCallable() {
316     return stub.addInstancesCallable();
317   }
318 
319   // AUTO-GENERATED DOCUMENTATION AND METHOD.
320   /**
321    * Retrieves the list of instance groups and sorts them by zone.
322    *
323    * <p>Sample code:
324    *
325    * <pre>{@code
326    * // This snippet has been automatically generated and should be regarded as a code template only.
327    * // It will require modifications to work:
328    * // - It may require correct/in-range values for request initialization.
329    * // - It may require specifying regional endpoints when creating the service client as shown in
330    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
331    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
332    *   String project = "project-309310695";
333    *   for (Map.Entry<String, InstanceGroupsScopedList> element :
334    *       instanceGroupsClient.aggregatedList(project).iterateAll()) {
335    *     // doThingsWith(element);
336    *   }
337    * }
338    * }</pre>
339    *
340    * @param project Project ID for this request.
341    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
342    */
aggregatedList(String project)343   public final AggregatedListPagedResponse aggregatedList(String project) {
344     AggregatedListInstanceGroupsRequest request =
345         AggregatedListInstanceGroupsRequest.newBuilder().setProject(project).build();
346     return aggregatedList(request);
347   }
348 
349   // AUTO-GENERATED DOCUMENTATION AND METHOD.
350   /**
351    * Retrieves the list of instance groups and sorts them by zone.
352    *
353    * <p>Sample code:
354    *
355    * <pre>{@code
356    * // This snippet has been automatically generated and should be regarded as a code template only.
357    * // It will require modifications to work:
358    * // - It may require correct/in-range values for request initialization.
359    * // - It may require specifying regional endpoints when creating the service client as shown in
360    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
361    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
362    *   AggregatedListInstanceGroupsRequest request =
363    *       AggregatedListInstanceGroupsRequest.newBuilder()
364    *           .setFilter("filter-1274492040")
365    *           .setIncludeAllScopes(true)
366    *           .setMaxResults(1128457243)
367    *           .setOrderBy("orderBy-1207110587")
368    *           .setPageToken("pageToken873572522")
369    *           .setProject("project-309310695")
370    *           .setReturnPartialSuccess(true)
371    *           .build();
372    *   for (Map.Entry<String, InstanceGroupsScopedList> element :
373    *       instanceGroupsClient.aggregatedList(request).iterateAll()) {
374    *     // doThingsWith(element);
375    *   }
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    */
aggregatedList( AggregatedListInstanceGroupsRequest request)382   public final AggregatedListPagedResponse aggregatedList(
383       AggregatedListInstanceGroupsRequest request) {
384     return aggregatedListPagedCallable().call(request);
385   }
386 
387   // AUTO-GENERATED DOCUMENTATION AND METHOD.
388   /**
389    * Retrieves the list of instance groups and sorts them by zone.
390    *
391    * <p>Sample code:
392    *
393    * <pre>{@code
394    * // This snippet has been automatically generated and should be regarded as a code template only.
395    * // It will require modifications to work:
396    * // - It may require correct/in-range values for request initialization.
397    * // - It may require specifying regional endpoints when creating the service client as shown in
398    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
399    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
400    *   AggregatedListInstanceGroupsRequest request =
401    *       AggregatedListInstanceGroupsRequest.newBuilder()
402    *           .setFilter("filter-1274492040")
403    *           .setIncludeAllScopes(true)
404    *           .setMaxResults(1128457243)
405    *           .setOrderBy("orderBy-1207110587")
406    *           .setPageToken("pageToken873572522")
407    *           .setProject("project-309310695")
408    *           .setReturnPartialSuccess(true)
409    *           .build();
410    *   ApiFuture<Map.Entry<String, InstanceGroupsScopedList>> future =
411    *       instanceGroupsClient.aggregatedListPagedCallable().futureCall(request);
412    *   // Do something.
413    *   for (Map.Entry<String, InstanceGroupsScopedList> element : future.get().iterateAll()) {
414    *     // doThingsWith(element);
415    *   }
416    * }
417    * }</pre>
418    */
419   public final UnaryCallable<AggregatedListInstanceGroupsRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()420       aggregatedListPagedCallable() {
421     return stub.aggregatedListPagedCallable();
422   }
423 
424   // AUTO-GENERATED DOCUMENTATION AND METHOD.
425   /**
426    * Retrieves the list of instance groups and sorts them by zone.
427    *
428    * <p>Sample code:
429    *
430    * <pre>{@code
431    * // This snippet has been automatically generated and should be regarded as a code template only.
432    * // It will require modifications to work:
433    * // - It may require correct/in-range values for request initialization.
434    * // - It may require specifying regional endpoints when creating the service client as shown in
435    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
436    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
437    *   AggregatedListInstanceGroupsRequest request =
438    *       AggregatedListInstanceGroupsRequest.newBuilder()
439    *           .setFilter("filter-1274492040")
440    *           .setIncludeAllScopes(true)
441    *           .setMaxResults(1128457243)
442    *           .setOrderBy("orderBy-1207110587")
443    *           .setPageToken("pageToken873572522")
444    *           .setProject("project-309310695")
445    *           .setReturnPartialSuccess(true)
446    *           .build();
447    *   while (true) {
448    *     InstanceGroupAggregatedList response =
449    *         instanceGroupsClient.aggregatedListCallable().call(request);
450    *     for (Map.Entry<String, InstanceGroupsScopedList> element : response.getItemsList()) {
451    *       // doThingsWith(element);
452    *     }
453    *     String nextPageToken = response.getNextPageToken();
454    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
455    *       request = request.toBuilder().setPageToken(nextPageToken).build();
456    *     } else {
457    *       break;
458    *     }
459    *   }
460    * }
461    * }</pre>
462    */
463   public final UnaryCallable<AggregatedListInstanceGroupsRequest, InstanceGroupAggregatedList>
aggregatedListCallable()464       aggregatedListCallable() {
465     return stub.aggregatedListCallable();
466   }
467 
468   // AUTO-GENERATED DOCUMENTATION AND METHOD.
469   /**
470    * Deletes the specified instance group. The instances in the group are not deleted. Note that
471    * instance group must not belong to a backend service. Read Deleting an instance group for more
472    * information.
473    *
474    * <p>Sample code:
475    *
476    * <pre>{@code
477    * // This snippet has been automatically generated and should be regarded as a code template only.
478    * // It will require modifications to work:
479    * // - It may require correct/in-range values for request initialization.
480    * // - It may require specifying regional endpoints when creating the service client as shown in
481    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
482    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
483    *   String project = "project-309310695";
484    *   String zone = "zone3744684";
485    *   String instanceGroup = "instanceGroup-1404696854";
486    *   Operation response = instanceGroupsClient.deleteAsync(project, zone, instanceGroup).get();
487    * }
488    * }</pre>
489    *
490    * @param project Project ID for this request.
491    * @param zone The name of the zone where the instance group is located.
492    * @param instanceGroup The name of the instance group to delete.
493    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
494    */
deleteAsync( String project, String zone, String instanceGroup)495   public final OperationFuture<Operation, Operation> deleteAsync(
496       String project, String zone, String instanceGroup) {
497     DeleteInstanceGroupRequest request =
498         DeleteInstanceGroupRequest.newBuilder()
499             .setProject(project)
500             .setZone(zone)
501             .setInstanceGroup(instanceGroup)
502             .build();
503     return deleteAsync(request);
504   }
505 
506   // AUTO-GENERATED DOCUMENTATION AND METHOD.
507   /**
508    * Deletes the specified instance group. The instances in the group are not deleted. Note that
509    * instance group must not belong to a backend service. Read Deleting an instance group for more
510    * information.
511    *
512    * <p>Sample code:
513    *
514    * <pre>{@code
515    * // This snippet has been automatically generated and should be regarded as a code template only.
516    * // It will require modifications to work:
517    * // - It may require correct/in-range values for request initialization.
518    * // - It may require specifying regional endpoints when creating the service client as shown in
519    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
520    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
521    *   DeleteInstanceGroupRequest request =
522    *       DeleteInstanceGroupRequest.newBuilder()
523    *           .setInstanceGroup("instanceGroup-1404696854")
524    *           .setProject("project-309310695")
525    *           .setRequestId("requestId693933066")
526    *           .setZone("zone3744684")
527    *           .build();
528    *   Operation response = instanceGroupsClient.deleteAsync(request).get();
529    * }
530    * }</pre>
531    *
532    * @param request The request object containing all of the parameters for the API call.
533    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
534    */
535   @BetaApi(
536       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteInstanceGroupRequest request)537   public final OperationFuture<Operation, Operation> deleteAsync(
538       DeleteInstanceGroupRequest request) {
539     return deleteOperationCallable().futureCall(request);
540   }
541 
542   // AUTO-GENERATED DOCUMENTATION AND METHOD.
543   /**
544    * Deletes the specified instance group. The instances in the group are not deleted. Note that
545    * instance group must not belong to a backend service. Read Deleting an instance group for more
546    * information.
547    *
548    * <p>Sample code:
549    *
550    * <pre>{@code
551    * // This snippet has been automatically generated and should be regarded as a code template only.
552    * // It will require modifications to work:
553    * // - It may require correct/in-range values for request initialization.
554    * // - It may require specifying regional endpoints when creating the service client as shown in
555    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
556    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
557    *   DeleteInstanceGroupRequest request =
558    *       DeleteInstanceGroupRequest.newBuilder()
559    *           .setInstanceGroup("instanceGroup-1404696854")
560    *           .setProject("project-309310695")
561    *           .setRequestId("requestId693933066")
562    *           .setZone("zone3744684")
563    *           .build();
564    *   OperationFuture<Operation, Operation> future =
565    *       instanceGroupsClient.deleteOperationCallable().futureCall(request);
566    *   // Do something.
567    *   Operation response = future.get();
568    * }
569    * }</pre>
570    */
571   public final OperationCallable<DeleteInstanceGroupRequest, Operation, Operation>
deleteOperationCallable()572       deleteOperationCallable() {
573     return stub.deleteOperationCallable();
574   }
575 
576   // AUTO-GENERATED DOCUMENTATION AND METHOD.
577   /**
578    * Deletes the specified instance group. The instances in the group are not deleted. Note that
579    * instance group must not belong to a backend service. Read Deleting an instance group for more
580    * information.
581    *
582    * <p>Sample code:
583    *
584    * <pre>{@code
585    * // This snippet has been automatically generated and should be regarded as a code template only.
586    * // It will require modifications to work:
587    * // - It may require correct/in-range values for request initialization.
588    * // - It may require specifying regional endpoints when creating the service client as shown in
589    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
590    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
591    *   DeleteInstanceGroupRequest request =
592    *       DeleteInstanceGroupRequest.newBuilder()
593    *           .setInstanceGroup("instanceGroup-1404696854")
594    *           .setProject("project-309310695")
595    *           .setRequestId("requestId693933066")
596    *           .setZone("zone3744684")
597    *           .build();
598    *   ApiFuture<Operation> future = instanceGroupsClient.deleteCallable().futureCall(request);
599    *   // Do something.
600    *   Operation response = future.get();
601    * }
602    * }</pre>
603    */
deleteCallable()604   public final UnaryCallable<DeleteInstanceGroupRequest, Operation> deleteCallable() {
605     return stub.deleteCallable();
606   }
607 
608   // AUTO-GENERATED DOCUMENTATION AND METHOD.
609   /**
610    * Returns the specified zonal instance group. Get a list of available zonal instance groups by
611    * making a list() request. For managed instance groups, use the instanceGroupManagers or
612    * regionInstanceGroupManagers methods instead.
613    *
614    * <p>Sample code:
615    *
616    * <pre>{@code
617    * // This snippet has been automatically generated and should be regarded as a code template only.
618    * // It will require modifications to work:
619    * // - It may require correct/in-range values for request initialization.
620    * // - It may require specifying regional endpoints when creating the service client as shown in
621    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
622    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
623    *   String project = "project-309310695";
624    *   String zone = "zone3744684";
625    *   String instanceGroup = "instanceGroup-1404696854";
626    *   InstanceGroup response = instanceGroupsClient.get(project, zone, instanceGroup);
627    * }
628    * }</pre>
629    *
630    * @param project Project ID for this request.
631    * @param zone The name of the zone where the instance group is located.
632    * @param instanceGroup The name of the instance group.
633    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
634    */
get(String project, String zone, String instanceGroup)635   public final InstanceGroup get(String project, String zone, String instanceGroup) {
636     GetInstanceGroupRequest request =
637         GetInstanceGroupRequest.newBuilder()
638             .setProject(project)
639             .setZone(zone)
640             .setInstanceGroup(instanceGroup)
641             .build();
642     return get(request);
643   }
644 
645   // AUTO-GENERATED DOCUMENTATION AND METHOD.
646   /**
647    * Returns the specified zonal instance group. Get a list of available zonal instance groups by
648    * making a list() request. For managed instance groups, use the instanceGroupManagers or
649    * regionInstanceGroupManagers methods instead.
650    *
651    * <p>Sample code:
652    *
653    * <pre>{@code
654    * // This snippet has been automatically generated and should be regarded as a code template only.
655    * // It will require modifications to work:
656    * // - It may require correct/in-range values for request initialization.
657    * // - It may require specifying regional endpoints when creating the service client as shown in
658    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
659    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
660    *   GetInstanceGroupRequest request =
661    *       GetInstanceGroupRequest.newBuilder()
662    *           .setInstanceGroup("instanceGroup-1404696854")
663    *           .setProject("project-309310695")
664    *           .setZone("zone3744684")
665    *           .build();
666    *   InstanceGroup response = instanceGroupsClient.get(request);
667    * }
668    * }</pre>
669    *
670    * @param request The request object containing all of the parameters for the API call.
671    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
672    */
get(GetInstanceGroupRequest request)673   public final InstanceGroup get(GetInstanceGroupRequest request) {
674     return getCallable().call(request);
675   }
676 
677   // AUTO-GENERATED DOCUMENTATION AND METHOD.
678   /**
679    * Returns the specified zonal instance group. Get a list of available zonal instance groups by
680    * making a list() request. For managed instance groups, use the instanceGroupManagers or
681    * regionInstanceGroupManagers methods instead.
682    *
683    * <p>Sample code:
684    *
685    * <pre>{@code
686    * // This snippet has been automatically generated and should be regarded as a code template only.
687    * // It will require modifications to work:
688    * // - It may require correct/in-range values for request initialization.
689    * // - It may require specifying regional endpoints when creating the service client as shown in
690    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
691    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
692    *   GetInstanceGroupRequest request =
693    *       GetInstanceGroupRequest.newBuilder()
694    *           .setInstanceGroup("instanceGroup-1404696854")
695    *           .setProject("project-309310695")
696    *           .setZone("zone3744684")
697    *           .build();
698    *   ApiFuture<InstanceGroup> future = instanceGroupsClient.getCallable().futureCall(request);
699    *   // Do something.
700    *   InstanceGroup response = future.get();
701    * }
702    * }</pre>
703    */
getCallable()704   public final UnaryCallable<GetInstanceGroupRequest, InstanceGroup> getCallable() {
705     return stub.getCallable();
706   }
707 
708   // AUTO-GENERATED DOCUMENTATION AND METHOD.
709   /**
710    * Creates an instance group in the specified project using the parameters that are included in
711    * the request.
712    *
713    * <p>Sample code:
714    *
715    * <pre>{@code
716    * // This snippet has been automatically generated and should be regarded as a code template only.
717    * // It will require modifications to work:
718    * // - It may require correct/in-range values for request initialization.
719    * // - It may require specifying regional endpoints when creating the service client as shown in
720    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
721    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
722    *   String project = "project-309310695";
723    *   String zone = "zone3744684";
724    *   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
725    *   Operation response =
726    *       instanceGroupsClient.insertAsync(project, zone, instanceGroupResource).get();
727    * }
728    * }</pre>
729    *
730    * @param project Project ID for this request.
731    * @param zone The name of the zone where you want to create the instance group.
732    * @param instanceGroupResource The body resource for this request
733    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
734    */
insertAsync( String project, String zone, InstanceGroup instanceGroupResource)735   public final OperationFuture<Operation, Operation> insertAsync(
736       String project, String zone, InstanceGroup instanceGroupResource) {
737     InsertInstanceGroupRequest request =
738         InsertInstanceGroupRequest.newBuilder()
739             .setProject(project)
740             .setZone(zone)
741             .setInstanceGroupResource(instanceGroupResource)
742             .build();
743     return insertAsync(request);
744   }
745 
746   // AUTO-GENERATED DOCUMENTATION AND METHOD.
747   /**
748    * Creates an instance group in the specified project using the parameters that are included in
749    * the request.
750    *
751    * <p>Sample code:
752    *
753    * <pre>{@code
754    * // This snippet has been automatically generated and should be regarded as a code template only.
755    * // It will require modifications to work:
756    * // - It may require correct/in-range values for request initialization.
757    * // - It may require specifying regional endpoints when creating the service client as shown in
758    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
759    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
760    *   InsertInstanceGroupRequest request =
761    *       InsertInstanceGroupRequest.newBuilder()
762    *           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
763    *           .setProject("project-309310695")
764    *           .setRequestId("requestId693933066")
765    *           .setZone("zone3744684")
766    *           .build();
767    *   Operation response = instanceGroupsClient.insertAsync(request).get();
768    * }
769    * }</pre>
770    *
771    * @param request The request object containing all of the parameters for the API call.
772    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
773    */
774   @BetaApi(
775       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertInstanceGroupRequest request)776   public final OperationFuture<Operation, Operation> insertAsync(
777       InsertInstanceGroupRequest request) {
778     return insertOperationCallable().futureCall(request);
779   }
780 
781   // AUTO-GENERATED DOCUMENTATION AND METHOD.
782   /**
783    * Creates an instance group in the specified project using the parameters that are included in
784    * the request.
785    *
786    * <p>Sample code:
787    *
788    * <pre>{@code
789    * // This snippet has been automatically generated and should be regarded as a code template only.
790    * // It will require modifications to work:
791    * // - It may require correct/in-range values for request initialization.
792    * // - It may require specifying regional endpoints when creating the service client as shown in
793    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
794    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
795    *   InsertInstanceGroupRequest request =
796    *       InsertInstanceGroupRequest.newBuilder()
797    *           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
798    *           .setProject("project-309310695")
799    *           .setRequestId("requestId693933066")
800    *           .setZone("zone3744684")
801    *           .build();
802    *   OperationFuture<Operation, Operation> future =
803    *       instanceGroupsClient.insertOperationCallable().futureCall(request);
804    *   // Do something.
805    *   Operation response = future.get();
806    * }
807    * }</pre>
808    */
809   public final OperationCallable<InsertInstanceGroupRequest, Operation, Operation>
insertOperationCallable()810       insertOperationCallable() {
811     return stub.insertOperationCallable();
812   }
813 
814   // AUTO-GENERATED DOCUMENTATION AND METHOD.
815   /**
816    * Creates an instance group in the specified project using the parameters that are included in
817    * the request.
818    *
819    * <p>Sample code:
820    *
821    * <pre>{@code
822    * // This snippet has been automatically generated and should be regarded as a code template only.
823    * // It will require modifications to work:
824    * // - It may require correct/in-range values for request initialization.
825    * // - It may require specifying regional endpoints when creating the service client as shown in
826    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
827    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
828    *   InsertInstanceGroupRequest request =
829    *       InsertInstanceGroupRequest.newBuilder()
830    *           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
831    *           .setProject("project-309310695")
832    *           .setRequestId("requestId693933066")
833    *           .setZone("zone3744684")
834    *           .build();
835    *   ApiFuture<Operation> future = instanceGroupsClient.insertCallable().futureCall(request);
836    *   // Do something.
837    *   Operation response = future.get();
838    * }
839    * }</pre>
840    */
insertCallable()841   public final UnaryCallable<InsertInstanceGroupRequest, Operation> insertCallable() {
842     return stub.insertCallable();
843   }
844 
845   // AUTO-GENERATED DOCUMENTATION AND METHOD.
846   /**
847    * Retrieves the list of zonal instance group resources contained within the specified zone. For
848    * managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods
849    * instead.
850    *
851    * <p>Sample code:
852    *
853    * <pre>{@code
854    * // This snippet has been automatically generated and should be regarded as a code template only.
855    * // It will require modifications to work:
856    * // - It may require correct/in-range values for request initialization.
857    * // - It may require specifying regional endpoints when creating the service client as shown in
858    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
859    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
860    *   String project = "project-309310695";
861    *   String zone = "zone3744684";
862    *   for (InstanceGroup element : instanceGroupsClient.list(project, zone).iterateAll()) {
863    *     // doThingsWith(element);
864    *   }
865    * }
866    * }</pre>
867    *
868    * @param project Project ID for this request.
869    * @param zone The name of the zone where the instance group is located.
870    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
871    */
list(String project, String zone)872   public final ListPagedResponse list(String project, String zone) {
873     ListInstanceGroupsRequest request =
874         ListInstanceGroupsRequest.newBuilder().setProject(project).setZone(zone).build();
875     return list(request);
876   }
877 
878   // AUTO-GENERATED DOCUMENTATION AND METHOD.
879   /**
880    * Retrieves the list of zonal instance group resources contained within the specified zone. For
881    * managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods
882    * instead.
883    *
884    * <p>Sample code:
885    *
886    * <pre>{@code
887    * // This snippet has been automatically generated and should be regarded as a code template only.
888    * // It will require modifications to work:
889    * // - It may require correct/in-range values for request initialization.
890    * // - It may require specifying regional endpoints when creating the service client as shown in
891    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
892    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
893    *   ListInstanceGroupsRequest request =
894    *       ListInstanceGroupsRequest.newBuilder()
895    *           .setFilter("filter-1274492040")
896    *           .setMaxResults(1128457243)
897    *           .setOrderBy("orderBy-1207110587")
898    *           .setPageToken("pageToken873572522")
899    *           .setProject("project-309310695")
900    *           .setReturnPartialSuccess(true)
901    *           .setZone("zone3744684")
902    *           .build();
903    *   for (InstanceGroup element : instanceGroupsClient.list(request).iterateAll()) {
904    *     // doThingsWith(element);
905    *   }
906    * }
907    * }</pre>
908    *
909    * @param request The request object containing all of the parameters for the API call.
910    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
911    */
list(ListInstanceGroupsRequest request)912   public final ListPagedResponse list(ListInstanceGroupsRequest request) {
913     return listPagedCallable().call(request);
914   }
915 
916   // AUTO-GENERATED DOCUMENTATION AND METHOD.
917   /**
918    * Retrieves the list of zonal instance group resources contained within the specified zone. For
919    * managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods
920    * instead.
921    *
922    * <p>Sample code:
923    *
924    * <pre>{@code
925    * // This snippet has been automatically generated and should be regarded as a code template only.
926    * // It will require modifications to work:
927    * // - It may require correct/in-range values for request initialization.
928    * // - It may require specifying regional endpoints when creating the service client as shown in
929    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
930    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
931    *   ListInstanceGroupsRequest request =
932    *       ListInstanceGroupsRequest.newBuilder()
933    *           .setFilter("filter-1274492040")
934    *           .setMaxResults(1128457243)
935    *           .setOrderBy("orderBy-1207110587")
936    *           .setPageToken("pageToken873572522")
937    *           .setProject("project-309310695")
938    *           .setReturnPartialSuccess(true)
939    *           .setZone("zone3744684")
940    *           .build();
941    *   ApiFuture<InstanceGroup> future =
942    *       instanceGroupsClient.listPagedCallable().futureCall(request);
943    *   // Do something.
944    *   for (InstanceGroup element : future.get().iterateAll()) {
945    *     // doThingsWith(element);
946    *   }
947    * }
948    * }</pre>
949    */
listPagedCallable()950   public final UnaryCallable<ListInstanceGroupsRequest, ListPagedResponse> listPagedCallable() {
951     return stub.listPagedCallable();
952   }
953 
954   // AUTO-GENERATED DOCUMENTATION AND METHOD.
955   /**
956    * Retrieves the list of zonal instance group resources contained within the specified zone. For
957    * managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods
958    * instead.
959    *
960    * <p>Sample code:
961    *
962    * <pre>{@code
963    * // This snippet has been automatically generated and should be regarded as a code template only.
964    * // It will require modifications to work:
965    * // - It may require correct/in-range values for request initialization.
966    * // - It may require specifying regional endpoints when creating the service client as shown in
967    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
968    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
969    *   ListInstanceGroupsRequest request =
970    *       ListInstanceGroupsRequest.newBuilder()
971    *           .setFilter("filter-1274492040")
972    *           .setMaxResults(1128457243)
973    *           .setOrderBy("orderBy-1207110587")
974    *           .setPageToken("pageToken873572522")
975    *           .setProject("project-309310695")
976    *           .setReturnPartialSuccess(true)
977    *           .setZone("zone3744684")
978    *           .build();
979    *   while (true) {
980    *     InstanceGroupList response = instanceGroupsClient.listCallable().call(request);
981    *     for (InstanceGroup element : response.getItemsList()) {
982    *       // doThingsWith(element);
983    *     }
984    *     String nextPageToken = response.getNextPageToken();
985    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
986    *       request = request.toBuilder().setPageToken(nextPageToken).build();
987    *     } else {
988    *       break;
989    *     }
990    *   }
991    * }
992    * }</pre>
993    */
listCallable()994   public final UnaryCallable<ListInstanceGroupsRequest, InstanceGroupList> listCallable() {
995     return stub.listCallable();
996   }
997 
998   // AUTO-GENERATED DOCUMENTATION AND METHOD.
999   /**
1000    * Lists the instances in the specified instance group. The orderBy query parameter is not
1001    * supported. The filter query parameter is supported, but only for expressions that use `eq`
1002    * (equal) or `ne` (not equal) operators.
1003    *
1004    * <p>Sample code:
1005    *
1006    * <pre>{@code
1007    * // This snippet has been automatically generated and should be regarded as a code template only.
1008    * // It will require modifications to work:
1009    * // - It may require correct/in-range values for request initialization.
1010    * // - It may require specifying regional endpoints when creating the service client as shown in
1011    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1012    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1013    *   String project = "project-309310695";
1014    *   String zone = "zone3744684";
1015    *   String instanceGroup = "instanceGroup-1404696854";
1016    *   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource =
1017    *       InstanceGroupsListInstancesRequest.newBuilder().build();
1018    *   for (InstanceWithNamedPorts element :
1019    *       instanceGroupsClient
1020    *           .listInstances(
1021    *               project, zone, instanceGroup, instanceGroupsListInstancesRequestResource)
1022    *           .iterateAll()) {
1023    *     // doThingsWith(element);
1024    *   }
1025    * }
1026    * }</pre>
1027    *
1028    * @param project Project ID for this request.
1029    * @param zone The name of the zone where the instance group is located.
1030    * @param instanceGroup The name of the instance group from which you want to generate a list of
1031    *     included instances.
1032    * @param instanceGroupsListInstancesRequestResource The body resource for this request
1033    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1034    */
listInstances( String project, String zone, String instanceGroup, InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)1035   public final ListInstancesPagedResponse listInstances(
1036       String project,
1037       String zone,
1038       String instanceGroup,
1039       InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource) {
1040     ListInstancesInstanceGroupsRequest request =
1041         ListInstancesInstanceGroupsRequest.newBuilder()
1042             .setProject(project)
1043             .setZone(zone)
1044             .setInstanceGroup(instanceGroup)
1045             .setInstanceGroupsListInstancesRequestResource(
1046                 instanceGroupsListInstancesRequestResource)
1047             .build();
1048     return listInstances(request);
1049   }
1050 
1051   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1052   /**
1053    * Lists the instances in the specified instance group. The orderBy query parameter is not
1054    * supported. The filter query parameter is supported, but only for expressions that use `eq`
1055    * (equal) or `ne` (not equal) operators.
1056    *
1057    * <p>Sample code:
1058    *
1059    * <pre>{@code
1060    * // This snippet has been automatically generated and should be regarded as a code template only.
1061    * // It will require modifications to work:
1062    * // - It may require correct/in-range values for request initialization.
1063    * // - It may require specifying regional endpoints when creating the service client as shown in
1064    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1065    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1066    *   ListInstancesInstanceGroupsRequest request =
1067    *       ListInstancesInstanceGroupsRequest.newBuilder()
1068    *           .setFilter("filter-1274492040")
1069    *           .setInstanceGroup("instanceGroup-1404696854")
1070    *           .setInstanceGroupsListInstancesRequestResource(
1071    *               InstanceGroupsListInstancesRequest.newBuilder().build())
1072    *           .setMaxResults(1128457243)
1073    *           .setOrderBy("orderBy-1207110587")
1074    *           .setPageToken("pageToken873572522")
1075    *           .setProject("project-309310695")
1076    *           .setReturnPartialSuccess(true)
1077    *           .setZone("zone3744684")
1078    *           .build();
1079    *   for (InstanceWithNamedPorts element :
1080    *       instanceGroupsClient.listInstances(request).iterateAll()) {
1081    *     // doThingsWith(element);
1082    *   }
1083    * }
1084    * }</pre>
1085    *
1086    * @param request The request object containing all of the parameters for the API call.
1087    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1088    */
listInstances( ListInstancesInstanceGroupsRequest request)1089   public final ListInstancesPagedResponse listInstances(
1090       ListInstancesInstanceGroupsRequest request) {
1091     return listInstancesPagedCallable().call(request);
1092   }
1093 
1094   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1095   /**
1096    * Lists the instances in the specified instance group. The orderBy query parameter is not
1097    * supported. The filter query parameter is supported, but only for expressions that use `eq`
1098    * (equal) or `ne` (not equal) operators.
1099    *
1100    * <p>Sample code:
1101    *
1102    * <pre>{@code
1103    * // This snippet has been automatically generated and should be regarded as a code template only.
1104    * // It will require modifications to work:
1105    * // - It may require correct/in-range values for request initialization.
1106    * // - It may require specifying regional endpoints when creating the service client as shown in
1107    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1108    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1109    *   ListInstancesInstanceGroupsRequest request =
1110    *       ListInstancesInstanceGroupsRequest.newBuilder()
1111    *           .setFilter("filter-1274492040")
1112    *           .setInstanceGroup("instanceGroup-1404696854")
1113    *           .setInstanceGroupsListInstancesRequestResource(
1114    *               InstanceGroupsListInstancesRequest.newBuilder().build())
1115    *           .setMaxResults(1128457243)
1116    *           .setOrderBy("orderBy-1207110587")
1117    *           .setPageToken("pageToken873572522")
1118    *           .setProject("project-309310695")
1119    *           .setReturnPartialSuccess(true)
1120    *           .setZone("zone3744684")
1121    *           .build();
1122    *   ApiFuture<InstanceWithNamedPorts> future =
1123    *       instanceGroupsClient.listInstancesPagedCallable().futureCall(request);
1124    *   // Do something.
1125    *   for (InstanceWithNamedPorts element : future.get().iterateAll()) {
1126    *     // doThingsWith(element);
1127    *   }
1128    * }
1129    * }</pre>
1130    */
1131   public final UnaryCallable<ListInstancesInstanceGroupsRequest, ListInstancesPagedResponse>
listInstancesPagedCallable()1132       listInstancesPagedCallable() {
1133     return stub.listInstancesPagedCallable();
1134   }
1135 
1136   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1137   /**
1138    * Lists the instances in the specified instance group. The orderBy query parameter is not
1139    * supported. The filter query parameter is supported, but only for expressions that use `eq`
1140    * (equal) or `ne` (not equal) operators.
1141    *
1142    * <p>Sample code:
1143    *
1144    * <pre>{@code
1145    * // This snippet has been automatically generated and should be regarded as a code template only.
1146    * // It will require modifications to work:
1147    * // - It may require correct/in-range values for request initialization.
1148    * // - It may require specifying regional endpoints when creating the service client as shown in
1149    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1150    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1151    *   ListInstancesInstanceGroupsRequest request =
1152    *       ListInstancesInstanceGroupsRequest.newBuilder()
1153    *           .setFilter("filter-1274492040")
1154    *           .setInstanceGroup("instanceGroup-1404696854")
1155    *           .setInstanceGroupsListInstancesRequestResource(
1156    *               InstanceGroupsListInstancesRequest.newBuilder().build())
1157    *           .setMaxResults(1128457243)
1158    *           .setOrderBy("orderBy-1207110587")
1159    *           .setPageToken("pageToken873572522")
1160    *           .setProject("project-309310695")
1161    *           .setReturnPartialSuccess(true)
1162    *           .setZone("zone3744684")
1163    *           .build();
1164    *   while (true) {
1165    *     InstanceGroupsListInstances response =
1166    *         instanceGroupsClient.listInstancesCallable().call(request);
1167    *     for (InstanceWithNamedPorts element : response.getItemsList()) {
1168    *       // doThingsWith(element);
1169    *     }
1170    *     String nextPageToken = response.getNextPageToken();
1171    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1172    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1173    *     } else {
1174    *       break;
1175    *     }
1176    *   }
1177    * }
1178    * }</pre>
1179    */
1180   public final UnaryCallable<ListInstancesInstanceGroupsRequest, InstanceGroupsListInstances>
listInstancesCallable()1181       listInstancesCallable() {
1182     return stub.listInstancesCallable();
1183   }
1184 
1185   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1186   /**
1187    * Removes one or more instances from the specified instance group, but does not delete those
1188    * instances. If the group is part of a backend service that has enabled connection draining, it
1189    * can take up to 60 seconds after the connection draining duration before the VM instance is
1190    * removed or deleted.
1191    *
1192    * <p>Sample code:
1193    *
1194    * <pre>{@code
1195    * // This snippet has been automatically generated and should be regarded as a code template only.
1196    * // It will require modifications to work:
1197    * // - It may require correct/in-range values for request initialization.
1198    * // - It may require specifying regional endpoints when creating the service client as shown in
1199    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1200    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1201    *   String project = "project-309310695";
1202    *   String zone = "zone3744684";
1203    *   String instanceGroup = "instanceGroup-1404696854";
1204    *   InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource =
1205    *       InstanceGroupsRemoveInstancesRequest.newBuilder().build();
1206    *   Operation response =
1207    *       instanceGroupsClient
1208    *           .removeInstancesAsync(
1209    *               project, zone, instanceGroup, instanceGroupsRemoveInstancesRequestResource)
1210    *           .get();
1211    * }
1212    * }</pre>
1213    *
1214    * @param project Project ID for this request.
1215    * @param zone The name of the zone where the instance group is located.
1216    * @param instanceGroup The name of the instance group where the specified instances will be
1217    *     removed.
1218    * @param instanceGroupsRemoveInstancesRequestResource The body resource for this request
1219    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1220    */
removeInstancesAsync( String project, String zone, String instanceGroup, InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)1221   public final OperationFuture<Operation, Operation> removeInstancesAsync(
1222       String project,
1223       String zone,
1224       String instanceGroup,
1225       InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource) {
1226     RemoveInstancesInstanceGroupRequest request =
1227         RemoveInstancesInstanceGroupRequest.newBuilder()
1228             .setProject(project)
1229             .setZone(zone)
1230             .setInstanceGroup(instanceGroup)
1231             .setInstanceGroupsRemoveInstancesRequestResource(
1232                 instanceGroupsRemoveInstancesRequestResource)
1233             .build();
1234     return removeInstancesAsync(request);
1235   }
1236 
1237   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1238   /**
1239    * Removes one or more instances from the specified instance group, but does not delete those
1240    * instances. If the group is part of a backend service that has enabled connection draining, it
1241    * can take up to 60 seconds after the connection draining duration before the VM instance is
1242    * removed or deleted.
1243    *
1244    * <p>Sample code:
1245    *
1246    * <pre>{@code
1247    * // This snippet has been automatically generated and should be regarded as a code template only.
1248    * // It will require modifications to work:
1249    * // - It may require correct/in-range values for request initialization.
1250    * // - It may require specifying regional endpoints when creating the service client as shown in
1251    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1252    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1253    *   RemoveInstancesInstanceGroupRequest request =
1254    *       RemoveInstancesInstanceGroupRequest.newBuilder()
1255    *           .setInstanceGroup("instanceGroup-1404696854")
1256    *           .setInstanceGroupsRemoveInstancesRequestResource(
1257    *               InstanceGroupsRemoveInstancesRequest.newBuilder().build())
1258    *           .setProject("project-309310695")
1259    *           .setRequestId("requestId693933066")
1260    *           .setZone("zone3744684")
1261    *           .build();
1262    *   Operation response = instanceGroupsClient.removeInstancesAsync(request).get();
1263    * }
1264    * }</pre>
1265    *
1266    * @param request The request object containing all of the parameters for the API call.
1267    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1268    */
1269   @BetaApi(
1270       "The surface for long-running operations is not stable yet and may change in the future.")
removeInstancesAsync( RemoveInstancesInstanceGroupRequest request)1271   public final OperationFuture<Operation, Operation> removeInstancesAsync(
1272       RemoveInstancesInstanceGroupRequest request) {
1273     return removeInstancesOperationCallable().futureCall(request);
1274   }
1275 
1276   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1277   /**
1278    * Removes one or more instances from the specified instance group, but does not delete those
1279    * instances. If the group is part of a backend service that has enabled connection draining, it
1280    * can take up to 60 seconds after the connection draining duration before the VM instance is
1281    * removed or deleted.
1282    *
1283    * <p>Sample code:
1284    *
1285    * <pre>{@code
1286    * // This snippet has been automatically generated and should be regarded as a code template only.
1287    * // It will require modifications to work:
1288    * // - It may require correct/in-range values for request initialization.
1289    * // - It may require specifying regional endpoints when creating the service client as shown in
1290    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1291    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1292    *   RemoveInstancesInstanceGroupRequest request =
1293    *       RemoveInstancesInstanceGroupRequest.newBuilder()
1294    *           .setInstanceGroup("instanceGroup-1404696854")
1295    *           .setInstanceGroupsRemoveInstancesRequestResource(
1296    *               InstanceGroupsRemoveInstancesRequest.newBuilder().build())
1297    *           .setProject("project-309310695")
1298    *           .setRequestId("requestId693933066")
1299    *           .setZone("zone3744684")
1300    *           .build();
1301    *   OperationFuture<Operation, Operation> future =
1302    *       instanceGroupsClient.removeInstancesOperationCallable().futureCall(request);
1303    *   // Do something.
1304    *   Operation response = future.get();
1305    * }
1306    * }</pre>
1307    */
1308   public final OperationCallable<RemoveInstancesInstanceGroupRequest, Operation, Operation>
removeInstancesOperationCallable()1309       removeInstancesOperationCallable() {
1310     return stub.removeInstancesOperationCallable();
1311   }
1312 
1313   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1314   /**
1315    * Removes one or more instances from the specified instance group, but does not delete those
1316    * instances. If the group is part of a backend service that has enabled connection draining, it
1317    * can take up to 60 seconds after the connection draining duration before the VM instance is
1318    * removed or deleted.
1319    *
1320    * <p>Sample code:
1321    *
1322    * <pre>{@code
1323    * // This snippet has been automatically generated and should be regarded as a code template only.
1324    * // It will require modifications to work:
1325    * // - It may require correct/in-range values for request initialization.
1326    * // - It may require specifying regional endpoints when creating the service client as shown in
1327    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1328    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1329    *   RemoveInstancesInstanceGroupRequest request =
1330    *       RemoveInstancesInstanceGroupRequest.newBuilder()
1331    *           .setInstanceGroup("instanceGroup-1404696854")
1332    *           .setInstanceGroupsRemoveInstancesRequestResource(
1333    *               InstanceGroupsRemoveInstancesRequest.newBuilder().build())
1334    *           .setProject("project-309310695")
1335    *           .setRequestId("requestId693933066")
1336    *           .setZone("zone3744684")
1337    *           .build();
1338    *   ApiFuture<Operation> future =
1339    *       instanceGroupsClient.removeInstancesCallable().futureCall(request);
1340    *   // Do something.
1341    *   Operation response = future.get();
1342    * }
1343    * }</pre>
1344    */
1345   public final UnaryCallable<RemoveInstancesInstanceGroupRequest, Operation>
removeInstancesCallable()1346       removeInstancesCallable() {
1347     return stub.removeInstancesCallable();
1348   }
1349 
1350   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1351   /**
1352    * Sets the named ports for the specified instance group.
1353    *
1354    * <p>Sample code:
1355    *
1356    * <pre>{@code
1357    * // This snippet has been automatically generated and should be regarded as a code template only.
1358    * // It will require modifications to work:
1359    * // - It may require correct/in-range values for request initialization.
1360    * // - It may require specifying regional endpoints when creating the service client as shown in
1361    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1362    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1363    *   String project = "project-309310695";
1364    *   String zone = "zone3744684";
1365    *   String instanceGroup = "instanceGroup-1404696854";
1366    *   InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource =
1367    *       InstanceGroupsSetNamedPortsRequest.newBuilder().build();
1368    *   Operation response =
1369    *       instanceGroupsClient
1370    *           .setNamedPortsAsync(
1371    *               project, zone, instanceGroup, instanceGroupsSetNamedPortsRequestResource)
1372    *           .get();
1373    * }
1374    * }</pre>
1375    *
1376    * @param project Project ID for this request.
1377    * @param zone The name of the zone where the instance group is located.
1378    * @param instanceGroup The name of the instance group where the named ports are updated.
1379    * @param instanceGroupsSetNamedPortsRequestResource The body resource for this request
1380    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1381    */
setNamedPortsAsync( String project, String zone, String instanceGroup, InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)1382   public final OperationFuture<Operation, Operation> setNamedPortsAsync(
1383       String project,
1384       String zone,
1385       String instanceGroup,
1386       InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource) {
1387     SetNamedPortsInstanceGroupRequest request =
1388         SetNamedPortsInstanceGroupRequest.newBuilder()
1389             .setProject(project)
1390             .setZone(zone)
1391             .setInstanceGroup(instanceGroup)
1392             .setInstanceGroupsSetNamedPortsRequestResource(
1393                 instanceGroupsSetNamedPortsRequestResource)
1394             .build();
1395     return setNamedPortsAsync(request);
1396   }
1397 
1398   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1399   /**
1400    * Sets the named ports for the specified instance group.
1401    *
1402    * <p>Sample code:
1403    *
1404    * <pre>{@code
1405    * // This snippet has been automatically generated and should be regarded as a code template only.
1406    * // It will require modifications to work:
1407    * // - It may require correct/in-range values for request initialization.
1408    * // - It may require specifying regional endpoints when creating the service client as shown in
1409    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1410    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1411    *   SetNamedPortsInstanceGroupRequest request =
1412    *       SetNamedPortsInstanceGroupRequest.newBuilder()
1413    *           .setInstanceGroup("instanceGroup-1404696854")
1414    *           .setInstanceGroupsSetNamedPortsRequestResource(
1415    *               InstanceGroupsSetNamedPortsRequest.newBuilder().build())
1416    *           .setProject("project-309310695")
1417    *           .setRequestId("requestId693933066")
1418    *           .setZone("zone3744684")
1419    *           .build();
1420    *   Operation response = instanceGroupsClient.setNamedPortsAsync(request).get();
1421    * }
1422    * }</pre>
1423    *
1424    * @param request The request object containing all of the parameters for the API call.
1425    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1426    */
1427   @BetaApi(
1428       "The surface for long-running operations is not stable yet and may change in the future.")
setNamedPortsAsync( SetNamedPortsInstanceGroupRequest request)1429   public final OperationFuture<Operation, Operation> setNamedPortsAsync(
1430       SetNamedPortsInstanceGroupRequest request) {
1431     return setNamedPortsOperationCallable().futureCall(request);
1432   }
1433 
1434   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1435   /**
1436    * Sets the named ports for the specified instance group.
1437    *
1438    * <p>Sample code:
1439    *
1440    * <pre>{@code
1441    * // This snippet has been automatically generated and should be regarded as a code template only.
1442    * // It will require modifications to work:
1443    * // - It may require correct/in-range values for request initialization.
1444    * // - It may require specifying regional endpoints when creating the service client as shown in
1445    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1446    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1447    *   SetNamedPortsInstanceGroupRequest request =
1448    *       SetNamedPortsInstanceGroupRequest.newBuilder()
1449    *           .setInstanceGroup("instanceGroup-1404696854")
1450    *           .setInstanceGroupsSetNamedPortsRequestResource(
1451    *               InstanceGroupsSetNamedPortsRequest.newBuilder().build())
1452    *           .setProject("project-309310695")
1453    *           .setRequestId("requestId693933066")
1454    *           .setZone("zone3744684")
1455    *           .build();
1456    *   OperationFuture<Operation, Operation> future =
1457    *       instanceGroupsClient.setNamedPortsOperationCallable().futureCall(request);
1458    *   // Do something.
1459    *   Operation response = future.get();
1460    * }
1461    * }</pre>
1462    */
1463   public final OperationCallable<SetNamedPortsInstanceGroupRequest, Operation, Operation>
setNamedPortsOperationCallable()1464       setNamedPortsOperationCallable() {
1465     return stub.setNamedPortsOperationCallable();
1466   }
1467 
1468   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1469   /**
1470    * Sets the named ports for the specified instance group.
1471    *
1472    * <p>Sample code:
1473    *
1474    * <pre>{@code
1475    * // This snippet has been automatically generated and should be regarded as a code template only.
1476    * // It will require modifications to work:
1477    * // - It may require correct/in-range values for request initialization.
1478    * // - It may require specifying regional endpoints when creating the service client as shown in
1479    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1480    * try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
1481    *   SetNamedPortsInstanceGroupRequest request =
1482    *       SetNamedPortsInstanceGroupRequest.newBuilder()
1483    *           .setInstanceGroup("instanceGroup-1404696854")
1484    *           .setInstanceGroupsSetNamedPortsRequestResource(
1485    *               InstanceGroupsSetNamedPortsRequest.newBuilder().build())
1486    *           .setProject("project-309310695")
1487    *           .setRequestId("requestId693933066")
1488    *           .setZone("zone3744684")
1489    *           .build();
1490    *   ApiFuture<Operation> future =
1491    *       instanceGroupsClient.setNamedPortsCallable().futureCall(request);
1492    *   // Do something.
1493    *   Operation response = future.get();
1494    * }
1495    * }</pre>
1496    */
setNamedPortsCallable()1497   public final UnaryCallable<SetNamedPortsInstanceGroupRequest, Operation> setNamedPortsCallable() {
1498     return stub.setNamedPortsCallable();
1499   }
1500 
1501   @Override
close()1502   public final void close() {
1503     stub.close();
1504   }
1505 
1506   @Override
shutdown()1507   public void shutdown() {
1508     stub.shutdown();
1509   }
1510 
1511   @Override
isShutdown()1512   public boolean isShutdown() {
1513     return stub.isShutdown();
1514   }
1515 
1516   @Override
isTerminated()1517   public boolean isTerminated() {
1518     return stub.isTerminated();
1519   }
1520 
1521   @Override
shutdownNow()1522   public void shutdownNow() {
1523     stub.shutdownNow();
1524   }
1525 
1526   @Override
awaitTermination(long duration, TimeUnit unit)1527   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1528     return stub.awaitTermination(duration, unit);
1529   }
1530 
1531   public static class AggregatedListPagedResponse
1532       extends AbstractPagedListResponse<
1533           AggregatedListInstanceGroupsRequest,
1534           InstanceGroupAggregatedList,
1535           Map.Entry<String, InstanceGroupsScopedList>,
1536           AggregatedListPage,
1537           AggregatedListFixedSizeCollection> {
1538 
createAsync( PageContext< AggregatedListInstanceGroupsRequest, InstanceGroupAggregatedList, Map.Entry<String, InstanceGroupsScopedList>> context, ApiFuture<InstanceGroupAggregatedList> futureResponse)1539     public static ApiFuture<AggregatedListPagedResponse> createAsync(
1540         PageContext<
1541                 AggregatedListInstanceGroupsRequest,
1542                 InstanceGroupAggregatedList,
1543                 Map.Entry<String, InstanceGroupsScopedList>>
1544             context,
1545         ApiFuture<InstanceGroupAggregatedList> futureResponse) {
1546       ApiFuture<AggregatedListPage> futurePage =
1547           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
1548       return ApiFutures.transform(
1549           futurePage,
1550           input -> new AggregatedListPagedResponse(input),
1551           MoreExecutors.directExecutor());
1552     }
1553 
AggregatedListPagedResponse(AggregatedListPage page)1554     private AggregatedListPagedResponse(AggregatedListPage page) {
1555       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
1556     }
1557   }
1558 
1559   public static class AggregatedListPage
1560       extends AbstractPage<
1561           AggregatedListInstanceGroupsRequest,
1562           InstanceGroupAggregatedList,
1563           Map.Entry<String, InstanceGroupsScopedList>,
1564           AggregatedListPage> {
1565 
AggregatedListPage( PageContext< AggregatedListInstanceGroupsRequest, InstanceGroupAggregatedList, Map.Entry<String, InstanceGroupsScopedList>> context, InstanceGroupAggregatedList response)1566     private AggregatedListPage(
1567         PageContext<
1568                 AggregatedListInstanceGroupsRequest,
1569                 InstanceGroupAggregatedList,
1570                 Map.Entry<String, InstanceGroupsScopedList>>
1571             context,
1572         InstanceGroupAggregatedList response) {
1573       super(context, response);
1574     }
1575 
createEmptyPage()1576     private static AggregatedListPage createEmptyPage() {
1577       return new AggregatedListPage(null, null);
1578     }
1579 
1580     @Override
createPage( PageContext< AggregatedListInstanceGroupsRequest, InstanceGroupAggregatedList, Map.Entry<String, InstanceGroupsScopedList>> context, InstanceGroupAggregatedList response)1581     protected AggregatedListPage createPage(
1582         PageContext<
1583                 AggregatedListInstanceGroupsRequest,
1584                 InstanceGroupAggregatedList,
1585                 Map.Entry<String, InstanceGroupsScopedList>>
1586             context,
1587         InstanceGroupAggregatedList response) {
1588       return new AggregatedListPage(context, response);
1589     }
1590 
1591     @Override
createPageAsync( PageContext< AggregatedListInstanceGroupsRequest, InstanceGroupAggregatedList, Map.Entry<String, InstanceGroupsScopedList>> context, ApiFuture<InstanceGroupAggregatedList> futureResponse)1592     public ApiFuture<AggregatedListPage> createPageAsync(
1593         PageContext<
1594                 AggregatedListInstanceGroupsRequest,
1595                 InstanceGroupAggregatedList,
1596                 Map.Entry<String, InstanceGroupsScopedList>>
1597             context,
1598         ApiFuture<InstanceGroupAggregatedList> futureResponse) {
1599       return super.createPageAsync(context, futureResponse);
1600     }
1601   }
1602 
1603   public static class AggregatedListFixedSizeCollection
1604       extends AbstractFixedSizeCollection<
1605           AggregatedListInstanceGroupsRequest,
1606           InstanceGroupAggregatedList,
1607           Map.Entry<String, InstanceGroupsScopedList>,
1608           AggregatedListPage,
1609           AggregatedListFixedSizeCollection> {
1610 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1611     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
1612       super(pages, collectionSize);
1613     }
1614 
createEmptyCollection()1615     private static AggregatedListFixedSizeCollection createEmptyCollection() {
1616       return new AggregatedListFixedSizeCollection(null, 0);
1617     }
1618 
1619     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)1620     protected AggregatedListFixedSizeCollection createCollection(
1621         List<AggregatedListPage> pages, int collectionSize) {
1622       return new AggregatedListFixedSizeCollection(pages, collectionSize);
1623     }
1624   }
1625 
1626   public static class ListPagedResponse
1627       extends AbstractPagedListResponse<
1628           ListInstanceGroupsRequest,
1629           InstanceGroupList,
1630           InstanceGroup,
1631           ListPage,
1632           ListFixedSizeCollection> {
1633 
createAsync( PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context, ApiFuture<InstanceGroupList> futureResponse)1634     public static ApiFuture<ListPagedResponse> createAsync(
1635         PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context,
1636         ApiFuture<InstanceGroupList> futureResponse) {
1637       ApiFuture<ListPage> futurePage =
1638           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
1639       return ApiFutures.transform(
1640           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
1641     }
1642 
ListPagedResponse(ListPage page)1643     private ListPagedResponse(ListPage page) {
1644       super(page, ListFixedSizeCollection.createEmptyCollection());
1645     }
1646   }
1647 
1648   public static class ListPage
1649       extends AbstractPage<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup, ListPage> {
1650 
ListPage( PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context, InstanceGroupList response)1651     private ListPage(
1652         PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context,
1653         InstanceGroupList response) {
1654       super(context, response);
1655     }
1656 
createEmptyPage()1657     private static ListPage createEmptyPage() {
1658       return new ListPage(null, null);
1659     }
1660 
1661     @Override
createPage( PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context, InstanceGroupList response)1662     protected ListPage createPage(
1663         PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context,
1664         InstanceGroupList response) {
1665       return new ListPage(context, response);
1666     }
1667 
1668     @Override
createPageAsync( PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context, ApiFuture<InstanceGroupList> futureResponse)1669     public ApiFuture<ListPage> createPageAsync(
1670         PageContext<ListInstanceGroupsRequest, InstanceGroupList, InstanceGroup> context,
1671         ApiFuture<InstanceGroupList> futureResponse) {
1672       return super.createPageAsync(context, futureResponse);
1673     }
1674   }
1675 
1676   public static class ListFixedSizeCollection
1677       extends AbstractFixedSizeCollection<
1678           ListInstanceGroupsRequest,
1679           InstanceGroupList,
1680           InstanceGroup,
1681           ListPage,
1682           ListFixedSizeCollection> {
1683 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1684     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
1685       super(pages, collectionSize);
1686     }
1687 
createEmptyCollection()1688     private static ListFixedSizeCollection createEmptyCollection() {
1689       return new ListFixedSizeCollection(null, 0);
1690     }
1691 
1692     @Override
createCollection(List<ListPage> pages, int collectionSize)1693     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1694       return new ListFixedSizeCollection(pages, collectionSize);
1695     }
1696   }
1697 
1698   public static class ListInstancesPagedResponse
1699       extends AbstractPagedListResponse<
1700           ListInstancesInstanceGroupsRequest,
1701           InstanceGroupsListInstances,
1702           InstanceWithNamedPorts,
1703           ListInstancesPage,
1704           ListInstancesFixedSizeCollection> {
1705 
createAsync( PageContext< ListInstancesInstanceGroupsRequest, InstanceGroupsListInstances, InstanceWithNamedPorts> context, ApiFuture<InstanceGroupsListInstances> futureResponse)1706     public static ApiFuture<ListInstancesPagedResponse> createAsync(
1707         PageContext<
1708                 ListInstancesInstanceGroupsRequest,
1709                 InstanceGroupsListInstances,
1710                 InstanceWithNamedPorts>
1711             context,
1712         ApiFuture<InstanceGroupsListInstances> futureResponse) {
1713       ApiFuture<ListInstancesPage> futurePage =
1714           ListInstancesPage.createEmptyPage().createPageAsync(context, futureResponse);
1715       return ApiFutures.transform(
1716           futurePage,
1717           input -> new ListInstancesPagedResponse(input),
1718           MoreExecutors.directExecutor());
1719     }
1720 
ListInstancesPagedResponse(ListInstancesPage page)1721     private ListInstancesPagedResponse(ListInstancesPage page) {
1722       super(page, ListInstancesFixedSizeCollection.createEmptyCollection());
1723     }
1724   }
1725 
1726   public static class ListInstancesPage
1727       extends AbstractPage<
1728           ListInstancesInstanceGroupsRequest,
1729           InstanceGroupsListInstances,
1730           InstanceWithNamedPorts,
1731           ListInstancesPage> {
1732 
ListInstancesPage( PageContext< ListInstancesInstanceGroupsRequest, InstanceGroupsListInstances, InstanceWithNamedPorts> context, InstanceGroupsListInstances response)1733     private ListInstancesPage(
1734         PageContext<
1735                 ListInstancesInstanceGroupsRequest,
1736                 InstanceGroupsListInstances,
1737                 InstanceWithNamedPorts>
1738             context,
1739         InstanceGroupsListInstances response) {
1740       super(context, response);
1741     }
1742 
createEmptyPage()1743     private static ListInstancesPage createEmptyPage() {
1744       return new ListInstancesPage(null, null);
1745     }
1746 
1747     @Override
createPage( PageContext< ListInstancesInstanceGroupsRequest, InstanceGroupsListInstances, InstanceWithNamedPorts> context, InstanceGroupsListInstances response)1748     protected ListInstancesPage createPage(
1749         PageContext<
1750                 ListInstancesInstanceGroupsRequest,
1751                 InstanceGroupsListInstances,
1752                 InstanceWithNamedPorts>
1753             context,
1754         InstanceGroupsListInstances response) {
1755       return new ListInstancesPage(context, response);
1756     }
1757 
1758     @Override
createPageAsync( PageContext< ListInstancesInstanceGroupsRequest, InstanceGroupsListInstances, InstanceWithNamedPorts> context, ApiFuture<InstanceGroupsListInstances> futureResponse)1759     public ApiFuture<ListInstancesPage> createPageAsync(
1760         PageContext<
1761                 ListInstancesInstanceGroupsRequest,
1762                 InstanceGroupsListInstances,
1763                 InstanceWithNamedPorts>
1764             context,
1765         ApiFuture<InstanceGroupsListInstances> futureResponse) {
1766       return super.createPageAsync(context, futureResponse);
1767     }
1768   }
1769 
1770   public static class ListInstancesFixedSizeCollection
1771       extends AbstractFixedSizeCollection<
1772           ListInstancesInstanceGroupsRequest,
1773           InstanceGroupsListInstances,
1774           InstanceWithNamedPorts,
1775           ListInstancesPage,
1776           ListInstancesFixedSizeCollection> {
1777 
ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize)1778     private ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize) {
1779       super(pages, collectionSize);
1780     }
1781 
createEmptyCollection()1782     private static ListInstancesFixedSizeCollection createEmptyCollection() {
1783       return new ListInstancesFixedSizeCollection(null, 0);
1784     }
1785 
1786     @Override
createCollection( List<ListInstancesPage> pages, int collectionSize)1787     protected ListInstancesFixedSizeCollection createCollection(
1788         List<ListInstancesPage> pages, int collectionSize) {
1789       return new ListInstancesFixedSizeCollection(pages, collectionSize);
1790     }
1791   }
1792 }
1793