Class PolicySpec.PolicyRule.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder>
com.google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.Builder
All Implemented Interfaces:
PolicySpec.PolicyRuleOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
PolicySpec.PolicyRule

public static final class PolicySpec.PolicyRule.Builder extends com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder> implements PolicySpec.PolicyRuleOrBuilder
 A rule used to express this policy.
 
Protobuf type google.cloud.orgpolicy.v2.PolicySpec.PolicyRule
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder>
    • clear

      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder>
    • getDefaultInstanceForType

      public PolicySpec.PolicyRule getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public PolicySpec.PolicyRule build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public PolicySpec.PolicyRule buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • mergeFrom

      public PolicySpec.PolicyRule.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<PolicySpec.PolicyRule.Builder>
    • mergeFrom

    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage.Builder<PolicySpec.PolicyRule.Builder>
    • mergeFrom

      public PolicySpec.PolicyRule.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<PolicySpec.PolicyRule.Builder>
      Throws:
      IOException
    • getKindCase

      public PolicySpec.PolicyRule.KindCase getKindCase()
      Specified by:
      getKindCase in interface PolicySpec.PolicyRuleOrBuilder
    • clearKind

      public PolicySpec.PolicyRule.Builder clearKind()
    • hasValues

      public boolean hasValues()
       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
      Specified by:
      hasValues in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the values field is set.
    • getValues

       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
      Specified by:
      getValues in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The values.
    • setValues

       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
    • setValues

       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
    • mergeValues

       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
    • clearValues

      public PolicySpec.PolicyRule.Builder clearValues()
       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
    • getValuesBuilder

      public PolicySpec.PolicyRule.StringValues.Builder getValuesBuilder()
       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
    • getValuesOrBuilder

      public PolicySpec.PolicyRule.StringValuesOrBuilder getValuesOrBuilder()
       List of values to be used for this policy rule. This field can be set
       only in policies for list constraints.
       
      .google.cloud.orgpolicy.v2.PolicySpec.PolicyRule.StringValues values = 1;
      Specified by:
      getValuesOrBuilder in interface PolicySpec.PolicyRuleOrBuilder
    • hasAllowAll

      public boolean hasAllowAll()
       Setting this to true means that all values are allowed. This field can
       be set only in policies for list constraints.
       
      bool allow_all = 2;
      Specified by:
      hasAllowAll in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the allowAll field is set.
    • getAllowAll

      public boolean getAllowAll()
       Setting this to true means that all values are allowed. This field can
       be set only in policies for list constraints.
       
      bool allow_all = 2;
      Specified by:
      getAllowAll in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The allowAll.
    • setAllowAll

      public PolicySpec.PolicyRule.Builder setAllowAll(boolean value)
       Setting this to true means that all values are allowed. This field can
       be set only in policies for list constraints.
       
      bool allow_all = 2;
      Parameters:
      value - The allowAll to set.
      Returns:
      This builder for chaining.
    • clearAllowAll

      public PolicySpec.PolicyRule.Builder clearAllowAll()
       Setting this to true means that all values are allowed. This field can
       be set only in policies for list constraints.
       
      bool allow_all = 2;
      Returns:
      This builder for chaining.
    • hasDenyAll

      public boolean hasDenyAll()
       Setting this to true means that all values are denied. This field can
       be set only in policies for list constraints.
       
      bool deny_all = 3;
      Specified by:
      hasDenyAll in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the denyAll field is set.
    • getDenyAll

      public boolean getDenyAll()
       Setting this to true means that all values are denied. This field can
       be set only in policies for list constraints.
       
      bool deny_all = 3;
      Specified by:
      getDenyAll in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The denyAll.
    • setDenyAll

      public PolicySpec.PolicyRule.Builder setDenyAll(boolean value)
       Setting this to true means that all values are denied. This field can
       be set only in policies for list constraints.
       
      bool deny_all = 3;
      Parameters:
      value - The denyAll to set.
      Returns:
      This builder for chaining.
    • clearDenyAll

      public PolicySpec.PolicyRule.Builder clearDenyAll()
       Setting this to true means that all values are denied. This field can
       be set only in policies for list constraints.
       
      bool deny_all = 3;
      Returns:
      This builder for chaining.
    • hasEnforce

      public boolean hasEnforce()
       If `true`, then the policy is enforced. If `false`, then any
       configuration is acceptable.
       This field can be set only in policies for boolean constraints.
       
      bool enforce = 4;
      Specified by:
      hasEnforce in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the enforce field is set.
    • getEnforce

      public boolean getEnforce()
       If `true`, then the policy is enforced. If `false`, then any
       configuration is acceptable.
       This field can be set only in policies for boolean constraints.
       
      bool enforce = 4;
      Specified by:
      getEnforce in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The enforce.
    • setEnforce

      public PolicySpec.PolicyRule.Builder setEnforce(boolean value)
       If `true`, then the policy is enforced. If `false`, then any
       configuration is acceptable.
       This field can be set only in policies for boolean constraints.
       
      bool enforce = 4;
      Parameters:
      value - The enforce to set.
      Returns:
      This builder for chaining.
    • clearEnforce

      public PolicySpec.PolicyRule.Builder clearEnforce()
       If `true`, then the policy is enforced. If `false`, then any
       configuration is acceptable.
       This field can be set only in policies for boolean constraints.
       
      bool enforce = 4;
      Returns:
      This builder for chaining.
    • hasCondition

      public boolean hasCondition()
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
      Specified by:
      hasCondition in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the condition field is set.
    • getCondition

      public Expr getCondition()
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
      Specified by:
      getCondition in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The condition.
    • setCondition

      public PolicySpec.PolicyRule.Builder setCondition(Expr value)
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
    • setCondition

      public PolicySpec.PolicyRule.Builder setCondition(Expr.Builder builderForValue)
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
    • mergeCondition

      public PolicySpec.PolicyRule.Builder mergeCondition(Expr value)
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
    • clearCondition

      public PolicySpec.PolicyRule.Builder clearCondition()
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
    • getConditionBuilder

      public Expr.Builder getConditionBuilder()
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
    • getConditionOrBuilder

      public ExprOrBuilder getConditionOrBuilder()
       A condition which determines whether this rule is used
       in the evaluation of the policy. When set, the `expression` field in
       the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
       or "&&" operators. Each subexpression must be of the form
       "resource.matchTag('<ORG_ID>/tag_key_short_name,
       'tag_value_short_name')". or "resource.matchTagId('tagKeys/key_id',
       'tagValues/value_id')". where key_name and value_name are the resource
       names for Label Keys and Values. These names are available from the Tag
       Manager Service. An example expression is:
       "resource.matchTag('123456789/environment,
       'prod')". or "resource.matchTagId('tagKeys/123',
       'tagValues/456')".
       
      .google.type.Expr condition = 5;
      Specified by:
      getConditionOrBuilder in interface PolicySpec.PolicyRuleOrBuilder
    • hasParameters

      public boolean hasParameters()
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
      Specified by:
      hasParameters in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      Whether the parameters field is set.
    • getParameters

      public com.google.protobuf.Struct getParameters()
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
      Specified by:
      getParameters in interface PolicySpec.PolicyRuleOrBuilder
      Returns:
      The parameters.
    • setParameters

      public PolicySpec.PolicyRule.Builder setParameters(com.google.protobuf.Struct value)
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
    • setParameters

      public PolicySpec.PolicyRule.Builder setParameters(com.google.protobuf.Struct.Builder builderForValue)
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
    • mergeParameters

      public PolicySpec.PolicyRule.Builder mergeParameters(com.google.protobuf.Struct value)
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
    • clearParameters

      public PolicySpec.PolicyRule.Builder clearParameters()
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
    • getParametersBuilder

      public com.google.protobuf.Struct.Builder getParametersBuilder()
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
    • getParametersOrBuilder

      public com.google.protobuf.StructOrBuilder getParametersOrBuilder()
       Optional. Required for managed constraints if parameters are defined.
       Passes parameter values when policy enforcement is enabled. Ensure that
       parameter value types match those defined in the constraint definition.
       For example:
       {
       "allowedLocations" : ["us-east1", "us-west1"],
       "allowAll" : true
       }
       
      .google.protobuf.Struct parameters = 6 [(.google.api.field_behavior) = OPTIONAL];
      Specified by:
      getParametersOrBuilder in interface PolicySpec.PolicyRuleOrBuilder