Class 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.GeneratedMessageV3.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 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's 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 please read about
     [`policies`][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 Detail

      • getDescriptor

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

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.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.GeneratedMessageV3.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.GeneratedMessageV3.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
      • clone

        public Constraint.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • setField

        public Constraint.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                           Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • clearField

        public Constraint.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • clearOneof

        public Constraint.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • setRepeatedField

        public Constraint.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                   int index,
                                                   Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • addRepeatedField

        public Constraint.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                   Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.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>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.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
      • 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 '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 '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 '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 '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 '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 ListConstraint.
         
        .google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
        Specified by:
        hasListConstraint in interface ConstraintOrBuilder
        Returns:
        Whether the listConstraint field is set.
      • setListConstraint

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

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

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

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

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

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

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

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

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

        public final Constraint.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>
      • mergeUnknownFields

        public final Constraint.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Constraint.Builder>