Class Constraint.Builder

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

public static final class Constraint.Builder extends com.google.protobuf.GeneratedMessage.Builder<Constraint.Builder> implements ConstraintOrBuilder
 A constraint describes a way to restrict resource's configuration. For
 example, you could enforce a constraint that controls which Google Cloud
 services can be activated across an organization, or whether a Compute Engine
 instance can have serial port connections established. Constraints can be
 configured by the organization policy administrator to fit the needs of the
 organization by setting a policy that includes constraints at different
 locations in the organization's resource hierarchy. Policies are inherited
 down the resource hierarchy from higher levels, but can also be overridden.
 For details about the inheritance rules, see
 [`Policy`][google.cloud.orgpolicy.v2.Policy].

 Constraints have a default behavior determined by the `constraint_default`
 field, which is the enforcement behavior that is used in the absence of a
 policy being defined or inherited for the resource in question.
 
Protobuf type google.cloud.orgpolicy.v2.Constraint
  • 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<Constraint.Builder>
    • clear

      public Constraint.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<Constraint.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<Constraint.Builder>
    • getDefaultInstanceForType

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

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

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

      public Constraint.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<Constraint.Builder>
    • mergeFrom

      public Constraint.Builder mergeFrom(Constraint other)
    • isInitialized

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

      public Constraint.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<Constraint.Builder>
      Throws:
      IOException
    • getConstraintTypeCase

      public Constraint.ConstraintTypeCase getConstraintTypeCase()
      Specified by:
      getConstraintTypeCase in interface ConstraintOrBuilder
    • clearConstraintType

      public Constraint.Builder clearConstraintType()
    • getName

      public String getName()
       Immutable. The resource name of the constraint. Must be in one of
       the following forms:
      
       * `projects/{project_number}/constraints/{constraint_name}`
       * `folders/{folder_id}/constraints/{constraint_name}`
       * `organizations/{organization_id}/constraints/{constraint_name}`
      
       For example, "/projects/123/constraints/compute.disableSerialPortAccess".
       
      string name = 1 [(.google.api.field_behavior) = IMMUTABLE];
      Specified by:
      getName in interface ConstraintOrBuilder
      Returns:
      The name.
    • getNameBytes

      public com.google.protobuf.ByteString getNameBytes()
       Immutable. The resource name of the constraint. Must be in one of
       the following forms:
      
       * `projects/{project_number}/constraints/{constraint_name}`
       * `folders/{folder_id}/constraints/{constraint_name}`
       * `organizations/{organization_id}/constraints/{constraint_name}`
      
       For example, "/projects/123/constraints/compute.disableSerialPortAccess".
       
      string name = 1 [(.google.api.field_behavior) = IMMUTABLE];
      Specified by:
      getNameBytes in interface ConstraintOrBuilder
      Returns:
      The bytes for name.
    • setName

      public Constraint.Builder setName(String value)
       Immutable. The resource name of the constraint. Must be in one of
       the following forms:
      
       * `projects/{project_number}/constraints/{constraint_name}`
       * `folders/{folder_id}/constraints/{constraint_name}`
       * `organizations/{organization_id}/constraints/{constraint_name}`
      
       For example, "/projects/123/constraints/compute.disableSerialPortAccess".
       
      string name = 1 [(.google.api.field_behavior) = IMMUTABLE];
      Parameters:
      value - The name to set.
      Returns:
      This builder for chaining.
    • clearName

      public Constraint.Builder clearName()
       Immutable. The resource name of the constraint. Must be in one of
       the following forms:
      
       * `projects/{project_number}/constraints/{constraint_name}`
       * `folders/{folder_id}/constraints/{constraint_name}`
       * `organizations/{organization_id}/constraints/{constraint_name}`
      
       For example, "/projects/123/constraints/compute.disableSerialPortAccess".
       
      string name = 1 [(.google.api.field_behavior) = IMMUTABLE];
      Returns:
      This builder for chaining.
    • setNameBytes

      public Constraint.Builder setNameBytes(com.google.protobuf.ByteString value)
       Immutable. The resource name of the constraint. Must be in one of
       the following forms:
      
       * `projects/{project_number}/constraints/{constraint_name}`
       * `folders/{folder_id}/constraints/{constraint_name}`
       * `organizations/{organization_id}/constraints/{constraint_name}`
      
       For example, "/projects/123/constraints/compute.disableSerialPortAccess".
       
      string name = 1 [(.google.api.field_behavior) = IMMUTABLE];
      Parameters:
      value - The bytes for name to set.
      Returns:
      This builder for chaining.
    • getDisplayName

      public String getDisplayName()
       The human readable name.
      
       Mutable.
       
      string display_name = 2;
      Specified by:
      getDisplayName in interface ConstraintOrBuilder
      Returns:
      The displayName.
    • getDisplayNameBytes

      public com.google.protobuf.ByteString getDisplayNameBytes()
       The human readable name.
      
       Mutable.
       
      string display_name = 2;
      Specified by:
      getDisplayNameBytes in interface ConstraintOrBuilder
      Returns:
      The bytes for displayName.
    • setDisplayName

      public Constraint.Builder setDisplayName(String value)
       The human readable name.
      
       Mutable.
       
      string display_name = 2;
      Parameters:
      value - The displayName to set.
      Returns:
      This builder for chaining.
    • clearDisplayName

      public Constraint.Builder clearDisplayName()
       The human readable name.
      
       Mutable.
       
      string display_name = 2;
      Returns:
      This builder for chaining.
    • setDisplayNameBytes

      public Constraint.Builder setDisplayNameBytes(com.google.protobuf.ByteString value)
       The human readable name.
      
       Mutable.
       
      string display_name = 2;
      Parameters:
      value - The bytes for displayName to set.
      Returns:
      This builder for chaining.
    • getDescription

      public String getDescription()
       Detailed description of what this constraint controls as well as how and
       where it is enforced.
      
       Mutable.
       
      string description = 3;
      Specified by:
      getDescription in interface ConstraintOrBuilder
      Returns:
      The description.
    • getDescriptionBytes

      public com.google.protobuf.ByteString getDescriptionBytes()
       Detailed description of what this constraint controls as well as how and
       where it is enforced.
      
       Mutable.
       
      string description = 3;
      Specified by:
      getDescriptionBytes in interface ConstraintOrBuilder
      Returns:
      The bytes for description.
    • setDescription

      public Constraint.Builder setDescription(String value)
       Detailed description of what this constraint controls as well as how and
       where it is enforced.
      
       Mutable.
       
      string description = 3;
      Parameters:
      value - The description to set.
      Returns:
      This builder for chaining.
    • clearDescription

      public Constraint.Builder clearDescription()
       Detailed description of what this constraint controls as well as how and
       where it is enforced.
      
       Mutable.
       
      string description = 3;
      Returns:
      This builder for chaining.
    • setDescriptionBytes

      public Constraint.Builder setDescriptionBytes(com.google.protobuf.ByteString value)
       Detailed description of what this constraint controls as well as how and
       where it is enforced.
      
       Mutable.
       
      string description = 3;
      Parameters:
      value - The bytes for description to set.
      Returns:
      This builder for chaining.
    • getConstraintDefaultValue

      public int getConstraintDefaultValue()
       The evaluation behavior of this constraint in the absence of a policy.
       
      .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
      Specified by:
      getConstraintDefaultValue in interface ConstraintOrBuilder
      Returns:
      The enum numeric value on the wire for constraintDefault.
    • setConstraintDefaultValue

      public Constraint.Builder setConstraintDefaultValue(int value)
       The evaluation behavior of this constraint in the absence of a policy.
       
      .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
      Parameters:
      value - The enum numeric value on the wire for constraintDefault to set.
      Returns:
      This builder for chaining.
    • getConstraintDefault

      public Constraint.ConstraintDefault getConstraintDefault()
       The evaluation behavior of this constraint in the absence of a policy.
       
      .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
      Specified by:
      getConstraintDefault in interface ConstraintOrBuilder
      Returns:
      The constraintDefault.
    • setConstraintDefault

      public Constraint.Builder setConstraintDefault(Constraint.ConstraintDefault value)
       The evaluation behavior of this constraint in the absence of a policy.
       
      .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
      Parameters:
      value - The constraintDefault to set.
      Returns:
      This builder for chaining.
    • clearConstraintDefault

      public Constraint.Builder clearConstraintDefault()
       The evaluation behavior of this constraint in the absence of a policy.
       
      .google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
      Returns:
      This builder for chaining.
    • hasListConstraint

      public boolean hasListConstraint()
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
      Specified by:
      hasListConstraint in interface ConstraintOrBuilder
      Returns:
      Whether the listConstraint field is set.
    • getListConstraint

      public Constraint.ListConstraint getListConstraint()
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
      Specified by:
      getListConstraint in interface ConstraintOrBuilder
      Returns:
      The listConstraint.
    • setListConstraint

      public Constraint.Builder setListConstraint(Constraint.ListConstraint value)
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
    • setListConstraint

      public Constraint.Builder setListConstraint(Constraint.ListConstraint.Builder builderForValue)
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
    • mergeListConstraint

      public Constraint.Builder mergeListConstraint(Constraint.ListConstraint value)
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
    • clearListConstraint

      public Constraint.Builder clearListConstraint()
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
    • getListConstraintBuilder

      public Constraint.ListConstraint.Builder getListConstraintBuilder()
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
    • getListConstraintOrBuilder

      public Constraint.ListConstraintOrBuilder getListConstraintOrBuilder()
       Defines this constraint as being a list constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
      Specified by:
      getListConstraintOrBuilder in interface ConstraintOrBuilder
    • hasBooleanConstraint

      public boolean hasBooleanConstraint()
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
      Specified by:
      hasBooleanConstraint in interface ConstraintOrBuilder
      Returns:
      Whether the booleanConstraint field is set.
    • getBooleanConstraint

      public Constraint.BooleanConstraint getBooleanConstraint()
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
      Specified by:
      getBooleanConstraint in interface ConstraintOrBuilder
      Returns:
      The booleanConstraint.
    • setBooleanConstraint

      public Constraint.Builder setBooleanConstraint(Constraint.BooleanConstraint value)
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
    • setBooleanConstraint

      public Constraint.Builder setBooleanConstraint(Constraint.BooleanConstraint.Builder builderForValue)
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
    • mergeBooleanConstraint

      public Constraint.Builder mergeBooleanConstraint(Constraint.BooleanConstraint value)
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
    • clearBooleanConstraint

      public Constraint.Builder clearBooleanConstraint()
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
    • getBooleanConstraintBuilder

      public Constraint.BooleanConstraint.Builder getBooleanConstraintBuilder()
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
    • getBooleanConstraintOrBuilder

      public Constraint.BooleanConstraintOrBuilder getBooleanConstraintOrBuilder()
       Defines this constraint as being a boolean constraint.
       
      .google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
      Specified by:
      getBooleanConstraintOrBuilder in interface ConstraintOrBuilder
    • getSupportsDryRun

      public boolean getSupportsDryRun()
       Shows if dry run is supported for this constraint or not.
       
      bool supports_dry_run = 7;
      Specified by:
      getSupportsDryRun in interface ConstraintOrBuilder
      Returns:
      The supportsDryRun.
    • setSupportsDryRun

      public Constraint.Builder setSupportsDryRun(boolean value)
       Shows if dry run is supported for this constraint or not.
       
      bool supports_dry_run = 7;
      Parameters:
      value - The supportsDryRun to set.
      Returns:
      This builder for chaining.
    • clearSupportsDryRun

      public Constraint.Builder clearSupportsDryRun()
       Shows if dry run is supported for this constraint or not.
       
      bool supports_dry_run = 7;
      Returns:
      This builder for chaining.
    • getEquivalentConstraint

      public String getEquivalentConstraint()
       Managed constraint and canned constraint sometimes can have
       equivalents. This field is used to store the equivalent constraint name.
       
      string equivalent_constraint = 8;
      Specified by:
      getEquivalentConstraint in interface ConstraintOrBuilder
      Returns:
      The equivalentConstraint.
    • getEquivalentConstraintBytes

      public com.google.protobuf.ByteString getEquivalentConstraintBytes()
       Managed constraint and canned constraint sometimes can have
       equivalents. This field is used to store the equivalent constraint name.
       
      string equivalent_constraint = 8;
      Specified by:
      getEquivalentConstraintBytes in interface ConstraintOrBuilder
      Returns:
      The bytes for equivalentConstraint.
    • setEquivalentConstraint

      public Constraint.Builder setEquivalentConstraint(String value)
       Managed constraint and canned constraint sometimes can have
       equivalents. This field is used to store the equivalent constraint name.
       
      string equivalent_constraint = 8;
      Parameters:
      value - The equivalentConstraint to set.
      Returns:
      This builder for chaining.
    • clearEquivalentConstraint

      public Constraint.Builder clearEquivalentConstraint()
       Managed constraint and canned constraint sometimes can have
       equivalents. This field is used to store the equivalent constraint name.
       
      string equivalent_constraint = 8;
      Returns:
      This builder for chaining.
    • setEquivalentConstraintBytes

      public Constraint.Builder setEquivalentConstraintBytes(com.google.protobuf.ByteString value)
       Managed constraint and canned constraint sometimes can have
       equivalents. This field is used to store the equivalent constraint name.
       
      string equivalent_constraint = 8;
      Parameters:
      value - The bytes for equivalentConstraint to set.
      Returns:
      This builder for chaining.
    • getSupportsSimulation

      public boolean getSupportsSimulation()
       Shows if simulation is supported for this constraint or not.
       
      bool supports_simulation = 9;
      Specified by:
      getSupportsSimulation in interface ConstraintOrBuilder
      Returns:
      The supportsSimulation.
    • setSupportsSimulation

      public Constraint.Builder setSupportsSimulation(boolean value)
       Shows if simulation is supported for this constraint or not.
       
      bool supports_simulation = 9;
      Parameters:
      value - The supportsSimulation to set.
      Returns:
      This builder for chaining.
    • clearSupportsSimulation

      public Constraint.Builder clearSupportsSimulation()
       Shows if simulation is supported for this constraint or not.
       
      bool supports_simulation = 9;
      Returns:
      This builder for chaining.