|
670 | 670 | * </td> |
671 | 671 | * </tr> |
672 | 672 | * <tr> |
| 673 | + * <td><p> ListDatabases</td> |
| 674 | + * <td><p> Lists Databases in a given project and location.</td> |
| 675 | + * <td> |
| 676 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 677 | + * <ul> |
| 678 | + * <li><p> listDatabases(ListDatabasesRequest request) |
| 679 | + * </ul> |
| 680 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 681 | + * <ul> |
| 682 | + * <li><p> listDatabases(ClusterName parent) |
| 683 | + * <li><p> listDatabases(String parent) |
| 684 | + * </ul> |
| 685 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 686 | + * <ul> |
| 687 | + * <li><p> listDatabasesPagedCallable() |
| 688 | + * <li><p> listDatabasesCallable() |
| 689 | + * </ul> |
| 690 | + * </td> |
| 691 | + * </tr> |
| 692 | + * <tr> |
673 | 693 | * <td><p> ListLocations</td> |
674 | 694 | * <td><p> Lists information about the supported locations for this service.</td> |
675 | 695 | * <td> |
@@ -5278,6 +5298,171 @@ public final UnaryCallable<DeleteUserRequest, Empty> deleteUserCallable() { |
5278 | 5298 | return stub.deleteUserCallable(); |
5279 | 5299 | } |
5280 | 5300 |
|
| 5301 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 5302 | + /** |
| 5303 | + * Lists Databases in a given project and location. |
| 5304 | + * |
| 5305 | + * <p>Sample code: |
| 5306 | + * |
| 5307 | + * <pre>{@code |
| 5308 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 5309 | + * // It will require modifications to work: |
| 5310 | + * // - It may require correct/in-range values for request initialization. |
| 5311 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 5312 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 5313 | + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { |
| 5314 | + * ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); |
| 5315 | + * for (Database element : alloyDBAdminClient.listDatabases(parent).iterateAll()) { |
| 5316 | + * // doThingsWith(element); |
| 5317 | + * } |
| 5318 | + * } |
| 5319 | + * }</pre> |
| 5320 | + * |
| 5321 | + * @param parent Required. Parent value for ListDatabasesRequest. |
| 5322 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 5323 | + */ |
| 5324 | + public final ListDatabasesPagedResponse listDatabases(ClusterName parent) { |
| 5325 | + ListDatabasesRequest request = |
| 5326 | + ListDatabasesRequest.newBuilder() |
| 5327 | + .setParent(parent == null ? null : parent.toString()) |
| 5328 | + .build(); |
| 5329 | + return listDatabases(request); |
| 5330 | + } |
| 5331 | + |
| 5332 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 5333 | + /** |
| 5334 | + * Lists Databases in a given project and location. |
| 5335 | + * |
| 5336 | + * <p>Sample code: |
| 5337 | + * |
| 5338 | + * <pre>{@code |
| 5339 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 5340 | + * // It will require modifications to work: |
| 5341 | + * // - It may require correct/in-range values for request initialization. |
| 5342 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 5343 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 5344 | + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { |
| 5345 | + * String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString(); |
| 5346 | + * for (Database element : alloyDBAdminClient.listDatabases(parent).iterateAll()) { |
| 5347 | + * // doThingsWith(element); |
| 5348 | + * } |
| 5349 | + * } |
| 5350 | + * }</pre> |
| 5351 | + * |
| 5352 | + * @param parent Required. Parent value for ListDatabasesRequest. |
| 5353 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 5354 | + */ |
| 5355 | + public final ListDatabasesPagedResponse listDatabases(String parent) { |
| 5356 | + ListDatabasesRequest request = ListDatabasesRequest.newBuilder().setParent(parent).build(); |
| 5357 | + return listDatabases(request); |
| 5358 | + } |
| 5359 | + |
| 5360 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 5361 | + /** |
| 5362 | + * Lists Databases in a given project and location. |
| 5363 | + * |
| 5364 | + * <p>Sample code: |
| 5365 | + * |
| 5366 | + * <pre>{@code |
| 5367 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 5368 | + * // It will require modifications to work: |
| 5369 | + * // - It may require correct/in-range values for request initialization. |
| 5370 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 5371 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 5372 | + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { |
| 5373 | + * ListDatabasesRequest request = |
| 5374 | + * ListDatabasesRequest.newBuilder() |
| 5375 | + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) |
| 5376 | + * .setPageSize(883849137) |
| 5377 | + * .setPageToken("pageToken873572522") |
| 5378 | + * .setFilter("filter-1274492040") |
| 5379 | + * .build(); |
| 5380 | + * for (Database element : alloyDBAdminClient.listDatabases(request).iterateAll()) { |
| 5381 | + * // doThingsWith(element); |
| 5382 | + * } |
| 5383 | + * } |
| 5384 | + * }</pre> |
| 5385 | + * |
| 5386 | + * @param request The request object containing all of the parameters for the API call. |
| 5387 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 5388 | + */ |
| 5389 | + public final ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request) { |
| 5390 | + return listDatabasesPagedCallable().call(request); |
| 5391 | + } |
| 5392 | + |
| 5393 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 5394 | + /** |
| 5395 | + * Lists Databases in a given project and location. |
| 5396 | + * |
| 5397 | + * <p>Sample code: |
| 5398 | + * |
| 5399 | + * <pre>{@code |
| 5400 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 5401 | + * // It will require modifications to work: |
| 5402 | + * // - It may require correct/in-range values for request initialization. |
| 5403 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 5404 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 5405 | + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { |
| 5406 | + * ListDatabasesRequest request = |
| 5407 | + * ListDatabasesRequest.newBuilder() |
| 5408 | + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) |
| 5409 | + * .setPageSize(883849137) |
| 5410 | + * .setPageToken("pageToken873572522") |
| 5411 | + * .setFilter("filter-1274492040") |
| 5412 | + * .build(); |
| 5413 | + * ApiFuture<Database> future = |
| 5414 | + * alloyDBAdminClient.listDatabasesPagedCallable().futureCall(request); |
| 5415 | + * // Do something. |
| 5416 | + * for (Database element : future.get().iterateAll()) { |
| 5417 | + * // doThingsWith(element); |
| 5418 | + * } |
| 5419 | + * } |
| 5420 | + * }</pre> |
| 5421 | + */ |
| 5422 | + public final UnaryCallable<ListDatabasesRequest, ListDatabasesPagedResponse> |
| 5423 | + listDatabasesPagedCallable() { |
| 5424 | + return stub.listDatabasesPagedCallable(); |
| 5425 | + } |
| 5426 | + |
| 5427 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 5428 | + /** |
| 5429 | + * Lists Databases in a given project and location. |
| 5430 | + * |
| 5431 | + * <p>Sample code: |
| 5432 | + * |
| 5433 | + * <pre>{@code |
| 5434 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 5435 | + * // It will require modifications to work: |
| 5436 | + * // - It may require correct/in-range values for request initialization. |
| 5437 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 5438 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 5439 | + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { |
| 5440 | + * ListDatabasesRequest request = |
| 5441 | + * ListDatabasesRequest.newBuilder() |
| 5442 | + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) |
| 5443 | + * .setPageSize(883849137) |
| 5444 | + * .setPageToken("pageToken873572522") |
| 5445 | + * .setFilter("filter-1274492040") |
| 5446 | + * .build(); |
| 5447 | + * while (true) { |
| 5448 | + * ListDatabasesResponse response = alloyDBAdminClient.listDatabasesCallable().call(request); |
| 5449 | + * for (Database element : response.getDatabasesList()) { |
| 5450 | + * // doThingsWith(element); |
| 5451 | + * } |
| 5452 | + * String nextPageToken = response.getNextPageToken(); |
| 5453 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 5454 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 5455 | + * } else { |
| 5456 | + * break; |
| 5457 | + * } |
| 5458 | + * } |
| 5459 | + * } |
| 5460 | + * }</pre> |
| 5461 | + */ |
| 5462 | + public final UnaryCallable<ListDatabasesRequest, ListDatabasesResponse> listDatabasesCallable() { |
| 5463 | + return stub.listDatabasesCallable(); |
| 5464 | + } |
| 5465 | + |
5281 | 5466 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
5282 | 5467 | /** |
5283 | 5468 | * Lists information about the supported locations for this service. |
@@ -5848,6 +6033,82 @@ protected ListUsersFixedSizeCollection createCollection( |
5848 | 6033 | } |
5849 | 6034 | } |
5850 | 6035 |
|
| 6036 | + public static class ListDatabasesPagedResponse |
| 6037 | + extends AbstractPagedListResponse< |
| 6038 | + ListDatabasesRequest, |
| 6039 | + ListDatabasesResponse, |
| 6040 | + Database, |
| 6041 | + ListDatabasesPage, |
| 6042 | + ListDatabasesFixedSizeCollection> { |
| 6043 | + |
| 6044 | + public static ApiFuture<ListDatabasesPagedResponse> createAsync( |
| 6045 | + PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context, |
| 6046 | + ApiFuture<ListDatabasesResponse> futureResponse) { |
| 6047 | + ApiFuture<ListDatabasesPage> futurePage = |
| 6048 | + ListDatabasesPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 6049 | + return ApiFutures.transform( |
| 6050 | + futurePage, |
| 6051 | + input -> new ListDatabasesPagedResponse(input), |
| 6052 | + MoreExecutors.directExecutor()); |
| 6053 | + } |
| 6054 | + |
| 6055 | + private ListDatabasesPagedResponse(ListDatabasesPage page) { |
| 6056 | + super(page, ListDatabasesFixedSizeCollection.createEmptyCollection()); |
| 6057 | + } |
| 6058 | + } |
| 6059 | + |
| 6060 | + public static class ListDatabasesPage |
| 6061 | + extends AbstractPage< |
| 6062 | + ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage> { |
| 6063 | + |
| 6064 | + private ListDatabasesPage( |
| 6065 | + PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context, |
| 6066 | + ListDatabasesResponse response) { |
| 6067 | + super(context, response); |
| 6068 | + } |
| 6069 | + |
| 6070 | + private static ListDatabasesPage createEmptyPage() { |
| 6071 | + return new ListDatabasesPage(null, null); |
| 6072 | + } |
| 6073 | + |
| 6074 | + @Override |
| 6075 | + protected ListDatabasesPage createPage( |
| 6076 | + PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context, |
| 6077 | + ListDatabasesResponse response) { |
| 6078 | + return new ListDatabasesPage(context, response); |
| 6079 | + } |
| 6080 | + |
| 6081 | + @Override |
| 6082 | + public ApiFuture<ListDatabasesPage> createPageAsync( |
| 6083 | + PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context, |
| 6084 | + ApiFuture<ListDatabasesResponse> futureResponse) { |
| 6085 | + return super.createPageAsync(context, futureResponse); |
| 6086 | + } |
| 6087 | + } |
| 6088 | + |
| 6089 | + public static class ListDatabasesFixedSizeCollection |
| 6090 | + extends AbstractFixedSizeCollection< |
| 6091 | + ListDatabasesRequest, |
| 6092 | + ListDatabasesResponse, |
| 6093 | + Database, |
| 6094 | + ListDatabasesPage, |
| 6095 | + ListDatabasesFixedSizeCollection> { |
| 6096 | + |
| 6097 | + private ListDatabasesFixedSizeCollection(List<ListDatabasesPage> pages, int collectionSize) { |
| 6098 | + super(pages, collectionSize); |
| 6099 | + } |
| 6100 | + |
| 6101 | + private static ListDatabasesFixedSizeCollection createEmptyCollection() { |
| 6102 | + return new ListDatabasesFixedSizeCollection(null, 0); |
| 6103 | + } |
| 6104 | + |
| 6105 | + @Override |
| 6106 | + protected ListDatabasesFixedSizeCollection createCollection( |
| 6107 | + List<ListDatabasesPage> pages, int collectionSize) { |
| 6108 | + return new ListDatabasesFixedSizeCollection(pages, collectionSize); |
| 6109 | + } |
| 6110 | + } |
| 6111 | + |
5851 | 6112 | public static class ListLocationsPagedResponse |
5852 | 6113 | extends AbstractPagedListResponse< |
5853 | 6114 | ListLocationsRequest, |
|
0 commit comments