|
24 | 24 | import com.google.api.gax.paging.AbstractPagedListResponse; |
25 | 25 | import com.google.api.gax.rpc.PageContext; |
26 | 26 | import com.google.api.gax.rpc.UnaryCallable; |
| 27 | +import com.google.cloud.location.GetLocationRequest; |
| 28 | +import com.google.cloud.location.ListLocationsRequest; |
| 29 | +import com.google.cloud.location.ListLocationsResponse; |
| 30 | +import com.google.cloud.location.Location; |
27 | 31 | import com.google.cloud.scheduler.v1.stub.CloudSchedulerStub; |
28 | 32 | import com.google.cloud.scheduler.v1.stub.CloudSchedulerStubSettings; |
29 | 33 | import com.google.common.util.concurrent.MoreExecutors; |
@@ -1184,6 +1188,161 @@ public final UnaryCallable<RunJobRequest, Job> runJobCallable() { |
1184 | 1188 | return stub.runJobCallable(); |
1185 | 1189 | } |
1186 | 1190 |
|
| 1191 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1192 | + /** |
| 1193 | + * Lists information about the supported locations for this service. |
| 1194 | + * |
| 1195 | + * <p>Sample code: |
| 1196 | + * |
| 1197 | + * <pre>{@code |
| 1198 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1199 | + * // It will require modifications to work: |
| 1200 | + * // - It may require correct/in-range values for request initialization. |
| 1201 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1202 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1203 | + * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { |
| 1204 | + * ListLocationsRequest request = |
| 1205 | + * ListLocationsRequest.newBuilder() |
| 1206 | + * .setName("name3373707") |
| 1207 | + * .setFilter("filter-1274492040") |
| 1208 | + * .setPageSize(883849137) |
| 1209 | + * .setPageToken("pageToken873572522") |
| 1210 | + * .build(); |
| 1211 | + * for (Location element : cloudSchedulerClient.listLocations(request).iterateAll()) { |
| 1212 | + * // doThingsWith(element); |
| 1213 | + * } |
| 1214 | + * } |
| 1215 | + * }</pre> |
| 1216 | + * |
| 1217 | + * @param request The request object containing all of the parameters for the API call. |
| 1218 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1219 | + */ |
| 1220 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 1221 | + return listLocationsPagedCallable().call(request); |
| 1222 | + } |
| 1223 | + |
| 1224 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1225 | + /** |
| 1226 | + * Lists information about the supported locations for this service. |
| 1227 | + * |
| 1228 | + * <p>Sample code: |
| 1229 | + * |
| 1230 | + * <pre>{@code |
| 1231 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1232 | + * // It will require modifications to work: |
| 1233 | + * // - It may require correct/in-range values for request initialization. |
| 1234 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1235 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1236 | + * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { |
| 1237 | + * ListLocationsRequest request = |
| 1238 | + * ListLocationsRequest.newBuilder() |
| 1239 | + * .setName("name3373707") |
| 1240 | + * .setFilter("filter-1274492040") |
| 1241 | + * .setPageSize(883849137) |
| 1242 | + * .setPageToken("pageToken873572522") |
| 1243 | + * .build(); |
| 1244 | + * ApiFuture<Location> future = |
| 1245 | + * cloudSchedulerClient.listLocationsPagedCallable().futureCall(request); |
| 1246 | + * // Do something. |
| 1247 | + * for (Location element : future.get().iterateAll()) { |
| 1248 | + * // doThingsWith(element); |
| 1249 | + * } |
| 1250 | + * } |
| 1251 | + * }</pre> |
| 1252 | + */ |
| 1253 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 1254 | + listLocationsPagedCallable() { |
| 1255 | + return stub.listLocationsPagedCallable(); |
| 1256 | + } |
| 1257 | + |
| 1258 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1259 | + /** |
| 1260 | + * Lists information about the supported locations for this service. |
| 1261 | + * |
| 1262 | + * <p>Sample code: |
| 1263 | + * |
| 1264 | + * <pre>{@code |
| 1265 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1266 | + * // It will require modifications to work: |
| 1267 | + * // - It may require correct/in-range values for request initialization. |
| 1268 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1269 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1270 | + * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { |
| 1271 | + * ListLocationsRequest request = |
| 1272 | + * ListLocationsRequest.newBuilder() |
| 1273 | + * .setName("name3373707") |
| 1274 | + * .setFilter("filter-1274492040") |
| 1275 | + * .setPageSize(883849137) |
| 1276 | + * .setPageToken("pageToken873572522") |
| 1277 | + * .build(); |
| 1278 | + * while (true) { |
| 1279 | + * ListLocationsResponse response = cloudSchedulerClient.listLocationsCallable().call(request); |
| 1280 | + * for (Location element : response.getLocationsList()) { |
| 1281 | + * // doThingsWith(element); |
| 1282 | + * } |
| 1283 | + * String nextPageToken = response.getNextPageToken(); |
| 1284 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 1285 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 1286 | + * } else { |
| 1287 | + * break; |
| 1288 | + * } |
| 1289 | + * } |
| 1290 | + * } |
| 1291 | + * }</pre> |
| 1292 | + */ |
| 1293 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 1294 | + return stub.listLocationsCallable(); |
| 1295 | + } |
| 1296 | + |
| 1297 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1298 | + /** |
| 1299 | + * Gets information about a location. |
| 1300 | + * |
| 1301 | + * <p>Sample code: |
| 1302 | + * |
| 1303 | + * <pre>{@code |
| 1304 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1305 | + * // It will require modifications to work: |
| 1306 | + * // - It may require correct/in-range values for request initialization. |
| 1307 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1308 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1309 | + * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { |
| 1310 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 1311 | + * Location response = cloudSchedulerClient.getLocation(request); |
| 1312 | + * } |
| 1313 | + * }</pre> |
| 1314 | + * |
| 1315 | + * @param request The request object containing all of the parameters for the API call. |
| 1316 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1317 | + */ |
| 1318 | + public final Location getLocation(GetLocationRequest request) { |
| 1319 | + return getLocationCallable().call(request); |
| 1320 | + } |
| 1321 | + |
| 1322 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1323 | + /** |
| 1324 | + * Gets information about a location. |
| 1325 | + * |
| 1326 | + * <p>Sample code: |
| 1327 | + * |
| 1328 | + * <pre>{@code |
| 1329 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1330 | + * // It will require modifications to work: |
| 1331 | + * // - It may require correct/in-range values for request initialization. |
| 1332 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1333 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1334 | + * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { |
| 1335 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 1336 | + * ApiFuture<Location> future = cloudSchedulerClient.getLocationCallable().futureCall(request); |
| 1337 | + * // Do something. |
| 1338 | + * Location response = future.get(); |
| 1339 | + * } |
| 1340 | + * }</pre> |
| 1341 | + */ |
| 1342 | + public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { |
| 1343 | + return stub.getLocationCallable(); |
| 1344 | + } |
| 1345 | + |
1187 | 1346 | @Override |
1188 | 1347 | public final void close() { |
1189 | 1348 | stub.close(); |
@@ -1276,4 +1435,80 @@ protected ListJobsFixedSizeCollection createCollection( |
1276 | 1435 | return new ListJobsFixedSizeCollection(pages, collectionSize); |
1277 | 1436 | } |
1278 | 1437 | } |
| 1438 | + |
| 1439 | + public static class ListLocationsPagedResponse |
| 1440 | + extends AbstractPagedListResponse< |
| 1441 | + ListLocationsRequest, |
| 1442 | + ListLocationsResponse, |
| 1443 | + Location, |
| 1444 | + ListLocationsPage, |
| 1445 | + ListLocationsFixedSizeCollection> { |
| 1446 | + |
| 1447 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 1448 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 1449 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 1450 | + ApiFuture<ListLocationsPage> futurePage = |
| 1451 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 1452 | + return ApiFutures.transform( |
| 1453 | + futurePage, |
| 1454 | + input -> new ListLocationsPagedResponse(input), |
| 1455 | + MoreExecutors.directExecutor()); |
| 1456 | + } |
| 1457 | + |
| 1458 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 1459 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 1460 | + } |
| 1461 | + } |
| 1462 | + |
| 1463 | + public static class ListLocationsPage |
| 1464 | + extends AbstractPage< |
| 1465 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 1466 | + |
| 1467 | + private ListLocationsPage( |
| 1468 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 1469 | + ListLocationsResponse response) { |
| 1470 | + super(context, response); |
| 1471 | + } |
| 1472 | + |
| 1473 | + private static ListLocationsPage createEmptyPage() { |
| 1474 | + return new ListLocationsPage(null, null); |
| 1475 | + } |
| 1476 | + |
| 1477 | + @Override |
| 1478 | + protected ListLocationsPage createPage( |
| 1479 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 1480 | + ListLocationsResponse response) { |
| 1481 | + return new ListLocationsPage(context, response); |
| 1482 | + } |
| 1483 | + |
| 1484 | + @Override |
| 1485 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 1486 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 1487 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 1488 | + return super.createPageAsync(context, futureResponse); |
| 1489 | + } |
| 1490 | + } |
| 1491 | + |
| 1492 | + public static class ListLocationsFixedSizeCollection |
| 1493 | + extends AbstractFixedSizeCollection< |
| 1494 | + ListLocationsRequest, |
| 1495 | + ListLocationsResponse, |
| 1496 | + Location, |
| 1497 | + ListLocationsPage, |
| 1498 | + ListLocationsFixedSizeCollection> { |
| 1499 | + |
| 1500 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 1501 | + super(pages, collectionSize); |
| 1502 | + } |
| 1503 | + |
| 1504 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 1505 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 1506 | + } |
| 1507 | + |
| 1508 | + @Override |
| 1509 | + protected ListLocationsFixedSizeCollection createCollection( |
| 1510 | + List<ListLocationsPage> pages, int collectionSize) { |
| 1511 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 1512 | + } |
| 1513 | + } |
1279 | 1514 | } |
0 commit comments