|
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.GetLocationRequest; |
| 32 | +import com.google.cloud.location.ListLocationsRequest; |
| 33 | +import com.google.cloud.location.ListLocationsResponse; |
| 34 | +import com.google.cloud.location.Location; |
31 | 35 | import com.google.cloud.redis.v1.stub.CloudRedisStub; |
32 | 36 | import com.google.cloud.redis.v1.stub.CloudRedisStubSettings; |
33 | 37 | import com.google.common.util.concurrent.MoreExecutors; |
@@ -1966,6 +1970,161 @@ public final OperationFuture<Instance, OperationMetadata> rescheduleMaintenanceA |
1966 | 1970 | return stub.rescheduleMaintenanceCallable(); |
1967 | 1971 | } |
1968 | 1972 |
|
| 1973 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1974 | + /** |
| 1975 | + * Lists information about the supported locations for this service. |
| 1976 | + * |
| 1977 | + * <p>Sample code: |
| 1978 | + * |
| 1979 | + * <pre>{@code |
| 1980 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1981 | + * // It will require modifications to work: |
| 1982 | + * // - It may require correct/in-range values for request initialization. |
| 1983 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1984 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1985 | + * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { |
| 1986 | + * ListLocationsRequest request = |
| 1987 | + * ListLocationsRequest.newBuilder() |
| 1988 | + * .setName("name3373707") |
| 1989 | + * .setFilter("filter-1274492040") |
| 1990 | + * .setPageSize(883849137) |
| 1991 | + * .setPageToken("pageToken873572522") |
| 1992 | + * .build(); |
| 1993 | + * for (Location element : cloudRedisClient.listLocations(request).iterateAll()) { |
| 1994 | + * // doThingsWith(element); |
| 1995 | + * } |
| 1996 | + * } |
| 1997 | + * }</pre> |
| 1998 | + * |
| 1999 | + * @param request The request object containing all of the parameters for the API call. |
| 2000 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2001 | + */ |
| 2002 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 2003 | + return listLocationsPagedCallable().call(request); |
| 2004 | + } |
| 2005 | + |
| 2006 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2007 | + /** |
| 2008 | + * Lists information about the supported locations for this service. |
| 2009 | + * |
| 2010 | + * <p>Sample code: |
| 2011 | + * |
| 2012 | + * <pre>{@code |
| 2013 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2014 | + * // It will require modifications to work: |
| 2015 | + * // - It may require correct/in-range values for request initialization. |
| 2016 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2017 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2018 | + * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { |
| 2019 | + * ListLocationsRequest request = |
| 2020 | + * ListLocationsRequest.newBuilder() |
| 2021 | + * .setName("name3373707") |
| 2022 | + * .setFilter("filter-1274492040") |
| 2023 | + * .setPageSize(883849137) |
| 2024 | + * .setPageToken("pageToken873572522") |
| 2025 | + * .build(); |
| 2026 | + * ApiFuture<Location> future = |
| 2027 | + * cloudRedisClient.listLocationsPagedCallable().futureCall(request); |
| 2028 | + * // Do something. |
| 2029 | + * for (Location element : future.get().iterateAll()) { |
| 2030 | + * // doThingsWith(element); |
| 2031 | + * } |
| 2032 | + * } |
| 2033 | + * }</pre> |
| 2034 | + */ |
| 2035 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 2036 | + listLocationsPagedCallable() { |
| 2037 | + return stub.listLocationsPagedCallable(); |
| 2038 | + } |
| 2039 | + |
| 2040 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2041 | + /** |
| 2042 | + * Lists information about the supported locations for this service. |
| 2043 | + * |
| 2044 | + * <p>Sample code: |
| 2045 | + * |
| 2046 | + * <pre>{@code |
| 2047 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2048 | + * // It will require modifications to work: |
| 2049 | + * // - It may require correct/in-range values for request initialization. |
| 2050 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2051 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2052 | + * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { |
| 2053 | + * ListLocationsRequest request = |
| 2054 | + * ListLocationsRequest.newBuilder() |
| 2055 | + * .setName("name3373707") |
| 2056 | + * .setFilter("filter-1274492040") |
| 2057 | + * .setPageSize(883849137) |
| 2058 | + * .setPageToken("pageToken873572522") |
| 2059 | + * .build(); |
| 2060 | + * while (true) { |
| 2061 | + * ListLocationsResponse response = cloudRedisClient.listLocationsCallable().call(request); |
| 2062 | + * for (Location element : response.getLocationsList()) { |
| 2063 | + * // doThingsWith(element); |
| 2064 | + * } |
| 2065 | + * String nextPageToken = response.getNextPageToken(); |
| 2066 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 2067 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 2068 | + * } else { |
| 2069 | + * break; |
| 2070 | + * } |
| 2071 | + * } |
| 2072 | + * } |
| 2073 | + * }</pre> |
| 2074 | + */ |
| 2075 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 2076 | + return stub.listLocationsCallable(); |
| 2077 | + } |
| 2078 | + |
| 2079 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2080 | + /** |
| 2081 | + * Gets information about a location. |
| 2082 | + * |
| 2083 | + * <p>Sample code: |
| 2084 | + * |
| 2085 | + * <pre>{@code |
| 2086 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2087 | + * // It will require modifications to work: |
| 2088 | + * // - It may require correct/in-range values for request initialization. |
| 2089 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2090 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2091 | + * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { |
| 2092 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2093 | + * Location response = cloudRedisClient.getLocation(request); |
| 2094 | + * } |
| 2095 | + * }</pre> |
| 2096 | + * |
| 2097 | + * @param request The request object containing all of the parameters for the API call. |
| 2098 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 2099 | + */ |
| 2100 | + public final Location getLocation(GetLocationRequest request) { |
| 2101 | + return getLocationCallable().call(request); |
| 2102 | + } |
| 2103 | + |
| 2104 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 2105 | + /** |
| 2106 | + * Gets information about a location. |
| 2107 | + * |
| 2108 | + * <p>Sample code: |
| 2109 | + * |
| 2110 | + * <pre>{@code |
| 2111 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 2112 | + * // It will require modifications to work: |
| 2113 | + * // - It may require correct/in-range values for request initialization. |
| 2114 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 2115 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 2116 | + * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { |
| 2117 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 2118 | + * ApiFuture<Location> future = cloudRedisClient.getLocationCallable().futureCall(request); |
| 2119 | + * // Do something. |
| 2120 | + * Location response = future.get(); |
| 2121 | + * } |
| 2122 | + * }</pre> |
| 2123 | + */ |
| 2124 | + public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { |
| 2125 | + return stub.getLocationCallable(); |
| 2126 | + } |
| 2127 | + |
1969 | 2128 | @Override |
1970 | 2129 | public final void close() { |
1971 | 2130 | stub.close(); |
@@ -2071,4 +2230,80 @@ protected ListInstancesFixedSizeCollection createCollection( |
2071 | 2230 | return new ListInstancesFixedSizeCollection(pages, collectionSize); |
2072 | 2231 | } |
2073 | 2232 | } |
| 2233 | + |
| 2234 | + public static class ListLocationsPagedResponse |
| 2235 | + extends AbstractPagedListResponse< |
| 2236 | + ListLocationsRequest, |
| 2237 | + ListLocationsResponse, |
| 2238 | + Location, |
| 2239 | + ListLocationsPage, |
| 2240 | + ListLocationsFixedSizeCollection> { |
| 2241 | + |
| 2242 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 2243 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2244 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2245 | + ApiFuture<ListLocationsPage> futurePage = |
| 2246 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 2247 | + return ApiFutures.transform( |
| 2248 | + futurePage, |
| 2249 | + input -> new ListLocationsPagedResponse(input), |
| 2250 | + MoreExecutors.directExecutor()); |
| 2251 | + } |
| 2252 | + |
| 2253 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 2254 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 2255 | + } |
| 2256 | + } |
| 2257 | + |
| 2258 | + public static class ListLocationsPage |
| 2259 | + extends AbstractPage< |
| 2260 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 2261 | + |
| 2262 | + private ListLocationsPage( |
| 2263 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2264 | + ListLocationsResponse response) { |
| 2265 | + super(context, response); |
| 2266 | + } |
| 2267 | + |
| 2268 | + private static ListLocationsPage createEmptyPage() { |
| 2269 | + return new ListLocationsPage(null, null); |
| 2270 | + } |
| 2271 | + |
| 2272 | + @Override |
| 2273 | + protected ListLocationsPage createPage( |
| 2274 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2275 | + ListLocationsResponse response) { |
| 2276 | + return new ListLocationsPage(context, response); |
| 2277 | + } |
| 2278 | + |
| 2279 | + @Override |
| 2280 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 2281 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 2282 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 2283 | + return super.createPageAsync(context, futureResponse); |
| 2284 | + } |
| 2285 | + } |
| 2286 | + |
| 2287 | + public static class ListLocationsFixedSizeCollection |
| 2288 | + extends AbstractFixedSizeCollection< |
| 2289 | + ListLocationsRequest, |
| 2290 | + ListLocationsResponse, |
| 2291 | + Location, |
| 2292 | + ListLocationsPage, |
| 2293 | + ListLocationsFixedSizeCollection> { |
| 2294 | + |
| 2295 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 2296 | + super(pages, collectionSize); |
| 2297 | + } |
| 2298 | + |
| 2299 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 2300 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 2301 | + } |
| 2302 | + |
| 2303 | + @Override |
| 2304 | + protected ListLocationsFixedSizeCollection createCollection( |
| 2305 | + List<ListLocationsPage> pages, int collectionSize) { |
| 2306 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 2307 | + } |
| 2308 | + } |
2074 | 2309 | } |
0 commit comments