|
28 | 28 | import com.google.api.gax.rpc.OperationCallable;
|
29 | 29 | import com.google.api.gax.rpc.PageContext;
|
30 | 30 | import com.google.api.gax.rpc.UnaryCallable;
|
| 31 | +import com.google.cloud.location.ListLocationsRequest; |
| 32 | +import com.google.cloud.location.ListLocationsResponse; |
| 33 | +import com.google.cloud.location.Location; |
31 | 34 | import com.google.cloud.vpcaccess.v1.stub.VpcAccessServiceStub;
|
32 | 35 | import com.google.cloud.vpcaccess.v1.stub.VpcAccessServiceStubSettings;
|
33 | 36 | import com.google.common.util.concurrent.MoreExecutors;
|
@@ -722,6 +725,104 @@ public final UnaryCallable<DeleteConnectorRequest, Operation> deleteConnectorCal
|
722 | 725 | return stub.deleteConnectorCallable();
|
723 | 726 | }
|
724 | 727 |
|
| 728 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 729 | + /** |
| 730 | + * Lists information about the supported locations for this service. |
| 731 | + * |
| 732 | + * <p>Sample code: |
| 733 | + * |
| 734 | + * <pre>{@code |
| 735 | + * // This snippet has been automatically generated for illustrative purposes only. |
| 736 | + * // It may require modifications to work in your environment. |
| 737 | + * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) { |
| 738 | + * ListLocationsRequest request = |
| 739 | + * ListLocationsRequest.newBuilder() |
| 740 | + * .setName("name3373707") |
| 741 | + * .setFilter("filter-1274492040") |
| 742 | + * .setPageSize(883849137) |
| 743 | + * .setPageToken("pageToken873572522") |
| 744 | + * .build(); |
| 745 | + * for (Location element : vpcAccessServiceClient.listLocations(request).iterateAll()) { |
| 746 | + * // doThingsWith(element); |
| 747 | + * } |
| 748 | + * } |
| 749 | + * }</pre> |
| 750 | + * |
| 751 | + * @param request The request object containing all of the parameters for the API call. |
| 752 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 753 | + */ |
| 754 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 755 | + return listLocationsPagedCallable().call(request); |
| 756 | + } |
| 757 | + |
| 758 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 759 | + /** |
| 760 | + * Lists information about the supported locations for this service. |
| 761 | + * |
| 762 | + * <p>Sample code: |
| 763 | + * |
| 764 | + * <pre>{@code |
| 765 | + * // This snippet has been automatically generated for illustrative purposes only. |
| 766 | + * // It may require modifications to work in your environment. |
| 767 | + * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) { |
| 768 | + * ListLocationsRequest request = |
| 769 | + * ListLocationsRequest.newBuilder() |
| 770 | + * .setName("name3373707") |
| 771 | + * .setFilter("filter-1274492040") |
| 772 | + * .setPageSize(883849137) |
| 773 | + * .setPageToken("pageToken873572522") |
| 774 | + * .build(); |
| 775 | + * ApiFuture<Location> future = |
| 776 | + * vpcAccessServiceClient.listLocationsPagedCallable().futureCall(request); |
| 777 | + * // Do something. |
| 778 | + * for (Location element : future.get().iterateAll()) { |
| 779 | + * // doThingsWith(element); |
| 780 | + * } |
| 781 | + * } |
| 782 | + * }</pre> |
| 783 | + */ |
| 784 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 785 | + listLocationsPagedCallable() { |
| 786 | + return stub.listLocationsPagedCallable(); |
| 787 | + } |
| 788 | + |
| 789 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 790 | + /** |
| 791 | + * Lists information about the supported locations for this service. |
| 792 | + * |
| 793 | + * <p>Sample code: |
| 794 | + * |
| 795 | + * <pre>{@code |
| 796 | + * // This snippet has been automatically generated for illustrative purposes only. |
| 797 | + * // It may require modifications to work in your environment. |
| 798 | + * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) { |
| 799 | + * ListLocationsRequest request = |
| 800 | + * ListLocationsRequest.newBuilder() |
| 801 | + * .setName("name3373707") |
| 802 | + * .setFilter("filter-1274492040") |
| 803 | + * .setPageSize(883849137) |
| 804 | + * .setPageToken("pageToken873572522") |
| 805 | + * .build(); |
| 806 | + * while (true) { |
| 807 | + * ListLocationsResponse response = |
| 808 | + * vpcAccessServiceClient.listLocationsCallable().call(request); |
| 809 | + * for (Location element : response.getLocationsList()) { |
| 810 | + * // doThingsWith(element); |
| 811 | + * } |
| 812 | + * String nextPageToken = response.getNextPageToken(); |
| 813 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 814 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 815 | + * } else { |
| 816 | + * break; |
| 817 | + * } |
| 818 | + * } |
| 819 | + * } |
| 820 | + * }</pre> |
| 821 | + */ |
| 822 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 823 | + return stub.listLocationsCallable(); |
| 824 | + } |
| 825 | + |
725 | 826 | @Override
|
726 | 827 | public final void close() {
|
727 | 828 | stub.close();
|
@@ -827,4 +928,80 @@ protected ListConnectorsFixedSizeCollection createCollection(
|
827 | 928 | return new ListConnectorsFixedSizeCollection(pages, collectionSize);
|
828 | 929 | }
|
829 | 930 | }
|
| 931 | + |
| 932 | + public static class ListLocationsPagedResponse |
| 933 | + extends AbstractPagedListResponse< |
| 934 | + ListLocationsRequest, |
| 935 | + ListLocationsResponse, |
| 936 | + Location, |
| 937 | + ListLocationsPage, |
| 938 | + ListLocationsFixedSizeCollection> { |
| 939 | + |
| 940 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 941 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 942 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 943 | + ApiFuture<ListLocationsPage> futurePage = |
| 944 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 945 | + return ApiFutures.transform( |
| 946 | + futurePage, |
| 947 | + input -> new ListLocationsPagedResponse(input), |
| 948 | + MoreExecutors.directExecutor()); |
| 949 | + } |
| 950 | + |
| 951 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 952 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 953 | + } |
| 954 | + } |
| 955 | + |
| 956 | + public static class ListLocationsPage |
| 957 | + extends AbstractPage< |
| 958 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 959 | + |
| 960 | + private ListLocationsPage( |
| 961 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 962 | + ListLocationsResponse response) { |
| 963 | + super(context, response); |
| 964 | + } |
| 965 | + |
| 966 | + private static ListLocationsPage createEmptyPage() { |
| 967 | + return new ListLocationsPage(null, null); |
| 968 | + } |
| 969 | + |
| 970 | + @Override |
| 971 | + protected ListLocationsPage createPage( |
| 972 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 973 | + ListLocationsResponse response) { |
| 974 | + return new ListLocationsPage(context, response); |
| 975 | + } |
| 976 | + |
| 977 | + @Override |
| 978 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 979 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 980 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 981 | + return super.createPageAsync(context, futureResponse); |
| 982 | + } |
| 983 | + } |
| 984 | + |
| 985 | + public static class ListLocationsFixedSizeCollection |
| 986 | + extends AbstractFixedSizeCollection< |
| 987 | + ListLocationsRequest, |
| 988 | + ListLocationsResponse, |
| 989 | + Location, |
| 990 | + ListLocationsPage, |
| 991 | + ListLocationsFixedSizeCollection> { |
| 992 | + |
| 993 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 994 | + super(pages, collectionSize); |
| 995 | + } |
| 996 | + |
| 997 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 998 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 999 | + } |
| 1000 | + |
| 1001 | + @Override |
| 1002 | + protected ListLocationsFixedSizeCollection createCollection( |
| 1003 | + List<ListLocationsPage> pages, int collectionSize) { |
| 1004 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 1005 | + } |
| 1006 | + } |
830 | 1007 | }
|
0 commit comments