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] Add new field in GenerateClientCertificate v1 API to allow AlloyDB connectors request client certs with metadata exchange support #10024

Merged
merged 2 commits into from
Nov 1, 2023
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
4 changes: 2 additions & 2 deletions java-alloydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.23.0</version>
<version>26.26.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down 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.13.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-alloydb/0.18.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 @@ -3872,6 +3872,7 @@ public final GenerateClientCertificateResponse generateClientCertificate(String
* .setRequestId("requestId693933066")
* .setCertDuration(Duration.newBuilder().build())
* .setPublicKey("publicKey1446899510")
* .setUseMetadataExchange(true)
* .build();
* GenerateClientCertificateResponse response =
* alloyDBAdminClient.generateClientCertificate(request);
Expand Down Expand Up @@ -3908,6 +3909,7 @@ public final GenerateClientCertificateResponse generateClientCertificate(
* .setRequestId("requestId693933066")
* .setCertDuration(Duration.newBuilder().build())
* .setPublicKey("publicKey1446899510")
* .setUseMetadataExchange(true)
* .build();
* ApiFuture<GenerateClientCertificateResponse> future =
* alloyDBAdminClient.generateClientCertificateCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ public interface NetworkConfigOrBuilder
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand All @@ -641,8 +641,8 @@ public interface NetworkConfigOrBuilder
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand Down Expand Up @@ -774,8 +774,8 @@ public com.google.protobuf.ByteString getNetworkBytes() {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand Down Expand Up @@ -803,8 +803,8 @@ public java.lang.String getAllocatedIpRange() {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand Down Expand Up @@ -1345,8 +1345,8 @@ public Builder setNetworkBytes(com.google.protobuf.ByteString value) {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand All @@ -1373,8 +1373,8 @@ public java.lang.String getAllocatedIpRange() {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand All @@ -1401,8 +1401,8 @@ public com.google.protobuf.ByteString getAllocatedIpRangeBytes() {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand All @@ -1428,8 +1428,8 @@ public Builder setAllocatedIpRange(java.lang.String value) {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand All @@ -1451,8 +1451,8 @@ public Builder clearAllocatedIpRange() {
* instance IPs for this cluster will be created in the allocated range. The
* range name must comply with RFC 1035. Specifically, the name must be 1-63
* characters long and match the regular expression
* [a-z]([-a-z0-9]*[a-z0-9])?.
* Field name is intended to be consistent with CloudSQL.
* `[a-z]([-a-z0-9]*[a-z0-9])?`.
* Field name is intended to be consistent with Cloud SQL.
* </pre>
*
* <code>string allocated_ip_range = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,26 @@ public com.google.protobuf.ByteString getPublicKeyBytes() {
}
}

public static final int USE_METADATA_EXCHANGE_FIELD_NUMBER = 6;
private boolean useMetadataExchange_ = false;
/**
*
*
* <pre>
* Optional. An optional hint to the endpoint to generate a client
* ceritificate that can be used by AlloyDB connectors to exchange additional
* metadata with the server after TLS handshake.
* </pre>
*
* <code>bool use_metadata_exchange = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useMetadataExchange.
*/
@java.lang.Override
public boolean getUseMetadataExchange() {
return useMetadataExchange_;
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -340,6 +360,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKey_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, publicKey_);
}
if (useMetadataExchange_ != false) {
output.writeBool(6, useMetadataExchange_);
}
getUnknownFields().writeTo(output);
}

Expand All @@ -361,6 +384,9 @@ public int getSerializedSize() {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKey_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, publicKey_);
}
if (useMetadataExchange_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, useMetadataExchange_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -384,6 +410,7 @@ public boolean equals(final java.lang.Object obj) {
if (!getCertDuration().equals(other.getCertDuration())) return false;
}
if (!getPublicKey().equals(other.getPublicKey())) return false;
if (getUseMetadataExchange() != other.getUseMetadataExchange()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
Expand All @@ -405,6 +432,8 @@ public int hashCode() {
}
hash = (37 * hash) + PUBLIC_KEY_FIELD_NUMBER;
hash = (53 * hash) + getPublicKey().hashCode();
hash = (37 * hash) + USE_METADATA_EXCHANGE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseMetadataExchange());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -554,6 +583,7 @@ public Builder clear() {
certDurationBuilder_ = null;
}
publicKey_ = "";
useMetadataExchange_ = false;
return this;
}

Expand Down Expand Up @@ -605,6 +635,9 @@ private void buildPartial0(
if (((from_bitField0_ & 0x00000008) != 0)) {
result.publicKey_ = publicKey_;
}
if (((from_bitField0_ & 0x00000010) != 0)) {
result.useMetadataExchange_ = useMetadataExchange_;
}
}

@java.lang.Override
Expand Down Expand Up @@ -672,6 +705,9 @@ public Builder mergeFrom(com.google.cloud.alloydb.v1.GenerateClientCertificateRe
bitField0_ |= 0x00000008;
onChanged();
}
if (other.getUseMetadataExchange() != false) {
setUseMetadataExchange(other.getUseMetadataExchange());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
Expand Down Expand Up @@ -722,6 +758,12 @@ public Builder mergeFrom(
bitField0_ |= 0x00000008;
break;
} // case 42
case 48:
{
useMetadataExchange_ = input.readBool();
bitField0_ |= 0x00000010;
break;
} // case 48
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
Expand Down Expand Up @@ -1362,6 +1404,65 @@ public Builder setPublicKeyBytes(com.google.protobuf.ByteString value) {
return this;
}

private boolean useMetadataExchange_;
/**
*
*
* <pre>
* Optional. An optional hint to the endpoint to generate a client
* ceritificate that can be used by AlloyDB connectors to exchange additional
* metadata with the server after TLS handshake.
* </pre>
*
* <code>bool use_metadata_exchange = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useMetadataExchange.
*/
@java.lang.Override
public boolean getUseMetadataExchange() {
return useMetadataExchange_;
}
/**
*
*
* <pre>
* Optional. An optional hint to the endpoint to generate a client
* ceritificate that can be used by AlloyDB connectors to exchange additional
* metadata with the server after TLS handshake.
* </pre>
*
* <code>bool use_metadata_exchange = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The useMetadataExchange to set.
* @return This builder for chaining.
*/
public Builder setUseMetadataExchange(boolean value) {

useMetadataExchange_ = value;
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. An optional hint to the endpoint to generate a client
* ceritificate that can be used by AlloyDB connectors to exchange additional
* metadata with the server after TLS handshake.
* </pre>
*
* <code>bool use_metadata_exchange = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearUseMetadataExchange() {
bitField0_ = (bitField0_ & ~0x00000010);
useMetadataExchange_ = false;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,19 @@ public interface GenerateClientCertificateRequestOrBuilder
* @return The bytes for publicKey.
*/
com.google.protobuf.ByteString getPublicKeyBytes();

/**
*
*
* <pre>
* Optional. An optional hint to the endpoint to generate a client
* ceritificate that can be used by AlloyDB connectors to exchange additional
* metadata with the server after TLS handshake.
* </pre>
*
* <code>bool use_metadata_exchange = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useMetadataExchange.
*/
boolean getUseMetadataExchange();
}
Loading
Loading