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