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