Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat!: Make CertificateTemplate bools optional to indicate unset values #172

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -60,6 +60,7 @@ private CertificateIdentityConstraints(
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
Expand All @@ -86,11 +87,13 @@ private CertificateIdentityConstraints(
}
case 16:
{
bitField0_ |= 0x00000001;
allowSubjectPassthrough_ = input.readBool();
break;
}
case 24:
{
bitField0_ |= 0x00000002;
allowSubjectAltNamesPassthrough_ = input.readBool();
break;
}
Expand Down Expand Up @@ -128,6 +131,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
com.google.cloud.security.privateca.v1.CertificateIdentityConstraints.Builder.class);
}

private int bitField0_;
public static final int CEL_EXPRESSION_FIELD_NUMBER = 1;
private com.google.type.Expr celExpression_;
/**
Expand Down Expand Up @@ -189,12 +193,29 @@ public com.google.type.ExprOrBuilder getCelExpressionOrBuilder() {
*
*
* <pre>
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded.
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return Whether the allowSubjectPassthrough field is set.
*/
@java.lang.Override
public boolean hasAllowSubjectPassthrough() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
*
* <pre>
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The allowSubjectPassthrough.
*/
Expand All @@ -209,12 +230,32 @@ public boolean getAllowSubjectPassthrough() {
*
*
* <pre>
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @return Whether the allowSubjectAltNamesPassthrough field is set.
*/
@java.lang.Override
public boolean hasAllowSubjectAltNamesPassthrough() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
*
* <pre>
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @return The allowSubjectAltNamesPassthrough.
Expand All @@ -241,10 +282,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (celExpression_ != null) {
output.writeMessage(1, getCelExpression());
}
if (allowSubjectPassthrough_ != false) {
if (((bitField0_ & 0x00000001) != 0)) {
output.writeBool(2, allowSubjectPassthrough_);
}
if (allowSubjectAltNamesPassthrough_ != false) {
if (((bitField0_ & 0x00000002) != 0)) {
output.writeBool(3, allowSubjectAltNamesPassthrough_);
}
unknownFields.writeTo(output);
Expand All @@ -259,10 +300,10 @@ public int getSerializedSize() {
if (celExpression_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCelExpression());
}
if (allowSubjectPassthrough_ != false) {
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, allowSubjectPassthrough_);
}
if (allowSubjectAltNamesPassthrough_ != false) {
if (((bitField0_ & 0x00000002) != 0)) {
size +=
com.google.protobuf.CodedOutputStream.computeBoolSize(
3, allowSubjectAltNamesPassthrough_);
Expand All @@ -287,9 +328,16 @@ public boolean equals(final java.lang.Object obj) {
if (hasCelExpression()) {
if (!getCelExpression().equals(other.getCelExpression())) return false;
}
if (getAllowSubjectPassthrough() != other.getAllowSubjectPassthrough()) return false;
if (getAllowSubjectAltNamesPassthrough() != other.getAllowSubjectAltNamesPassthrough())
if (hasAllowSubjectPassthrough() != other.hasAllowSubjectPassthrough()) return false;
if (hasAllowSubjectPassthrough()) {
if (getAllowSubjectPassthrough() != other.getAllowSubjectPassthrough()) return false;
}
if (hasAllowSubjectAltNamesPassthrough() != other.hasAllowSubjectAltNamesPassthrough())
return false;
if (hasAllowSubjectAltNamesPassthrough()) {
if (getAllowSubjectAltNamesPassthrough() != other.getAllowSubjectAltNamesPassthrough())
return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
Expand All @@ -305,12 +353,16 @@ public int hashCode() {
hash = (37 * hash) + CEL_EXPRESSION_FIELD_NUMBER;
hash = (53 * hash) + getCelExpression().hashCode();
}
hash = (37 * hash) + ALLOW_SUBJECT_PASSTHROUGH_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowSubjectPassthrough());
hash = (37 * hash) + ALLOW_SUBJECT_ALT_NAMES_PASSTHROUGH_FIELD_NUMBER;
hash =
(53 * hash)
+ com.google.protobuf.Internal.hashBoolean(getAllowSubjectAltNamesPassthrough());
if (hasAllowSubjectPassthrough()) {
hash = (37 * hash) + ALLOW_SUBJECT_PASSTHROUGH_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowSubjectPassthrough());
}
if (hasAllowSubjectAltNamesPassthrough()) {
hash = (37 * hash) + ALLOW_SUBJECT_ALT_NAMES_PASSTHROUGH_FIELD_NUMBER;
hash =
(53 * hash)
+ com.google.protobuf.Internal.hashBoolean(getAllowSubjectAltNamesPassthrough());
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -467,9 +519,9 @@ public Builder clear() {
celExpressionBuilder_ = null;
}
allowSubjectPassthrough_ = false;

bitField0_ = (bitField0_ & ~0x00000001);
allowSubjectAltNamesPassthrough_ = false;

bitField0_ = (bitField0_ & ~0x00000002);
return this;
}

Expand Down Expand Up @@ -499,13 +551,22 @@ public com.google.cloud.security.privateca.v1.CertificateIdentityConstraints bui
public com.google.cloud.security.privateca.v1.CertificateIdentityConstraints buildPartial() {
com.google.cloud.security.privateca.v1.CertificateIdentityConstraints result =
new com.google.cloud.security.privateca.v1.CertificateIdentityConstraints(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (celExpressionBuilder_ == null) {
result.celExpression_ = celExpression_;
} else {
result.celExpression_ = celExpressionBuilder_.build();
}
result.allowSubjectPassthrough_ = allowSubjectPassthrough_;
result.allowSubjectAltNamesPassthrough_ = allowSubjectAltNamesPassthrough_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.allowSubjectPassthrough_ = allowSubjectPassthrough_;
to_bitField0_ |= 0x00000001;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.allowSubjectAltNamesPassthrough_ = allowSubjectAltNamesPassthrough_;
to_bitField0_ |= 0x00000002;
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -562,10 +623,10 @@ public Builder mergeFrom(
if (other.hasCelExpression()) {
mergeCelExpression(other.getCelExpression());
}
if (other.getAllowSubjectPassthrough() != false) {
if (other.hasAllowSubjectPassthrough()) {
setAllowSubjectPassthrough(other.getAllowSubjectPassthrough());
}
if (other.getAllowSubjectAltNamesPassthrough() != false) {
if (other.hasAllowSubjectAltNamesPassthrough()) {
setAllowSubjectAltNamesPassthrough(other.getAllowSubjectAltNamesPassthrough());
}
this.mergeUnknownFields(other.unknownFields);
Expand Down Expand Up @@ -599,6 +660,8 @@ public Builder mergeFrom(
return this;
}

private int bitField0_;

private com.google.type.Expr celExpression_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>
Expand Down Expand Up @@ -804,12 +867,29 @@ public com.google.type.ExprOrBuilder getCelExpressionOrBuilder() {
*
*
* <pre>
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded.
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return Whether the allowSubjectPassthrough field is set.
*/
@java.lang.Override
public boolean hasAllowSubjectPassthrough() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
*
* <pre>
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The allowSubjectPassthrough.
*/
Expand All @@ -821,18 +901,18 @@ public boolean getAllowSubjectPassthrough() {
*
*
* <pre>
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded.
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The allowSubjectPassthrough to set.
* @return This builder for chaining.
*/
public Builder setAllowSubjectPassthrough(boolean value) {

bitField0_ |= 0x00000001;
allowSubjectPassthrough_ = value;
onChanged();
return this;
Expand All @@ -841,17 +921,17 @@ public Builder setAllowSubjectPassthrough(boolean value) {
*
*
* <pre>
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
* will be discarded.
* will be discarded. The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return This builder for chaining.
*/
public Builder clearAllowSubjectPassthrough() {

bitField0_ = (bitField0_ & ~0x00000001);
allowSubjectPassthrough_ = false;
onChanged();
return this;
Expand All @@ -862,12 +942,32 @@ public Builder clearAllowSubjectPassthrough() {
*
*
* <pre>
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @return Whether the allowSubjectAltNamesPassthrough field is set.
*/
@java.lang.Override
public boolean hasAllowSubjectAltNamesPassthrough() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
*
* <pre>
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @return The allowSubjectAltNamesPassthrough.
Expand All @@ -880,19 +980,20 @@ public boolean getAllowSubjectAltNamesPassthrough() {
*
*
* <pre>
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @param value The allowSubjectAltNamesPassthrough to set.
* @return This builder for chaining.
*/
public Builder setAllowSubjectAltNamesPassthrough(boolean value) {

bitField0_ |= 0x00000002;
allowSubjectAltNamesPassthrough_ = value;
onChanged();
return this;
Expand All @@ -901,18 +1002,19 @@ public Builder setAllowSubjectAltNamesPassthrough(boolean value) {
*
*
* <pre>
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
* certificate request into the signed certificate. Otherwise, the requested
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
* </pre>
*
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
* </code>
*
* @return This builder for chaining.
*/
public Builder clearAllowSubjectAltNamesPassthrough() {

bitField0_ = (bitField0_ & ~0x00000002);
allowSubjectAltNamesPassthrough_ = false;
onChanged();
return this;
Expand Down