public final class Constraint extends GeneratedMessageV3 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 adminstrator to fit the needs of the organzation
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
.
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
Static Fields
BOOLEAN_CONSTRAINT_FIELD_NUMBER
public static final int BOOLEAN_CONSTRAINT_FIELD_NUMBER
Field Value
CONSTRAINT_DEFAULT_FIELD_NUMBER
public static final int CONSTRAINT_DEFAULT_FIELD_NUMBER
Field Value
DESCRIPTION_FIELD_NUMBER
public static final int DESCRIPTION_FIELD_NUMBER
Field Value
DISPLAY_NAME_FIELD_NUMBER
public static final int DISPLAY_NAME_FIELD_NUMBER
Field Value
LIST_CONSTRAINT_FIELD_NUMBER
public static final int LIST_CONSTRAINT_FIELD_NUMBER
Field Value
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER
Field Value
Static Methods
getDefaultInstance()
public static Constraint getDefaultInstance()
Returns
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns
newBuilder()
public static Constraint.Builder newBuilder()
Returns
newBuilder(Constraint prototype)
public static Constraint.Builder newBuilder(Constraint prototype)
Parameter
Returns
public static Constraint parseDelimitedFrom(InputStream input)
Parameter
Returns
Exceptions
public static Constraint parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(byte[] data)
public static Constraint parseFrom(byte[] data)
Parameter
Name | Description |
data | byte[]
|
Returns
Exceptions
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static Constraint parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteString data)
public static Constraint parseFrom(ByteString data)
Parameter
Returns
Exceptions
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static Constraint parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static Constraint parseFrom(CodedInputStream input)
Parameter
Returns
Exceptions
public static Constraint parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static Constraint parseFrom(InputStream input)
Parameter
Returns
Exceptions
public static Constraint parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteBuffer data)
public static Constraint parseFrom(ByteBuffer data)
Parameter
Returns
Exceptions
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static Constraint parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parser()
public static Parser<Constraint> parser()
Returns
Methods
equals(Object obj)
public boolean equals(Object obj)
Parameter
Returns
Overrides
getBooleanConstraint()
public Constraint.BooleanConstraint getBooleanConstraint()
Defines this constraint as being a BooleanConstraint.
.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
Returns
getBooleanConstraintOrBuilder()
public Constraint.BooleanConstraintOrBuilder getBooleanConstraintOrBuilder()
Defines this constraint as being a BooleanConstraint.
.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
Returns
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;
Returns
getConstraintDefaultValue()
public int getConstraintDefaultValue()
The evaluation behavior of this constraint in the absence of 'Policy'.
.google.cloud.orgpolicy.v2.Constraint.ConstraintDefault constraint_default = 4;
Returns
Type | Description |
int | The enum numeric value on the wire for constraintDefault.
|
getConstraintTypeCase()
public Constraint.ConstraintTypeCase getConstraintTypeCase()
Returns
getDefaultInstanceForType()
public Constraint getDefaultInstanceForType()
Returns
getDescription()
public String getDescription()
Detailed description of what this Constraint
controls as well as how and
where it is enforced.
Mutable.
string description = 3;
Returns
Type | Description |
String | The description.
|
getDescriptionBytes()
public ByteString getDescriptionBytes()
Detailed description of what this Constraint
controls as well as how and
where it is enforced.
Mutable.
string description = 3;
Returns
Type | Description |
ByteString | The bytes for description.
|
getDisplayName()
public String getDisplayName()
The human readable name.
Mutable.
string display_name = 2;
Returns
Type | Description |
String | The displayName.
|
getDisplayNameBytes()
public ByteString getDisplayNameBytes()
The human readable name.
Mutable.
string display_name = 2;
Returns
Type | Description |
ByteString | The bytes for displayName.
|
getListConstraint()
public Constraint.ListConstraint getListConstraint()
Defines this constraint as being a ListConstraint.
.google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
Returns
getListConstraintOrBuilder()
public Constraint.ListConstraintOrBuilder getListConstraintOrBuilder()
Defines this constraint as being a ListConstraint.
.google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
Returns
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];
Returns
Type | Description |
String | The name.
|
getNameBytes()
public 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];
Returns
getParserForType()
public Parser<Constraint> getParserForType()
Returns
Overrides
getSerializedSize()
public int getSerializedSize()
Returns
Overrides
getUnknownFields()
public final UnknownFieldSet getUnknownFields()
Returns
Overrides
hasBooleanConstraint()
public boolean hasBooleanConstraint()
Defines this constraint as being a BooleanConstraint.
.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;
Returns
Type | Description |
boolean | Whether the booleanConstraint field is set.
|
hasListConstraint()
public boolean hasListConstraint()
Defines this constraint as being a ListConstraint.
.google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;
Returns
Type | Description |
boolean | Whether the listConstraint field is set.
|
hashCode()
Returns
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Overrides
isInitialized()
public final boolean isInitialized()
Returns
Overrides
newBuilderForType()
public Constraint.Builder newBuilderForType()
Returns
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected Constraint.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Returns
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Returns
Overrides
toBuilder()
public Constraint.Builder toBuilder()
Returns
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Parameter
Overrides
Exceptions