Skip to content

Commit

Permalink
feat: [alloydb] Add support to generate client certificate and get co…
Browse files Browse the repository at this point in the history
…nnection info for auth proxy in AlloyDB v1 (#9903)

* feat: Add support to generate client certificate and get connection info for auth proxy in AlloyDB v1

PiperOrigin-RevId: 568860878

Source-Link: googleapis/googleapis@5601ad3

Source-Link: googleapis/googleapis-gen@a1f1322
Copy-Tag: eyJwIjoiamF2YS1hbGxveWRiLy5Pd2xCb3QueWFtbCIsImgiOiJhMWYxMzIyNjBhZjI4YTMzNmY0M2Q1YTdhNTNiZjNlNjZhNGI3NWU4In0=

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Sep 28, 2023
1 parent ad81708 commit 16f1b33
Show file tree
Hide file tree
Showing 32 changed files with 7,073 additions and 431 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3784,6 +3784,262 @@ public final ListSupportedDatabaseFlagsPagedResponse listSupportedDatabaseFlags(
return stub.listSupportedDatabaseFlagsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Generate a client certificate signed by a Cluster CA. The sole purpose of this endpoint is to
* support AlloyDB connectors and the Auth Proxy client. The endpoint's behavior is subject to
* change without notice, so do not rely on its behavior remaining constant. Future changes will
* not break AlloyDB connectors or the Auth Proxy client.
*
* <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]");
* GenerateClientCertificateResponse response =
* alloyDBAdminClient.generateClientCertificate(parent);
* }
* }</pre>
*
* @param parent Required. The name of the parent resource. The required format is: &#42;
* projects/{project}/locations/{location}/clusters/{cluster}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateClientCertificateResponse generateClientCertificate(ClusterName parent) {
GenerateClientCertificateRequest request =
GenerateClientCertificateRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return generateClientCertificate(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Generate a client certificate signed by a Cluster CA. The sole purpose of this endpoint is to
* support AlloyDB connectors and the Auth Proxy client. The endpoint's behavior is subject to
* change without notice, so do not rely on its behavior remaining constant. Future changes will
* not break AlloyDB connectors or the Auth Proxy client.
*
* <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();
* GenerateClientCertificateResponse response =
* alloyDBAdminClient.generateClientCertificate(parent);
* }
* }</pre>
*
* @param parent Required. The name of the parent resource. The required format is: &#42;
* projects/{project}/locations/{location}/clusters/{cluster}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GenerateClientCertificateResponse generateClientCertificate(String parent) {
GenerateClientCertificateRequest request =
GenerateClientCertificateRequest.newBuilder().setParent(parent).build();
return generateClientCertificate(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Generate a client certificate signed by a Cluster CA. The sole purpose of this endpoint is to
* support AlloyDB connectors and the Auth Proxy client. The endpoint's behavior is subject to
* change without notice, so do not rely on its behavior remaining constant. Future changes will
* not break AlloyDB connectors or the Auth Proxy client.
*
* <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()) {
* GenerateClientCertificateRequest request =
* GenerateClientCertificateRequest.newBuilder()
* .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
* .setRequestId("requestId693933066")
* .setCertDuration(Duration.newBuilder().build())
* .setPublicKey("publicKey1446899510")
* .build();
* GenerateClientCertificateResponse response =
* alloyDBAdminClient.generateClientCertificate(request);
* }
* }</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 GenerateClientCertificateResponse generateClientCertificate(
GenerateClientCertificateRequest request) {
return generateClientCertificateCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Generate a client certificate signed by a Cluster CA. The sole purpose of this endpoint is to
* support AlloyDB connectors and the Auth Proxy client. The endpoint's behavior is subject to
* change without notice, so do not rely on its behavior remaining constant. Future changes will
* not break AlloyDB connectors or the Auth Proxy client.
*
* <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()) {
* GenerateClientCertificateRequest request =
* GenerateClientCertificateRequest.newBuilder()
* .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
* .setRequestId("requestId693933066")
* .setCertDuration(Duration.newBuilder().build())
* .setPublicKey("publicKey1446899510")
* .build();
* ApiFuture<GenerateClientCertificateResponse> future =
* alloyDBAdminClient.generateClientCertificateCallable().futureCall(request);
* // Do something.
* GenerateClientCertificateResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GenerateClientCertificateRequest, GenerateClientCertificateResponse>
generateClientCertificateCallable() {
return stub.generateClientCertificateCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get instance metadata used for a connection.
*
* <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()) {
* InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]");
* ConnectionInfo response = alloyDBAdminClient.getConnectionInfo(parent);
* }
* }</pre>
*
* @param parent Required. The name of the parent resource. The required format is:
* projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ConnectionInfo getConnectionInfo(InstanceName parent) {
GetConnectionInfoRequest request =
GetConnectionInfoRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return getConnectionInfo(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get instance metadata used for a connection.
*
* <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 =
* InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString();
* ConnectionInfo response = alloyDBAdminClient.getConnectionInfo(parent);
* }
* }</pre>
*
* @param parent Required. The name of the parent resource. The required format is:
* projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ConnectionInfo getConnectionInfo(String parent) {
GetConnectionInfoRequest request =
GetConnectionInfoRequest.newBuilder().setParent(parent).build();
return getConnectionInfo(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get instance metadata used for a connection.
*
* <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()) {
* GetConnectionInfoRequest request =
* GetConnectionInfoRequest.newBuilder()
* .setParent(
* InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString())
* .setRequestId("requestId693933066")
* .build();
* ConnectionInfo response = alloyDBAdminClient.getConnectionInfo(request);
* }
* }</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 ConnectionInfo getConnectionInfo(GetConnectionInfoRequest request) {
return getConnectionInfoCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get instance metadata used for a connection.
*
* <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()) {
* GetConnectionInfoRequest request =
* GetConnectionInfoRequest.newBuilder()
* .setParent(
* InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString())
* .setRequestId("requestId693933066")
* .build();
* ApiFuture<ConnectionInfo> future =
* alloyDBAdminClient.getConnectionInfoCallable().futureCall(request);
* // Do something.
* ConnectionInfo response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetConnectionInfoRequest, ConnectionInfo> getConnectionInfoCallable() {
return stub.getConnectionInfoCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Users in a given project and location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@ public UnaryCallSettings<DeleteBackupRequest, Operation> deleteBackupSettings()
return ((AlloyDBAdminStubSettings) getStubSettings()).listSupportedDatabaseFlagsSettings();
}

/** Returns the object with the settings used for calls to generateClientCertificate. */
public UnaryCallSettings<GenerateClientCertificateRequest, GenerateClientCertificateResponse>
generateClientCertificateSettings() {
return ((AlloyDBAdminStubSettings) getStubSettings()).generateClientCertificateSettings();
}

/** Returns the object with the settings used for calls to getConnectionInfo. */
public UnaryCallSettings<GetConnectionInfoRequest, ConnectionInfo> getConnectionInfoSettings() {
return ((AlloyDBAdminStubSettings) getStubSettings()).getConnectionInfoSettings();
}

/** Returns the object with the settings used for calls to listUsers. */
public PagedCallSettings<ListUsersRequest, ListUsersResponse, ListUsersPagedResponse>
listUsersSettings() {
Expand Down Expand Up @@ -709,6 +720,19 @@ public UnaryCallSettings.Builder<DeleteBackupRequest, Operation> deleteBackupSet
return getStubSettingsBuilder().listSupportedDatabaseFlagsSettings();
}

/** Returns the builder for the settings used for calls to generateClientCertificate. */
public UnaryCallSettings.Builder<
GenerateClientCertificateRequest, GenerateClientCertificateResponse>
generateClientCertificateSettings() {
return getStubSettingsBuilder().generateClientCertificateSettings();
}

/** Returns the builder for the settings used for calls to getConnectionInfo. */
public UnaryCallSettings.Builder<GetConnectionInfoRequest, ConnectionInfo>
getConnectionInfoSettings() {
return getStubSettingsBuilder().getConnectionInfoSettings();
}

/** Returns the builder for the settings used for calls to listUsers. */
public PagedCallSettings.Builder<ListUsersRequest, ListUsersResponse, ListUsersPagedResponse>
listUsersSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@
"FailoverInstance": {
"methods": ["failoverInstanceAsync", "failoverInstanceAsync", "failoverInstanceAsync", "failoverInstanceOperationCallable", "failoverInstanceCallable"]
},
"GenerateClientCertificate": {
"methods": ["generateClientCertificate", "generateClientCertificate", "generateClientCertificate", "generateClientCertificateCallable"]
},
"GetBackup": {
"methods": ["getBackup", "getBackup", "getBackup", "getBackupCallable"]
},
"GetCluster": {
"methods": ["getCluster", "getCluster", "getCluster", "getClusterCallable"]
},
"GetConnectionInfo": {
"methods": ["getConnectionInfo", "getConnectionInfo", "getConnectionInfo", "getConnectionInfoCallable"]
},
"GetInstance": {
"methods": ["getInstance", "getInstance", "getInstance", "getInstanceCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.cloud.alloydb.v1.BatchCreateInstancesRequest;
import com.google.cloud.alloydb.v1.BatchCreateInstancesResponse;
import com.google.cloud.alloydb.v1.Cluster;
import com.google.cloud.alloydb.v1.ConnectionInfo;
import com.google.cloud.alloydb.v1.CreateBackupRequest;
import com.google.cloud.alloydb.v1.CreateClusterRequest;
import com.google.cloud.alloydb.v1.CreateInstanceRequest;
Expand All @@ -41,8 +42,11 @@
import com.google.cloud.alloydb.v1.DeleteInstanceRequest;
import com.google.cloud.alloydb.v1.DeleteUserRequest;
import com.google.cloud.alloydb.v1.FailoverInstanceRequest;
import com.google.cloud.alloydb.v1.GenerateClientCertificateRequest;
import com.google.cloud.alloydb.v1.GenerateClientCertificateResponse;
import com.google.cloud.alloydb.v1.GetBackupRequest;
import com.google.cloud.alloydb.v1.GetClusterRequest;
import com.google.cloud.alloydb.v1.GetConnectionInfoRequest;
import com.google.cloud.alloydb.v1.GetInstanceRequest;
import com.google.cloud.alloydb.v1.GetUserRequest;
import com.google.cloud.alloydb.v1.InjectFaultRequest;
Expand Down Expand Up @@ -299,6 +303,15 @@ public UnaryCallable<DeleteBackupRequest, Operation> deleteBackupCallable() {
"Not implemented: listSupportedDatabaseFlagsCallable()");
}

public UnaryCallable<GenerateClientCertificateRequest, GenerateClientCertificateResponse>
generateClientCertificateCallable() {
throw new UnsupportedOperationException("Not implemented: generateClientCertificateCallable()");
}

public UnaryCallable<GetConnectionInfoRequest, ConnectionInfo> getConnectionInfoCallable() {
throw new UnsupportedOperationException("Not implemented: getConnectionInfoCallable()");
}

public UnaryCallable<ListUsersRequest, ListUsersPagedResponse> listUsersPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listUsersPagedCallable()");
}
Expand Down
Loading

0 comments on commit 16f1b33

Please sign in to comment.