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

Commit c3fddec

Browse files
feat!: Make CertificateTemplate bools optional to indicate unset values (#172)
PiperOrigin-RevId: 372197428 Source-Link: googleapis/googleapis@ffc7779 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca23023d0bc0a50057cdfc0364be329448ab9aaa
1 parent 672fd91 commit c3fddec

5 files changed

Lines changed: 198 additions & 58 deletions

File tree

proto-google-cloud-security-private-ca-v1/src/main/java/com/google/cloud/security/privateca/v1/CertificateIdentityConstraints.java

Lines changed: 144 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ private CertificateIdentityConstraints(
6060
if (extensionRegistry == null) {
6161
throw new java.lang.NullPointerException();
6262
}
63+
int mutable_bitField0_ = 0;
6364
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
6465
com.google.protobuf.UnknownFieldSet.newBuilder();
6566
try {
@@ -86,11 +87,13 @@ private CertificateIdentityConstraints(
8687
}
8788
case 16:
8889
{
90+
bitField0_ |= 0x00000001;
8991
allowSubjectPassthrough_ = input.readBool();
9092
break;
9193
}
9294
case 24:
9395
{
96+
bitField0_ |= 0x00000002;
9497
allowSubjectAltNamesPassthrough_ = input.readBool();
9598
break;
9699
}
@@ -128,6 +131,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
128131
com.google.cloud.security.privateca.v1.CertificateIdentityConstraints.Builder.class);
129132
}
130133

134+
private int bitField0_;
131135
public static final int CEL_EXPRESSION_FIELD_NUMBER = 1;
132136
private com.google.type.Expr celExpression_;
133137
/**
@@ -189,12 +193,29 @@ public com.google.type.ExprOrBuilder getCelExpressionOrBuilder() {
189193
*
190194
*
191195
* <pre>
192-
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
196+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
193197
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
194-
* will be discarded.
198+
* 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.
195199
* </pre>
196200
*
197-
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
201+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
202+
*
203+
* @return Whether the allowSubjectPassthrough field is set.
204+
*/
205+
@java.lang.Override
206+
public boolean hasAllowSubjectPassthrough() {
207+
return ((bitField0_ & 0x00000001) != 0);
208+
}
209+
/**
210+
*
211+
*
212+
* <pre>
213+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
214+
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
215+
* 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.
216+
* </pre>
217+
*
218+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
198219
*
199220
* @return The allowSubjectPassthrough.
200221
*/
@@ -209,12 +230,32 @@ public boolean getAllowSubjectPassthrough() {
209230
*
210231
*
211232
* <pre>
212-
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
233+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
213234
* certificate request into the signed certificate. Otherwise, the requested
214235
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
236+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
215237
* </pre>
216238
*
217-
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
239+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
240+
* </code>
241+
*
242+
* @return Whether the allowSubjectAltNamesPassthrough field is set.
243+
*/
244+
@java.lang.Override
245+
public boolean hasAllowSubjectAltNamesPassthrough() {
246+
return ((bitField0_ & 0x00000002) != 0);
247+
}
248+
/**
249+
*
250+
*
251+
* <pre>
252+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
253+
* certificate request into the signed certificate. Otherwise, the requested
254+
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
255+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
256+
* </pre>
257+
*
258+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
218259
* </code>
219260
*
220261
* @return The allowSubjectAltNamesPassthrough.
@@ -241,10 +282,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
241282
if (celExpression_ != null) {
242283
output.writeMessage(1, getCelExpression());
243284
}
244-
if (allowSubjectPassthrough_ != false) {
285+
if (((bitField0_ & 0x00000001) != 0)) {
245286
output.writeBool(2, allowSubjectPassthrough_);
246287
}
247-
if (allowSubjectAltNamesPassthrough_ != false) {
288+
if (((bitField0_ & 0x00000002) != 0)) {
248289
output.writeBool(3, allowSubjectAltNamesPassthrough_);
249290
}
250291
unknownFields.writeTo(output);
@@ -259,10 +300,10 @@ public int getSerializedSize() {
259300
if (celExpression_ != null) {
260301
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCelExpression());
261302
}
262-
if (allowSubjectPassthrough_ != false) {
303+
if (((bitField0_ & 0x00000001) != 0)) {
263304
size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, allowSubjectPassthrough_);
264305
}
265-
if (allowSubjectAltNamesPassthrough_ != false) {
306+
if (((bitField0_ & 0x00000002) != 0)) {
266307
size +=
267308
com.google.protobuf.CodedOutputStream.computeBoolSize(
268309
3, allowSubjectAltNamesPassthrough_);
@@ -287,9 +328,16 @@ public boolean equals(final java.lang.Object obj) {
287328
if (hasCelExpression()) {
288329
if (!getCelExpression().equals(other.getCelExpression())) return false;
289330
}
290-
if (getAllowSubjectPassthrough() != other.getAllowSubjectPassthrough()) return false;
291-
if (getAllowSubjectAltNamesPassthrough() != other.getAllowSubjectAltNamesPassthrough())
331+
if (hasAllowSubjectPassthrough() != other.hasAllowSubjectPassthrough()) return false;
332+
if (hasAllowSubjectPassthrough()) {
333+
if (getAllowSubjectPassthrough() != other.getAllowSubjectPassthrough()) return false;
334+
}
335+
if (hasAllowSubjectAltNamesPassthrough() != other.hasAllowSubjectAltNamesPassthrough())
292336
return false;
337+
if (hasAllowSubjectAltNamesPassthrough()) {
338+
if (getAllowSubjectAltNamesPassthrough() != other.getAllowSubjectAltNamesPassthrough())
339+
return false;
340+
}
293341
if (!unknownFields.equals(other.unknownFields)) return false;
294342
return true;
295343
}
@@ -305,12 +353,16 @@ public int hashCode() {
305353
hash = (37 * hash) + CEL_EXPRESSION_FIELD_NUMBER;
306354
hash = (53 * hash) + getCelExpression().hashCode();
307355
}
308-
hash = (37 * hash) + ALLOW_SUBJECT_PASSTHROUGH_FIELD_NUMBER;
309-
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowSubjectPassthrough());
310-
hash = (37 * hash) + ALLOW_SUBJECT_ALT_NAMES_PASSTHROUGH_FIELD_NUMBER;
311-
hash =
312-
(53 * hash)
313-
+ com.google.protobuf.Internal.hashBoolean(getAllowSubjectAltNamesPassthrough());
356+
if (hasAllowSubjectPassthrough()) {
357+
hash = (37 * hash) + ALLOW_SUBJECT_PASSTHROUGH_FIELD_NUMBER;
358+
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowSubjectPassthrough());
359+
}
360+
if (hasAllowSubjectAltNamesPassthrough()) {
361+
hash = (37 * hash) + ALLOW_SUBJECT_ALT_NAMES_PASSTHROUGH_FIELD_NUMBER;
362+
hash =
363+
(53 * hash)
364+
+ com.google.protobuf.Internal.hashBoolean(getAllowSubjectAltNamesPassthrough());
365+
}
314366
hash = (29 * hash) + unknownFields.hashCode();
315367
memoizedHashCode = hash;
316368
return hash;
@@ -467,9 +519,9 @@ public Builder clear() {
467519
celExpressionBuilder_ = null;
468520
}
469521
allowSubjectPassthrough_ = false;
470-
522+
bitField0_ = (bitField0_ & ~0x00000001);
471523
allowSubjectAltNamesPassthrough_ = false;
472-
524+
bitField0_ = (bitField0_ & ~0x00000002);
473525
return this;
474526
}
475527

@@ -499,13 +551,22 @@ public com.google.cloud.security.privateca.v1.CertificateIdentityConstraints bui
499551
public com.google.cloud.security.privateca.v1.CertificateIdentityConstraints buildPartial() {
500552
com.google.cloud.security.privateca.v1.CertificateIdentityConstraints result =
501553
new com.google.cloud.security.privateca.v1.CertificateIdentityConstraints(this);
554+
int from_bitField0_ = bitField0_;
555+
int to_bitField0_ = 0;
502556
if (celExpressionBuilder_ == null) {
503557
result.celExpression_ = celExpression_;
504558
} else {
505559
result.celExpression_ = celExpressionBuilder_.build();
506560
}
507-
result.allowSubjectPassthrough_ = allowSubjectPassthrough_;
508-
result.allowSubjectAltNamesPassthrough_ = allowSubjectAltNamesPassthrough_;
561+
if (((from_bitField0_ & 0x00000001) != 0)) {
562+
result.allowSubjectPassthrough_ = allowSubjectPassthrough_;
563+
to_bitField0_ |= 0x00000001;
564+
}
565+
if (((from_bitField0_ & 0x00000002) != 0)) {
566+
result.allowSubjectAltNamesPassthrough_ = allowSubjectAltNamesPassthrough_;
567+
to_bitField0_ |= 0x00000002;
568+
}
569+
result.bitField0_ = to_bitField0_;
509570
onBuilt();
510571
return result;
511572
}
@@ -562,10 +623,10 @@ public Builder mergeFrom(
562623
if (other.hasCelExpression()) {
563624
mergeCelExpression(other.getCelExpression());
564625
}
565-
if (other.getAllowSubjectPassthrough() != false) {
626+
if (other.hasAllowSubjectPassthrough()) {
566627
setAllowSubjectPassthrough(other.getAllowSubjectPassthrough());
567628
}
568-
if (other.getAllowSubjectAltNamesPassthrough() != false) {
629+
if (other.hasAllowSubjectAltNamesPassthrough()) {
569630
setAllowSubjectAltNamesPassthrough(other.getAllowSubjectAltNamesPassthrough());
570631
}
571632
this.mergeUnknownFields(other.unknownFields);
@@ -599,6 +660,8 @@ public Builder mergeFrom(
599660
return this;
600661
}
601662

663+
private int bitField0_;
664+
602665
private com.google.type.Expr celExpression_;
603666
private com.google.protobuf.SingleFieldBuilderV3<
604667
com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>
@@ -804,12 +867,29 @@ public com.google.type.ExprOrBuilder getCelExpressionOrBuilder() {
804867
*
805868
*
806869
* <pre>
807-
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
870+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
808871
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
809-
* will be discarded.
872+
* 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.
810873
* </pre>
811874
*
812-
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
875+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
876+
*
877+
* @return Whether the allowSubjectPassthrough field is set.
878+
*/
879+
@java.lang.Override
880+
public boolean hasAllowSubjectPassthrough() {
881+
return ((bitField0_ & 0x00000001) != 0);
882+
}
883+
/**
884+
*
885+
*
886+
* <pre>
887+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
888+
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
889+
* 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.
890+
* </pre>
891+
*
892+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
813893
*
814894
* @return The allowSubjectPassthrough.
815895
*/
@@ -821,18 +901,18 @@ public boolean getAllowSubjectPassthrough() {
821901
*
822902
*
823903
* <pre>
824-
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
904+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
825905
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
826-
* will be discarded.
906+
* 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.
827907
* </pre>
828908
*
829-
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
909+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
830910
*
831911
* @param value The allowSubjectPassthrough to set.
832912
* @return This builder for chaining.
833913
*/
834914
public Builder setAllowSubjectPassthrough(boolean value) {
835-
915+
bitField0_ |= 0x00000001;
836916
allowSubjectPassthrough_ = value;
837917
onChanged();
838918
return this;
@@ -841,17 +921,17 @@ public Builder setAllowSubjectPassthrough(boolean value) {
841921
*
842922
*
843923
* <pre>
844-
* Optional. If this is set, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
924+
* Required. If this is true, the [Subject][google.cloud.security.privateca.v1.Subject] field may be copied from a certificate
845925
* request into the signed certificate. Otherwise, the requested [Subject][google.cloud.security.privateca.v1.Subject]
846-
* will be discarded.
926+
* 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.
847927
* </pre>
848928
*
849-
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
929+
* <code>bool allow_subject_passthrough = 2 [(.google.api.field_behavior) = REQUIRED];</code>
850930
*
851931
* @return This builder for chaining.
852932
*/
853933
public Builder clearAllowSubjectPassthrough() {
854-
934+
bitField0_ = (bitField0_ & ~0x00000001);
855935
allowSubjectPassthrough_ = false;
856936
onChanged();
857937
return this;
@@ -862,12 +942,32 @@ public Builder clearAllowSubjectPassthrough() {
862942
*
863943
*
864944
* <pre>
865-
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
945+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
866946
* certificate request into the signed certificate. Otherwise, the requested
867947
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
948+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
868949
* </pre>
869950
*
870-
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
951+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
952+
* </code>
953+
*
954+
* @return Whether the allowSubjectAltNamesPassthrough field is set.
955+
*/
956+
@java.lang.Override
957+
public boolean hasAllowSubjectAltNamesPassthrough() {
958+
return ((bitField0_ & 0x00000002) != 0);
959+
}
960+
/**
961+
*
962+
*
963+
* <pre>
964+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
965+
* certificate request into the signed certificate. Otherwise, the requested
966+
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
967+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
968+
* </pre>
969+
*
970+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
871971
* </code>
872972
*
873973
* @return The allowSubjectAltNamesPassthrough.
@@ -880,19 +980,20 @@ public boolean getAllowSubjectAltNamesPassthrough() {
880980
*
881981
*
882982
* <pre>
883-
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
983+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
884984
* certificate request into the signed certificate. Otherwise, the requested
885985
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
986+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
886987
* </pre>
887988
*
888-
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
989+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
889990
* </code>
890991
*
891992
* @param value The allowSubjectAltNamesPassthrough to set.
892993
* @return This builder for chaining.
893994
*/
894995
public Builder setAllowSubjectAltNamesPassthrough(boolean value) {
895-
996+
bitField0_ |= 0x00000002;
896997
allowSubjectAltNamesPassthrough_ = value;
897998
onChanged();
898999
return this;
@@ -901,18 +1002,19 @@ public Builder setAllowSubjectAltNamesPassthrough(boolean value) {
9011002
*
9021003
*
9031004
* <pre>
904-
* Optional. If this is set, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
1005+
* Required. If this is true, the [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] extension may be copied from a
9051006
* certificate request into the signed certificate. Otherwise, the requested
9061007
* [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] will be discarded.
1008+
* The bool is optional to indicate an unset field, which suggests a forgotten value that needs to be set by the caller.
9071009
* </pre>
9081010
*
909-
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = OPTIONAL];
1011+
* <code>bool allow_subject_alt_names_passthrough = 3 [(.google.api.field_behavior) = REQUIRED];
9101012
* </code>
9111013
*
9121014
* @return This builder for chaining.
9131015
*/
9141016
public Builder clearAllowSubjectAltNamesPassthrough() {
915-
1017+
bitField0_ = (bitField0_ & ~0x00000002);
9161018
allowSubjectAltNamesPassthrough_ = false;
9171019
onChanged();
9181020
return this;

0 commit comments

Comments
 (0)