|
25 | 25 | import com.google.api.gax.rpc.PageContext;
|
26 | 26 | import com.google.api.gax.rpc.UnaryCallable;
|
27 | 27 | import com.google.api.resourcenames.ResourceName;
|
| 28 | +import com.google.cloud.location.GetLocationRequest; |
| 29 | +import com.google.cloud.location.ListLocationsRequest; |
| 30 | +import com.google.cloud.location.ListLocationsResponse; |
| 31 | +import com.google.cloud.location.Location; |
28 | 32 | import com.google.cloud.tasks.v2.stub.CloudTasksStub;
|
29 | 33 | import com.google.cloud.tasks.v2.stub.CloudTasksStubSettings;
|
30 | 34 | import com.google.common.util.concurrent.MoreExecutors;
|
@@ -2583,6 +2587,161 @@ public final UnaryCallable<RunTaskRequest, Task> runTaskCallable() {
|
2583 | 2587 | return stub.runTaskCallable();
|
2584 | 2588 | }
|
2585 | 2589 |
|
| 2590 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2591 | + /** |
| 2592 | + * Lists information about the supported locations for this service. |
| 2593 | + * |
| 2594 | + * <p>Sample code: |
| 2595 | + * |
| 2596 | + * <pre>{@code |
| 2597 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2598 | + * // It will require modifications to work: |
| 2599 | + * // - It may require correct/in-range values for request initialization. |
| 2600 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2601 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2602 | + * try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { |
| 2603 | + * ListLocationsRequest request = |
| 2604 | + * ListLocationsRequest.newBuilder() |
| 2605 | + * .setName("name3373707") |
| 2606 | + * .setFilter("filter-1274492040") |
| 2607 | + * .setPageSize(883849137) |
| 2608 | + * .setPageToken("pageToken873572522") |
| 2609 | + * .build(); |
| 2610 | + * for (Location element : cloudTasksClient.listLocations(request).iterateAll()) { |
| 2611 | + * // doThingsWith(element); |
| 2612 | + * } |
| 2613 | + * } |
| 2614 | + * }</pre> |
| 2615 | + * |
| 2616 | + * @param request The request object containing all of the parameters for the API call. |
| 2617 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2618 | + */ |
| 2619 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 2620 | + return listLocationsPagedCallable().call(request); |
| 2621 | + } |
| 2622 | + |
| 2623 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2624 | + /** |
| 2625 | + * Lists information about the supported locations for this service. |
| 2626 | + * |
| 2627 | + * <p>Sample code: |
| 2628 | + * |
| 2629 | + * <pre>{@code |
| 2630 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2631 | + * // It will require modifications to work: |
| 2632 | + * // - It may require correct/in-range values for request initialization. |
| 2633 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2634 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2635 | + * try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { |
| 2636 | + * ListLocationsRequest request = |
| 2637 | + * ListLocationsRequest.newBuilder() |
| 2638 | + * .setName("name3373707") |
| 2639 | + * .setFilter("filter-1274492040") |
| 2640 | + * .setPageSize(883849137) |
| 2641 | + * .setPageToken("pageToken873572522") |
| 2642 | + * .build(); |
| 2643 | + * ApiFuture<Location> future = |
| 2644 | + * cloudTasksClient.listLocationsPagedCallable().futureCall(request); |
| 2645 | + * // Do something. |
| 2646 | + * for (Location element : future.get().iterateAll()) { |
| 2647 | + * // doThingsWith(element); |
| 2648 | + * } |
| 2649 | + * } |
| 2650 | + * }</pre> |
| 2651 | + */ |
| 2652 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 2653 | + listLocationsPagedCallable() { |
| 2654 | + return stub.listLocationsPagedCallable(); |
| 2655 | + } |
| 2656 | + |
| 2657 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2658 | + /** |
| 2659 | + * Lists information about the supported locations for this service. |
| 2660 | + * |
| 2661 | + * <p>Sample code: |
| 2662 | + * |
| 2663 | + * <pre>{@code |
| 2664 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2665 | + * // It will require modifications to work: |
| 2666 | + * // - It may require correct/in-range values for request initialization. |
| 2667 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2668 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2669 | + * try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { |
| 2670 | + * ListLocationsRequest request = |
| 2671 | + * ListLocationsRequest.newBuilder() |
| 2672 | + * .setName("name3373707") |
| 2673 | + * .setFilter("filter-1274492040") |
| 2674 | + * .setPageSize(883849137) |
| 2675 | + * .setPageToken("pageToken873572522") |
| 2676 | + * .build(); |
| 2677 | + * while (true) { |
| 2678 | + * ListLocationsResponse response = cloudTasksClient.listLocationsCallable().call(request); |
| 2679 | + * for (Location element : response.getLocationsList()) { |
| 2680 | + * // doThingsWith(element); |
| 2681 | + * } |
| 2682 | + * String nextPageToken = response.getNextPageToken(); |
| 2683 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 2684 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 2685 | + * } else { |
| 2686 | + * break; |
| 2687 | + * } |
| 2688 | + * } |
| 2689 | + * } |
| 2690 | + * }</pre> |
| 2691 | + */ |
| 2692 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 2693 | + return stub.listLocationsCallable(); |
| 2694 | + } |
| 2695 | + |
| 2696 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2697 | + /** |
| 2698 | + * Gets information about a location. |
| 2699 | + * |
| 2700 | + * <p>Sample code: |
| 2701 | + * |
| 2702 | + * <pre>{@code |
| 2703 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2704 | + * // It will require modifications to work: |
| 2705 | + * // - It may require correct/in-range values for request initialization. |
| 2706 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2707 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2708 | + * try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { |
| 2709 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2710 | + * Location response = cloudTasksClient.getLocation(request); |
| 2711 | + * } |
| 2712 | + * }</pre> |
| 2713 | + * |
| 2714 | + * @param request The request object containing all of the parameters for the API call. |
| 2715 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2716 | + */ |
| 2717 | + public final Location getLocation(GetLocationRequest request) { |
| 2718 | + return getLocationCallable().call(request); |
| 2719 | + } |
| 2720 | + |
| 2721 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2722 | + /** |
| 2723 | + * Gets information about a location. |
| 2724 | + * |
| 2725 | + * <p>Sample code: |
| 2726 | + * |
| 2727 | + * <pre>{@code |
| 2728 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2729 | + * // It will require modifications to work: |
| 2730 | + * // - It may require correct/in-range values for request initialization. |
| 2731 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2732 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2733 | + * try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { |
| 2734 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2735 | + * ApiFuture<Location> future = cloudTasksClient.getLocationCallable().futureCall(request); |
| 2736 | + * // Do something. |
| 2737 | + * Location response = future.get(); |
| 2738 | + * } |
| 2739 | + * }</pre> |
| 2740 | + */ |
| 2741 | + public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { |
| 2742 | + return stub.getLocationCallable(); |
| 2743 | + } |
| 2744 | + |
2586 | 2745 | @Override
|
2587 | 2746 | public final void close() {
|
2588 | 2747 | stub.close();
|
@@ -2750,4 +2909,80 @@ protected ListTasksFixedSizeCollection createCollection(
|
2750 | 2909 | return new ListTasksFixedSizeCollection(pages, collectionSize);
|
2751 | 2910 | }
|
2752 | 2911 | }
|
| 2912 | + |
| 2913 | + public static class ListLocationsPagedResponse |
| 2914 | + extends AbstractPagedListResponse< |
| 2915 | + ListLocationsRequest, |
| 2916 | + ListLocationsResponse, |
| 2917 | + Location, |
| 2918 | + ListLocationsPage, |
| 2919 | + ListLocationsFixedSizeCollection> { |
| 2920 | + |
| 2921 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 2922 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2923 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2924 | + ApiFuture<ListLocationsPage> futurePage = |
| 2925 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 2926 | + return ApiFutures.transform( |
| 2927 | + futurePage, |
| 2928 | + input -> new ListLocationsPagedResponse(input), |
| 2929 | + MoreExecutors.directExecutor()); |
| 2930 | + } |
| 2931 | + |
| 2932 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 2933 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 2934 | + } |
| 2935 | + } |
| 2936 | + |
| 2937 | + public static class ListLocationsPage |
| 2938 | + extends AbstractPage< |
| 2939 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 2940 | + |
| 2941 | + private ListLocationsPage( |
| 2942 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2943 | + ListLocationsResponse response) { |
| 2944 | + super(context, response); |
| 2945 | + } |
| 2946 | + |
| 2947 | + private static ListLocationsPage createEmptyPage() { |
| 2948 | + return new ListLocationsPage(null, null); |
| 2949 | + } |
| 2950 | + |
| 2951 | + @Override |
| 2952 | + protected ListLocationsPage createPage( |
| 2953 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2954 | + ListLocationsResponse response) { |
| 2955 | + return new ListLocationsPage(context, response); |
| 2956 | + } |
| 2957 | + |
| 2958 | + @Override |
| 2959 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 2960 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2961 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2962 | + return super.createPageAsync(context, futureResponse); |
| 2963 | + } |
| 2964 | + } |
| 2965 | + |
| 2966 | + public static class ListLocationsFixedSizeCollection |
| 2967 | + extends AbstractFixedSizeCollection< |
| 2968 | + ListLocationsRequest, |
| 2969 | + ListLocationsResponse, |
| 2970 | + Location, |
| 2971 | + ListLocationsPage, |
| 2972 | + ListLocationsFixedSizeCollection> { |
| 2973 | + |
| 2974 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 2975 | + super(pages, collectionSize); |
| 2976 | + } |
| 2977 | + |
| 2978 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 2979 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 2980 | + } |
| 2981 | + |
| 2982 | + @Override |
| 2983 | + protected ListLocationsFixedSizeCollection createCollection( |
| 2984 | + List<ListLocationsPage> pages, int collectionSize) { |
| 2985 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 2986 | + } |
| 2987 | + } |
2753 | 2988 | }
|
0 commit comments