• 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.dialogflow.v2;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.gax.core.BackgroundResource;
22 import com.google.api.gax.paging.AbstractFixedSizeCollection;
23 import com.google.api.gax.paging.AbstractPage;
24 import com.google.api.gax.paging.AbstractPagedListResponse;
25 import com.google.api.gax.rpc.PageContext;
26 import com.google.api.gax.rpc.UnaryCallable;
27 import com.google.cloud.dialogflow.v2.stub.EnvironmentsStub;
28 import com.google.cloud.dialogflow.v2.stub.EnvironmentsStubSettings;
29 import com.google.cloud.location.GetLocationRequest;
30 import com.google.cloud.location.ListLocationsRequest;
31 import com.google.cloud.location.ListLocationsResponse;
32 import com.google.cloud.location.Location;
33 import com.google.common.util.concurrent.MoreExecutors;
34 import com.google.protobuf.Empty;
35 import java.io.IOException;
36 import java.util.List;
37 import java.util.concurrent.TimeUnit;
38 import javax.annotation.Generated;
39 
40 // AUTO-GENERATED DOCUMENTATION AND CLASS.
41 /**
42  * Service Description: Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
43  *
44  * <p>This class provides the ability to make remote calls to the backing service through method
45  * calls that map to API methods. Sample code to get started:
46  *
47  * <pre>{@code
48  * // This snippet has been automatically generated and should be regarded as a code template only.
49  * // It will require modifications to work:
50  * // - It may require correct/in-range values for request initialization.
51  * // - It may require specifying regional endpoints when creating the service client as shown in
52  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
53  * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
54  *   GetEnvironmentRequest request =
55  *       GetEnvironmentRequest.newBuilder()
56  *           .setName(
57  *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
58  *           .build();
59  *   Environment response = environmentsClient.getEnvironment(request);
60  * }
61  * }</pre>
62  *
63  * <p>Note: close() needs to be called on the EnvironmentsClient object to clean up resources such
64  * as threads. In the example above, try-with-resources is used, which automatically calls close().
65  *
66  * <p>The surface of this class includes several types of Java methods for each of the API's
67  * methods:
68  *
69  * <ol>
70  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
71  *       converted into function parameters. It may be the case that not all fields are available as
72  *       parameters, and not every API method will have a flattened method entry point.
73  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
74  *       which must be constructed before the call. Not every API method will have a request object
75  *       method.
76  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
77  *       callable object, which can be used to initiate calls to the service.
78  * </ol>
79  *
80  * <p>See the individual methods for example code.
81  *
82  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
83  * these names, this class includes a format method for each type of name, and additionally a parse
84  * method to extract the individual identifiers contained within names that are returned.
85  *
86  * <p>This class can be customized by passing in a custom instance of EnvironmentsSettings to
87  * create(). For example:
88  *
89  * <p>To customize credentials:
90  *
91  * <pre>{@code
92  * // This snippet has been automatically generated and should be regarded as a code template only.
93  * // It will require modifications to work:
94  * // - It may require correct/in-range values for request initialization.
95  * // - It may require specifying regional endpoints when creating the service client as shown in
96  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
97  * EnvironmentsSettings environmentsSettings =
98  *     EnvironmentsSettings.newBuilder()
99  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
100  *         .build();
101  * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
102  * }</pre>
103  *
104  * <p>To customize the endpoint:
105  *
106  * <pre>{@code
107  * // This snippet has been automatically generated and should be regarded as a code template only.
108  * // It will require modifications to work:
109  * // - It may require correct/in-range values for request initialization.
110  * // - It may require specifying regional endpoints when creating the service client as shown in
111  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
112  * EnvironmentsSettings environmentsSettings =
113  *     EnvironmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
114  * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
115  * }</pre>
116  *
117  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
118  * the wire:
119  *
120  * <pre>{@code
121  * // This snippet has been automatically generated and should be regarded as a code template only.
122  * // It will require modifications to work:
123  * // - It may require correct/in-range values for request initialization.
124  * // - It may require specifying regional endpoints when creating the service client as shown in
125  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
126  * EnvironmentsSettings environmentsSettings = EnvironmentsSettings.newHttpJsonBuilder().build();
127  * EnvironmentsClient environmentsClient = EnvironmentsClient.create(environmentsSettings);
128  * }</pre>
129  *
130  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
131  */
132 @Generated("by gapic-generator-java")
133 public class EnvironmentsClient implements BackgroundResource {
134   private final EnvironmentsSettings settings;
135   private final EnvironmentsStub stub;
136 
137   /** Constructs an instance of EnvironmentsClient with default settings. */
create()138   public static final EnvironmentsClient create() throws IOException {
139     return create(EnvironmentsSettings.newBuilder().build());
140   }
141 
142   /**
143    * Constructs an instance of EnvironmentsClient, using the given settings. The channels are
144    * created based on the settings passed in, or defaults for any settings that are not set.
145    */
create(EnvironmentsSettings settings)146   public static final EnvironmentsClient create(EnvironmentsSettings settings) throws IOException {
147     return new EnvironmentsClient(settings);
148   }
149 
150   /**
151    * Constructs an instance of EnvironmentsClient, using the given stub for making calls. This is
152    * for advanced usage - prefer using create(EnvironmentsSettings).
153    */
create(EnvironmentsStub stub)154   public static final EnvironmentsClient create(EnvironmentsStub stub) {
155     return new EnvironmentsClient(stub);
156   }
157 
158   /**
159    * Constructs an instance of EnvironmentsClient, using the given settings. This is protected so
160    * that it is easy to make a subclass, but otherwise, the static factory methods should be
161    * preferred.
162    */
EnvironmentsClient(EnvironmentsSettings settings)163   protected EnvironmentsClient(EnvironmentsSettings settings) throws IOException {
164     this.settings = settings;
165     this.stub = ((EnvironmentsStubSettings) settings.getStubSettings()).createStub();
166   }
167 
EnvironmentsClient(EnvironmentsStub stub)168   protected EnvironmentsClient(EnvironmentsStub stub) {
169     this.settings = null;
170     this.stub = stub;
171   }
172 
getSettings()173   public final EnvironmentsSettings getSettings() {
174     return settings;
175   }
176 
getStub()177   public EnvironmentsStub getStub() {
178     return stub;
179   }
180 
181   // AUTO-GENERATED DOCUMENTATION AND METHOD.
182   /**
183    * Returns the list of all non-default environments of the specified agent.
184    *
185    * <p>Sample code:
186    *
187    * <pre>{@code
188    * // This snippet has been automatically generated and should be regarded as a code template only.
189    * // It will require modifications to work:
190    * // - It may require correct/in-range values for request initialization.
191    * // - It may require specifying regional endpoints when creating the service client as shown in
192    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
193    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
194    *   AgentName parent = AgentName.ofProjectName("[PROJECT]");
195    *   for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
196    *     // doThingsWith(element);
197    *   }
198    * }
199    * }</pre>
200    *
201    * @param parent Required. The agent to list all environments from. Format:
202    *     <p>- `projects/&lt;Project ID&gt;/agent` - `projects/&lt;Project
203    *     ID&gt;/locations/&lt;Location ID&gt;/agent`
204    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
205    */
listEnvironments(AgentName parent)206   public final ListEnvironmentsPagedResponse listEnvironments(AgentName parent) {
207     ListEnvironmentsRequest request =
208         ListEnvironmentsRequest.newBuilder()
209             .setParent(parent == null ? null : parent.toString())
210             .build();
211     return listEnvironments(request);
212   }
213 
214   // AUTO-GENERATED DOCUMENTATION AND METHOD.
215   /**
216    * Returns the list of all non-default environments of the specified agent.
217    *
218    * <p>Sample code:
219    *
220    * <pre>{@code
221    * // This snippet has been automatically generated and should be regarded as a code template only.
222    * // It will require modifications to work:
223    * // - It may require correct/in-range values for request initialization.
224    * // - It may require specifying regional endpoints when creating the service client as shown in
225    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
226    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
227    *   String parent = AgentName.ofProjectName("[PROJECT]").toString();
228    *   for (Environment element : environmentsClient.listEnvironments(parent).iterateAll()) {
229    *     // doThingsWith(element);
230    *   }
231    * }
232    * }</pre>
233    *
234    * @param parent Required. The agent to list all environments from. Format:
235    *     <p>- `projects/&lt;Project ID&gt;/agent` - `projects/&lt;Project
236    *     ID&gt;/locations/&lt;Location ID&gt;/agent`
237    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
238    */
listEnvironments(String parent)239   public final ListEnvironmentsPagedResponse listEnvironments(String parent) {
240     ListEnvironmentsRequest request =
241         ListEnvironmentsRequest.newBuilder().setParent(parent).build();
242     return listEnvironments(request);
243   }
244 
245   // AUTO-GENERATED DOCUMENTATION AND METHOD.
246   /**
247    * Returns the list of all non-default environments of the specified agent.
248    *
249    * <p>Sample code:
250    *
251    * <pre>{@code
252    * // This snippet has been automatically generated and should be regarded as a code template only.
253    * // It will require modifications to work:
254    * // - It may require correct/in-range values for request initialization.
255    * // - It may require specifying regional endpoints when creating the service client as shown in
256    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
257    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
258    *   ListEnvironmentsRequest request =
259    *       ListEnvironmentsRequest.newBuilder()
260    *           .setParent(AgentName.ofProjectName("[PROJECT]").toString())
261    *           .setPageSize(883849137)
262    *           .setPageToken("pageToken873572522")
263    *           .build();
264    *   for (Environment element : environmentsClient.listEnvironments(request).iterateAll()) {
265    *     // doThingsWith(element);
266    *   }
267    * }
268    * }</pre>
269    *
270    * @param request The request object containing all of the parameters for the API call.
271    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
272    */
listEnvironments(ListEnvironmentsRequest request)273   public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequest request) {
274     return listEnvironmentsPagedCallable().call(request);
275   }
276 
277   // AUTO-GENERATED DOCUMENTATION AND METHOD.
278   /**
279    * Returns the list of all non-default environments of the specified agent.
280    *
281    * <p>Sample code:
282    *
283    * <pre>{@code
284    * // This snippet has been automatically generated and should be regarded as a code template only.
285    * // It will require modifications to work:
286    * // - It may require correct/in-range values for request initialization.
287    * // - It may require specifying regional endpoints when creating the service client as shown in
288    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
289    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
290    *   ListEnvironmentsRequest request =
291    *       ListEnvironmentsRequest.newBuilder()
292    *           .setParent(AgentName.ofProjectName("[PROJECT]").toString())
293    *           .setPageSize(883849137)
294    *           .setPageToken("pageToken873572522")
295    *           .build();
296    *   ApiFuture<Environment> future =
297    *       environmentsClient.listEnvironmentsPagedCallable().futureCall(request);
298    *   // Do something.
299    *   for (Environment element : future.get().iterateAll()) {
300    *     // doThingsWith(element);
301    *   }
302    * }
303    * }</pre>
304    */
305   public final UnaryCallable<ListEnvironmentsRequest, ListEnvironmentsPagedResponse>
listEnvironmentsPagedCallable()306       listEnvironmentsPagedCallable() {
307     return stub.listEnvironmentsPagedCallable();
308   }
309 
310   // AUTO-GENERATED DOCUMENTATION AND METHOD.
311   /**
312    * Returns the list of all non-default environments of the specified agent.
313    *
314    * <p>Sample code:
315    *
316    * <pre>{@code
317    * // This snippet has been automatically generated and should be regarded as a code template only.
318    * // It will require modifications to work:
319    * // - It may require correct/in-range values for request initialization.
320    * // - It may require specifying regional endpoints when creating the service client as shown in
321    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
322    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
323    *   ListEnvironmentsRequest request =
324    *       ListEnvironmentsRequest.newBuilder()
325    *           .setParent(AgentName.ofProjectName("[PROJECT]").toString())
326    *           .setPageSize(883849137)
327    *           .setPageToken("pageToken873572522")
328    *           .build();
329    *   while (true) {
330    *     ListEnvironmentsResponse response =
331    *         environmentsClient.listEnvironmentsCallable().call(request);
332    *     for (Environment element : response.getEnvironmentsList()) {
333    *       // doThingsWith(element);
334    *     }
335    *     String nextPageToken = response.getNextPageToken();
336    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
337    *       request = request.toBuilder().setPageToken(nextPageToken).build();
338    *     } else {
339    *       break;
340    *     }
341    *   }
342    * }
343    * }</pre>
344    */
345   public final UnaryCallable<ListEnvironmentsRequest, ListEnvironmentsResponse>
listEnvironmentsCallable()346       listEnvironmentsCallable() {
347     return stub.listEnvironmentsCallable();
348   }
349 
350   // AUTO-GENERATED DOCUMENTATION AND METHOD.
351   /**
352    * Retrieves the specified agent environment.
353    *
354    * <p>Sample code:
355    *
356    * <pre>{@code
357    * // This snippet has been automatically generated and should be regarded as a code template only.
358    * // It will require modifications to work:
359    * // - It may require correct/in-range values for request initialization.
360    * // - It may require specifying regional endpoints when creating the service client as shown in
361    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
362    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
363    *   GetEnvironmentRequest request =
364    *       GetEnvironmentRequest.newBuilder()
365    *           .setName(
366    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
367    *           .build();
368    *   Environment response = environmentsClient.getEnvironment(request);
369    * }
370    * }</pre>
371    *
372    * @param request The request object containing all of the parameters for the API call.
373    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
374    */
getEnvironment(GetEnvironmentRequest request)375   public final Environment getEnvironment(GetEnvironmentRequest request) {
376     return getEnvironmentCallable().call(request);
377   }
378 
379   // AUTO-GENERATED DOCUMENTATION AND METHOD.
380   /**
381    * Retrieves the specified agent environment.
382    *
383    * <p>Sample code:
384    *
385    * <pre>{@code
386    * // This snippet has been automatically generated and should be regarded as a code template only.
387    * // It will require modifications to work:
388    * // - It may require correct/in-range values for request initialization.
389    * // - It may require specifying regional endpoints when creating the service client as shown in
390    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
391    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
392    *   GetEnvironmentRequest request =
393    *       GetEnvironmentRequest.newBuilder()
394    *           .setName(
395    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
396    *           .build();
397    *   ApiFuture<Environment> future =
398    *       environmentsClient.getEnvironmentCallable().futureCall(request);
399    *   // Do something.
400    *   Environment response = future.get();
401    * }
402    * }</pre>
403    */
getEnvironmentCallable()404   public final UnaryCallable<GetEnvironmentRequest, Environment> getEnvironmentCallable() {
405     return stub.getEnvironmentCallable();
406   }
407 
408   // AUTO-GENERATED DOCUMENTATION AND METHOD.
409   /**
410    * Creates an agent environment.
411    *
412    * <p>Sample code:
413    *
414    * <pre>{@code
415    * // This snippet has been automatically generated and should be regarded as a code template only.
416    * // It will require modifications to work:
417    * // - It may require correct/in-range values for request initialization.
418    * // - It may require specifying regional endpoints when creating the service client as shown in
419    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
420    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
421    *   CreateEnvironmentRequest request =
422    *       CreateEnvironmentRequest.newBuilder()
423    *           .setParent(AgentName.ofProjectName("[PROJECT]").toString())
424    *           .setEnvironment(Environment.newBuilder().build())
425    *           .setEnvironmentId("environmentId-950205810")
426    *           .build();
427    *   Environment response = environmentsClient.createEnvironment(request);
428    * }
429    * }</pre>
430    *
431    * @param request The request object containing all of the parameters for the API call.
432    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
433    */
createEnvironment(CreateEnvironmentRequest request)434   public final Environment createEnvironment(CreateEnvironmentRequest request) {
435     return createEnvironmentCallable().call(request);
436   }
437 
438   // AUTO-GENERATED DOCUMENTATION AND METHOD.
439   /**
440    * Creates an agent environment.
441    *
442    * <p>Sample code:
443    *
444    * <pre>{@code
445    * // This snippet has been automatically generated and should be regarded as a code template only.
446    * // It will require modifications to work:
447    * // - It may require correct/in-range values for request initialization.
448    * // - It may require specifying regional endpoints when creating the service client as shown in
449    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
450    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
451    *   CreateEnvironmentRequest request =
452    *       CreateEnvironmentRequest.newBuilder()
453    *           .setParent(AgentName.ofProjectName("[PROJECT]").toString())
454    *           .setEnvironment(Environment.newBuilder().build())
455    *           .setEnvironmentId("environmentId-950205810")
456    *           .build();
457    *   ApiFuture<Environment> future =
458    *       environmentsClient.createEnvironmentCallable().futureCall(request);
459    *   // Do something.
460    *   Environment response = future.get();
461    * }
462    * }</pre>
463    */
createEnvironmentCallable()464   public final UnaryCallable<CreateEnvironmentRequest, Environment> createEnvironmentCallable() {
465     return stub.createEnvironmentCallable();
466   }
467 
468   // AUTO-GENERATED DOCUMENTATION AND METHOD.
469   /**
470    * Updates the specified agent environment.
471    *
472    * <p>This method allows you to deploy new agent versions into the environment. When an
473    * environment is pointed to a new agent version by setting `environment.agent_version`, the
474    * environment is temporarily set to the `LOADING` state. During that time, the environment
475    * continues serving the previous version of the agent. After the new agent version is done
476    * loading, the environment is set back to the `RUNNING` state. You can use "-" as Environment ID
477    * in environment name to update an agent version in the default environment. WARNING: this will
478    * negate all recent changes to the draft agent and can't be undone. You may want to save the
479    * draft agent to a version before calling this method.
480    *
481    * <p>Sample code:
482    *
483    * <pre>{@code
484    * // This snippet has been automatically generated and should be regarded as a code template only.
485    * // It will require modifications to work:
486    * // - It may require correct/in-range values for request initialization.
487    * // - It may require specifying regional endpoints when creating the service client as shown in
488    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
489    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
490    *   UpdateEnvironmentRequest request =
491    *       UpdateEnvironmentRequest.newBuilder()
492    *           .setEnvironment(Environment.newBuilder().build())
493    *           .setUpdateMask(FieldMask.newBuilder().build())
494    *           .setAllowLoadToDraftAndDiscardChanges(true)
495    *           .build();
496    *   Environment response = environmentsClient.updateEnvironment(request);
497    * }
498    * }</pre>
499    *
500    * @param request The request object containing all of the parameters for the API call.
501    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
502    */
updateEnvironment(UpdateEnvironmentRequest request)503   public final Environment updateEnvironment(UpdateEnvironmentRequest request) {
504     return updateEnvironmentCallable().call(request);
505   }
506 
507   // AUTO-GENERATED DOCUMENTATION AND METHOD.
508   /**
509    * Updates the specified agent environment.
510    *
511    * <p>This method allows you to deploy new agent versions into the environment. When an
512    * environment is pointed to a new agent version by setting `environment.agent_version`, the
513    * environment is temporarily set to the `LOADING` state. During that time, the environment
514    * continues serving the previous version of the agent. After the new agent version is done
515    * loading, the environment is set back to the `RUNNING` state. You can use "-" as Environment ID
516    * in environment name to update an agent version in the default environment. WARNING: this will
517    * negate all recent changes to the draft agent and can't be undone. You may want to save the
518    * draft agent to a version before calling this method.
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 (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
529    *   UpdateEnvironmentRequest request =
530    *       UpdateEnvironmentRequest.newBuilder()
531    *           .setEnvironment(Environment.newBuilder().build())
532    *           .setUpdateMask(FieldMask.newBuilder().build())
533    *           .setAllowLoadToDraftAndDiscardChanges(true)
534    *           .build();
535    *   ApiFuture<Environment> future =
536    *       environmentsClient.updateEnvironmentCallable().futureCall(request);
537    *   // Do something.
538    *   Environment response = future.get();
539    * }
540    * }</pre>
541    */
updateEnvironmentCallable()542   public final UnaryCallable<UpdateEnvironmentRequest, Environment> updateEnvironmentCallable() {
543     return stub.updateEnvironmentCallable();
544   }
545 
546   // AUTO-GENERATED DOCUMENTATION AND METHOD.
547   /**
548    * Deletes the specified agent environment.
549    *
550    * <p>Sample code:
551    *
552    * <pre>{@code
553    * // This snippet has been automatically generated and should be regarded as a code template only.
554    * // It will require modifications to work:
555    * // - It may require correct/in-range values for request initialization.
556    * // - It may require specifying regional endpoints when creating the service client as shown in
557    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
558    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
559    *   DeleteEnvironmentRequest request =
560    *       DeleteEnvironmentRequest.newBuilder()
561    *           .setName(
562    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
563    *           .build();
564    *   environmentsClient.deleteEnvironment(request);
565    * }
566    * }</pre>
567    *
568    * @param request The request object containing all of the parameters for the API call.
569    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
570    */
deleteEnvironment(DeleteEnvironmentRequest request)571   public final void deleteEnvironment(DeleteEnvironmentRequest request) {
572     deleteEnvironmentCallable().call(request);
573   }
574 
575   // AUTO-GENERATED DOCUMENTATION AND METHOD.
576   /**
577    * Deletes the specified agent environment.
578    *
579    * <p>Sample code:
580    *
581    * <pre>{@code
582    * // This snippet has been automatically generated and should be regarded as a code template only.
583    * // It will require modifications to work:
584    * // - It may require correct/in-range values for request initialization.
585    * // - It may require specifying regional endpoints when creating the service client as shown in
586    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
587    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
588    *   DeleteEnvironmentRequest request =
589    *       DeleteEnvironmentRequest.newBuilder()
590    *           .setName(
591    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
592    *           .build();
593    *   ApiFuture<Empty> future = environmentsClient.deleteEnvironmentCallable().futureCall(request);
594    *   // Do something.
595    *   future.get();
596    * }
597    * }</pre>
598    */
deleteEnvironmentCallable()599   public final UnaryCallable<DeleteEnvironmentRequest, Empty> deleteEnvironmentCallable() {
600     return stub.deleteEnvironmentCallable();
601   }
602 
603   // AUTO-GENERATED DOCUMENTATION AND METHOD.
604   /**
605    * Gets the history of the specified environment.
606    *
607    * <p>Sample code:
608    *
609    * <pre>{@code
610    * // This snippet has been automatically generated and should be regarded as a code template only.
611    * // It will require modifications to work:
612    * // - It may require correct/in-range values for request initialization.
613    * // - It may require specifying regional endpoints when creating the service client as shown in
614    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
615    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
616    *   GetEnvironmentHistoryRequest request =
617    *       GetEnvironmentHistoryRequest.newBuilder()
618    *           .setParent(
619    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
620    *           .setPageSize(883849137)
621    *           .setPageToken("pageToken873572522")
622    *           .build();
623    *   for (EnvironmentHistory.Entry element :
624    *       environmentsClient.getEnvironmentHistory(request).iterateAll()) {
625    *     // doThingsWith(element);
626    *   }
627    * }
628    * }</pre>
629    *
630    * @param request The request object containing all of the parameters for the API call.
631    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
632    */
getEnvironmentHistory( GetEnvironmentHistoryRequest request)633   public final GetEnvironmentHistoryPagedResponse getEnvironmentHistory(
634       GetEnvironmentHistoryRequest request) {
635     return getEnvironmentHistoryPagedCallable().call(request);
636   }
637 
638   // AUTO-GENERATED DOCUMENTATION AND METHOD.
639   /**
640    * Gets the history of the specified environment.
641    *
642    * <p>Sample code:
643    *
644    * <pre>{@code
645    * // This snippet has been automatically generated and should be regarded as a code template only.
646    * // It will require modifications to work:
647    * // - It may require correct/in-range values for request initialization.
648    * // - It may require specifying regional endpoints when creating the service client as shown in
649    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
650    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
651    *   GetEnvironmentHistoryRequest request =
652    *       GetEnvironmentHistoryRequest.newBuilder()
653    *           .setParent(
654    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
655    *           .setPageSize(883849137)
656    *           .setPageToken("pageToken873572522")
657    *           .build();
658    *   ApiFuture<EnvironmentHistory.Entry> future =
659    *       environmentsClient.getEnvironmentHistoryPagedCallable().futureCall(request);
660    *   // Do something.
661    *   for (EnvironmentHistory.Entry element : future.get().iterateAll()) {
662    *     // doThingsWith(element);
663    *   }
664    * }
665    * }</pre>
666    */
667   public final UnaryCallable<GetEnvironmentHistoryRequest, GetEnvironmentHistoryPagedResponse>
getEnvironmentHistoryPagedCallable()668       getEnvironmentHistoryPagedCallable() {
669     return stub.getEnvironmentHistoryPagedCallable();
670   }
671 
672   // AUTO-GENERATED DOCUMENTATION AND METHOD.
673   /**
674    * Gets the history of the specified environment.
675    *
676    * <p>Sample code:
677    *
678    * <pre>{@code
679    * // This snippet has been automatically generated and should be regarded as a code template only.
680    * // It will require modifications to work:
681    * // - It may require correct/in-range values for request initialization.
682    * // - It may require specifying regional endpoints when creating the service client as shown in
683    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
684    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
685    *   GetEnvironmentHistoryRequest request =
686    *       GetEnvironmentHistoryRequest.newBuilder()
687    *           .setParent(
688    *               EnvironmentName.ofProjectEnvironmentName("[PROJECT]", "[ENVIRONMENT]").toString())
689    *           .setPageSize(883849137)
690    *           .setPageToken("pageToken873572522")
691    *           .build();
692    *   while (true) {
693    *     EnvironmentHistory response =
694    *         environmentsClient.getEnvironmentHistoryCallable().call(request);
695    *     for (EnvironmentHistory.Entry element : response.getEntriesList()) {
696    *       // doThingsWith(element);
697    *     }
698    *     String nextPageToken = response.getNextPageToken();
699    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
700    *       request = request.toBuilder().setPageToken(nextPageToken).build();
701    *     } else {
702    *       break;
703    *     }
704    *   }
705    * }
706    * }</pre>
707    */
708   public final UnaryCallable<GetEnvironmentHistoryRequest, EnvironmentHistory>
getEnvironmentHistoryCallable()709       getEnvironmentHistoryCallable() {
710     return stub.getEnvironmentHistoryCallable();
711   }
712 
713   // AUTO-GENERATED DOCUMENTATION AND METHOD.
714   /**
715    * Lists information about the supported locations for this service.
716    *
717    * <p>Sample code:
718    *
719    * <pre>{@code
720    * // This snippet has been automatically generated and should be regarded as a code template only.
721    * // It will require modifications to work:
722    * // - It may require correct/in-range values for request initialization.
723    * // - It may require specifying regional endpoints when creating the service client as shown in
724    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
725    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
726    *   ListLocationsRequest request =
727    *       ListLocationsRequest.newBuilder()
728    *           .setName("name3373707")
729    *           .setFilter("filter-1274492040")
730    *           .setPageSize(883849137)
731    *           .setPageToken("pageToken873572522")
732    *           .build();
733    *   for (Location element : environmentsClient.listLocations(request).iterateAll()) {
734    *     // doThingsWith(element);
735    *   }
736    * }
737    * }</pre>
738    *
739    * @param request The request object containing all of the parameters for the API call.
740    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
741    */
listLocations(ListLocationsRequest request)742   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
743     return listLocationsPagedCallable().call(request);
744   }
745 
746   // AUTO-GENERATED DOCUMENTATION AND METHOD.
747   /**
748    * Lists information about the supported locations for this service.
749    *
750    * <p>Sample code:
751    *
752    * <pre>{@code
753    * // This snippet has been automatically generated and should be regarded as a code template only.
754    * // It will require modifications to work:
755    * // - It may require correct/in-range values for request initialization.
756    * // - It may require specifying regional endpoints when creating the service client as shown in
757    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
758    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
759    *   ListLocationsRequest request =
760    *       ListLocationsRequest.newBuilder()
761    *           .setName("name3373707")
762    *           .setFilter("filter-1274492040")
763    *           .setPageSize(883849137)
764    *           .setPageToken("pageToken873572522")
765    *           .build();
766    *   ApiFuture<Location> future =
767    *       environmentsClient.listLocationsPagedCallable().futureCall(request);
768    *   // Do something.
769    *   for (Location element : future.get().iterateAll()) {
770    *     // doThingsWith(element);
771    *   }
772    * }
773    * }</pre>
774    */
775   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()776       listLocationsPagedCallable() {
777     return stub.listLocationsPagedCallable();
778   }
779 
780   // AUTO-GENERATED DOCUMENTATION AND METHOD.
781   /**
782    * Lists information about the supported locations for this service.
783    *
784    * <p>Sample code:
785    *
786    * <pre>{@code
787    * // This snippet has been automatically generated and should be regarded as a code template only.
788    * // It will require modifications to work:
789    * // - It may require correct/in-range values for request initialization.
790    * // - It may require specifying regional endpoints when creating the service client as shown in
791    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
792    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
793    *   ListLocationsRequest request =
794    *       ListLocationsRequest.newBuilder()
795    *           .setName("name3373707")
796    *           .setFilter("filter-1274492040")
797    *           .setPageSize(883849137)
798    *           .setPageToken("pageToken873572522")
799    *           .build();
800    *   while (true) {
801    *     ListLocationsResponse response = environmentsClient.listLocationsCallable().call(request);
802    *     for (Location element : response.getLocationsList()) {
803    *       // doThingsWith(element);
804    *     }
805    *     String nextPageToken = response.getNextPageToken();
806    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
807    *       request = request.toBuilder().setPageToken(nextPageToken).build();
808    *     } else {
809    *       break;
810    *     }
811    *   }
812    * }
813    * }</pre>
814    */
listLocationsCallable()815   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
816     return stub.listLocationsCallable();
817   }
818 
819   // AUTO-GENERATED DOCUMENTATION AND METHOD.
820   /**
821    * Gets information about a location.
822    *
823    * <p>Sample code:
824    *
825    * <pre>{@code
826    * // This snippet has been automatically generated and should be regarded as a code template only.
827    * // It will require modifications to work:
828    * // - It may require correct/in-range values for request initialization.
829    * // - It may require specifying regional endpoints when creating the service client as shown in
830    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
831    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
832    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
833    *   Location response = environmentsClient.getLocation(request);
834    * }
835    * }</pre>
836    *
837    * @param request The request object containing all of the parameters for the API call.
838    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
839    */
getLocation(GetLocationRequest request)840   public final Location getLocation(GetLocationRequest request) {
841     return getLocationCallable().call(request);
842   }
843 
844   // AUTO-GENERATED DOCUMENTATION AND METHOD.
845   /**
846    * Gets information about a location.
847    *
848    * <p>Sample code:
849    *
850    * <pre>{@code
851    * // This snippet has been automatically generated and should be regarded as a code template only.
852    * // It will require modifications to work:
853    * // - It may require correct/in-range values for request initialization.
854    * // - It may require specifying regional endpoints when creating the service client as shown in
855    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
856    * try (EnvironmentsClient environmentsClient = EnvironmentsClient.create()) {
857    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
858    *   ApiFuture<Location> future = environmentsClient.getLocationCallable().futureCall(request);
859    *   // Do something.
860    *   Location response = future.get();
861    * }
862    * }</pre>
863    */
getLocationCallable()864   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
865     return stub.getLocationCallable();
866   }
867 
868   @Override
close()869   public final void close() {
870     stub.close();
871   }
872 
873   @Override
shutdown()874   public void shutdown() {
875     stub.shutdown();
876   }
877 
878   @Override
isShutdown()879   public boolean isShutdown() {
880     return stub.isShutdown();
881   }
882 
883   @Override
isTerminated()884   public boolean isTerminated() {
885     return stub.isTerminated();
886   }
887 
888   @Override
shutdownNow()889   public void shutdownNow() {
890     stub.shutdownNow();
891   }
892 
893   @Override
awaitTermination(long duration, TimeUnit unit)894   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
895     return stub.awaitTermination(duration, unit);
896   }
897 
898   public static class ListEnvironmentsPagedResponse
899       extends AbstractPagedListResponse<
900           ListEnvironmentsRequest,
901           ListEnvironmentsResponse,
902           Environment,
903           ListEnvironmentsPage,
904           ListEnvironmentsFixedSizeCollection> {
905 
createAsync( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ApiFuture<ListEnvironmentsResponse> futureResponse)906     public static ApiFuture<ListEnvironmentsPagedResponse> createAsync(
907         PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context,
908         ApiFuture<ListEnvironmentsResponse> futureResponse) {
909       ApiFuture<ListEnvironmentsPage> futurePage =
910           ListEnvironmentsPage.createEmptyPage().createPageAsync(context, futureResponse);
911       return ApiFutures.transform(
912           futurePage,
913           input -> new ListEnvironmentsPagedResponse(input),
914           MoreExecutors.directExecutor());
915     }
916 
ListEnvironmentsPagedResponse(ListEnvironmentsPage page)917     private ListEnvironmentsPagedResponse(ListEnvironmentsPage page) {
918       super(page, ListEnvironmentsFixedSizeCollection.createEmptyCollection());
919     }
920   }
921 
922   public static class ListEnvironmentsPage
923       extends AbstractPage<
924           ListEnvironmentsRequest, ListEnvironmentsResponse, Environment, ListEnvironmentsPage> {
925 
ListEnvironmentsPage( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ListEnvironmentsResponse response)926     private ListEnvironmentsPage(
927         PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context,
928         ListEnvironmentsResponse response) {
929       super(context, response);
930     }
931 
createEmptyPage()932     private static ListEnvironmentsPage createEmptyPage() {
933       return new ListEnvironmentsPage(null, null);
934     }
935 
936     @Override
createPage( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ListEnvironmentsResponse response)937     protected ListEnvironmentsPage createPage(
938         PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context,
939         ListEnvironmentsResponse response) {
940       return new ListEnvironmentsPage(context, response);
941     }
942 
943     @Override
createPageAsync( PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context, ApiFuture<ListEnvironmentsResponse> futureResponse)944     public ApiFuture<ListEnvironmentsPage> createPageAsync(
945         PageContext<ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> context,
946         ApiFuture<ListEnvironmentsResponse> futureResponse) {
947       return super.createPageAsync(context, futureResponse);
948     }
949   }
950 
951   public static class ListEnvironmentsFixedSizeCollection
952       extends AbstractFixedSizeCollection<
953           ListEnvironmentsRequest,
954           ListEnvironmentsResponse,
955           Environment,
956           ListEnvironmentsPage,
957           ListEnvironmentsFixedSizeCollection> {
958 
ListEnvironmentsFixedSizeCollection( List<ListEnvironmentsPage> pages, int collectionSize)959     private ListEnvironmentsFixedSizeCollection(
960         List<ListEnvironmentsPage> pages, int collectionSize) {
961       super(pages, collectionSize);
962     }
963 
createEmptyCollection()964     private static ListEnvironmentsFixedSizeCollection createEmptyCollection() {
965       return new ListEnvironmentsFixedSizeCollection(null, 0);
966     }
967 
968     @Override
createCollection( List<ListEnvironmentsPage> pages, int collectionSize)969     protected ListEnvironmentsFixedSizeCollection createCollection(
970         List<ListEnvironmentsPage> pages, int collectionSize) {
971       return new ListEnvironmentsFixedSizeCollection(pages, collectionSize);
972     }
973   }
974 
975   public static class GetEnvironmentHistoryPagedResponse
976       extends AbstractPagedListResponse<
977           GetEnvironmentHistoryRequest,
978           EnvironmentHistory,
979           EnvironmentHistory.Entry,
980           GetEnvironmentHistoryPage,
981           GetEnvironmentHistoryFixedSizeCollection> {
982 
createAsync( PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry> context, ApiFuture<EnvironmentHistory> futureResponse)983     public static ApiFuture<GetEnvironmentHistoryPagedResponse> createAsync(
984         PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry>
985             context,
986         ApiFuture<EnvironmentHistory> futureResponse) {
987       ApiFuture<GetEnvironmentHistoryPage> futurePage =
988           GetEnvironmentHistoryPage.createEmptyPage().createPageAsync(context, futureResponse);
989       return ApiFutures.transform(
990           futurePage,
991           input -> new GetEnvironmentHistoryPagedResponse(input),
992           MoreExecutors.directExecutor());
993     }
994 
GetEnvironmentHistoryPagedResponse(GetEnvironmentHistoryPage page)995     private GetEnvironmentHistoryPagedResponse(GetEnvironmentHistoryPage page) {
996       super(page, GetEnvironmentHistoryFixedSizeCollection.createEmptyCollection());
997     }
998   }
999 
1000   public static class GetEnvironmentHistoryPage
1001       extends AbstractPage<
1002           GetEnvironmentHistoryRequest,
1003           EnvironmentHistory,
1004           EnvironmentHistory.Entry,
1005           GetEnvironmentHistoryPage> {
1006 
GetEnvironmentHistoryPage( PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry> context, EnvironmentHistory response)1007     private GetEnvironmentHistoryPage(
1008         PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry>
1009             context,
1010         EnvironmentHistory response) {
1011       super(context, response);
1012     }
1013 
createEmptyPage()1014     private static GetEnvironmentHistoryPage createEmptyPage() {
1015       return new GetEnvironmentHistoryPage(null, null);
1016     }
1017 
1018     @Override
createPage( PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry> context, EnvironmentHistory response)1019     protected GetEnvironmentHistoryPage createPage(
1020         PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry>
1021             context,
1022         EnvironmentHistory response) {
1023       return new GetEnvironmentHistoryPage(context, response);
1024     }
1025 
1026     @Override
createPageAsync( PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry> context, ApiFuture<EnvironmentHistory> futureResponse)1027     public ApiFuture<GetEnvironmentHistoryPage> createPageAsync(
1028         PageContext<GetEnvironmentHistoryRequest, EnvironmentHistory, EnvironmentHistory.Entry>
1029             context,
1030         ApiFuture<EnvironmentHistory> futureResponse) {
1031       return super.createPageAsync(context, futureResponse);
1032     }
1033   }
1034 
1035   public static class GetEnvironmentHistoryFixedSizeCollection
1036       extends AbstractFixedSizeCollection<
1037           GetEnvironmentHistoryRequest,
1038           EnvironmentHistory,
1039           EnvironmentHistory.Entry,
1040           GetEnvironmentHistoryPage,
1041           GetEnvironmentHistoryFixedSizeCollection> {
1042 
GetEnvironmentHistoryFixedSizeCollection( List<GetEnvironmentHistoryPage> pages, int collectionSize)1043     private GetEnvironmentHistoryFixedSizeCollection(
1044         List<GetEnvironmentHistoryPage> pages, int collectionSize) {
1045       super(pages, collectionSize);
1046     }
1047 
createEmptyCollection()1048     private static GetEnvironmentHistoryFixedSizeCollection createEmptyCollection() {
1049       return new GetEnvironmentHistoryFixedSizeCollection(null, 0);
1050     }
1051 
1052     @Override
createCollection( List<GetEnvironmentHistoryPage> pages, int collectionSize)1053     protected GetEnvironmentHistoryFixedSizeCollection createCollection(
1054         List<GetEnvironmentHistoryPage> pages, int collectionSize) {
1055       return new GetEnvironmentHistoryFixedSizeCollection(pages, collectionSize);
1056     }
1057   }
1058 
1059   public static class ListLocationsPagedResponse
1060       extends AbstractPagedListResponse<
1061           ListLocationsRequest,
1062           ListLocationsResponse,
1063           Location,
1064           ListLocationsPage,
1065           ListLocationsFixedSizeCollection> {
1066 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1067     public static ApiFuture<ListLocationsPagedResponse> createAsync(
1068         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1069         ApiFuture<ListLocationsResponse> futureResponse) {
1070       ApiFuture<ListLocationsPage> futurePage =
1071           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1072       return ApiFutures.transform(
1073           futurePage,
1074           input -> new ListLocationsPagedResponse(input),
1075           MoreExecutors.directExecutor());
1076     }
1077 
ListLocationsPagedResponse(ListLocationsPage page)1078     private ListLocationsPagedResponse(ListLocationsPage page) {
1079       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1080     }
1081   }
1082 
1083   public static class ListLocationsPage
1084       extends AbstractPage<
1085           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1086 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1087     private ListLocationsPage(
1088         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1089         ListLocationsResponse response) {
1090       super(context, response);
1091     }
1092 
createEmptyPage()1093     private static ListLocationsPage createEmptyPage() {
1094       return new ListLocationsPage(null, null);
1095     }
1096 
1097     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)1098     protected ListLocationsPage createPage(
1099         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1100         ListLocationsResponse response) {
1101       return new ListLocationsPage(context, response);
1102     }
1103 
1104     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)1105     public ApiFuture<ListLocationsPage> createPageAsync(
1106         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1107         ApiFuture<ListLocationsResponse> futureResponse) {
1108       return super.createPageAsync(context, futureResponse);
1109     }
1110   }
1111 
1112   public static class ListLocationsFixedSizeCollection
1113       extends AbstractFixedSizeCollection<
1114           ListLocationsRequest,
1115           ListLocationsResponse,
1116           Location,
1117           ListLocationsPage,
1118           ListLocationsFixedSizeCollection> {
1119 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)1120     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1121       super(pages, collectionSize);
1122     }
1123 
createEmptyCollection()1124     private static ListLocationsFixedSizeCollection createEmptyCollection() {
1125       return new ListLocationsFixedSizeCollection(null, 0);
1126     }
1127 
1128     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)1129     protected ListLocationsFixedSizeCollection createCollection(
1130         List<ListLocationsPage> pages, int collectionSize) {
1131       return new ListLocationsFixedSizeCollection(pages, collectionSize);
1132     }
1133   }
1134 }
1135