• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/orgpolicy/v2/orgpolicy.proto
18 
19 package com.google.cloud.orgpolicy.v2;
20 
21 /**
22  *
23  *
24  * <pre>
25  * Defines a Cloud Organization `PolicySpec` which is used to specify
26  * `Constraints` for configurations of Cloud Platform resources.
27  * </pre>
28  *
29  * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec}
30  */
31 public final class PolicySpec extends com.google.protobuf.GeneratedMessageV3
32     implements
33     // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v2.PolicySpec)
34     PolicySpecOrBuilder {
35   private static final long serialVersionUID = 0L;
36   // Use PolicySpec.newBuilder() to construct.
PolicySpec(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)37   private PolicySpec(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
38     super(builder);
39   }
40 
PolicySpec()41   private PolicySpec() {
42     etag_ = "";
43     rules_ = java.util.Collections.emptyList();
44   }
45 
46   @java.lang.Override
47   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)48   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
49     return new PolicySpec();
50   }
51 
52   @java.lang.Override
getUnknownFields()53   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
54     return this.unknownFields;
55   }
56 
getDescriptor()57   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
58     return com.google.cloud.orgpolicy.v2.OrgPolicyProto
59         .internal_static_google_cloud_orgpolicy_v2_PolicySpec_descriptor;
60   }
61 
62   @java.lang.Override
63   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()64       internalGetFieldAccessorTable() {
65     return com.google.cloud.orgpolicy.v2.OrgPolicyProto
66         .internal_static_google_cloud_orgpolicy_v2_PolicySpec_fieldAccessorTable
67         .ensureFieldAccessorsInitialized(
68             com.google.cloud.orgpolicy.v2.PolicySpec.class,
69             com.google.cloud.orgpolicy.v2.PolicySpec.Builder.class);
70   }
71 
72   public interface PolicyRuleOrBuilder
73       extends
74       // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)
75       com.google.protobuf.MessageOrBuilder {
76 
77     /**
78      *
79      *
80      * <pre>
81      * List of values to be used for this PolicyRule. This field can be set
82      * only in Policies for list constraints.
83      * </pre>
84      *
85      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
86      *
87      * @return Whether the values field is set.
88      */
hasValues()89     boolean hasValues();
90     /**
91      *
92      *
93      * <pre>
94      * List of values to be used for this PolicyRule. This field can be set
95      * only in Policies for list constraints.
96      * </pre>
97      *
98      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
99      *
100      * @return The values.
101      */
getValues()102     com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues getValues();
103     /**
104      *
105      *
106      * <pre>
107      * List of values to be used for this PolicyRule. This field can be set
108      * only in Policies for list constraints.
109      * </pre>
110      *
111      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
112      */
getValuesOrBuilder()113     com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder getValuesOrBuilder();
114 
115     /**
116      *
117      *
118      * <pre>
119      * Setting this to true means that all values are allowed. This field can
120      * be set only in Policies for list constraints.
121      * </pre>
122      *
123      * <code>bool allow_all = 2;</code>
124      *
125      * @return Whether the allowAll field is set.
126      */
hasAllowAll()127     boolean hasAllowAll();
128     /**
129      *
130      *
131      * <pre>
132      * Setting this to true means that all values are allowed. This field can
133      * be set only in Policies for list constraints.
134      * </pre>
135      *
136      * <code>bool allow_all = 2;</code>
137      *
138      * @return The allowAll.
139      */
getAllowAll()140     boolean getAllowAll();
141 
142     /**
143      *
144      *
145      * <pre>
146      * Setting this to true means that all values are denied. This field can
147      * be set only in Policies for list constraints.
148      * </pre>
149      *
150      * <code>bool deny_all = 3;</code>
151      *
152      * @return Whether the denyAll field is set.
153      */
hasDenyAll()154     boolean hasDenyAll();
155     /**
156      *
157      *
158      * <pre>
159      * Setting this to true means that all values are denied. This field can
160      * be set only in Policies for list constraints.
161      * </pre>
162      *
163      * <code>bool deny_all = 3;</code>
164      *
165      * @return The denyAll.
166      */
getDenyAll()167     boolean getDenyAll();
168 
169     /**
170      *
171      *
172      * <pre>
173      * If `true`, then the `Policy` is enforced. If `false`, then any
174      * configuration is acceptable.
175      * This field can be set only in Policies for boolean constraints.
176      * </pre>
177      *
178      * <code>bool enforce = 4;</code>
179      *
180      * @return Whether the enforce field is set.
181      */
hasEnforce()182     boolean hasEnforce();
183     /**
184      *
185      *
186      * <pre>
187      * If `true`, then the `Policy` is enforced. If `false`, then any
188      * configuration is acceptable.
189      * This field can be set only in Policies for boolean constraints.
190      * </pre>
191      *
192      * <code>bool enforce = 4;</code>
193      *
194      * @return The enforce.
195      */
getEnforce()196     boolean getEnforce();
197 
198     /**
199      *
200      *
201      * <pre>
202      * A condition which determines whether this rule is used
203      * in the evaluation of the policy. When set, the `expression` field in
204      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
205      * or "&amp;&amp;" operators. Each subexpression must be of the form
206      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
207      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
208      * 'tagValues/value_id')". where key_name and value_name are the resource
209      * names for Label Keys and Values. These names are available from the Tag
210      * Manager Service. An example expression is:
211      * "resource.matchTag('123456789/environment,
212      * 'prod')". or "resource.matchTagId('tagKeys/123',
213      * 'tagValues/456')".
214      * </pre>
215      *
216      * <code>.google.type.Expr condition = 5;</code>
217      *
218      * @return Whether the condition field is set.
219      */
hasCondition()220     boolean hasCondition();
221     /**
222      *
223      *
224      * <pre>
225      * A condition which determines whether this rule is used
226      * in the evaluation of the policy. When set, the `expression` field in
227      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
228      * or "&amp;&amp;" operators. Each subexpression must be of the form
229      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
230      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
231      * 'tagValues/value_id')". where key_name and value_name are the resource
232      * names for Label Keys and Values. These names are available from the Tag
233      * Manager Service. An example expression is:
234      * "resource.matchTag('123456789/environment,
235      * 'prod')". or "resource.matchTagId('tagKeys/123',
236      * 'tagValues/456')".
237      * </pre>
238      *
239      * <code>.google.type.Expr condition = 5;</code>
240      *
241      * @return The condition.
242      */
getCondition()243     com.google.type.Expr getCondition();
244     /**
245      *
246      *
247      * <pre>
248      * A condition which determines whether this rule is used
249      * in the evaluation of the policy. When set, the `expression` field in
250      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
251      * or "&amp;&amp;" operators. Each subexpression must be of the form
252      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
253      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
254      * 'tagValues/value_id')". where key_name and value_name are the resource
255      * names for Label Keys and Values. These names are available from the Tag
256      * Manager Service. An example expression is:
257      * "resource.matchTag('123456789/environment,
258      * 'prod')". or "resource.matchTagId('tagKeys/123',
259      * 'tagValues/456')".
260      * </pre>
261      *
262      * <code>.google.type.Expr condition = 5;</code>
263      */
getConditionOrBuilder()264     com.google.type.ExprOrBuilder getConditionOrBuilder();
265 
getKindCase()266     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.KindCase getKindCase();
267   }
268   /**
269    *
270    *
271    * <pre>
272    * A rule used to express this policy.
273    * </pre>
274    *
275    * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec.PolicyRule}
276    */
277   public static final class PolicyRule extends com.google.protobuf.GeneratedMessageV3
278       implements
279       // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)
280       PolicyRuleOrBuilder {
281     private static final long serialVersionUID = 0L;
282     // Use PolicyRule.newBuilder() to construct.
PolicyRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)283     private PolicyRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
284       super(builder);
285     }
286 
PolicyRule()287     private PolicyRule() {}
288 
289     @java.lang.Override
290     @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)291     protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
292       return new PolicyRule();
293     }
294 
295     @java.lang.Override
getUnknownFields()296     public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
297       return this.unknownFields;
298     }
299 
getDescriptor()300     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
301       return com.google.cloud.orgpolicy.v2.OrgPolicyProto
302           .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_descriptor;
303     }
304 
305     @java.lang.Override
306     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()307         internalGetFieldAccessorTable() {
308       return com.google.cloud.orgpolicy.v2.OrgPolicyProto
309           .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_fieldAccessorTable
310           .ensureFieldAccessorsInitialized(
311               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.class,
312               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder.class);
313     }
314 
315     public interface StringValuesOrBuilder
316         extends
317         // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)
318         com.google.protobuf.MessageOrBuilder {
319 
320       /**
321        *
322        *
323        * <pre>
324        * List of values allowed at this resource.
325        * </pre>
326        *
327        * <code>repeated string allowed_values = 1;</code>
328        *
329        * @return A list containing the allowedValues.
330        */
getAllowedValuesList()331       java.util.List<java.lang.String> getAllowedValuesList();
332       /**
333        *
334        *
335        * <pre>
336        * List of values allowed at this resource.
337        * </pre>
338        *
339        * <code>repeated string allowed_values = 1;</code>
340        *
341        * @return The count of allowedValues.
342        */
getAllowedValuesCount()343       int getAllowedValuesCount();
344       /**
345        *
346        *
347        * <pre>
348        * List of values allowed at this resource.
349        * </pre>
350        *
351        * <code>repeated string allowed_values = 1;</code>
352        *
353        * @param index The index of the element to return.
354        * @return The allowedValues at the given index.
355        */
getAllowedValues(int index)356       java.lang.String getAllowedValues(int index);
357       /**
358        *
359        *
360        * <pre>
361        * List of values allowed at this resource.
362        * </pre>
363        *
364        * <code>repeated string allowed_values = 1;</code>
365        *
366        * @param index The index of the value to return.
367        * @return The bytes of the allowedValues at the given index.
368        */
getAllowedValuesBytes(int index)369       com.google.protobuf.ByteString getAllowedValuesBytes(int index);
370 
371       /**
372        *
373        *
374        * <pre>
375        * List of values denied at this resource.
376        * </pre>
377        *
378        * <code>repeated string denied_values = 2;</code>
379        *
380        * @return A list containing the deniedValues.
381        */
getDeniedValuesList()382       java.util.List<java.lang.String> getDeniedValuesList();
383       /**
384        *
385        *
386        * <pre>
387        * List of values denied at this resource.
388        * </pre>
389        *
390        * <code>repeated string denied_values = 2;</code>
391        *
392        * @return The count of deniedValues.
393        */
getDeniedValuesCount()394       int getDeniedValuesCount();
395       /**
396        *
397        *
398        * <pre>
399        * List of values denied at this resource.
400        * </pre>
401        *
402        * <code>repeated string denied_values = 2;</code>
403        *
404        * @param index The index of the element to return.
405        * @return The deniedValues at the given index.
406        */
getDeniedValues(int index)407       java.lang.String getDeniedValues(int index);
408       /**
409        *
410        *
411        * <pre>
412        * List of values denied at this resource.
413        * </pre>
414        *
415        * <code>repeated string denied_values = 2;</code>
416        *
417        * @param index The index of the value to return.
418        * @return The bytes of the deniedValues at the given index.
419        */
getDeniedValuesBytes(int index)420       com.google.protobuf.ByteString getDeniedValuesBytes(int index);
421     }
422     /**
423      *
424      *
425      * <pre>
426      * A message that holds specific allowed and denied values.
427      * This message can define specific values and subtrees of Cloud Resource
428      * Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
429      * are allowed or denied. This is achieved by using the `under:` and
430      * optional `is:` prefixes.
431      * The `under:` prefix is used to denote resource subtree values.
432      * The `is:` prefix is used to denote specific values, and is required only
433      * if the value contains a ":". Values prefixed with "is:" are treated the
434      * same as values with no prefix.
435      * Ancestry subtrees must be in one of the following formats:
436      *     - "projects/&lt;project-id&gt;", e.g. "projects/tokyo-rain-123"
437      *     - "folders/&lt;folder-id&gt;", e.g. "folders/1234"
438      *     - "organizations/&lt;organization-id&gt;", e.g. "organizations/1234"
439      * The `supports_under` field of the associated `Constraint`  defines
440      * whether ancestry prefixes can be used.
441      * </pre>
442      *
443      * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues}
444      */
445     public static final class StringValues extends com.google.protobuf.GeneratedMessageV3
446         implements
447         // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)
448         StringValuesOrBuilder {
449       private static final long serialVersionUID = 0L;
450       // Use StringValues.newBuilder() to construct.
StringValues(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)451       private StringValues(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
452         super(builder);
453       }
454 
StringValues()455       private StringValues() {
456         allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
457         deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
458       }
459 
460       @java.lang.Override
461       @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)462       protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
463         return new StringValues();
464       }
465 
466       @java.lang.Override
getUnknownFields()467       public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
468         return this.unknownFields;
469       }
470 
getDescriptor()471       public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
472         return com.google.cloud.orgpolicy.v2.OrgPolicyProto
473             .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_StringValues_descriptor;
474       }
475 
476       @java.lang.Override
477       protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()478           internalGetFieldAccessorTable() {
479         return com.google.cloud.orgpolicy.v2.OrgPolicyProto
480             .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_StringValues_fieldAccessorTable
481             .ensureFieldAccessorsInitialized(
482                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.class,
483                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder.class);
484       }
485 
486       public static final int ALLOWED_VALUES_FIELD_NUMBER = 1;
487 
488       @SuppressWarnings("serial")
489       private com.google.protobuf.LazyStringList allowedValues_;
490       /**
491        *
492        *
493        * <pre>
494        * List of values allowed at this resource.
495        * </pre>
496        *
497        * <code>repeated string allowed_values = 1;</code>
498        *
499        * @return A list containing the allowedValues.
500        */
getAllowedValuesList()501       public com.google.protobuf.ProtocolStringList getAllowedValuesList() {
502         return allowedValues_;
503       }
504       /**
505        *
506        *
507        * <pre>
508        * List of values allowed at this resource.
509        * </pre>
510        *
511        * <code>repeated string allowed_values = 1;</code>
512        *
513        * @return The count of allowedValues.
514        */
getAllowedValuesCount()515       public int getAllowedValuesCount() {
516         return allowedValues_.size();
517       }
518       /**
519        *
520        *
521        * <pre>
522        * List of values allowed at this resource.
523        * </pre>
524        *
525        * <code>repeated string allowed_values = 1;</code>
526        *
527        * @param index The index of the element to return.
528        * @return The allowedValues at the given index.
529        */
getAllowedValues(int index)530       public java.lang.String getAllowedValues(int index) {
531         return allowedValues_.get(index);
532       }
533       /**
534        *
535        *
536        * <pre>
537        * List of values allowed at this resource.
538        * </pre>
539        *
540        * <code>repeated string allowed_values = 1;</code>
541        *
542        * @param index The index of the value to return.
543        * @return The bytes of the allowedValues at the given index.
544        */
getAllowedValuesBytes(int index)545       public com.google.protobuf.ByteString getAllowedValuesBytes(int index) {
546         return allowedValues_.getByteString(index);
547       }
548 
549       public static final int DENIED_VALUES_FIELD_NUMBER = 2;
550 
551       @SuppressWarnings("serial")
552       private com.google.protobuf.LazyStringList deniedValues_;
553       /**
554        *
555        *
556        * <pre>
557        * List of values denied at this resource.
558        * </pre>
559        *
560        * <code>repeated string denied_values = 2;</code>
561        *
562        * @return A list containing the deniedValues.
563        */
getDeniedValuesList()564       public com.google.protobuf.ProtocolStringList getDeniedValuesList() {
565         return deniedValues_;
566       }
567       /**
568        *
569        *
570        * <pre>
571        * List of values denied at this resource.
572        * </pre>
573        *
574        * <code>repeated string denied_values = 2;</code>
575        *
576        * @return The count of deniedValues.
577        */
getDeniedValuesCount()578       public int getDeniedValuesCount() {
579         return deniedValues_.size();
580       }
581       /**
582        *
583        *
584        * <pre>
585        * List of values denied at this resource.
586        * </pre>
587        *
588        * <code>repeated string denied_values = 2;</code>
589        *
590        * @param index The index of the element to return.
591        * @return The deniedValues at the given index.
592        */
getDeniedValues(int index)593       public java.lang.String getDeniedValues(int index) {
594         return deniedValues_.get(index);
595       }
596       /**
597        *
598        *
599        * <pre>
600        * List of values denied at this resource.
601        * </pre>
602        *
603        * <code>repeated string denied_values = 2;</code>
604        *
605        * @param index The index of the value to return.
606        * @return The bytes of the deniedValues at the given index.
607        */
getDeniedValuesBytes(int index)608       public com.google.protobuf.ByteString getDeniedValuesBytes(int index) {
609         return deniedValues_.getByteString(index);
610       }
611 
612       private byte memoizedIsInitialized = -1;
613 
614       @java.lang.Override
isInitialized()615       public final boolean isInitialized() {
616         byte isInitialized = memoizedIsInitialized;
617         if (isInitialized == 1) return true;
618         if (isInitialized == 0) return false;
619 
620         memoizedIsInitialized = 1;
621         return true;
622       }
623 
624       @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)625       public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
626         for (int i = 0; i < allowedValues_.size(); i++) {
627           com.google.protobuf.GeneratedMessageV3.writeString(output, 1, allowedValues_.getRaw(i));
628         }
629         for (int i = 0; i < deniedValues_.size(); i++) {
630           com.google.protobuf.GeneratedMessageV3.writeString(output, 2, deniedValues_.getRaw(i));
631         }
632         getUnknownFields().writeTo(output);
633       }
634 
635       @java.lang.Override
getSerializedSize()636       public int getSerializedSize() {
637         int size = memoizedSize;
638         if (size != -1) return size;
639 
640         size = 0;
641         {
642           int dataSize = 0;
643           for (int i = 0; i < allowedValues_.size(); i++) {
644             dataSize += computeStringSizeNoTag(allowedValues_.getRaw(i));
645           }
646           size += dataSize;
647           size += 1 * getAllowedValuesList().size();
648         }
649         {
650           int dataSize = 0;
651           for (int i = 0; i < deniedValues_.size(); i++) {
652             dataSize += computeStringSizeNoTag(deniedValues_.getRaw(i));
653           }
654           size += dataSize;
655           size += 1 * getDeniedValuesList().size();
656         }
657         size += getUnknownFields().getSerializedSize();
658         memoizedSize = size;
659         return size;
660       }
661 
662       @java.lang.Override
equals(final java.lang.Object obj)663       public boolean equals(final java.lang.Object obj) {
664         if (obj == this) {
665           return true;
666         }
667         if (!(obj instanceof com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)) {
668           return super.equals(obj);
669         }
670         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues other =
671             (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) obj;
672 
673         if (!getAllowedValuesList().equals(other.getAllowedValuesList())) return false;
674         if (!getDeniedValuesList().equals(other.getDeniedValuesList())) return false;
675         if (!getUnknownFields().equals(other.getUnknownFields())) return false;
676         return true;
677       }
678 
679       @java.lang.Override
hashCode()680       public int hashCode() {
681         if (memoizedHashCode != 0) {
682           return memoizedHashCode;
683         }
684         int hash = 41;
685         hash = (19 * hash) + getDescriptor().hashCode();
686         if (getAllowedValuesCount() > 0) {
687           hash = (37 * hash) + ALLOWED_VALUES_FIELD_NUMBER;
688           hash = (53 * hash) + getAllowedValuesList().hashCode();
689         }
690         if (getDeniedValuesCount() > 0) {
691           hash = (37 * hash) + DENIED_VALUES_FIELD_NUMBER;
692           hash = (53 * hash) + getDeniedValuesList().hashCode();
693         }
694         hash = (29 * hash) + getUnknownFields().hashCode();
695         memoizedHashCode = hash;
696         return hash;
697       }
698 
parseFrom( java.nio.ByteBuffer data)699       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
700           java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
701         return PARSER.parseFrom(data);
702       }
703 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)704       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
705           java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
706           throws com.google.protobuf.InvalidProtocolBufferException {
707         return PARSER.parseFrom(data, extensionRegistry);
708       }
709 
parseFrom( com.google.protobuf.ByteString data)710       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
711           com.google.protobuf.ByteString data)
712           throws com.google.protobuf.InvalidProtocolBufferException {
713         return PARSER.parseFrom(data);
714       }
715 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)716       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
717           com.google.protobuf.ByteString data,
718           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
719           throws com.google.protobuf.InvalidProtocolBufferException {
720         return PARSER.parseFrom(data, extensionRegistry);
721       }
722 
parseFrom( byte[] data)723       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
724           byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
725         return PARSER.parseFrom(data);
726       }
727 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)728       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
729           byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
730           throws com.google.protobuf.InvalidProtocolBufferException {
731         return PARSER.parseFrom(data, extensionRegistry);
732       }
733 
parseFrom( java.io.InputStream input)734       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
735           java.io.InputStream input) throws java.io.IOException {
736         return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
737       }
738 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)739       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
740           java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
741           throws java.io.IOException {
742         return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
743             PARSER, input, extensionRegistry);
744       }
745 
746       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
parseDelimitedFrom(java.io.InputStream input)747           parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
748         return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
749       }
750 
751       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)752           parseDelimitedFrom(
753               java.io.InputStream input,
754               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
755               throws java.io.IOException {
756         return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
757             PARSER, input, extensionRegistry);
758       }
759 
parseFrom( com.google.protobuf.CodedInputStream input)760       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
761           com.google.protobuf.CodedInputStream input) throws java.io.IOException {
762         return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
763       }
764 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)765       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues parseFrom(
766           com.google.protobuf.CodedInputStream input,
767           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
768           throws java.io.IOException {
769         return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
770             PARSER, input, extensionRegistry);
771       }
772 
773       @java.lang.Override
newBuilderForType()774       public Builder newBuilderForType() {
775         return newBuilder();
776       }
777 
newBuilder()778       public static Builder newBuilder() {
779         return DEFAULT_INSTANCE.toBuilder();
780       }
781 
newBuilder( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues prototype)782       public static Builder newBuilder(
783           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues prototype) {
784         return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
785       }
786 
787       @java.lang.Override
toBuilder()788       public Builder toBuilder() {
789         return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
790       }
791 
792       @java.lang.Override
newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent)793       protected Builder newBuilderForType(
794           com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
795         Builder builder = new Builder(parent);
796         return builder;
797       }
798       /**
799        *
800        *
801        * <pre>
802        * A message that holds specific allowed and denied values.
803        * This message can define specific values and subtrees of Cloud Resource
804        * Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
805        * are allowed or denied. This is achieved by using the `under:` and
806        * optional `is:` prefixes.
807        * The `under:` prefix is used to denote resource subtree values.
808        * The `is:` prefix is used to denote specific values, and is required only
809        * if the value contains a ":". Values prefixed with "is:" are treated the
810        * same as values with no prefix.
811        * Ancestry subtrees must be in one of the following formats:
812        *     - "projects/&lt;project-id&gt;", e.g. "projects/tokyo-rain-123"
813        *     - "folders/&lt;folder-id&gt;", e.g. "folders/1234"
814        *     - "organizations/&lt;organization-id&gt;", e.g. "organizations/1234"
815        * The `supports_under` field of the associated `Constraint`  defines
816        * whether ancestry prefixes can be used.
817        * </pre>
818        *
819        * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues}
820        */
821       public static final class Builder
822           extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
823           implements
824           // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)
825           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder {
getDescriptor()826         public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
827           return com.google.cloud.orgpolicy.v2.OrgPolicyProto
828               .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_StringValues_descriptor;
829         }
830 
831         @java.lang.Override
832         protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()833             internalGetFieldAccessorTable() {
834           return com.google.cloud.orgpolicy.v2.OrgPolicyProto
835               .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_StringValues_fieldAccessorTable
836               .ensureFieldAccessorsInitialized(
837                   com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.class,
838                   com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder.class);
839         }
840 
841         // Construct using
842         // com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.newBuilder()
Builder()843         private Builder() {}
844 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)845         private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
846           super(parent);
847         }
848 
849         @java.lang.Override
clear()850         public Builder clear() {
851           super.clear();
852           bitField0_ = 0;
853           allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
854           bitField0_ = (bitField0_ & ~0x00000001);
855           deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
856           bitField0_ = (bitField0_ & ~0x00000002);
857           return this;
858         }
859 
860         @java.lang.Override
getDescriptorForType()861         public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
862           return com.google.cloud.orgpolicy.v2.OrgPolicyProto
863               .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_StringValues_descriptor;
864         }
865 
866         @java.lang.Override
867         public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
getDefaultInstanceForType()868             getDefaultInstanceForType() {
869           return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
870               .getDefaultInstance();
871         }
872 
873         @java.lang.Override
build()874         public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues build() {
875           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result = buildPartial();
876           if (!result.isInitialized()) {
877             throw newUninitializedMessageException(result);
878           }
879           return result;
880         }
881 
882         @java.lang.Override
buildPartial()883         public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues buildPartial() {
884           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result =
885               new com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues(this);
886           buildPartialRepeatedFields(result);
887           if (bitField0_ != 0) {
888             buildPartial0(result);
889           }
890           onBuilt();
891           return result;
892         }
893 
buildPartialRepeatedFields( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result)894         private void buildPartialRepeatedFields(
895             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result) {
896           if (((bitField0_ & 0x00000001) != 0)) {
897             allowedValues_ = allowedValues_.getUnmodifiableView();
898             bitField0_ = (bitField0_ & ~0x00000001);
899           }
900           result.allowedValues_ = allowedValues_;
901           if (((bitField0_ & 0x00000002) != 0)) {
902             deniedValues_ = deniedValues_.getUnmodifiableView();
903             bitField0_ = (bitField0_ & ~0x00000002);
904           }
905           result.deniedValues_ = deniedValues_;
906         }
907 
buildPartial0( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result)908         private void buildPartial0(
909             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues result) {
910           int from_bitField0_ = bitField0_;
911         }
912 
913         @java.lang.Override
clone()914         public Builder clone() {
915           return super.clone();
916         }
917 
918         @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)919         public Builder setField(
920             com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
921           return super.setField(field, value);
922         }
923 
924         @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)925         public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
926           return super.clearField(field);
927         }
928 
929         @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)930         public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
931           return super.clearOneof(oneof);
932         }
933 
934         @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)935         public Builder setRepeatedField(
936             com.google.protobuf.Descriptors.FieldDescriptor field,
937             int index,
938             java.lang.Object value) {
939           return super.setRepeatedField(field, index, value);
940         }
941 
942         @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)943         public Builder addRepeatedField(
944             com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
945           return super.addRepeatedField(field, value);
946         }
947 
948         @java.lang.Override
mergeFrom(com.google.protobuf.Message other)949         public Builder mergeFrom(com.google.protobuf.Message other) {
950           if (other instanceof com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) {
951             return mergeFrom(
952                 (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) other);
953           } else {
954             super.mergeFrom(other);
955             return this;
956           }
957         }
958 
mergeFrom( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues other)959         public Builder mergeFrom(
960             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues other) {
961           if (other
962               == com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
963                   .getDefaultInstance()) return this;
964           if (!other.allowedValues_.isEmpty()) {
965             if (allowedValues_.isEmpty()) {
966               allowedValues_ = other.allowedValues_;
967               bitField0_ = (bitField0_ & ~0x00000001);
968             } else {
969               ensureAllowedValuesIsMutable();
970               allowedValues_.addAll(other.allowedValues_);
971             }
972             onChanged();
973           }
974           if (!other.deniedValues_.isEmpty()) {
975             if (deniedValues_.isEmpty()) {
976               deniedValues_ = other.deniedValues_;
977               bitField0_ = (bitField0_ & ~0x00000002);
978             } else {
979               ensureDeniedValuesIsMutable();
980               deniedValues_.addAll(other.deniedValues_);
981             }
982             onChanged();
983           }
984           this.mergeUnknownFields(other.getUnknownFields());
985           onChanged();
986           return this;
987         }
988 
989         @java.lang.Override
isInitialized()990         public final boolean isInitialized() {
991           return true;
992         }
993 
994         @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)995         public Builder mergeFrom(
996             com.google.protobuf.CodedInputStream input,
997             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
998             throws java.io.IOException {
999           if (extensionRegistry == null) {
1000             throw new java.lang.NullPointerException();
1001           }
1002           try {
1003             boolean done = false;
1004             while (!done) {
1005               int tag = input.readTag();
1006               switch (tag) {
1007                 case 0:
1008                   done = true;
1009                   break;
1010                 case 10:
1011                   {
1012                     java.lang.String s = input.readStringRequireUtf8();
1013                     ensureAllowedValuesIsMutable();
1014                     allowedValues_.add(s);
1015                     break;
1016                   } // case 10
1017                 case 18:
1018                   {
1019                     java.lang.String s = input.readStringRequireUtf8();
1020                     ensureDeniedValuesIsMutable();
1021                     deniedValues_.add(s);
1022                     break;
1023                   } // case 18
1024                 default:
1025                   {
1026                     if (!super.parseUnknownField(input, extensionRegistry, tag)) {
1027                       done = true; // was an endgroup tag
1028                     }
1029                     break;
1030                   } // default:
1031               } // switch (tag)
1032             } // while (!done)
1033           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1034             throw e.unwrapIOException();
1035           } finally {
1036             onChanged();
1037           } // finally
1038           return this;
1039         }
1040 
1041         private int bitField0_;
1042 
1043         private com.google.protobuf.LazyStringList allowedValues_ =
1044             com.google.protobuf.LazyStringArrayList.EMPTY;
1045 
ensureAllowedValuesIsMutable()1046         private void ensureAllowedValuesIsMutable() {
1047           if (!((bitField0_ & 0x00000001) != 0)) {
1048             allowedValues_ = new com.google.protobuf.LazyStringArrayList(allowedValues_);
1049             bitField0_ |= 0x00000001;
1050           }
1051         }
1052         /**
1053          *
1054          *
1055          * <pre>
1056          * List of values allowed at this resource.
1057          * </pre>
1058          *
1059          * <code>repeated string allowed_values = 1;</code>
1060          *
1061          * @return A list containing the allowedValues.
1062          */
getAllowedValuesList()1063         public com.google.protobuf.ProtocolStringList getAllowedValuesList() {
1064           return allowedValues_.getUnmodifiableView();
1065         }
1066         /**
1067          *
1068          *
1069          * <pre>
1070          * List of values allowed at this resource.
1071          * </pre>
1072          *
1073          * <code>repeated string allowed_values = 1;</code>
1074          *
1075          * @return The count of allowedValues.
1076          */
getAllowedValuesCount()1077         public int getAllowedValuesCount() {
1078           return allowedValues_.size();
1079         }
1080         /**
1081          *
1082          *
1083          * <pre>
1084          * List of values allowed at this resource.
1085          * </pre>
1086          *
1087          * <code>repeated string allowed_values = 1;</code>
1088          *
1089          * @param index The index of the element to return.
1090          * @return The allowedValues at the given index.
1091          */
getAllowedValues(int index)1092         public java.lang.String getAllowedValues(int index) {
1093           return allowedValues_.get(index);
1094         }
1095         /**
1096          *
1097          *
1098          * <pre>
1099          * List of values allowed at this resource.
1100          * </pre>
1101          *
1102          * <code>repeated string allowed_values = 1;</code>
1103          *
1104          * @param index The index of the value to return.
1105          * @return The bytes of the allowedValues at the given index.
1106          */
getAllowedValuesBytes(int index)1107         public com.google.protobuf.ByteString getAllowedValuesBytes(int index) {
1108           return allowedValues_.getByteString(index);
1109         }
1110         /**
1111          *
1112          *
1113          * <pre>
1114          * List of values allowed at this resource.
1115          * </pre>
1116          *
1117          * <code>repeated string allowed_values = 1;</code>
1118          *
1119          * @param index The index to set the value at.
1120          * @param value The allowedValues to set.
1121          * @return This builder for chaining.
1122          */
setAllowedValues(int index, java.lang.String value)1123         public Builder setAllowedValues(int index, java.lang.String value) {
1124           if (value == null) {
1125             throw new NullPointerException();
1126           }
1127           ensureAllowedValuesIsMutable();
1128           allowedValues_.set(index, value);
1129           onChanged();
1130           return this;
1131         }
1132         /**
1133          *
1134          *
1135          * <pre>
1136          * List of values allowed at this resource.
1137          * </pre>
1138          *
1139          * <code>repeated string allowed_values = 1;</code>
1140          *
1141          * @param value The allowedValues to add.
1142          * @return This builder for chaining.
1143          */
addAllowedValues(java.lang.String value)1144         public Builder addAllowedValues(java.lang.String value) {
1145           if (value == null) {
1146             throw new NullPointerException();
1147           }
1148           ensureAllowedValuesIsMutable();
1149           allowedValues_.add(value);
1150           onChanged();
1151           return this;
1152         }
1153         /**
1154          *
1155          *
1156          * <pre>
1157          * List of values allowed at this resource.
1158          * </pre>
1159          *
1160          * <code>repeated string allowed_values = 1;</code>
1161          *
1162          * @param values The allowedValues to add.
1163          * @return This builder for chaining.
1164          */
addAllAllowedValues(java.lang.Iterable<java.lang.String> values)1165         public Builder addAllAllowedValues(java.lang.Iterable<java.lang.String> values) {
1166           ensureAllowedValuesIsMutable();
1167           com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedValues_);
1168           onChanged();
1169           return this;
1170         }
1171         /**
1172          *
1173          *
1174          * <pre>
1175          * List of values allowed at this resource.
1176          * </pre>
1177          *
1178          * <code>repeated string allowed_values = 1;</code>
1179          *
1180          * @return This builder for chaining.
1181          */
clearAllowedValues()1182         public Builder clearAllowedValues() {
1183           allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
1184           bitField0_ = (bitField0_ & ~0x00000001);
1185           onChanged();
1186           return this;
1187         }
1188         /**
1189          *
1190          *
1191          * <pre>
1192          * List of values allowed at this resource.
1193          * </pre>
1194          *
1195          * <code>repeated string allowed_values = 1;</code>
1196          *
1197          * @param value The bytes of the allowedValues to add.
1198          * @return This builder for chaining.
1199          */
addAllowedValuesBytes(com.google.protobuf.ByteString value)1200         public Builder addAllowedValuesBytes(com.google.protobuf.ByteString value) {
1201           if (value == null) {
1202             throw new NullPointerException();
1203           }
1204           checkByteStringIsUtf8(value);
1205           ensureAllowedValuesIsMutable();
1206           allowedValues_.add(value);
1207           onChanged();
1208           return this;
1209         }
1210 
1211         private com.google.protobuf.LazyStringList deniedValues_ =
1212             com.google.protobuf.LazyStringArrayList.EMPTY;
1213 
ensureDeniedValuesIsMutable()1214         private void ensureDeniedValuesIsMutable() {
1215           if (!((bitField0_ & 0x00000002) != 0)) {
1216             deniedValues_ = new com.google.protobuf.LazyStringArrayList(deniedValues_);
1217             bitField0_ |= 0x00000002;
1218           }
1219         }
1220         /**
1221          *
1222          *
1223          * <pre>
1224          * List of values denied at this resource.
1225          * </pre>
1226          *
1227          * <code>repeated string denied_values = 2;</code>
1228          *
1229          * @return A list containing the deniedValues.
1230          */
getDeniedValuesList()1231         public com.google.protobuf.ProtocolStringList getDeniedValuesList() {
1232           return deniedValues_.getUnmodifiableView();
1233         }
1234         /**
1235          *
1236          *
1237          * <pre>
1238          * List of values denied at this resource.
1239          * </pre>
1240          *
1241          * <code>repeated string denied_values = 2;</code>
1242          *
1243          * @return The count of deniedValues.
1244          */
getDeniedValuesCount()1245         public int getDeniedValuesCount() {
1246           return deniedValues_.size();
1247         }
1248         /**
1249          *
1250          *
1251          * <pre>
1252          * List of values denied at this resource.
1253          * </pre>
1254          *
1255          * <code>repeated string denied_values = 2;</code>
1256          *
1257          * @param index The index of the element to return.
1258          * @return The deniedValues at the given index.
1259          */
getDeniedValues(int index)1260         public java.lang.String getDeniedValues(int index) {
1261           return deniedValues_.get(index);
1262         }
1263         /**
1264          *
1265          *
1266          * <pre>
1267          * List of values denied at this resource.
1268          * </pre>
1269          *
1270          * <code>repeated string denied_values = 2;</code>
1271          *
1272          * @param index The index of the value to return.
1273          * @return The bytes of the deniedValues at the given index.
1274          */
getDeniedValuesBytes(int index)1275         public com.google.protobuf.ByteString getDeniedValuesBytes(int index) {
1276           return deniedValues_.getByteString(index);
1277         }
1278         /**
1279          *
1280          *
1281          * <pre>
1282          * List of values denied at this resource.
1283          * </pre>
1284          *
1285          * <code>repeated string denied_values = 2;</code>
1286          *
1287          * @param index The index to set the value at.
1288          * @param value The deniedValues to set.
1289          * @return This builder for chaining.
1290          */
setDeniedValues(int index, java.lang.String value)1291         public Builder setDeniedValues(int index, java.lang.String value) {
1292           if (value == null) {
1293             throw new NullPointerException();
1294           }
1295           ensureDeniedValuesIsMutable();
1296           deniedValues_.set(index, value);
1297           onChanged();
1298           return this;
1299         }
1300         /**
1301          *
1302          *
1303          * <pre>
1304          * List of values denied at this resource.
1305          * </pre>
1306          *
1307          * <code>repeated string denied_values = 2;</code>
1308          *
1309          * @param value The deniedValues to add.
1310          * @return This builder for chaining.
1311          */
addDeniedValues(java.lang.String value)1312         public Builder addDeniedValues(java.lang.String value) {
1313           if (value == null) {
1314             throw new NullPointerException();
1315           }
1316           ensureDeniedValuesIsMutable();
1317           deniedValues_.add(value);
1318           onChanged();
1319           return this;
1320         }
1321         /**
1322          *
1323          *
1324          * <pre>
1325          * List of values denied at this resource.
1326          * </pre>
1327          *
1328          * <code>repeated string denied_values = 2;</code>
1329          *
1330          * @param values The deniedValues to add.
1331          * @return This builder for chaining.
1332          */
addAllDeniedValues(java.lang.Iterable<java.lang.String> values)1333         public Builder addAllDeniedValues(java.lang.Iterable<java.lang.String> values) {
1334           ensureDeniedValuesIsMutable();
1335           com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deniedValues_);
1336           onChanged();
1337           return this;
1338         }
1339         /**
1340          *
1341          *
1342          * <pre>
1343          * List of values denied at this resource.
1344          * </pre>
1345          *
1346          * <code>repeated string denied_values = 2;</code>
1347          *
1348          * @return This builder for chaining.
1349          */
clearDeniedValues()1350         public Builder clearDeniedValues() {
1351           deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
1352           bitField0_ = (bitField0_ & ~0x00000002);
1353           onChanged();
1354           return this;
1355         }
1356         /**
1357          *
1358          *
1359          * <pre>
1360          * List of values denied at this resource.
1361          * </pre>
1362          *
1363          * <code>repeated string denied_values = 2;</code>
1364          *
1365          * @param value The bytes of the deniedValues to add.
1366          * @return This builder for chaining.
1367          */
addDeniedValuesBytes(com.google.protobuf.ByteString value)1368         public Builder addDeniedValuesBytes(com.google.protobuf.ByteString value) {
1369           if (value == null) {
1370             throw new NullPointerException();
1371           }
1372           checkByteStringIsUtf8(value);
1373           ensureDeniedValuesIsMutable();
1374           deniedValues_.add(value);
1375           onChanged();
1376           return this;
1377         }
1378 
1379         @java.lang.Override
setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1380         public final Builder setUnknownFields(
1381             final com.google.protobuf.UnknownFieldSet unknownFields) {
1382           return super.setUnknownFields(unknownFields);
1383         }
1384 
1385         @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1386         public final Builder mergeUnknownFields(
1387             final com.google.protobuf.UnknownFieldSet unknownFields) {
1388           return super.mergeUnknownFields(unknownFields);
1389         }
1390 
1391         // @@protoc_insertion_point(builder_scope:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)
1392       }
1393 
1394       // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues)
1395       private static final com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
1396           DEFAULT_INSTANCE;
1397 
1398       static {
1399         DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues();
1400       }
1401 
1402       public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
getDefaultInstance()1403           getDefaultInstance() {
1404         return DEFAULT_INSTANCE;
1405       }
1406 
1407       private static final com.google.protobuf.Parser<StringValues> PARSER =
1408           new com.google.protobuf.AbstractParser<StringValues>() {
1409             @java.lang.Override
1410             public StringValues parsePartialFrom(
1411                 com.google.protobuf.CodedInputStream input,
1412                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1413                 throws com.google.protobuf.InvalidProtocolBufferException {
1414               Builder builder = newBuilder();
1415               try {
1416                 builder.mergeFrom(input, extensionRegistry);
1417               } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1418                 throw e.setUnfinishedMessage(builder.buildPartial());
1419               } catch (com.google.protobuf.UninitializedMessageException e) {
1420                 throw e.asInvalidProtocolBufferException()
1421                     .setUnfinishedMessage(builder.buildPartial());
1422               } catch (java.io.IOException e) {
1423                 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1424                     .setUnfinishedMessage(builder.buildPartial());
1425               }
1426               return builder.buildPartial();
1427             }
1428           };
1429 
parser()1430       public static com.google.protobuf.Parser<StringValues> parser() {
1431         return PARSER;
1432       }
1433 
1434       @java.lang.Override
getParserForType()1435       public com.google.protobuf.Parser<StringValues> getParserForType() {
1436         return PARSER;
1437       }
1438 
1439       @java.lang.Override
1440       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
getDefaultInstanceForType()1441           getDefaultInstanceForType() {
1442         return DEFAULT_INSTANCE;
1443       }
1444     }
1445 
1446     private int kindCase_ = 0;
1447     private java.lang.Object kind_;
1448 
1449     public enum KindCase
1450         implements
1451             com.google.protobuf.Internal.EnumLite,
1452             com.google.protobuf.AbstractMessage.InternalOneOfEnum {
1453       VALUES(1),
1454       ALLOW_ALL(2),
1455       DENY_ALL(3),
1456       ENFORCE(4),
1457       KIND_NOT_SET(0);
1458       private final int value;
1459 
KindCase(int value)1460       private KindCase(int value) {
1461         this.value = value;
1462       }
1463       /**
1464        * @param value The number of the enum to look for.
1465        * @return The enum associated with the given number.
1466        * @deprecated Use {@link #forNumber(int)} instead.
1467        */
1468       @java.lang.Deprecated
valueOf(int value)1469       public static KindCase valueOf(int value) {
1470         return forNumber(value);
1471       }
1472 
forNumber(int value)1473       public static KindCase forNumber(int value) {
1474         switch (value) {
1475           case 1:
1476             return VALUES;
1477           case 2:
1478             return ALLOW_ALL;
1479           case 3:
1480             return DENY_ALL;
1481           case 4:
1482             return ENFORCE;
1483           case 0:
1484             return KIND_NOT_SET;
1485           default:
1486             return null;
1487         }
1488       }
1489 
getNumber()1490       public int getNumber() {
1491         return this.value;
1492       }
1493     };
1494 
getKindCase()1495     public KindCase getKindCase() {
1496       return KindCase.forNumber(kindCase_);
1497     }
1498 
1499     public static final int VALUES_FIELD_NUMBER = 1;
1500     /**
1501      *
1502      *
1503      * <pre>
1504      * List of values to be used for this PolicyRule. This field can be set
1505      * only in Policies for list constraints.
1506      * </pre>
1507      *
1508      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
1509      *
1510      * @return Whether the values field is set.
1511      */
1512     @java.lang.Override
hasValues()1513     public boolean hasValues() {
1514       return kindCase_ == 1;
1515     }
1516     /**
1517      *
1518      *
1519      * <pre>
1520      * List of values to be used for this PolicyRule. This field can be set
1521      * only in Policies for list constraints.
1522      * </pre>
1523      *
1524      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
1525      *
1526      * @return The values.
1527      */
1528     @java.lang.Override
getValues()1529     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues getValues() {
1530       if (kindCase_ == 1) {
1531         return (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_;
1532       }
1533       return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.getDefaultInstance();
1534     }
1535     /**
1536      *
1537      *
1538      * <pre>
1539      * List of values to be used for this PolicyRule. This field can be set
1540      * only in Policies for list constraints.
1541      * </pre>
1542      *
1543      * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
1544      */
1545     @java.lang.Override
1546     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder
getValuesOrBuilder()1547         getValuesOrBuilder() {
1548       if (kindCase_ == 1) {
1549         return (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_;
1550       }
1551       return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.getDefaultInstance();
1552     }
1553 
1554     public static final int ALLOW_ALL_FIELD_NUMBER = 2;
1555     /**
1556      *
1557      *
1558      * <pre>
1559      * Setting this to true means that all values are allowed. This field can
1560      * be set only in Policies for list constraints.
1561      * </pre>
1562      *
1563      * <code>bool allow_all = 2;</code>
1564      *
1565      * @return Whether the allowAll field is set.
1566      */
1567     @java.lang.Override
hasAllowAll()1568     public boolean hasAllowAll() {
1569       return kindCase_ == 2;
1570     }
1571     /**
1572      *
1573      *
1574      * <pre>
1575      * Setting this to true means that all values are allowed. This field can
1576      * be set only in Policies for list constraints.
1577      * </pre>
1578      *
1579      * <code>bool allow_all = 2;</code>
1580      *
1581      * @return The allowAll.
1582      */
1583     @java.lang.Override
getAllowAll()1584     public boolean getAllowAll() {
1585       if (kindCase_ == 2) {
1586         return (java.lang.Boolean) kind_;
1587       }
1588       return false;
1589     }
1590 
1591     public static final int DENY_ALL_FIELD_NUMBER = 3;
1592     /**
1593      *
1594      *
1595      * <pre>
1596      * Setting this to true means that all values are denied. This field can
1597      * be set only in Policies for list constraints.
1598      * </pre>
1599      *
1600      * <code>bool deny_all = 3;</code>
1601      *
1602      * @return Whether the denyAll field is set.
1603      */
1604     @java.lang.Override
hasDenyAll()1605     public boolean hasDenyAll() {
1606       return kindCase_ == 3;
1607     }
1608     /**
1609      *
1610      *
1611      * <pre>
1612      * Setting this to true means that all values are denied. This field can
1613      * be set only in Policies for list constraints.
1614      * </pre>
1615      *
1616      * <code>bool deny_all = 3;</code>
1617      *
1618      * @return The denyAll.
1619      */
1620     @java.lang.Override
getDenyAll()1621     public boolean getDenyAll() {
1622       if (kindCase_ == 3) {
1623         return (java.lang.Boolean) kind_;
1624       }
1625       return false;
1626     }
1627 
1628     public static final int ENFORCE_FIELD_NUMBER = 4;
1629     /**
1630      *
1631      *
1632      * <pre>
1633      * If `true`, then the `Policy` is enforced. If `false`, then any
1634      * configuration is acceptable.
1635      * This field can be set only in Policies for boolean constraints.
1636      * </pre>
1637      *
1638      * <code>bool enforce = 4;</code>
1639      *
1640      * @return Whether the enforce field is set.
1641      */
1642     @java.lang.Override
hasEnforce()1643     public boolean hasEnforce() {
1644       return kindCase_ == 4;
1645     }
1646     /**
1647      *
1648      *
1649      * <pre>
1650      * If `true`, then the `Policy` is enforced. If `false`, then any
1651      * configuration is acceptable.
1652      * This field can be set only in Policies for boolean constraints.
1653      * </pre>
1654      *
1655      * <code>bool enforce = 4;</code>
1656      *
1657      * @return The enforce.
1658      */
1659     @java.lang.Override
getEnforce()1660     public boolean getEnforce() {
1661       if (kindCase_ == 4) {
1662         return (java.lang.Boolean) kind_;
1663       }
1664       return false;
1665     }
1666 
1667     public static final int CONDITION_FIELD_NUMBER = 5;
1668     private com.google.type.Expr condition_;
1669     /**
1670      *
1671      *
1672      * <pre>
1673      * A condition which determines whether this rule is used
1674      * in the evaluation of the policy. When set, the `expression` field in
1675      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
1676      * or "&amp;&amp;" operators. Each subexpression must be of the form
1677      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
1678      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
1679      * 'tagValues/value_id')". where key_name and value_name are the resource
1680      * names for Label Keys and Values. These names are available from the Tag
1681      * Manager Service. An example expression is:
1682      * "resource.matchTag('123456789/environment,
1683      * 'prod')". or "resource.matchTagId('tagKeys/123',
1684      * 'tagValues/456')".
1685      * </pre>
1686      *
1687      * <code>.google.type.Expr condition = 5;</code>
1688      *
1689      * @return Whether the condition field is set.
1690      */
1691     @java.lang.Override
hasCondition()1692     public boolean hasCondition() {
1693       return condition_ != null;
1694     }
1695     /**
1696      *
1697      *
1698      * <pre>
1699      * A condition which determines whether this rule is used
1700      * in the evaluation of the policy. When set, the `expression` field in
1701      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
1702      * or "&amp;&amp;" operators. Each subexpression must be of the form
1703      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
1704      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
1705      * 'tagValues/value_id')". where key_name and value_name are the resource
1706      * names for Label Keys and Values. These names are available from the Tag
1707      * Manager Service. An example expression is:
1708      * "resource.matchTag('123456789/environment,
1709      * 'prod')". or "resource.matchTagId('tagKeys/123',
1710      * 'tagValues/456')".
1711      * </pre>
1712      *
1713      * <code>.google.type.Expr condition = 5;</code>
1714      *
1715      * @return The condition.
1716      */
1717     @java.lang.Override
getCondition()1718     public com.google.type.Expr getCondition() {
1719       return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_;
1720     }
1721     /**
1722      *
1723      *
1724      * <pre>
1725      * A condition which determines whether this rule is used
1726      * in the evaluation of the policy. When set, the `expression` field in
1727      * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
1728      * or "&amp;&amp;" operators. Each subexpression must be of the form
1729      * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
1730      * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
1731      * 'tagValues/value_id')". where key_name and value_name are the resource
1732      * names for Label Keys and Values. These names are available from the Tag
1733      * Manager Service. An example expression is:
1734      * "resource.matchTag('123456789/environment,
1735      * 'prod')". or "resource.matchTagId('tagKeys/123',
1736      * 'tagValues/456')".
1737      * </pre>
1738      *
1739      * <code>.google.type.Expr condition = 5;</code>
1740      */
1741     @java.lang.Override
getConditionOrBuilder()1742     public com.google.type.ExprOrBuilder getConditionOrBuilder() {
1743       return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_;
1744     }
1745 
1746     private byte memoizedIsInitialized = -1;
1747 
1748     @java.lang.Override
isInitialized()1749     public final boolean isInitialized() {
1750       byte isInitialized = memoizedIsInitialized;
1751       if (isInitialized == 1) return true;
1752       if (isInitialized == 0) return false;
1753 
1754       memoizedIsInitialized = 1;
1755       return true;
1756     }
1757 
1758     @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)1759     public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
1760       if (kindCase_ == 1) {
1761         output.writeMessage(
1762             1, (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_);
1763       }
1764       if (kindCase_ == 2) {
1765         output.writeBool(2, (boolean) ((java.lang.Boolean) kind_));
1766       }
1767       if (kindCase_ == 3) {
1768         output.writeBool(3, (boolean) ((java.lang.Boolean) kind_));
1769       }
1770       if (kindCase_ == 4) {
1771         output.writeBool(4, (boolean) ((java.lang.Boolean) kind_));
1772       }
1773       if (condition_ != null) {
1774         output.writeMessage(5, getCondition());
1775       }
1776       getUnknownFields().writeTo(output);
1777     }
1778 
1779     @java.lang.Override
getSerializedSize()1780     public int getSerializedSize() {
1781       int size = memoizedSize;
1782       if (size != -1) return size;
1783 
1784       size = 0;
1785       if (kindCase_ == 1) {
1786         size +=
1787             com.google.protobuf.CodedOutputStream.computeMessageSize(
1788                 1, (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_);
1789       }
1790       if (kindCase_ == 2) {
1791         size +=
1792             com.google.protobuf.CodedOutputStream.computeBoolSize(
1793                 2, (boolean) ((java.lang.Boolean) kind_));
1794       }
1795       if (kindCase_ == 3) {
1796         size +=
1797             com.google.protobuf.CodedOutputStream.computeBoolSize(
1798                 3, (boolean) ((java.lang.Boolean) kind_));
1799       }
1800       if (kindCase_ == 4) {
1801         size +=
1802             com.google.protobuf.CodedOutputStream.computeBoolSize(
1803                 4, (boolean) ((java.lang.Boolean) kind_));
1804       }
1805       if (condition_ != null) {
1806         size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getCondition());
1807       }
1808       size += getUnknownFields().getSerializedSize();
1809       memoizedSize = size;
1810       return size;
1811     }
1812 
1813     @java.lang.Override
equals(final java.lang.Object obj)1814     public boolean equals(final java.lang.Object obj) {
1815       if (obj == this) {
1816         return true;
1817       }
1818       if (!(obj instanceof com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)) {
1819         return super.equals(obj);
1820       }
1821       com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule other =
1822           (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule) obj;
1823 
1824       if (hasCondition() != other.hasCondition()) return false;
1825       if (hasCondition()) {
1826         if (!getCondition().equals(other.getCondition())) return false;
1827       }
1828       if (!getKindCase().equals(other.getKindCase())) return false;
1829       switch (kindCase_) {
1830         case 1:
1831           if (!getValues().equals(other.getValues())) return false;
1832           break;
1833         case 2:
1834           if (getAllowAll() != other.getAllowAll()) return false;
1835           break;
1836         case 3:
1837           if (getDenyAll() != other.getDenyAll()) return false;
1838           break;
1839         case 4:
1840           if (getEnforce() != other.getEnforce()) return false;
1841           break;
1842         case 0:
1843         default:
1844       }
1845       if (!getUnknownFields().equals(other.getUnknownFields())) return false;
1846       return true;
1847     }
1848 
1849     @java.lang.Override
hashCode()1850     public int hashCode() {
1851       if (memoizedHashCode != 0) {
1852         return memoizedHashCode;
1853       }
1854       int hash = 41;
1855       hash = (19 * hash) + getDescriptor().hashCode();
1856       if (hasCondition()) {
1857         hash = (37 * hash) + CONDITION_FIELD_NUMBER;
1858         hash = (53 * hash) + getCondition().hashCode();
1859       }
1860       switch (kindCase_) {
1861         case 1:
1862           hash = (37 * hash) + VALUES_FIELD_NUMBER;
1863           hash = (53 * hash) + getValues().hashCode();
1864           break;
1865         case 2:
1866           hash = (37 * hash) + ALLOW_ALL_FIELD_NUMBER;
1867           hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowAll());
1868           break;
1869         case 3:
1870           hash = (37 * hash) + DENY_ALL_FIELD_NUMBER;
1871           hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDenyAll());
1872           break;
1873         case 4:
1874           hash = (37 * hash) + ENFORCE_FIELD_NUMBER;
1875           hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnforce());
1876           break;
1877         case 0:
1878         default:
1879       }
1880       hash = (29 * hash) + getUnknownFields().hashCode();
1881       memoizedHashCode = hash;
1882       return hash;
1883     }
1884 
parseFrom( java.nio.ByteBuffer data)1885     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1886         java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
1887       return PARSER.parseFrom(data);
1888     }
1889 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1890     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1891         java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1892         throws com.google.protobuf.InvalidProtocolBufferException {
1893       return PARSER.parseFrom(data, extensionRegistry);
1894     }
1895 
parseFrom( com.google.protobuf.ByteString data)1896     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1897         com.google.protobuf.ByteString data)
1898         throws com.google.protobuf.InvalidProtocolBufferException {
1899       return PARSER.parseFrom(data);
1900     }
1901 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1902     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1903         com.google.protobuf.ByteString data,
1904         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1905         throws com.google.protobuf.InvalidProtocolBufferException {
1906       return PARSER.parseFrom(data, extensionRegistry);
1907     }
1908 
parseFrom(byte[] data)1909     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(byte[] data)
1910         throws com.google.protobuf.InvalidProtocolBufferException {
1911       return PARSER.parseFrom(data);
1912     }
1913 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1914     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1915         byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1916         throws com.google.protobuf.InvalidProtocolBufferException {
1917       return PARSER.parseFrom(data, extensionRegistry);
1918     }
1919 
parseFrom( java.io.InputStream input)1920     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1921         java.io.InputStream input) throws java.io.IOException {
1922       return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
1923     }
1924 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1925     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1926         java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1927         throws java.io.IOException {
1928       return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
1929           PARSER, input, extensionRegistry);
1930     }
1931 
parseDelimitedFrom( java.io.InputStream input)1932     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseDelimitedFrom(
1933         java.io.InputStream input) throws java.io.IOException {
1934       return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
1935     }
1936 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1937     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseDelimitedFrom(
1938         java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1939         throws java.io.IOException {
1940       return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
1941           PARSER, input, extensionRegistry);
1942     }
1943 
parseFrom( com.google.protobuf.CodedInputStream input)1944     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1945         com.google.protobuf.CodedInputStream input) throws java.io.IOException {
1946       return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
1947     }
1948 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1949     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule parseFrom(
1950         com.google.protobuf.CodedInputStream input,
1951         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1952         throws java.io.IOException {
1953       return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
1954           PARSER, input, extensionRegistry);
1955     }
1956 
1957     @java.lang.Override
newBuilderForType()1958     public Builder newBuilderForType() {
1959       return newBuilder();
1960     }
1961 
newBuilder()1962     public static Builder newBuilder() {
1963       return DEFAULT_INSTANCE.toBuilder();
1964     }
1965 
newBuilder( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule prototype)1966     public static Builder newBuilder(
1967         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule prototype) {
1968       return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
1969     }
1970 
1971     @java.lang.Override
toBuilder()1972     public Builder toBuilder() {
1973       return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
1974     }
1975 
1976     @java.lang.Override
newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1977     protected Builder newBuilderForType(
1978         com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
1979       Builder builder = new Builder(parent);
1980       return builder;
1981     }
1982     /**
1983      *
1984      *
1985      * <pre>
1986      * A rule used to express this policy.
1987      * </pre>
1988      *
1989      * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec.PolicyRule}
1990      */
1991     public static final class Builder
1992         extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
1993         implements
1994         // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)
1995         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder {
getDescriptor()1996       public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
1997         return com.google.cloud.orgpolicy.v2.OrgPolicyProto
1998             .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_descriptor;
1999       }
2000 
2001       @java.lang.Override
2002       protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()2003           internalGetFieldAccessorTable() {
2004         return com.google.cloud.orgpolicy.v2.OrgPolicyProto
2005             .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_fieldAccessorTable
2006             .ensureFieldAccessorsInitialized(
2007                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.class,
2008                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder.class);
2009       }
2010 
2011       // Construct using com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.newBuilder()
Builder()2012       private Builder() {}
2013 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)2014       private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
2015         super(parent);
2016       }
2017 
2018       @java.lang.Override
clear()2019       public Builder clear() {
2020         super.clear();
2021         bitField0_ = 0;
2022         if (valuesBuilder_ != null) {
2023           valuesBuilder_.clear();
2024         }
2025         condition_ = null;
2026         if (conditionBuilder_ != null) {
2027           conditionBuilder_.dispose();
2028           conditionBuilder_ = null;
2029         }
2030         kindCase_ = 0;
2031         kind_ = null;
2032         return this;
2033       }
2034 
2035       @java.lang.Override
getDescriptorForType()2036       public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
2037         return com.google.cloud.orgpolicy.v2.OrgPolicyProto
2038             .internal_static_google_cloud_orgpolicy_v2_PolicySpec_PolicyRule_descriptor;
2039       }
2040 
2041       @java.lang.Override
getDefaultInstanceForType()2042       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule getDefaultInstanceForType() {
2043         return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.getDefaultInstance();
2044       }
2045 
2046       @java.lang.Override
build()2047       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule build() {
2048         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result = buildPartial();
2049         if (!result.isInitialized()) {
2050           throw newUninitializedMessageException(result);
2051         }
2052         return result;
2053       }
2054 
2055       @java.lang.Override
buildPartial()2056       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule buildPartial() {
2057         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result =
2058             new com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule(this);
2059         if (bitField0_ != 0) {
2060           buildPartial0(result);
2061         }
2062         buildPartialOneofs(result);
2063         onBuilt();
2064         return result;
2065       }
2066 
buildPartial0(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result)2067       private void buildPartial0(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result) {
2068         int from_bitField0_ = bitField0_;
2069         if (((from_bitField0_ & 0x00000010) != 0)) {
2070           result.condition_ = conditionBuilder_ == null ? condition_ : conditionBuilder_.build();
2071         }
2072       }
2073 
buildPartialOneofs(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result)2074       private void buildPartialOneofs(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule result) {
2075         result.kindCase_ = kindCase_;
2076         result.kind_ = this.kind_;
2077         if (kindCase_ == 1 && valuesBuilder_ != null) {
2078           result.kind_ = valuesBuilder_.build();
2079         }
2080       }
2081 
2082       @java.lang.Override
clone()2083       public Builder clone() {
2084         return super.clone();
2085       }
2086 
2087       @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)2088       public Builder setField(
2089           com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
2090         return super.setField(field, value);
2091       }
2092 
2093       @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)2094       public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
2095         return super.clearField(field);
2096       }
2097 
2098       @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)2099       public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
2100         return super.clearOneof(oneof);
2101       }
2102 
2103       @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)2104       public Builder setRepeatedField(
2105           com.google.protobuf.Descriptors.FieldDescriptor field,
2106           int index,
2107           java.lang.Object value) {
2108         return super.setRepeatedField(field, index, value);
2109       }
2110 
2111       @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)2112       public Builder addRepeatedField(
2113           com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
2114         return super.addRepeatedField(field, value);
2115       }
2116 
2117       @java.lang.Override
mergeFrom(com.google.protobuf.Message other)2118       public Builder mergeFrom(com.google.protobuf.Message other) {
2119         if (other instanceof com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule) {
2120           return mergeFrom((com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule) other);
2121         } else {
2122           super.mergeFrom(other);
2123           return this;
2124         }
2125       }
2126 
mergeFrom(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule other)2127       public Builder mergeFrom(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule other) {
2128         if (other == com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.getDefaultInstance())
2129           return this;
2130         if (other.hasCondition()) {
2131           mergeCondition(other.getCondition());
2132         }
2133         switch (other.getKindCase()) {
2134           case VALUES:
2135             {
2136               mergeValues(other.getValues());
2137               break;
2138             }
2139           case ALLOW_ALL:
2140             {
2141               setAllowAll(other.getAllowAll());
2142               break;
2143             }
2144           case DENY_ALL:
2145             {
2146               setDenyAll(other.getDenyAll());
2147               break;
2148             }
2149           case ENFORCE:
2150             {
2151               setEnforce(other.getEnforce());
2152               break;
2153             }
2154           case KIND_NOT_SET:
2155             {
2156               break;
2157             }
2158         }
2159         this.mergeUnknownFields(other.getUnknownFields());
2160         onChanged();
2161         return this;
2162       }
2163 
2164       @java.lang.Override
isInitialized()2165       public final boolean isInitialized() {
2166         return true;
2167       }
2168 
2169       @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)2170       public Builder mergeFrom(
2171           com.google.protobuf.CodedInputStream input,
2172           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2173           throws java.io.IOException {
2174         if (extensionRegistry == null) {
2175           throw new java.lang.NullPointerException();
2176         }
2177         try {
2178           boolean done = false;
2179           while (!done) {
2180             int tag = input.readTag();
2181             switch (tag) {
2182               case 0:
2183                 done = true;
2184                 break;
2185               case 10:
2186                 {
2187                   input.readMessage(getValuesFieldBuilder().getBuilder(), extensionRegistry);
2188                   kindCase_ = 1;
2189                   break;
2190                 } // case 10
2191               case 16:
2192                 {
2193                   kind_ = input.readBool();
2194                   kindCase_ = 2;
2195                   break;
2196                 } // case 16
2197               case 24:
2198                 {
2199                   kind_ = input.readBool();
2200                   kindCase_ = 3;
2201                   break;
2202                 } // case 24
2203               case 32:
2204                 {
2205                   kind_ = input.readBool();
2206                   kindCase_ = 4;
2207                   break;
2208                 } // case 32
2209               case 42:
2210                 {
2211                   input.readMessage(getConditionFieldBuilder().getBuilder(), extensionRegistry);
2212                   bitField0_ |= 0x00000010;
2213                   break;
2214                 } // case 42
2215               default:
2216                 {
2217                   if (!super.parseUnknownField(input, extensionRegistry, tag)) {
2218                     done = true; // was an endgroup tag
2219                   }
2220                   break;
2221                 } // default:
2222             } // switch (tag)
2223           } // while (!done)
2224         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
2225           throw e.unwrapIOException();
2226         } finally {
2227           onChanged();
2228         } // finally
2229         return this;
2230       }
2231 
2232       private int kindCase_ = 0;
2233       private java.lang.Object kind_;
2234 
getKindCase()2235       public KindCase getKindCase() {
2236         return KindCase.forNumber(kindCase_);
2237       }
2238 
clearKind()2239       public Builder clearKind() {
2240         kindCase_ = 0;
2241         kind_ = null;
2242         onChanged();
2243         return this;
2244       }
2245 
2246       private int bitField0_;
2247 
2248       private com.google.protobuf.SingleFieldBuilderV3<
2249               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues,
2250               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder,
2251               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder>
2252           valuesBuilder_;
2253       /**
2254        *
2255        *
2256        * <pre>
2257        * List of values to be used for this PolicyRule. This field can be set
2258        * only in Policies for list constraints.
2259        * </pre>
2260        *
2261        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2262        *
2263        * @return Whether the values field is set.
2264        */
2265       @java.lang.Override
hasValues()2266       public boolean hasValues() {
2267         return kindCase_ == 1;
2268       }
2269       /**
2270        *
2271        *
2272        * <pre>
2273        * List of values to be used for this PolicyRule. This field can be set
2274        * only in Policies for list constraints.
2275        * </pre>
2276        *
2277        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2278        *
2279        * @return The values.
2280        */
2281       @java.lang.Override
getValues()2282       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues getValues() {
2283         if (valuesBuilder_ == null) {
2284           if (kindCase_ == 1) {
2285             return (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_;
2286           }
2287           return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
2288               .getDefaultInstance();
2289         } else {
2290           if (kindCase_ == 1) {
2291             return valuesBuilder_.getMessage();
2292           }
2293           return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
2294               .getDefaultInstance();
2295         }
2296       }
2297       /**
2298        *
2299        *
2300        * <pre>
2301        * List of values to be used for this PolicyRule. This field can be set
2302        * only in Policies for list constraints.
2303        * </pre>
2304        *
2305        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2306        */
setValues( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues value)2307       public Builder setValues(
2308           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues value) {
2309         if (valuesBuilder_ == null) {
2310           if (value == null) {
2311             throw new NullPointerException();
2312           }
2313           kind_ = value;
2314           onChanged();
2315         } else {
2316           valuesBuilder_.setMessage(value);
2317         }
2318         kindCase_ = 1;
2319         return this;
2320       }
2321       /**
2322        *
2323        *
2324        * <pre>
2325        * List of values to be used for this PolicyRule. This field can be set
2326        * only in Policies for list constraints.
2327        * </pre>
2328        *
2329        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2330        */
setValues( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder builderForValue)2331       public Builder setValues(
2332           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder
2333               builderForValue) {
2334         if (valuesBuilder_ == null) {
2335           kind_ = builderForValue.build();
2336           onChanged();
2337         } else {
2338           valuesBuilder_.setMessage(builderForValue.build());
2339         }
2340         kindCase_ = 1;
2341         return this;
2342       }
2343       /**
2344        *
2345        *
2346        * <pre>
2347        * List of values to be used for this PolicyRule. This field can be set
2348        * only in Policies for list constraints.
2349        * </pre>
2350        *
2351        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2352        */
mergeValues( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues value)2353       public Builder mergeValues(
2354           com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues value) {
2355         if (valuesBuilder_ == null) {
2356           if (kindCase_ == 1
2357               && kind_
2358                   != com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
2359                       .getDefaultInstance()) {
2360             kind_ =
2361                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.newBuilder(
2362                         (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_)
2363                     .mergeFrom(value)
2364                     .buildPartial();
2365           } else {
2366             kind_ = value;
2367           }
2368           onChanged();
2369         } else {
2370           if (kindCase_ == 1) {
2371             valuesBuilder_.mergeFrom(value);
2372           } else {
2373             valuesBuilder_.setMessage(value);
2374           }
2375         }
2376         kindCase_ = 1;
2377         return this;
2378       }
2379       /**
2380        *
2381        *
2382        * <pre>
2383        * List of values to be used for this PolicyRule. This field can be set
2384        * only in Policies for list constraints.
2385        * </pre>
2386        *
2387        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2388        */
clearValues()2389       public Builder clearValues() {
2390         if (valuesBuilder_ == null) {
2391           if (kindCase_ == 1) {
2392             kindCase_ = 0;
2393             kind_ = null;
2394             onChanged();
2395           }
2396         } else {
2397           if (kindCase_ == 1) {
2398             kindCase_ = 0;
2399             kind_ = null;
2400           }
2401           valuesBuilder_.clear();
2402         }
2403         return this;
2404       }
2405       /**
2406        *
2407        *
2408        * <pre>
2409        * List of values to be used for this PolicyRule. This field can be set
2410        * only in Policies for list constraints.
2411        * </pre>
2412        *
2413        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2414        */
2415       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder
getValuesBuilder()2416           getValuesBuilder() {
2417         return getValuesFieldBuilder().getBuilder();
2418       }
2419       /**
2420        *
2421        *
2422        * <pre>
2423        * List of values to be used for this PolicyRule. This field can be set
2424        * only in Policies for list constraints.
2425        * </pre>
2426        *
2427        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2428        */
2429       @java.lang.Override
2430       public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder
getValuesOrBuilder()2431           getValuesOrBuilder() {
2432         if ((kindCase_ == 1) && (valuesBuilder_ != null)) {
2433           return valuesBuilder_.getMessageOrBuilder();
2434         } else {
2435           if (kindCase_ == 1) {
2436             return (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_;
2437           }
2438           return com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
2439               .getDefaultInstance();
2440         }
2441       }
2442       /**
2443        *
2444        *
2445        * <pre>
2446        * List of values to be used for this PolicyRule. This field can be set
2447        * only in Policies for list constraints.
2448        * </pre>
2449        *
2450        * <code>.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;</code>
2451        */
2452       private com.google.protobuf.SingleFieldBuilderV3<
2453               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues,
2454               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder,
2455               com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder>
getValuesFieldBuilder()2456           getValuesFieldBuilder() {
2457         if (valuesBuilder_ == null) {
2458           if (!(kindCase_ == 1)) {
2459             kind_ =
2460                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues
2461                     .getDefaultInstance();
2462           }
2463           valuesBuilder_ =
2464               new com.google.protobuf.SingleFieldBuilderV3<
2465                   com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues,
2466                   com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues.Builder,
2467                   com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValuesOrBuilder>(
2468                   (com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues) kind_,
2469                   getParentForChildren(),
2470                   isClean());
2471           kind_ = null;
2472         }
2473         kindCase_ = 1;
2474         onChanged();
2475         return valuesBuilder_;
2476       }
2477 
2478       /**
2479        *
2480        *
2481        * <pre>
2482        * Setting this to true means that all values are allowed. This field can
2483        * be set only in Policies for list constraints.
2484        * </pre>
2485        *
2486        * <code>bool allow_all = 2;</code>
2487        *
2488        * @return Whether the allowAll field is set.
2489        */
hasAllowAll()2490       public boolean hasAllowAll() {
2491         return kindCase_ == 2;
2492       }
2493       /**
2494        *
2495        *
2496        * <pre>
2497        * Setting this to true means that all values are allowed. This field can
2498        * be set only in Policies for list constraints.
2499        * </pre>
2500        *
2501        * <code>bool allow_all = 2;</code>
2502        *
2503        * @return The allowAll.
2504        */
getAllowAll()2505       public boolean getAllowAll() {
2506         if (kindCase_ == 2) {
2507           return (java.lang.Boolean) kind_;
2508         }
2509         return false;
2510       }
2511       /**
2512        *
2513        *
2514        * <pre>
2515        * Setting this to true means that all values are allowed. This field can
2516        * be set only in Policies for list constraints.
2517        * </pre>
2518        *
2519        * <code>bool allow_all = 2;</code>
2520        *
2521        * @param value The allowAll to set.
2522        * @return This builder for chaining.
2523        */
setAllowAll(boolean value)2524       public Builder setAllowAll(boolean value) {
2525 
2526         kindCase_ = 2;
2527         kind_ = value;
2528         onChanged();
2529         return this;
2530       }
2531       /**
2532        *
2533        *
2534        * <pre>
2535        * Setting this to true means that all values are allowed. This field can
2536        * be set only in Policies for list constraints.
2537        * </pre>
2538        *
2539        * <code>bool allow_all = 2;</code>
2540        *
2541        * @return This builder for chaining.
2542        */
clearAllowAll()2543       public Builder clearAllowAll() {
2544         if (kindCase_ == 2) {
2545           kindCase_ = 0;
2546           kind_ = null;
2547           onChanged();
2548         }
2549         return this;
2550       }
2551 
2552       /**
2553        *
2554        *
2555        * <pre>
2556        * Setting this to true means that all values are denied. This field can
2557        * be set only in Policies for list constraints.
2558        * </pre>
2559        *
2560        * <code>bool deny_all = 3;</code>
2561        *
2562        * @return Whether the denyAll field is set.
2563        */
hasDenyAll()2564       public boolean hasDenyAll() {
2565         return kindCase_ == 3;
2566       }
2567       /**
2568        *
2569        *
2570        * <pre>
2571        * Setting this to true means that all values are denied. This field can
2572        * be set only in Policies for list constraints.
2573        * </pre>
2574        *
2575        * <code>bool deny_all = 3;</code>
2576        *
2577        * @return The denyAll.
2578        */
getDenyAll()2579       public boolean getDenyAll() {
2580         if (kindCase_ == 3) {
2581           return (java.lang.Boolean) kind_;
2582         }
2583         return false;
2584       }
2585       /**
2586        *
2587        *
2588        * <pre>
2589        * Setting this to true means that all values are denied. This field can
2590        * be set only in Policies for list constraints.
2591        * </pre>
2592        *
2593        * <code>bool deny_all = 3;</code>
2594        *
2595        * @param value The denyAll to set.
2596        * @return This builder for chaining.
2597        */
setDenyAll(boolean value)2598       public Builder setDenyAll(boolean value) {
2599 
2600         kindCase_ = 3;
2601         kind_ = value;
2602         onChanged();
2603         return this;
2604       }
2605       /**
2606        *
2607        *
2608        * <pre>
2609        * Setting this to true means that all values are denied. This field can
2610        * be set only in Policies for list constraints.
2611        * </pre>
2612        *
2613        * <code>bool deny_all = 3;</code>
2614        *
2615        * @return This builder for chaining.
2616        */
clearDenyAll()2617       public Builder clearDenyAll() {
2618         if (kindCase_ == 3) {
2619           kindCase_ = 0;
2620           kind_ = null;
2621           onChanged();
2622         }
2623         return this;
2624       }
2625 
2626       /**
2627        *
2628        *
2629        * <pre>
2630        * If `true`, then the `Policy` is enforced. If `false`, then any
2631        * configuration is acceptable.
2632        * This field can be set only in Policies for boolean constraints.
2633        * </pre>
2634        *
2635        * <code>bool enforce = 4;</code>
2636        *
2637        * @return Whether the enforce field is set.
2638        */
hasEnforce()2639       public boolean hasEnforce() {
2640         return kindCase_ == 4;
2641       }
2642       /**
2643        *
2644        *
2645        * <pre>
2646        * If `true`, then the `Policy` is enforced. If `false`, then any
2647        * configuration is acceptable.
2648        * This field can be set only in Policies for boolean constraints.
2649        * </pre>
2650        *
2651        * <code>bool enforce = 4;</code>
2652        *
2653        * @return The enforce.
2654        */
getEnforce()2655       public boolean getEnforce() {
2656         if (kindCase_ == 4) {
2657           return (java.lang.Boolean) kind_;
2658         }
2659         return false;
2660       }
2661       /**
2662        *
2663        *
2664        * <pre>
2665        * If `true`, then the `Policy` is enforced. If `false`, then any
2666        * configuration is acceptable.
2667        * This field can be set only in Policies for boolean constraints.
2668        * </pre>
2669        *
2670        * <code>bool enforce = 4;</code>
2671        *
2672        * @param value The enforce to set.
2673        * @return This builder for chaining.
2674        */
setEnforce(boolean value)2675       public Builder setEnforce(boolean value) {
2676 
2677         kindCase_ = 4;
2678         kind_ = value;
2679         onChanged();
2680         return this;
2681       }
2682       /**
2683        *
2684        *
2685        * <pre>
2686        * If `true`, then the `Policy` is enforced. If `false`, then any
2687        * configuration is acceptable.
2688        * This field can be set only in Policies for boolean constraints.
2689        * </pre>
2690        *
2691        * <code>bool enforce = 4;</code>
2692        *
2693        * @return This builder for chaining.
2694        */
clearEnforce()2695       public Builder clearEnforce() {
2696         if (kindCase_ == 4) {
2697           kindCase_ = 0;
2698           kind_ = null;
2699           onChanged();
2700         }
2701         return this;
2702       }
2703 
2704       private com.google.type.Expr condition_;
2705       private com.google.protobuf.SingleFieldBuilderV3<
2706               com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>
2707           conditionBuilder_;
2708       /**
2709        *
2710        *
2711        * <pre>
2712        * A condition which determines whether this rule is used
2713        * in the evaluation of the policy. When set, the `expression` field in
2714        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2715        * or "&amp;&amp;" operators. Each subexpression must be of the form
2716        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2717        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2718        * 'tagValues/value_id')". where key_name and value_name are the resource
2719        * names for Label Keys and Values. These names are available from the Tag
2720        * Manager Service. An example expression is:
2721        * "resource.matchTag('123456789/environment,
2722        * 'prod')". or "resource.matchTagId('tagKeys/123',
2723        * 'tagValues/456')".
2724        * </pre>
2725        *
2726        * <code>.google.type.Expr condition = 5;</code>
2727        *
2728        * @return Whether the condition field is set.
2729        */
hasCondition()2730       public boolean hasCondition() {
2731         return ((bitField0_ & 0x00000010) != 0);
2732       }
2733       /**
2734        *
2735        *
2736        * <pre>
2737        * A condition which determines whether this rule is used
2738        * in the evaluation of the policy. When set, the `expression` field in
2739        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2740        * or "&amp;&amp;" operators. Each subexpression must be of the form
2741        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2742        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2743        * 'tagValues/value_id')". where key_name and value_name are the resource
2744        * names for Label Keys and Values. These names are available from the Tag
2745        * Manager Service. An example expression is:
2746        * "resource.matchTag('123456789/environment,
2747        * 'prod')". or "resource.matchTagId('tagKeys/123',
2748        * 'tagValues/456')".
2749        * </pre>
2750        *
2751        * <code>.google.type.Expr condition = 5;</code>
2752        *
2753        * @return The condition.
2754        */
getCondition()2755       public com.google.type.Expr getCondition() {
2756         if (conditionBuilder_ == null) {
2757           return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_;
2758         } else {
2759           return conditionBuilder_.getMessage();
2760         }
2761       }
2762       /**
2763        *
2764        *
2765        * <pre>
2766        * A condition which determines whether this rule is used
2767        * in the evaluation of the policy. When set, the `expression` field in
2768        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2769        * or "&amp;&amp;" operators. Each subexpression must be of the form
2770        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2771        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2772        * 'tagValues/value_id')". where key_name and value_name are the resource
2773        * names for Label Keys and Values. These names are available from the Tag
2774        * Manager Service. An example expression is:
2775        * "resource.matchTag('123456789/environment,
2776        * 'prod')". or "resource.matchTagId('tagKeys/123',
2777        * 'tagValues/456')".
2778        * </pre>
2779        *
2780        * <code>.google.type.Expr condition = 5;</code>
2781        */
setCondition(com.google.type.Expr value)2782       public Builder setCondition(com.google.type.Expr value) {
2783         if (conditionBuilder_ == null) {
2784           if (value == null) {
2785             throw new NullPointerException();
2786           }
2787           condition_ = value;
2788         } else {
2789           conditionBuilder_.setMessage(value);
2790         }
2791         bitField0_ |= 0x00000010;
2792         onChanged();
2793         return this;
2794       }
2795       /**
2796        *
2797        *
2798        * <pre>
2799        * A condition which determines whether this rule is used
2800        * in the evaluation of the policy. When set, the `expression` field in
2801        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2802        * or "&amp;&amp;" operators. Each subexpression must be of the form
2803        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2804        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2805        * 'tagValues/value_id')". where key_name and value_name are the resource
2806        * names for Label Keys and Values. These names are available from the Tag
2807        * Manager Service. An example expression is:
2808        * "resource.matchTag('123456789/environment,
2809        * 'prod')". or "resource.matchTagId('tagKeys/123',
2810        * 'tagValues/456')".
2811        * </pre>
2812        *
2813        * <code>.google.type.Expr condition = 5;</code>
2814        */
setCondition(com.google.type.Expr.Builder builderForValue)2815       public Builder setCondition(com.google.type.Expr.Builder builderForValue) {
2816         if (conditionBuilder_ == null) {
2817           condition_ = builderForValue.build();
2818         } else {
2819           conditionBuilder_.setMessage(builderForValue.build());
2820         }
2821         bitField0_ |= 0x00000010;
2822         onChanged();
2823         return this;
2824       }
2825       /**
2826        *
2827        *
2828        * <pre>
2829        * A condition which determines whether this rule is used
2830        * in the evaluation of the policy. When set, the `expression` field in
2831        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2832        * or "&amp;&amp;" operators. Each subexpression must be of the form
2833        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2834        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2835        * 'tagValues/value_id')". where key_name and value_name are the resource
2836        * names for Label Keys and Values. These names are available from the Tag
2837        * Manager Service. An example expression is:
2838        * "resource.matchTag('123456789/environment,
2839        * 'prod')". or "resource.matchTagId('tagKeys/123',
2840        * 'tagValues/456')".
2841        * </pre>
2842        *
2843        * <code>.google.type.Expr condition = 5;</code>
2844        */
mergeCondition(com.google.type.Expr value)2845       public Builder mergeCondition(com.google.type.Expr value) {
2846         if (conditionBuilder_ == null) {
2847           if (((bitField0_ & 0x00000010) != 0)
2848               && condition_ != null
2849               && condition_ != com.google.type.Expr.getDefaultInstance()) {
2850             getConditionBuilder().mergeFrom(value);
2851           } else {
2852             condition_ = value;
2853           }
2854         } else {
2855           conditionBuilder_.mergeFrom(value);
2856         }
2857         bitField0_ |= 0x00000010;
2858         onChanged();
2859         return this;
2860       }
2861       /**
2862        *
2863        *
2864        * <pre>
2865        * A condition which determines whether this rule is used
2866        * in the evaluation of the policy. When set, the `expression` field in
2867        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2868        * or "&amp;&amp;" operators. Each subexpression must be of the form
2869        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2870        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2871        * 'tagValues/value_id')". where key_name and value_name are the resource
2872        * names for Label Keys and Values. These names are available from the Tag
2873        * Manager Service. An example expression is:
2874        * "resource.matchTag('123456789/environment,
2875        * 'prod')". or "resource.matchTagId('tagKeys/123',
2876        * 'tagValues/456')".
2877        * </pre>
2878        *
2879        * <code>.google.type.Expr condition = 5;</code>
2880        */
clearCondition()2881       public Builder clearCondition() {
2882         bitField0_ = (bitField0_ & ~0x00000010);
2883         condition_ = null;
2884         if (conditionBuilder_ != null) {
2885           conditionBuilder_.dispose();
2886           conditionBuilder_ = null;
2887         }
2888         onChanged();
2889         return this;
2890       }
2891       /**
2892        *
2893        *
2894        * <pre>
2895        * A condition which determines whether this rule is used
2896        * in the evaluation of the policy. When set, the `expression` field in
2897        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2898        * or "&amp;&amp;" operators. Each subexpression must be of the form
2899        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2900        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2901        * 'tagValues/value_id')". where key_name and value_name are the resource
2902        * names for Label Keys and Values. These names are available from the Tag
2903        * Manager Service. An example expression is:
2904        * "resource.matchTag('123456789/environment,
2905        * 'prod')". or "resource.matchTagId('tagKeys/123',
2906        * 'tagValues/456')".
2907        * </pre>
2908        *
2909        * <code>.google.type.Expr condition = 5;</code>
2910        */
getConditionBuilder()2911       public com.google.type.Expr.Builder getConditionBuilder() {
2912         bitField0_ |= 0x00000010;
2913         onChanged();
2914         return getConditionFieldBuilder().getBuilder();
2915       }
2916       /**
2917        *
2918        *
2919        * <pre>
2920        * A condition which determines whether this rule is used
2921        * in the evaluation of the policy. When set, the `expression` field in
2922        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2923        * or "&amp;&amp;" operators. Each subexpression must be of the form
2924        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2925        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2926        * 'tagValues/value_id')". where key_name and value_name are the resource
2927        * names for Label Keys and Values. These names are available from the Tag
2928        * Manager Service. An example expression is:
2929        * "resource.matchTag('123456789/environment,
2930        * 'prod')". or "resource.matchTagId('tagKeys/123',
2931        * 'tagValues/456')".
2932        * </pre>
2933        *
2934        * <code>.google.type.Expr condition = 5;</code>
2935        */
getConditionOrBuilder()2936       public com.google.type.ExprOrBuilder getConditionOrBuilder() {
2937         if (conditionBuilder_ != null) {
2938           return conditionBuilder_.getMessageOrBuilder();
2939         } else {
2940           return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_;
2941         }
2942       }
2943       /**
2944        *
2945        *
2946        * <pre>
2947        * A condition which determines whether this rule is used
2948        * in the evaluation of the policy. When set, the `expression` field in
2949        * the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
2950        * or "&amp;&amp;" operators. Each subexpression must be of the form
2951        * "resource.matchTag('&lt;ORG_ID&gt;/tag_key_short_name,
2952        * 'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
2953        * 'tagValues/value_id')". where key_name and value_name are the resource
2954        * names for Label Keys and Values. These names are available from the Tag
2955        * Manager Service. An example expression is:
2956        * "resource.matchTag('123456789/environment,
2957        * 'prod')". or "resource.matchTagId('tagKeys/123',
2958        * 'tagValues/456')".
2959        * </pre>
2960        *
2961        * <code>.google.type.Expr condition = 5;</code>
2962        */
2963       private com.google.protobuf.SingleFieldBuilderV3<
2964               com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>
getConditionFieldBuilder()2965           getConditionFieldBuilder() {
2966         if (conditionBuilder_ == null) {
2967           conditionBuilder_ =
2968               new com.google.protobuf.SingleFieldBuilderV3<
2969                   com.google.type.Expr,
2970                   com.google.type.Expr.Builder,
2971                   com.google.type.ExprOrBuilder>(getCondition(), getParentForChildren(), isClean());
2972           condition_ = null;
2973         }
2974         return conditionBuilder_;
2975       }
2976 
2977       @java.lang.Override
setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2978       public final Builder setUnknownFields(
2979           final com.google.protobuf.UnknownFieldSet unknownFields) {
2980         return super.setUnknownFields(unknownFields);
2981       }
2982 
2983       @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2984       public final Builder mergeUnknownFields(
2985           final com.google.protobuf.UnknownFieldSet unknownFields) {
2986         return super.mergeUnknownFields(unknownFields);
2987       }
2988 
2989       // @@protoc_insertion_point(builder_scope:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)
2990     }
2991 
2992     // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v2.PolicySpec.PolicyRule)
2993     private static final com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule DEFAULT_INSTANCE;
2994 
2995     static {
2996       DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule();
2997     }
2998 
getDefaultInstance()2999     public static com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule getDefaultInstance() {
3000       return DEFAULT_INSTANCE;
3001     }
3002 
3003     private static final com.google.protobuf.Parser<PolicyRule> PARSER =
3004         new com.google.protobuf.AbstractParser<PolicyRule>() {
3005           @java.lang.Override
3006           public PolicyRule parsePartialFrom(
3007               com.google.protobuf.CodedInputStream input,
3008               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3009               throws com.google.protobuf.InvalidProtocolBufferException {
3010             Builder builder = newBuilder();
3011             try {
3012               builder.mergeFrom(input, extensionRegistry);
3013             } catch (com.google.protobuf.InvalidProtocolBufferException e) {
3014               throw e.setUnfinishedMessage(builder.buildPartial());
3015             } catch (com.google.protobuf.UninitializedMessageException e) {
3016               throw e.asInvalidProtocolBufferException()
3017                   .setUnfinishedMessage(builder.buildPartial());
3018             } catch (java.io.IOException e) {
3019               throw new com.google.protobuf.InvalidProtocolBufferException(e)
3020                   .setUnfinishedMessage(builder.buildPartial());
3021             }
3022             return builder.buildPartial();
3023           }
3024         };
3025 
parser()3026     public static com.google.protobuf.Parser<PolicyRule> parser() {
3027       return PARSER;
3028     }
3029 
3030     @java.lang.Override
getParserForType()3031     public com.google.protobuf.Parser<PolicyRule> getParserForType() {
3032       return PARSER;
3033     }
3034 
3035     @java.lang.Override
getDefaultInstanceForType()3036     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule getDefaultInstanceForType() {
3037       return DEFAULT_INSTANCE;
3038     }
3039   }
3040 
3041   public static final int ETAG_FIELD_NUMBER = 1;
3042 
3043   @SuppressWarnings("serial")
3044   private volatile java.lang.Object etag_ = "";
3045   /**
3046    *
3047    *
3048    * <pre>
3049    * An opaque tag indicating the current version of the `Policy`, used for
3050    * concurrency control.
3051    * This field is ignored if used in a `CreatePolicy` request.
3052    * When the `Policy` is returned from either a `GetPolicy` or a
3053    * `ListPolicies` request, this `etag` indicates the version of the
3054    * current `Policy` to use when executing a read-modify-write loop.
3055    * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3056    * `etag` will be unset.
3057    * </pre>
3058    *
3059    * <code>string etag = 1;</code>
3060    *
3061    * @return The etag.
3062    */
3063   @java.lang.Override
getEtag()3064   public java.lang.String getEtag() {
3065     java.lang.Object ref = etag_;
3066     if (ref instanceof java.lang.String) {
3067       return (java.lang.String) ref;
3068     } else {
3069       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
3070       java.lang.String s = bs.toStringUtf8();
3071       etag_ = s;
3072       return s;
3073     }
3074   }
3075   /**
3076    *
3077    *
3078    * <pre>
3079    * An opaque tag indicating the current version of the `Policy`, used for
3080    * concurrency control.
3081    * This field is ignored if used in a `CreatePolicy` request.
3082    * When the `Policy` is returned from either a `GetPolicy` or a
3083    * `ListPolicies` request, this `etag` indicates the version of the
3084    * current `Policy` to use when executing a read-modify-write loop.
3085    * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3086    * `etag` will be unset.
3087    * </pre>
3088    *
3089    * <code>string etag = 1;</code>
3090    *
3091    * @return The bytes for etag.
3092    */
3093   @java.lang.Override
getEtagBytes()3094   public com.google.protobuf.ByteString getEtagBytes() {
3095     java.lang.Object ref = etag_;
3096     if (ref instanceof java.lang.String) {
3097       com.google.protobuf.ByteString b =
3098           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
3099       etag_ = b;
3100       return b;
3101     } else {
3102       return (com.google.protobuf.ByteString) ref;
3103     }
3104   }
3105 
3106   public static final int UPDATE_TIME_FIELD_NUMBER = 2;
3107   private com.google.protobuf.Timestamp updateTime_;
3108   /**
3109    *
3110    *
3111    * <pre>
3112    * Output only. The time stamp this was previously updated. This
3113    * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3114    * made for that `Policy`.
3115    * </pre>
3116    *
3117    * <code>.google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3118    * </code>
3119    *
3120    * @return Whether the updateTime field is set.
3121    */
3122   @java.lang.Override
hasUpdateTime()3123   public boolean hasUpdateTime() {
3124     return updateTime_ != null;
3125   }
3126   /**
3127    *
3128    *
3129    * <pre>
3130    * Output only. The time stamp this was previously updated. This
3131    * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3132    * made for that `Policy`.
3133    * </pre>
3134    *
3135    * <code>.google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3136    * </code>
3137    *
3138    * @return The updateTime.
3139    */
3140   @java.lang.Override
getUpdateTime()3141   public com.google.protobuf.Timestamp getUpdateTime() {
3142     return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_;
3143   }
3144   /**
3145    *
3146    *
3147    * <pre>
3148    * Output only. The time stamp this was previously updated. This
3149    * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3150    * made for that `Policy`.
3151    * </pre>
3152    *
3153    * <code>.google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3154    * </code>
3155    */
3156   @java.lang.Override
getUpdateTimeOrBuilder()3157   public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
3158     return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_;
3159   }
3160 
3161   public static final int RULES_FIELD_NUMBER = 3;
3162 
3163   @SuppressWarnings("serial")
3164   private java.util.List<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> rules_;
3165   /**
3166    *
3167    *
3168    * <pre>
3169    * Up to 10 PolicyRules are allowed.
3170    * In Policies for boolean constraints, the following requirements apply:
3171    *   - There must be one and only one PolicyRule where condition is unset.
3172    *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
3173    *     of the PolicyRule without a condition.
3174    *   - During policy evaluation, PolicyRules with conditions that are
3175    *     true for a target resource take precedence.
3176    * </pre>
3177    *
3178    * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
3179    */
3180   @java.lang.Override
getRulesList()3181   public java.util.List<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> getRulesList() {
3182     return rules_;
3183   }
3184   /**
3185    *
3186    *
3187    * <pre>
3188    * Up to 10 PolicyRules are allowed.
3189    * In Policies for boolean constraints, the following requirements apply:
3190    *   - There must be one and only one PolicyRule where condition is unset.
3191    *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
3192    *     of the PolicyRule without a condition.
3193    *   - During policy evaluation, PolicyRules with conditions that are
3194    *     true for a target resource take precedence.
3195    * </pre>
3196    *
3197    * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
3198    */
3199   @java.lang.Override
3200   public java.util.List<? extends com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder>
getRulesOrBuilderList()3201       getRulesOrBuilderList() {
3202     return rules_;
3203   }
3204   /**
3205    *
3206    *
3207    * <pre>
3208    * Up to 10 PolicyRules are allowed.
3209    * In Policies for boolean constraints, the following requirements apply:
3210    *   - There must be one and only one PolicyRule where condition is unset.
3211    *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
3212    *     of the PolicyRule without a condition.
3213    *   - During policy evaluation, PolicyRules with conditions that are
3214    *     true for a target resource take precedence.
3215    * </pre>
3216    *
3217    * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
3218    */
3219   @java.lang.Override
getRulesCount()3220   public int getRulesCount() {
3221     return rules_.size();
3222   }
3223   /**
3224    *
3225    *
3226    * <pre>
3227    * Up to 10 PolicyRules are allowed.
3228    * In Policies for boolean constraints, the following requirements apply:
3229    *   - There must be one and only one PolicyRule where condition is unset.
3230    *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
3231    *     of the PolicyRule without a condition.
3232    *   - During policy evaluation, PolicyRules with conditions that are
3233    *     true for a target resource take precedence.
3234    * </pre>
3235    *
3236    * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
3237    */
3238   @java.lang.Override
getRules(int index)3239   public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule getRules(int index) {
3240     return rules_.get(index);
3241   }
3242   /**
3243    *
3244    *
3245    * <pre>
3246    * Up to 10 PolicyRules are allowed.
3247    * In Policies for boolean constraints, the following requirements apply:
3248    *   - There must be one and only one PolicyRule where condition is unset.
3249    *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
3250    *     of the PolicyRule without a condition.
3251    *   - During policy evaluation, PolicyRules with conditions that are
3252    *     true for a target resource take precedence.
3253    * </pre>
3254    *
3255    * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
3256    */
3257   @java.lang.Override
getRulesOrBuilder(int index)3258   public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder getRulesOrBuilder(int index) {
3259     return rules_.get(index);
3260   }
3261 
3262   public static final int INHERIT_FROM_PARENT_FIELD_NUMBER = 4;
3263   private boolean inheritFromParent_ = false;
3264   /**
3265    *
3266    *
3267    * <pre>
3268    * Determines the inheritance behavior for this `Policy`.
3269    * If `inherit_from_parent` is true, PolicyRules set higher up in the
3270    * hierarchy (up to the closest root) are inherited and present in the
3271    * effective policy. If it is false, then no rules are inherited, and this
3272    * Policy becomes the new root for evaluation.
3273    * This field can be set only for Policies which configure list constraints.
3274    * </pre>
3275    *
3276    * <code>bool inherit_from_parent = 4;</code>
3277    *
3278    * @return The inheritFromParent.
3279    */
3280   @java.lang.Override
getInheritFromParent()3281   public boolean getInheritFromParent() {
3282     return inheritFromParent_;
3283   }
3284 
3285   public static final int RESET_FIELD_NUMBER = 5;
3286   private boolean reset_ = false;
3287   /**
3288    *
3289    *
3290    * <pre>
3291    * Ignores policies set above this resource and restores the
3292    * `constraint_default` enforcement behavior of the specific `Constraint` at
3293    * this resource.
3294    * This field can be set in policies for either list or boolean
3295    * constraints. If set, `rules` must be empty and `inherit_from_parent`
3296    * must be set to false.
3297    * </pre>
3298    *
3299    * <code>bool reset = 5;</code>
3300    *
3301    * @return The reset.
3302    */
3303   @java.lang.Override
getReset()3304   public boolean getReset() {
3305     return reset_;
3306   }
3307 
3308   private byte memoizedIsInitialized = -1;
3309 
3310   @java.lang.Override
isInitialized()3311   public final boolean isInitialized() {
3312     byte isInitialized = memoizedIsInitialized;
3313     if (isInitialized == 1) return true;
3314     if (isInitialized == 0) return false;
3315 
3316     memoizedIsInitialized = 1;
3317     return true;
3318   }
3319 
3320   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)3321   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
3322     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) {
3323       com.google.protobuf.GeneratedMessageV3.writeString(output, 1, etag_);
3324     }
3325     if (updateTime_ != null) {
3326       output.writeMessage(2, getUpdateTime());
3327     }
3328     for (int i = 0; i < rules_.size(); i++) {
3329       output.writeMessage(3, rules_.get(i));
3330     }
3331     if (inheritFromParent_ != false) {
3332       output.writeBool(4, inheritFromParent_);
3333     }
3334     if (reset_ != false) {
3335       output.writeBool(5, reset_);
3336     }
3337     getUnknownFields().writeTo(output);
3338   }
3339 
3340   @java.lang.Override
getSerializedSize()3341   public int getSerializedSize() {
3342     int size = memoizedSize;
3343     if (size != -1) return size;
3344 
3345     size = 0;
3346     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) {
3347       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, etag_);
3348     }
3349     if (updateTime_ != null) {
3350       size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateTime());
3351     }
3352     for (int i = 0; i < rules_.size(); i++) {
3353       size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, rules_.get(i));
3354     }
3355     if (inheritFromParent_ != false) {
3356       size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, inheritFromParent_);
3357     }
3358     if (reset_ != false) {
3359       size += com.google.protobuf.CodedOutputStream.computeBoolSize(5, reset_);
3360     }
3361     size += getUnknownFields().getSerializedSize();
3362     memoizedSize = size;
3363     return size;
3364   }
3365 
3366   @java.lang.Override
equals(final java.lang.Object obj)3367   public boolean equals(final java.lang.Object obj) {
3368     if (obj == this) {
3369       return true;
3370     }
3371     if (!(obj instanceof com.google.cloud.orgpolicy.v2.PolicySpec)) {
3372       return super.equals(obj);
3373     }
3374     com.google.cloud.orgpolicy.v2.PolicySpec other = (com.google.cloud.orgpolicy.v2.PolicySpec) obj;
3375 
3376     if (!getEtag().equals(other.getEtag())) return false;
3377     if (hasUpdateTime() != other.hasUpdateTime()) return false;
3378     if (hasUpdateTime()) {
3379       if (!getUpdateTime().equals(other.getUpdateTime())) return false;
3380     }
3381     if (!getRulesList().equals(other.getRulesList())) return false;
3382     if (getInheritFromParent() != other.getInheritFromParent()) return false;
3383     if (getReset() != other.getReset()) return false;
3384     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
3385     return true;
3386   }
3387 
3388   @java.lang.Override
hashCode()3389   public int hashCode() {
3390     if (memoizedHashCode != 0) {
3391       return memoizedHashCode;
3392     }
3393     int hash = 41;
3394     hash = (19 * hash) + getDescriptor().hashCode();
3395     hash = (37 * hash) + ETAG_FIELD_NUMBER;
3396     hash = (53 * hash) + getEtag().hashCode();
3397     if (hasUpdateTime()) {
3398       hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER;
3399       hash = (53 * hash) + getUpdateTime().hashCode();
3400     }
3401     if (getRulesCount() > 0) {
3402       hash = (37 * hash) + RULES_FIELD_NUMBER;
3403       hash = (53 * hash) + getRulesList().hashCode();
3404     }
3405     hash = (37 * hash) + INHERIT_FROM_PARENT_FIELD_NUMBER;
3406     hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getInheritFromParent());
3407     hash = (37 * hash) + RESET_FIELD_NUMBER;
3408     hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReset());
3409     hash = (29 * hash) + getUnknownFields().hashCode();
3410     memoizedHashCode = hash;
3411     return hash;
3412   }
3413 
parseFrom(java.nio.ByteBuffer data)3414   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(java.nio.ByteBuffer data)
3415       throws com.google.protobuf.InvalidProtocolBufferException {
3416     return PARSER.parseFrom(data);
3417   }
3418 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3419   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3420       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3421       throws com.google.protobuf.InvalidProtocolBufferException {
3422     return PARSER.parseFrom(data, extensionRegistry);
3423   }
3424 
parseFrom( com.google.protobuf.ByteString data)3425   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3426       com.google.protobuf.ByteString data)
3427       throws com.google.protobuf.InvalidProtocolBufferException {
3428     return PARSER.parseFrom(data);
3429   }
3430 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3431   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3432       com.google.protobuf.ByteString data,
3433       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3434       throws com.google.protobuf.InvalidProtocolBufferException {
3435     return PARSER.parseFrom(data, extensionRegistry);
3436   }
3437 
parseFrom(byte[] data)3438   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(byte[] data)
3439       throws com.google.protobuf.InvalidProtocolBufferException {
3440     return PARSER.parseFrom(data);
3441   }
3442 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3443   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3444       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3445       throws com.google.protobuf.InvalidProtocolBufferException {
3446     return PARSER.parseFrom(data, extensionRegistry);
3447   }
3448 
parseFrom(java.io.InputStream input)3449   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(java.io.InputStream input)
3450       throws java.io.IOException {
3451     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
3452   }
3453 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3454   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3455       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3456       throws java.io.IOException {
3457     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
3458         PARSER, input, extensionRegistry);
3459   }
3460 
parseDelimitedFrom( java.io.InputStream input)3461   public static com.google.cloud.orgpolicy.v2.PolicySpec parseDelimitedFrom(
3462       java.io.InputStream input) throws java.io.IOException {
3463     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
3464   }
3465 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3466   public static com.google.cloud.orgpolicy.v2.PolicySpec parseDelimitedFrom(
3467       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3468       throws java.io.IOException {
3469     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
3470         PARSER, input, extensionRegistry);
3471   }
3472 
parseFrom( com.google.protobuf.CodedInputStream input)3473   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3474       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
3475     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
3476   }
3477 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3478   public static com.google.cloud.orgpolicy.v2.PolicySpec parseFrom(
3479       com.google.protobuf.CodedInputStream input,
3480       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3481       throws java.io.IOException {
3482     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
3483         PARSER, input, extensionRegistry);
3484   }
3485 
3486   @java.lang.Override
newBuilderForType()3487   public Builder newBuilderForType() {
3488     return newBuilder();
3489   }
3490 
newBuilder()3491   public static Builder newBuilder() {
3492     return DEFAULT_INSTANCE.toBuilder();
3493   }
3494 
newBuilder(com.google.cloud.orgpolicy.v2.PolicySpec prototype)3495   public static Builder newBuilder(com.google.cloud.orgpolicy.v2.PolicySpec prototype) {
3496     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
3497   }
3498 
3499   @java.lang.Override
toBuilder()3500   public Builder toBuilder() {
3501     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
3502   }
3503 
3504   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)3505   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
3506     Builder builder = new Builder(parent);
3507     return builder;
3508   }
3509   /**
3510    *
3511    *
3512    * <pre>
3513    * Defines a Cloud Organization `PolicySpec` which is used to specify
3514    * `Constraints` for configurations of Cloud Platform resources.
3515    * </pre>
3516    *
3517    * Protobuf type {@code google.cloud.orgpolicy.v2.PolicySpec}
3518    */
3519   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
3520       implements
3521       // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v2.PolicySpec)
3522       com.google.cloud.orgpolicy.v2.PolicySpecOrBuilder {
getDescriptor()3523     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
3524       return com.google.cloud.orgpolicy.v2.OrgPolicyProto
3525           .internal_static_google_cloud_orgpolicy_v2_PolicySpec_descriptor;
3526     }
3527 
3528     @java.lang.Override
3529     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()3530         internalGetFieldAccessorTable() {
3531       return com.google.cloud.orgpolicy.v2.OrgPolicyProto
3532           .internal_static_google_cloud_orgpolicy_v2_PolicySpec_fieldAccessorTable
3533           .ensureFieldAccessorsInitialized(
3534               com.google.cloud.orgpolicy.v2.PolicySpec.class,
3535               com.google.cloud.orgpolicy.v2.PolicySpec.Builder.class);
3536     }
3537 
3538     // Construct using com.google.cloud.orgpolicy.v2.PolicySpec.newBuilder()
Builder()3539     private Builder() {}
3540 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)3541     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
3542       super(parent);
3543     }
3544 
3545     @java.lang.Override
clear()3546     public Builder clear() {
3547       super.clear();
3548       bitField0_ = 0;
3549       etag_ = "";
3550       updateTime_ = null;
3551       if (updateTimeBuilder_ != null) {
3552         updateTimeBuilder_.dispose();
3553         updateTimeBuilder_ = null;
3554       }
3555       if (rulesBuilder_ == null) {
3556         rules_ = java.util.Collections.emptyList();
3557       } else {
3558         rules_ = null;
3559         rulesBuilder_.clear();
3560       }
3561       bitField0_ = (bitField0_ & ~0x00000004);
3562       inheritFromParent_ = false;
3563       reset_ = false;
3564       return this;
3565     }
3566 
3567     @java.lang.Override
getDescriptorForType()3568     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
3569       return com.google.cloud.orgpolicy.v2.OrgPolicyProto
3570           .internal_static_google_cloud_orgpolicy_v2_PolicySpec_descriptor;
3571     }
3572 
3573     @java.lang.Override
getDefaultInstanceForType()3574     public com.google.cloud.orgpolicy.v2.PolicySpec getDefaultInstanceForType() {
3575       return com.google.cloud.orgpolicy.v2.PolicySpec.getDefaultInstance();
3576     }
3577 
3578     @java.lang.Override
build()3579     public com.google.cloud.orgpolicy.v2.PolicySpec build() {
3580       com.google.cloud.orgpolicy.v2.PolicySpec result = buildPartial();
3581       if (!result.isInitialized()) {
3582         throw newUninitializedMessageException(result);
3583       }
3584       return result;
3585     }
3586 
3587     @java.lang.Override
buildPartial()3588     public com.google.cloud.orgpolicy.v2.PolicySpec buildPartial() {
3589       com.google.cloud.orgpolicy.v2.PolicySpec result =
3590           new com.google.cloud.orgpolicy.v2.PolicySpec(this);
3591       buildPartialRepeatedFields(result);
3592       if (bitField0_ != 0) {
3593         buildPartial0(result);
3594       }
3595       onBuilt();
3596       return result;
3597     }
3598 
buildPartialRepeatedFields(com.google.cloud.orgpolicy.v2.PolicySpec result)3599     private void buildPartialRepeatedFields(com.google.cloud.orgpolicy.v2.PolicySpec result) {
3600       if (rulesBuilder_ == null) {
3601         if (((bitField0_ & 0x00000004) != 0)) {
3602           rules_ = java.util.Collections.unmodifiableList(rules_);
3603           bitField0_ = (bitField0_ & ~0x00000004);
3604         }
3605         result.rules_ = rules_;
3606       } else {
3607         result.rules_ = rulesBuilder_.build();
3608       }
3609     }
3610 
buildPartial0(com.google.cloud.orgpolicy.v2.PolicySpec result)3611     private void buildPartial0(com.google.cloud.orgpolicy.v2.PolicySpec result) {
3612       int from_bitField0_ = bitField0_;
3613       if (((from_bitField0_ & 0x00000001) != 0)) {
3614         result.etag_ = etag_;
3615       }
3616       if (((from_bitField0_ & 0x00000002) != 0)) {
3617         result.updateTime_ = updateTimeBuilder_ == null ? updateTime_ : updateTimeBuilder_.build();
3618       }
3619       if (((from_bitField0_ & 0x00000008) != 0)) {
3620         result.inheritFromParent_ = inheritFromParent_;
3621       }
3622       if (((from_bitField0_ & 0x00000010) != 0)) {
3623         result.reset_ = reset_;
3624       }
3625     }
3626 
3627     @java.lang.Override
clone()3628     public Builder clone() {
3629       return super.clone();
3630     }
3631 
3632     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)3633     public Builder setField(
3634         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
3635       return super.setField(field, value);
3636     }
3637 
3638     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)3639     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
3640       return super.clearField(field);
3641     }
3642 
3643     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)3644     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
3645       return super.clearOneof(oneof);
3646     }
3647 
3648     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)3649     public Builder setRepeatedField(
3650         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
3651       return super.setRepeatedField(field, index, value);
3652     }
3653 
3654     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)3655     public Builder addRepeatedField(
3656         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
3657       return super.addRepeatedField(field, value);
3658     }
3659 
3660     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)3661     public Builder mergeFrom(com.google.protobuf.Message other) {
3662       if (other instanceof com.google.cloud.orgpolicy.v2.PolicySpec) {
3663         return mergeFrom((com.google.cloud.orgpolicy.v2.PolicySpec) other);
3664       } else {
3665         super.mergeFrom(other);
3666         return this;
3667       }
3668     }
3669 
mergeFrom(com.google.cloud.orgpolicy.v2.PolicySpec other)3670     public Builder mergeFrom(com.google.cloud.orgpolicy.v2.PolicySpec other) {
3671       if (other == com.google.cloud.orgpolicy.v2.PolicySpec.getDefaultInstance()) return this;
3672       if (!other.getEtag().isEmpty()) {
3673         etag_ = other.etag_;
3674         bitField0_ |= 0x00000001;
3675         onChanged();
3676       }
3677       if (other.hasUpdateTime()) {
3678         mergeUpdateTime(other.getUpdateTime());
3679       }
3680       if (rulesBuilder_ == null) {
3681         if (!other.rules_.isEmpty()) {
3682           if (rules_.isEmpty()) {
3683             rules_ = other.rules_;
3684             bitField0_ = (bitField0_ & ~0x00000004);
3685           } else {
3686             ensureRulesIsMutable();
3687             rules_.addAll(other.rules_);
3688           }
3689           onChanged();
3690         }
3691       } else {
3692         if (!other.rules_.isEmpty()) {
3693           if (rulesBuilder_.isEmpty()) {
3694             rulesBuilder_.dispose();
3695             rulesBuilder_ = null;
3696             rules_ = other.rules_;
3697             bitField0_ = (bitField0_ & ~0x00000004);
3698             rulesBuilder_ =
3699                 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
3700                     ? getRulesFieldBuilder()
3701                     : null;
3702           } else {
3703             rulesBuilder_.addAllMessages(other.rules_);
3704           }
3705         }
3706       }
3707       if (other.getInheritFromParent() != false) {
3708         setInheritFromParent(other.getInheritFromParent());
3709       }
3710       if (other.getReset() != false) {
3711         setReset(other.getReset());
3712       }
3713       this.mergeUnknownFields(other.getUnknownFields());
3714       onChanged();
3715       return this;
3716     }
3717 
3718     @java.lang.Override
isInitialized()3719     public final boolean isInitialized() {
3720       return true;
3721     }
3722 
3723     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)3724     public Builder mergeFrom(
3725         com.google.protobuf.CodedInputStream input,
3726         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3727         throws java.io.IOException {
3728       if (extensionRegistry == null) {
3729         throw new java.lang.NullPointerException();
3730       }
3731       try {
3732         boolean done = false;
3733         while (!done) {
3734           int tag = input.readTag();
3735           switch (tag) {
3736             case 0:
3737               done = true;
3738               break;
3739             case 10:
3740               {
3741                 etag_ = input.readStringRequireUtf8();
3742                 bitField0_ |= 0x00000001;
3743                 break;
3744               } // case 10
3745             case 18:
3746               {
3747                 input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry);
3748                 bitField0_ |= 0x00000002;
3749                 break;
3750               } // case 18
3751             case 26:
3752               {
3753                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule m =
3754                     input.readMessage(
3755                         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.parser(),
3756                         extensionRegistry);
3757                 if (rulesBuilder_ == null) {
3758                   ensureRulesIsMutable();
3759                   rules_.add(m);
3760                 } else {
3761                   rulesBuilder_.addMessage(m);
3762                 }
3763                 break;
3764               } // case 26
3765             case 32:
3766               {
3767                 inheritFromParent_ = input.readBool();
3768                 bitField0_ |= 0x00000008;
3769                 break;
3770               } // case 32
3771             case 40:
3772               {
3773                 reset_ = input.readBool();
3774                 bitField0_ |= 0x00000010;
3775                 break;
3776               } // case 40
3777             default:
3778               {
3779                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
3780                   done = true; // was an endgroup tag
3781                 }
3782                 break;
3783               } // default:
3784           } // switch (tag)
3785         } // while (!done)
3786       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
3787         throw e.unwrapIOException();
3788       } finally {
3789         onChanged();
3790       } // finally
3791       return this;
3792     }
3793 
3794     private int bitField0_;
3795 
3796     private java.lang.Object etag_ = "";
3797     /**
3798      *
3799      *
3800      * <pre>
3801      * An opaque tag indicating the current version of the `Policy`, used for
3802      * concurrency control.
3803      * This field is ignored if used in a `CreatePolicy` request.
3804      * When the `Policy` is returned from either a `GetPolicy` or a
3805      * `ListPolicies` request, this `etag` indicates the version of the
3806      * current `Policy` to use when executing a read-modify-write loop.
3807      * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3808      * `etag` will be unset.
3809      * </pre>
3810      *
3811      * <code>string etag = 1;</code>
3812      *
3813      * @return The etag.
3814      */
getEtag()3815     public java.lang.String getEtag() {
3816       java.lang.Object ref = etag_;
3817       if (!(ref instanceof java.lang.String)) {
3818         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
3819         java.lang.String s = bs.toStringUtf8();
3820         etag_ = s;
3821         return s;
3822       } else {
3823         return (java.lang.String) ref;
3824       }
3825     }
3826     /**
3827      *
3828      *
3829      * <pre>
3830      * An opaque tag indicating the current version of the `Policy`, used for
3831      * concurrency control.
3832      * This field is ignored if used in a `CreatePolicy` request.
3833      * When the `Policy` is returned from either a `GetPolicy` or a
3834      * `ListPolicies` request, this `etag` indicates the version of the
3835      * current `Policy` to use when executing a read-modify-write loop.
3836      * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3837      * `etag` will be unset.
3838      * </pre>
3839      *
3840      * <code>string etag = 1;</code>
3841      *
3842      * @return The bytes for etag.
3843      */
getEtagBytes()3844     public com.google.protobuf.ByteString getEtagBytes() {
3845       java.lang.Object ref = etag_;
3846       if (ref instanceof String) {
3847         com.google.protobuf.ByteString b =
3848             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
3849         etag_ = b;
3850         return b;
3851       } else {
3852         return (com.google.protobuf.ByteString) ref;
3853       }
3854     }
3855     /**
3856      *
3857      *
3858      * <pre>
3859      * An opaque tag indicating the current version of the `Policy`, used for
3860      * concurrency control.
3861      * This field is ignored if used in a `CreatePolicy` request.
3862      * When the `Policy` is returned from either a `GetPolicy` or a
3863      * `ListPolicies` request, this `etag` indicates the version of the
3864      * current `Policy` to use when executing a read-modify-write loop.
3865      * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3866      * `etag` will be unset.
3867      * </pre>
3868      *
3869      * <code>string etag = 1;</code>
3870      *
3871      * @param value The etag to set.
3872      * @return This builder for chaining.
3873      */
setEtag(java.lang.String value)3874     public Builder setEtag(java.lang.String value) {
3875       if (value == null) {
3876         throw new NullPointerException();
3877       }
3878       etag_ = value;
3879       bitField0_ |= 0x00000001;
3880       onChanged();
3881       return this;
3882     }
3883     /**
3884      *
3885      *
3886      * <pre>
3887      * An opaque tag indicating the current version of the `Policy`, used for
3888      * concurrency control.
3889      * This field is ignored if used in a `CreatePolicy` request.
3890      * When the `Policy` is returned from either a `GetPolicy` or a
3891      * `ListPolicies` request, this `etag` indicates the version of the
3892      * current `Policy` to use when executing a read-modify-write loop.
3893      * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3894      * `etag` will be unset.
3895      * </pre>
3896      *
3897      * <code>string etag = 1;</code>
3898      *
3899      * @return This builder for chaining.
3900      */
clearEtag()3901     public Builder clearEtag() {
3902       etag_ = getDefaultInstance().getEtag();
3903       bitField0_ = (bitField0_ & ~0x00000001);
3904       onChanged();
3905       return this;
3906     }
3907     /**
3908      *
3909      *
3910      * <pre>
3911      * An opaque tag indicating the current version of the `Policy`, used for
3912      * concurrency control.
3913      * This field is ignored if used in a `CreatePolicy` request.
3914      * When the `Policy` is returned from either a `GetPolicy` or a
3915      * `ListPolicies` request, this `etag` indicates the version of the
3916      * current `Policy` to use when executing a read-modify-write loop.
3917      * When the `Policy` is returned from a `GetEffectivePolicy` request, the
3918      * `etag` will be unset.
3919      * </pre>
3920      *
3921      * <code>string etag = 1;</code>
3922      *
3923      * @param value The bytes for etag to set.
3924      * @return This builder for chaining.
3925      */
setEtagBytes(com.google.protobuf.ByteString value)3926     public Builder setEtagBytes(com.google.protobuf.ByteString value) {
3927       if (value == null) {
3928         throw new NullPointerException();
3929       }
3930       checkByteStringIsUtf8(value);
3931       etag_ = value;
3932       bitField0_ |= 0x00000001;
3933       onChanged();
3934       return this;
3935     }
3936 
3937     private com.google.protobuf.Timestamp updateTime_;
3938     private com.google.protobuf.SingleFieldBuilderV3<
3939             com.google.protobuf.Timestamp,
3940             com.google.protobuf.Timestamp.Builder,
3941             com.google.protobuf.TimestampOrBuilder>
3942         updateTimeBuilder_;
3943     /**
3944      *
3945      *
3946      * <pre>
3947      * Output only. The time stamp this was previously updated. This
3948      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3949      * made for that `Policy`.
3950      * </pre>
3951      *
3952      * <code>
3953      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3954      * </code>
3955      *
3956      * @return Whether the updateTime field is set.
3957      */
hasUpdateTime()3958     public boolean hasUpdateTime() {
3959       return ((bitField0_ & 0x00000002) != 0);
3960     }
3961     /**
3962      *
3963      *
3964      * <pre>
3965      * Output only. The time stamp this was previously updated. This
3966      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3967      * made for that `Policy`.
3968      * </pre>
3969      *
3970      * <code>
3971      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3972      * </code>
3973      *
3974      * @return The updateTime.
3975      */
getUpdateTime()3976     public com.google.protobuf.Timestamp getUpdateTime() {
3977       if (updateTimeBuilder_ == null) {
3978         return updateTime_ == null
3979             ? com.google.protobuf.Timestamp.getDefaultInstance()
3980             : updateTime_;
3981       } else {
3982         return updateTimeBuilder_.getMessage();
3983       }
3984     }
3985     /**
3986      *
3987      *
3988      * <pre>
3989      * Output only. The time stamp this was previously updated. This
3990      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
3991      * made for that `Policy`.
3992      * </pre>
3993      *
3994      * <code>
3995      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
3996      * </code>
3997      */
setUpdateTime(com.google.protobuf.Timestamp value)3998     public Builder setUpdateTime(com.google.protobuf.Timestamp value) {
3999       if (updateTimeBuilder_ == null) {
4000         if (value == null) {
4001           throw new NullPointerException();
4002         }
4003         updateTime_ = value;
4004       } else {
4005         updateTimeBuilder_.setMessage(value);
4006       }
4007       bitField0_ |= 0x00000002;
4008       onChanged();
4009       return this;
4010     }
4011     /**
4012      *
4013      *
4014      * <pre>
4015      * Output only. The time stamp this was previously updated. This
4016      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4017      * made for that `Policy`.
4018      * </pre>
4019      *
4020      * <code>
4021      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4022      * </code>
4023      */
setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue)4024     public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) {
4025       if (updateTimeBuilder_ == null) {
4026         updateTime_ = builderForValue.build();
4027       } else {
4028         updateTimeBuilder_.setMessage(builderForValue.build());
4029       }
4030       bitField0_ |= 0x00000002;
4031       onChanged();
4032       return this;
4033     }
4034     /**
4035      *
4036      *
4037      * <pre>
4038      * Output only. The time stamp this was previously updated. This
4039      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4040      * made for that `Policy`.
4041      * </pre>
4042      *
4043      * <code>
4044      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4045      * </code>
4046      */
mergeUpdateTime(com.google.protobuf.Timestamp value)4047     public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) {
4048       if (updateTimeBuilder_ == null) {
4049         if (((bitField0_ & 0x00000002) != 0)
4050             && updateTime_ != null
4051             && updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) {
4052           getUpdateTimeBuilder().mergeFrom(value);
4053         } else {
4054           updateTime_ = value;
4055         }
4056       } else {
4057         updateTimeBuilder_.mergeFrom(value);
4058       }
4059       bitField0_ |= 0x00000002;
4060       onChanged();
4061       return this;
4062     }
4063     /**
4064      *
4065      *
4066      * <pre>
4067      * Output only. The time stamp this was previously updated. This
4068      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4069      * made for that `Policy`.
4070      * </pre>
4071      *
4072      * <code>
4073      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4074      * </code>
4075      */
clearUpdateTime()4076     public Builder clearUpdateTime() {
4077       bitField0_ = (bitField0_ & ~0x00000002);
4078       updateTime_ = null;
4079       if (updateTimeBuilder_ != null) {
4080         updateTimeBuilder_.dispose();
4081         updateTimeBuilder_ = null;
4082       }
4083       onChanged();
4084       return this;
4085     }
4086     /**
4087      *
4088      *
4089      * <pre>
4090      * Output only. The time stamp this was previously updated. This
4091      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4092      * made for that `Policy`.
4093      * </pre>
4094      *
4095      * <code>
4096      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4097      * </code>
4098      */
getUpdateTimeBuilder()4099     public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() {
4100       bitField0_ |= 0x00000002;
4101       onChanged();
4102       return getUpdateTimeFieldBuilder().getBuilder();
4103     }
4104     /**
4105      *
4106      *
4107      * <pre>
4108      * Output only. The time stamp this was previously updated. This
4109      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4110      * made for that `Policy`.
4111      * </pre>
4112      *
4113      * <code>
4114      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4115      * </code>
4116      */
getUpdateTimeOrBuilder()4117     public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
4118       if (updateTimeBuilder_ != null) {
4119         return updateTimeBuilder_.getMessageOrBuilder();
4120       } else {
4121         return updateTime_ == null
4122             ? com.google.protobuf.Timestamp.getDefaultInstance()
4123             : updateTime_;
4124       }
4125     }
4126     /**
4127      *
4128      *
4129      * <pre>
4130      * Output only. The time stamp this was previously updated. This
4131      * represents the last time a call to `CreatePolicy` or `UpdatePolicy` was
4132      * made for that `Policy`.
4133      * </pre>
4134      *
4135      * <code>
4136      * .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
4137      * </code>
4138      */
4139     private com.google.protobuf.SingleFieldBuilderV3<
4140             com.google.protobuf.Timestamp,
4141             com.google.protobuf.Timestamp.Builder,
4142             com.google.protobuf.TimestampOrBuilder>
getUpdateTimeFieldBuilder()4143         getUpdateTimeFieldBuilder() {
4144       if (updateTimeBuilder_ == null) {
4145         updateTimeBuilder_ =
4146             new com.google.protobuf.SingleFieldBuilderV3<
4147                 com.google.protobuf.Timestamp,
4148                 com.google.protobuf.Timestamp.Builder,
4149                 com.google.protobuf.TimestampOrBuilder>(
4150                 getUpdateTime(), getParentForChildren(), isClean());
4151         updateTime_ = null;
4152       }
4153       return updateTimeBuilder_;
4154     }
4155 
4156     private java.util.List<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> rules_ =
4157         java.util.Collections.emptyList();
4158 
ensureRulesIsMutable()4159     private void ensureRulesIsMutable() {
4160       if (!((bitField0_ & 0x00000004) != 0)) {
4161         rules_ =
4162             new java.util.ArrayList<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule>(rules_);
4163         bitField0_ |= 0x00000004;
4164       }
4165     }
4166 
4167     private com.google.protobuf.RepeatedFieldBuilderV3<
4168             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule,
4169             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder,
4170             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder>
4171         rulesBuilder_;
4172 
4173     /**
4174      *
4175      *
4176      * <pre>
4177      * Up to 10 PolicyRules are allowed.
4178      * In Policies for boolean constraints, the following requirements apply:
4179      *   - There must be one and only one PolicyRule where condition is unset.
4180      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4181      *     of the PolicyRule without a condition.
4182      *   - During policy evaluation, PolicyRules with conditions that are
4183      *     true for a target resource take precedence.
4184      * </pre>
4185      *
4186      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4187      */
getRulesList()4188     public java.util.List<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> getRulesList() {
4189       if (rulesBuilder_ == null) {
4190         return java.util.Collections.unmodifiableList(rules_);
4191       } else {
4192         return rulesBuilder_.getMessageList();
4193       }
4194     }
4195     /**
4196      *
4197      *
4198      * <pre>
4199      * Up to 10 PolicyRules are allowed.
4200      * In Policies for boolean constraints, the following requirements apply:
4201      *   - There must be one and only one PolicyRule where condition is unset.
4202      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4203      *     of the PolicyRule without a condition.
4204      *   - During policy evaluation, PolicyRules with conditions that are
4205      *     true for a target resource take precedence.
4206      * </pre>
4207      *
4208      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4209      */
getRulesCount()4210     public int getRulesCount() {
4211       if (rulesBuilder_ == null) {
4212         return rules_.size();
4213       } else {
4214         return rulesBuilder_.getCount();
4215       }
4216     }
4217     /**
4218      *
4219      *
4220      * <pre>
4221      * Up to 10 PolicyRules are allowed.
4222      * In Policies for boolean constraints, the following requirements apply:
4223      *   - There must be one and only one PolicyRule where condition is unset.
4224      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4225      *     of the PolicyRule without a condition.
4226      *   - During policy evaluation, PolicyRules with conditions that are
4227      *     true for a target resource take precedence.
4228      * </pre>
4229      *
4230      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4231      */
getRules(int index)4232     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule getRules(int index) {
4233       if (rulesBuilder_ == null) {
4234         return rules_.get(index);
4235       } else {
4236         return rulesBuilder_.getMessage(index);
4237       }
4238     }
4239     /**
4240      *
4241      *
4242      * <pre>
4243      * Up to 10 PolicyRules are allowed.
4244      * In Policies for boolean constraints, the following requirements apply:
4245      *   - There must be one and only one PolicyRule where condition is unset.
4246      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4247      *     of the PolicyRule without a condition.
4248      *   - During policy evaluation, PolicyRules with conditions that are
4249      *     true for a target resource take precedence.
4250      * </pre>
4251      *
4252      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4253      */
setRules(int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value)4254     public Builder setRules(int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value) {
4255       if (rulesBuilder_ == null) {
4256         if (value == null) {
4257           throw new NullPointerException();
4258         }
4259         ensureRulesIsMutable();
4260         rules_.set(index, value);
4261         onChanged();
4262       } else {
4263         rulesBuilder_.setMessage(index, value);
4264       }
4265       return this;
4266     }
4267     /**
4268      *
4269      *
4270      * <pre>
4271      * Up to 10 PolicyRules are allowed.
4272      * In Policies for boolean constraints, the following requirements apply:
4273      *   - There must be one and only one PolicyRule where condition is unset.
4274      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4275      *     of the PolicyRule without a condition.
4276      *   - During policy evaluation, PolicyRules with conditions that are
4277      *     true for a target resource take precedence.
4278      * </pre>
4279      *
4280      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4281      */
setRules( int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue)4282     public Builder setRules(
4283         int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue) {
4284       if (rulesBuilder_ == null) {
4285         ensureRulesIsMutable();
4286         rules_.set(index, builderForValue.build());
4287         onChanged();
4288       } else {
4289         rulesBuilder_.setMessage(index, builderForValue.build());
4290       }
4291       return this;
4292     }
4293     /**
4294      *
4295      *
4296      * <pre>
4297      * Up to 10 PolicyRules are allowed.
4298      * In Policies for boolean constraints, the following requirements apply:
4299      *   - There must be one and only one PolicyRule where condition is unset.
4300      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4301      *     of the PolicyRule without a condition.
4302      *   - During policy evaluation, PolicyRules with conditions that are
4303      *     true for a target resource take precedence.
4304      * </pre>
4305      *
4306      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4307      */
addRules(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value)4308     public Builder addRules(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value) {
4309       if (rulesBuilder_ == null) {
4310         if (value == null) {
4311           throw new NullPointerException();
4312         }
4313         ensureRulesIsMutable();
4314         rules_.add(value);
4315         onChanged();
4316       } else {
4317         rulesBuilder_.addMessage(value);
4318       }
4319       return this;
4320     }
4321     /**
4322      *
4323      *
4324      * <pre>
4325      * Up to 10 PolicyRules are allowed.
4326      * In Policies for boolean constraints, the following requirements apply:
4327      *   - There must be one and only one PolicyRule where condition is unset.
4328      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4329      *     of the PolicyRule without a condition.
4330      *   - During policy evaluation, PolicyRules with conditions that are
4331      *     true for a target resource take precedence.
4332      * </pre>
4333      *
4334      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4335      */
addRules(int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value)4336     public Builder addRules(int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule value) {
4337       if (rulesBuilder_ == null) {
4338         if (value == null) {
4339           throw new NullPointerException();
4340         }
4341         ensureRulesIsMutable();
4342         rules_.add(index, value);
4343         onChanged();
4344       } else {
4345         rulesBuilder_.addMessage(index, value);
4346       }
4347       return this;
4348     }
4349     /**
4350      *
4351      *
4352      * <pre>
4353      * Up to 10 PolicyRules are allowed.
4354      * In Policies for boolean constraints, the following requirements apply:
4355      *   - There must be one and only one PolicyRule where condition is unset.
4356      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4357      *     of the PolicyRule without a condition.
4358      *   - During policy evaluation, PolicyRules with conditions that are
4359      *     true for a target resource take precedence.
4360      * </pre>
4361      *
4362      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4363      */
addRules( com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue)4364     public Builder addRules(
4365         com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue) {
4366       if (rulesBuilder_ == null) {
4367         ensureRulesIsMutable();
4368         rules_.add(builderForValue.build());
4369         onChanged();
4370       } else {
4371         rulesBuilder_.addMessage(builderForValue.build());
4372       }
4373       return this;
4374     }
4375     /**
4376      *
4377      *
4378      * <pre>
4379      * Up to 10 PolicyRules are allowed.
4380      * In Policies for boolean constraints, the following requirements apply:
4381      *   - There must be one and only one PolicyRule where condition is unset.
4382      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4383      *     of the PolicyRule without a condition.
4384      *   - During policy evaluation, PolicyRules with conditions that are
4385      *     true for a target resource take precedence.
4386      * </pre>
4387      *
4388      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4389      */
addRules( int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue)4390     public Builder addRules(
4391         int index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder builderForValue) {
4392       if (rulesBuilder_ == null) {
4393         ensureRulesIsMutable();
4394         rules_.add(index, builderForValue.build());
4395         onChanged();
4396       } else {
4397         rulesBuilder_.addMessage(index, builderForValue.build());
4398       }
4399       return this;
4400     }
4401     /**
4402      *
4403      *
4404      * <pre>
4405      * Up to 10 PolicyRules are allowed.
4406      * In Policies for boolean constraints, the following requirements apply:
4407      *   - There must be one and only one PolicyRule where condition is unset.
4408      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4409      *     of the PolicyRule without a condition.
4410      *   - During policy evaluation, PolicyRules with conditions that are
4411      *     true for a target resource take precedence.
4412      * </pre>
4413      *
4414      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4415      */
addAllRules( java.lang.Iterable<? extends com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> values)4416     public Builder addAllRules(
4417         java.lang.Iterable<? extends com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule> values) {
4418       if (rulesBuilder_ == null) {
4419         ensureRulesIsMutable();
4420         com.google.protobuf.AbstractMessageLite.Builder.addAll(values, rules_);
4421         onChanged();
4422       } else {
4423         rulesBuilder_.addAllMessages(values);
4424       }
4425       return this;
4426     }
4427     /**
4428      *
4429      *
4430      * <pre>
4431      * Up to 10 PolicyRules are allowed.
4432      * In Policies for boolean constraints, the following requirements apply:
4433      *   - There must be one and only one PolicyRule where condition is unset.
4434      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4435      *     of the PolicyRule without a condition.
4436      *   - During policy evaluation, PolicyRules with conditions that are
4437      *     true for a target resource take precedence.
4438      * </pre>
4439      *
4440      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4441      */
clearRules()4442     public Builder clearRules() {
4443       if (rulesBuilder_ == null) {
4444         rules_ = java.util.Collections.emptyList();
4445         bitField0_ = (bitField0_ & ~0x00000004);
4446         onChanged();
4447       } else {
4448         rulesBuilder_.clear();
4449       }
4450       return this;
4451     }
4452     /**
4453      *
4454      *
4455      * <pre>
4456      * Up to 10 PolicyRules are allowed.
4457      * In Policies for boolean constraints, the following requirements apply:
4458      *   - There must be one and only one PolicyRule where condition is unset.
4459      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4460      *     of the PolicyRule without a condition.
4461      *   - During policy evaluation, PolicyRules with conditions that are
4462      *     true for a target resource take precedence.
4463      * </pre>
4464      *
4465      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4466      */
removeRules(int index)4467     public Builder removeRules(int index) {
4468       if (rulesBuilder_ == null) {
4469         ensureRulesIsMutable();
4470         rules_.remove(index);
4471         onChanged();
4472       } else {
4473         rulesBuilder_.remove(index);
4474       }
4475       return this;
4476     }
4477     /**
4478      *
4479      *
4480      * <pre>
4481      * Up to 10 PolicyRules are allowed.
4482      * In Policies for boolean constraints, the following requirements apply:
4483      *   - There must be one and only one PolicyRule where condition is unset.
4484      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4485      *     of the PolicyRule without a condition.
4486      *   - During policy evaluation, PolicyRules with conditions that are
4487      *     true for a target resource take precedence.
4488      * </pre>
4489      *
4490      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4491      */
getRulesBuilder(int index)4492     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder getRulesBuilder(int index) {
4493       return getRulesFieldBuilder().getBuilder(index);
4494     }
4495     /**
4496      *
4497      *
4498      * <pre>
4499      * Up to 10 PolicyRules are allowed.
4500      * In Policies for boolean constraints, the following requirements apply:
4501      *   - There must be one and only one PolicyRule where condition is unset.
4502      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4503      *     of the PolicyRule without a condition.
4504      *   - During policy evaluation, PolicyRules with conditions that are
4505      *     true for a target resource take precedence.
4506      * </pre>
4507      *
4508      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4509      */
getRulesOrBuilder( int index)4510     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder getRulesOrBuilder(
4511         int index) {
4512       if (rulesBuilder_ == null) {
4513         return rules_.get(index);
4514       } else {
4515         return rulesBuilder_.getMessageOrBuilder(index);
4516       }
4517     }
4518     /**
4519      *
4520      *
4521      * <pre>
4522      * Up to 10 PolicyRules are allowed.
4523      * In Policies for boolean constraints, the following requirements apply:
4524      *   - There must be one and only one PolicyRule where condition is unset.
4525      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4526      *     of the PolicyRule without a condition.
4527      *   - During policy evaluation, PolicyRules with conditions that are
4528      *     true for a target resource take precedence.
4529      * </pre>
4530      *
4531      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4532      */
4533     public java.util.List<? extends com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder>
getRulesOrBuilderList()4534         getRulesOrBuilderList() {
4535       if (rulesBuilder_ != null) {
4536         return rulesBuilder_.getMessageOrBuilderList();
4537       } else {
4538         return java.util.Collections.unmodifiableList(rules_);
4539       }
4540     }
4541     /**
4542      *
4543      *
4544      * <pre>
4545      * Up to 10 PolicyRules are allowed.
4546      * In Policies for boolean constraints, the following requirements apply:
4547      *   - There must be one and only one PolicyRule where condition is unset.
4548      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4549      *     of the PolicyRule without a condition.
4550      *   - During policy evaluation, PolicyRules with conditions that are
4551      *     true for a target resource take precedence.
4552      * </pre>
4553      *
4554      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4555      */
addRulesBuilder()4556     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder addRulesBuilder() {
4557       return getRulesFieldBuilder()
4558           .addBuilder(com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.getDefaultInstance());
4559     }
4560     /**
4561      *
4562      *
4563      * <pre>
4564      * Up to 10 PolicyRules are allowed.
4565      * In Policies for boolean constraints, the following requirements apply:
4566      *   - There must be one and only one PolicyRule where condition is unset.
4567      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4568      *     of the PolicyRule without a condition.
4569      *   - During policy evaluation, PolicyRules with conditions that are
4570      *     true for a target resource take precedence.
4571      * </pre>
4572      *
4573      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4574      */
addRulesBuilder(int index)4575     public com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder addRulesBuilder(int index) {
4576       return getRulesFieldBuilder()
4577           .addBuilder(
4578               index, com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.getDefaultInstance());
4579     }
4580     /**
4581      *
4582      *
4583      * <pre>
4584      * Up to 10 PolicyRules are allowed.
4585      * In Policies for boolean constraints, the following requirements apply:
4586      *   - There must be one and only one PolicyRule where condition is unset.
4587      *   - BooleanPolicyRules with conditions must set `enforced` to the opposite
4588      *     of the PolicyRule without a condition.
4589      *   - During policy evaluation, PolicyRules with conditions that are
4590      *     true for a target resource take precedence.
4591      * </pre>
4592      *
4593      * <code>repeated .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule rules = 3;</code>
4594      */
4595     public java.util.List<com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder>
getRulesBuilderList()4596         getRulesBuilderList() {
4597       return getRulesFieldBuilder().getBuilderList();
4598     }
4599 
4600     private com.google.protobuf.RepeatedFieldBuilderV3<
4601             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule,
4602             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder,
4603             com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder>
getRulesFieldBuilder()4604         getRulesFieldBuilder() {
4605       if (rulesBuilder_ == null) {
4606         rulesBuilder_ =
4607             new com.google.protobuf.RepeatedFieldBuilderV3<
4608                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule,
4609                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder,
4610                 com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRuleOrBuilder>(
4611                 rules_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean());
4612         rules_ = null;
4613       }
4614       return rulesBuilder_;
4615     }
4616 
4617     private boolean inheritFromParent_;
4618     /**
4619      *
4620      *
4621      * <pre>
4622      * Determines the inheritance behavior for this `Policy`.
4623      * If `inherit_from_parent` is true, PolicyRules set higher up in the
4624      * hierarchy (up to the closest root) are inherited and present in the
4625      * effective policy. If it is false, then no rules are inherited, and this
4626      * Policy becomes the new root for evaluation.
4627      * This field can be set only for Policies which configure list constraints.
4628      * </pre>
4629      *
4630      * <code>bool inherit_from_parent = 4;</code>
4631      *
4632      * @return The inheritFromParent.
4633      */
4634     @java.lang.Override
getInheritFromParent()4635     public boolean getInheritFromParent() {
4636       return inheritFromParent_;
4637     }
4638     /**
4639      *
4640      *
4641      * <pre>
4642      * Determines the inheritance behavior for this `Policy`.
4643      * If `inherit_from_parent` is true, PolicyRules set higher up in the
4644      * hierarchy (up to the closest root) are inherited and present in the
4645      * effective policy. If it is false, then no rules are inherited, and this
4646      * Policy becomes the new root for evaluation.
4647      * This field can be set only for Policies which configure list constraints.
4648      * </pre>
4649      *
4650      * <code>bool inherit_from_parent = 4;</code>
4651      *
4652      * @param value The inheritFromParent to set.
4653      * @return This builder for chaining.
4654      */
setInheritFromParent(boolean value)4655     public Builder setInheritFromParent(boolean value) {
4656 
4657       inheritFromParent_ = value;
4658       bitField0_ |= 0x00000008;
4659       onChanged();
4660       return this;
4661     }
4662     /**
4663      *
4664      *
4665      * <pre>
4666      * Determines the inheritance behavior for this `Policy`.
4667      * If `inherit_from_parent` is true, PolicyRules set higher up in the
4668      * hierarchy (up to the closest root) are inherited and present in the
4669      * effective policy. If it is false, then no rules are inherited, and this
4670      * Policy becomes the new root for evaluation.
4671      * This field can be set only for Policies which configure list constraints.
4672      * </pre>
4673      *
4674      * <code>bool inherit_from_parent = 4;</code>
4675      *
4676      * @return This builder for chaining.
4677      */
clearInheritFromParent()4678     public Builder clearInheritFromParent() {
4679       bitField0_ = (bitField0_ & ~0x00000008);
4680       inheritFromParent_ = false;
4681       onChanged();
4682       return this;
4683     }
4684 
4685     private boolean reset_;
4686     /**
4687      *
4688      *
4689      * <pre>
4690      * Ignores policies set above this resource and restores the
4691      * `constraint_default` enforcement behavior of the specific `Constraint` at
4692      * this resource.
4693      * This field can be set in policies for either list or boolean
4694      * constraints. If set, `rules` must be empty and `inherit_from_parent`
4695      * must be set to false.
4696      * </pre>
4697      *
4698      * <code>bool reset = 5;</code>
4699      *
4700      * @return The reset.
4701      */
4702     @java.lang.Override
getReset()4703     public boolean getReset() {
4704       return reset_;
4705     }
4706     /**
4707      *
4708      *
4709      * <pre>
4710      * Ignores policies set above this resource and restores the
4711      * `constraint_default` enforcement behavior of the specific `Constraint` at
4712      * this resource.
4713      * This field can be set in policies for either list or boolean
4714      * constraints. If set, `rules` must be empty and `inherit_from_parent`
4715      * must be set to false.
4716      * </pre>
4717      *
4718      * <code>bool reset = 5;</code>
4719      *
4720      * @param value The reset to set.
4721      * @return This builder for chaining.
4722      */
setReset(boolean value)4723     public Builder setReset(boolean value) {
4724 
4725       reset_ = value;
4726       bitField0_ |= 0x00000010;
4727       onChanged();
4728       return this;
4729     }
4730     /**
4731      *
4732      *
4733      * <pre>
4734      * Ignores policies set above this resource and restores the
4735      * `constraint_default` enforcement behavior of the specific `Constraint` at
4736      * this resource.
4737      * This field can be set in policies for either list or boolean
4738      * constraints. If set, `rules` must be empty and `inherit_from_parent`
4739      * must be set to false.
4740      * </pre>
4741      *
4742      * <code>bool reset = 5;</code>
4743      *
4744      * @return This builder for chaining.
4745      */
clearReset()4746     public Builder clearReset() {
4747       bitField0_ = (bitField0_ & ~0x00000010);
4748       reset_ = false;
4749       onChanged();
4750       return this;
4751     }
4752 
4753     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)4754     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
4755       return super.setUnknownFields(unknownFields);
4756     }
4757 
4758     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)4759     public final Builder mergeUnknownFields(
4760         final com.google.protobuf.UnknownFieldSet unknownFields) {
4761       return super.mergeUnknownFields(unknownFields);
4762     }
4763 
4764     // @@protoc_insertion_point(builder_scope:google.cloud.orgpolicy.v2.PolicySpec)
4765   }
4766 
4767   // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v2.PolicySpec)
4768   private static final com.google.cloud.orgpolicy.v2.PolicySpec DEFAULT_INSTANCE;
4769 
4770   static {
4771     DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v2.PolicySpec();
4772   }
4773 
getDefaultInstance()4774   public static com.google.cloud.orgpolicy.v2.PolicySpec getDefaultInstance() {
4775     return DEFAULT_INSTANCE;
4776   }
4777 
4778   private static final com.google.protobuf.Parser<PolicySpec> PARSER =
4779       new com.google.protobuf.AbstractParser<PolicySpec>() {
4780         @java.lang.Override
4781         public PolicySpec parsePartialFrom(
4782             com.google.protobuf.CodedInputStream input,
4783             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
4784             throws com.google.protobuf.InvalidProtocolBufferException {
4785           Builder builder = newBuilder();
4786           try {
4787             builder.mergeFrom(input, extensionRegistry);
4788           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
4789             throw e.setUnfinishedMessage(builder.buildPartial());
4790           } catch (com.google.protobuf.UninitializedMessageException e) {
4791             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
4792           } catch (java.io.IOException e) {
4793             throw new com.google.protobuf.InvalidProtocolBufferException(e)
4794                 .setUnfinishedMessage(builder.buildPartial());
4795           }
4796           return builder.buildPartial();
4797         }
4798       };
4799 
parser()4800   public static com.google.protobuf.Parser<PolicySpec> parser() {
4801     return PARSER;
4802   }
4803 
4804   @java.lang.Override
getParserForType()4805   public com.google.protobuf.Parser<PolicySpec> getParserForType() {
4806     return PARSER;
4807   }
4808 
4809   @java.lang.Override
getDefaultInstanceForType()4810   public com.google.cloud.orgpolicy.v2.PolicySpec getDefaultInstanceForType() {
4811     return DEFAULT_INSTANCE;
4812   }
4813 }
4814