Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [alloydb] added PSC config, PSC interface config, PSC instance config #10166

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java-alloydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-alloydb/java11.html
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-alloydb.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-alloydb/0.19.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-alloydb/0.21.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4657,6 +4657,171 @@ public final UnaryCallable<DeleteUserRequest, Empty> deleteUserCallable() {
return stub.deleteUserCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Databases in a given project and location.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
* ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
* for (Database element : alloyDBAdminClient.listDatabases(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. Parent value for ListDatabasesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDatabasesPagedResponse listDatabases(ClusterName parent) {
ListDatabasesRequest request =
ListDatabasesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listDatabases(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Databases in a given project and location.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
* String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
* for (Database element : alloyDBAdminClient.listDatabases(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. Parent value for ListDatabasesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDatabasesPagedResponse listDatabases(String parent) {
ListDatabasesRequest request = ListDatabasesRequest.newBuilder().setParent(parent).build();
return listDatabases(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Databases in a given project and location.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
* ListDatabasesRequest request =
* ListDatabasesRequest.newBuilder()
* .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .build();
* for (Database element : alloyDBAdminClient.listDatabases(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request) {
return listDatabasesPagedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Databases in a given project and location.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
* ListDatabasesRequest request =
* ListDatabasesRequest.newBuilder()
* .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .build();
* ApiFuture<Database> future =
* alloyDBAdminClient.listDatabasesPagedCallable().futureCall(request);
* // Do something.
* for (Database element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListDatabasesRequest, ListDatabasesPagedResponse>
listDatabasesPagedCallable() {
return stub.listDatabasesPagedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Databases in a given project and location.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
* ListDatabasesRequest request =
* ListDatabasesRequest.newBuilder()
* .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .build();
* while (true) {
* ListDatabasesResponse response = alloyDBAdminClient.listDatabasesCallable().call(request);
* for (Database element : response.getDatabasesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListDatabasesRequest, ListDatabasesResponse> listDatabasesCallable() {
return stub.listDatabasesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down Expand Up @@ -5227,6 +5392,82 @@ protected ListUsersFixedSizeCollection createCollection(
}
}

public static class ListDatabasesPagedResponse
extends AbstractPagedListResponse<
ListDatabasesRequest,
ListDatabasesResponse,
Database,
ListDatabasesPage,
ListDatabasesFixedSizeCollection> {

public static ApiFuture<ListDatabasesPagedResponse> createAsync(
PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context,
ApiFuture<ListDatabasesResponse> futureResponse) {
ApiFuture<ListDatabasesPage> futurePage =
ListDatabasesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListDatabasesPagedResponse(input),
MoreExecutors.directExecutor());
}

private ListDatabasesPagedResponse(ListDatabasesPage page) {
super(page, ListDatabasesFixedSizeCollection.createEmptyCollection());
}
}

public static class ListDatabasesPage
extends AbstractPage<
ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage> {

private ListDatabasesPage(
PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context,
ListDatabasesResponse response) {
super(context, response);
}

private static ListDatabasesPage createEmptyPage() {
return new ListDatabasesPage(null, null);
}

@Override
protected ListDatabasesPage createPage(
PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context,
ListDatabasesResponse response) {
return new ListDatabasesPage(context, response);
}

@Override
public ApiFuture<ListDatabasesPage> createPageAsync(
PageContext<ListDatabasesRequest, ListDatabasesResponse, Database> context,
ApiFuture<ListDatabasesResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}

public static class ListDatabasesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListDatabasesRequest,
ListDatabasesResponse,
Database,
ListDatabasesPage,
ListDatabasesFixedSizeCollection> {

private ListDatabasesFixedSizeCollection(List<ListDatabasesPage> pages, int collectionSize) {
super(pages, collectionSize);
}

private static ListDatabasesFixedSizeCollection createEmptyCollection() {
return new ListDatabasesFixedSizeCollection(null, 0);
}

@Override
protected ListDatabasesFixedSizeCollection createCollection(
List<ListDatabasesPage> pages, int collectionSize) {
return new ListDatabasesFixedSizeCollection(pages, collectionSize);
}
}

public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListClustersPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListDatabasesPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListInstancesPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListLocationsPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListSupportedDatabaseFlagsPagedResponse;
Expand Down Expand Up @@ -357,6 +358,12 @@ public UnaryCallSettings<DeleteUserRequest, Empty> deleteUserSettings() {
return ((AlloyDBAdminStubSettings) getStubSettings()).deleteUserSettings();
}

/** Returns the object with the settings used for calls to listDatabases. */
public PagedCallSettings<ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
listDatabasesSettings() {
return ((AlloyDBAdminStubSettings) getStubSettings()).listDatabasesSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -760,6 +767,13 @@ public UnaryCallSettings.Builder<DeleteUserRequest, Empty> deleteUserSettings()
return getStubSettingsBuilder().deleteUserSettings();
}

/** Returns the builder for the settings used for calls to listDatabases. */
public PagedCallSettings.Builder<
ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
listDatabasesSettings() {
return getStubSettingsBuilder().listDatabasesSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
"ListClusters": {
"methods": ["listClusters", "listClusters", "listClusters", "listClustersPagedCallable", "listClustersCallable"]
},
"ListDatabases": {
"methods": ["listDatabases", "listDatabases", "listDatabases", "listDatabasesPagedCallable", "listDatabasesCallable"]
},
"ListInstances": {
"methods": ["listInstances", "listInstances", "listInstances", "listInstancesPagedCallable", "listInstancesCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListClustersPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListDatabasesPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListInstancesPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListLocationsPagedResponse;
import static com.google.cloud.alloydb.v1alpha.AlloyDBAdminClient.ListSupportedDatabaseFlagsPagedResponse;
Expand Down Expand Up @@ -56,6 +57,8 @@
import com.google.cloud.alloydb.v1alpha.ListBackupsResponse;
import com.google.cloud.alloydb.v1alpha.ListClustersRequest;
import com.google.cloud.alloydb.v1alpha.ListClustersResponse;
import com.google.cloud.alloydb.v1alpha.ListDatabasesRequest;
import com.google.cloud.alloydb.v1alpha.ListDatabasesResponse;
import com.google.cloud.alloydb.v1alpha.ListInstancesRequest;
import com.google.cloud.alloydb.v1alpha.ListInstancesResponse;
import com.google.cloud.alloydb.v1alpha.ListSupportedDatabaseFlagsRequest;
Expand Down Expand Up @@ -338,6 +341,15 @@ public UnaryCallable<DeleteUserRequest, Empty> deleteUserCallable() {
throw new UnsupportedOperationException("Not implemented: deleteUserCallable()");
}

public UnaryCallable<ListDatabasesRequest, ListDatabasesPagedResponse>
listDatabasesPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listDatabasesPagedCallable()");
}

public UnaryCallable<ListDatabasesRequest, ListDatabasesResponse> listDatabasesCallable() {
throw new UnsupportedOperationException("Not implemented: listDatabasesCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Loading
Loading