|
26 | 26 | import com.google.api.gax.rpc.UnaryCallable;
|
27 | 27 | import com.google.cloud.bigquery.datatransfer.v1.stub.DataTransferServiceStub;
|
28 | 28 | import com.google.cloud.bigquery.datatransfer.v1.stub.DataTransferServiceStubSettings;
|
| 29 | +import com.google.cloud.location.GetLocationRequest; |
| 30 | +import com.google.cloud.location.ListLocationsRequest; |
| 31 | +import com.google.cloud.location.ListLocationsResponse; |
| 32 | +import com.google.cloud.location.Location; |
29 | 33 | import com.google.common.util.concurrent.MoreExecutors;
|
30 | 34 | import com.google.protobuf.Empty;
|
31 | 35 | import com.google.protobuf.FieldMask;
|
@@ -2287,6 +2291,163 @@ public final UnaryCallable<EnrollDataSourcesRequest, Empty> enrollDataSourcesCal
|
2287 | 2291 | return stub.enrollDataSourcesCallable();
|
2288 | 2292 | }
|
2289 | 2293 |
|
| 2294 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2295 | + /** |
| 2296 | + * Lists information about the supported locations for this service. |
| 2297 | + * |
| 2298 | + * <p>Sample code: |
| 2299 | + * |
| 2300 | + * <pre>{@code |
| 2301 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2302 | + * // It will require modifications to work: |
| 2303 | + * // - It may require correct/in-range values for request initialization. |
| 2304 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2305 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2306 | + * try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { |
| 2307 | + * ListLocationsRequest request = |
| 2308 | + * ListLocationsRequest.newBuilder() |
| 2309 | + * .setName("name3373707") |
| 2310 | + * .setFilter("filter-1274492040") |
| 2311 | + * .setPageSize(883849137) |
| 2312 | + * .setPageToken("pageToken873572522") |
| 2313 | + * .build(); |
| 2314 | + * for (Location element : dataTransferServiceClient.listLocations(request).iterateAll()) { |
| 2315 | + * // doThingsWith(element); |
| 2316 | + * } |
| 2317 | + * } |
| 2318 | + * }</pre> |
| 2319 | + * |
| 2320 | + * @param request The request object containing all of the parameters for the API call. |
| 2321 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2322 | + */ |
| 2323 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 2324 | + return listLocationsPagedCallable().call(request); |
| 2325 | + } |
| 2326 | + |
| 2327 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2328 | + /** |
| 2329 | + * Lists information about the supported locations for this service. |
| 2330 | + * |
| 2331 | + * <p>Sample code: |
| 2332 | + * |
| 2333 | + * <pre>{@code |
| 2334 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2335 | + * // It will require modifications to work: |
| 2336 | + * // - It may require correct/in-range values for request initialization. |
| 2337 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2338 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2339 | + * try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { |
| 2340 | + * ListLocationsRequest request = |
| 2341 | + * ListLocationsRequest.newBuilder() |
| 2342 | + * .setName("name3373707") |
| 2343 | + * .setFilter("filter-1274492040") |
| 2344 | + * .setPageSize(883849137) |
| 2345 | + * .setPageToken("pageToken873572522") |
| 2346 | + * .build(); |
| 2347 | + * ApiFuture<Location> future = |
| 2348 | + * dataTransferServiceClient.listLocationsPagedCallable().futureCall(request); |
| 2349 | + * // Do something. |
| 2350 | + * for (Location element : future.get().iterateAll()) { |
| 2351 | + * // doThingsWith(element); |
| 2352 | + * } |
| 2353 | + * } |
| 2354 | + * }</pre> |
| 2355 | + */ |
| 2356 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 2357 | + listLocationsPagedCallable() { |
| 2358 | + return stub.listLocationsPagedCallable(); |
| 2359 | + } |
| 2360 | + |
| 2361 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2362 | + /** |
| 2363 | + * Lists information about the supported locations for this service. |
| 2364 | + * |
| 2365 | + * <p>Sample code: |
| 2366 | + * |
| 2367 | + * <pre>{@code |
| 2368 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2369 | + * // It will require modifications to work: |
| 2370 | + * // - It may require correct/in-range values for request initialization. |
| 2371 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2372 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2373 | + * try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { |
| 2374 | + * ListLocationsRequest request = |
| 2375 | + * ListLocationsRequest.newBuilder() |
| 2376 | + * .setName("name3373707") |
| 2377 | + * .setFilter("filter-1274492040") |
| 2378 | + * .setPageSize(883849137) |
| 2379 | + * .setPageToken("pageToken873572522") |
| 2380 | + * .build(); |
| 2381 | + * while (true) { |
| 2382 | + * ListLocationsResponse response = |
| 2383 | + * dataTransferServiceClient.listLocationsCallable().call(request); |
| 2384 | + * for (Location element : response.getLocationsList()) { |
| 2385 | + * // doThingsWith(element); |
| 2386 | + * } |
| 2387 | + * String nextPageToken = response.getNextPageToken(); |
| 2388 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 2389 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 2390 | + * } else { |
| 2391 | + * break; |
| 2392 | + * } |
| 2393 | + * } |
| 2394 | + * } |
| 2395 | + * }</pre> |
| 2396 | + */ |
| 2397 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 2398 | + return stub.listLocationsCallable(); |
| 2399 | + } |
| 2400 | + |
| 2401 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2402 | + /** |
| 2403 | + * Gets information about a location. |
| 2404 | + * |
| 2405 | + * <p>Sample code: |
| 2406 | + * |
| 2407 | + * <pre>{@code |
| 2408 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2409 | + * // It will require modifications to work: |
| 2410 | + * // - It may require correct/in-range values for request initialization. |
| 2411 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2412 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2413 | + * try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { |
| 2414 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2415 | + * Location response = dataTransferServiceClient.getLocation(request); |
| 2416 | + * } |
| 2417 | + * }</pre> |
| 2418 | + * |
| 2419 | + * @param request The request object containing all of the parameters for the API call. |
| 2420 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2421 | + */ |
| 2422 | + public final Location getLocation(GetLocationRequest request) { |
| 2423 | + return getLocationCallable().call(request); |
| 2424 | + } |
| 2425 | + |
| 2426 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2427 | + /** |
| 2428 | + * Gets information about a location. |
| 2429 | + * |
| 2430 | + * <p>Sample code: |
| 2431 | + * |
| 2432 | + * <pre>{@code |
| 2433 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2434 | + * // It will require modifications to work: |
| 2435 | + * // - It may require correct/in-range values for request initialization. |
| 2436 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2437 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2438 | + * try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { |
| 2439 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2440 | + * ApiFuture<Location> future = |
| 2441 | + * dataTransferServiceClient.getLocationCallable().futureCall(request); |
| 2442 | + * // Do something. |
| 2443 | + * Location response = future.get(); |
| 2444 | + * } |
| 2445 | + * }</pre> |
| 2446 | + */ |
| 2447 | + public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { |
| 2448 | + return stub.getLocationCallable(); |
| 2449 | + } |
| 2450 | + |
2290 | 2451 | @Override
|
2291 | 2452 | public final void close() {
|
2292 | 2453 | stub.close();
|
@@ -2634,4 +2795,80 @@ protected ListTransferLogsFixedSizeCollection createCollection(
|
2634 | 2795 | return new ListTransferLogsFixedSizeCollection(pages, collectionSize);
|
2635 | 2796 | }
|
2636 | 2797 | }
|
| 2798 | + |
| 2799 | + public static class ListLocationsPagedResponse |
| 2800 | + extends AbstractPagedListResponse< |
| 2801 | + ListLocationsRequest, |
| 2802 | + ListLocationsResponse, |
| 2803 | + Location, |
| 2804 | + ListLocationsPage, |
| 2805 | + ListLocationsFixedSizeCollection> { |
| 2806 | + |
| 2807 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 2808 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2809 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2810 | + ApiFuture<ListLocationsPage> futurePage = |
| 2811 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 2812 | + return ApiFutures.transform( |
| 2813 | + futurePage, |
| 2814 | + input -> new ListLocationsPagedResponse(input), |
| 2815 | + MoreExecutors.directExecutor()); |
| 2816 | + } |
| 2817 | + |
| 2818 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 2819 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 2820 | + } |
| 2821 | + } |
| 2822 | + |
| 2823 | + public static class ListLocationsPage |
| 2824 | + extends AbstractPage< |
| 2825 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 2826 | + |
| 2827 | + private ListLocationsPage( |
| 2828 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2829 | + ListLocationsResponse response) { |
| 2830 | + super(context, response); |
| 2831 | + } |
| 2832 | + |
| 2833 | + private static ListLocationsPage createEmptyPage() { |
| 2834 | + return new ListLocationsPage(null, null); |
| 2835 | + } |
| 2836 | + |
| 2837 | + @Override |
| 2838 | + protected ListLocationsPage createPage( |
| 2839 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2840 | + ListLocationsResponse response) { |
| 2841 | + return new ListLocationsPage(context, response); |
| 2842 | + } |
| 2843 | + |
| 2844 | + @Override |
| 2845 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 2846 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2847 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2848 | + return super.createPageAsync(context, futureResponse); |
| 2849 | + } |
| 2850 | + } |
| 2851 | + |
| 2852 | + public static class ListLocationsFixedSizeCollection |
| 2853 | + extends AbstractFixedSizeCollection< |
| 2854 | + ListLocationsRequest, |
| 2855 | + ListLocationsResponse, |
| 2856 | + Location, |
| 2857 | + ListLocationsPage, |
| 2858 | + ListLocationsFixedSizeCollection> { |
| 2859 | + |
| 2860 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 2861 | + super(pages, collectionSize); |
| 2862 | + } |
| 2863 | + |
| 2864 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 2865 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 2866 | + } |
| 2867 | + |
| 2868 | + @Override |
| 2869 | + protected ListLocationsFixedSizeCollection createCollection( |
| 2870 | + List<ListLocationsPage> pages, int collectionSize) { |
| 2871 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 2872 | + } |
| 2873 | + } |
2637 | 2874 | }
|
0 commit comments