Class Constraint (2.3.7-SNAPSHOT)

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 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. 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

Implements

ConstraintOrBuilder

Static Fields

BOOLEAN_CONSTRAINT_FIELD_NUMBER

public static final int BOOLEAN_CONSTRAINT_FIELD_NUMBER
Field Value
TypeDescription
int

CONSTRAINT_DEFAULT_FIELD_NUMBER

public static final int CONSTRAINT_DEFAULT_FIELD_NUMBER
Field Value
TypeDescription
int

DESCRIPTION_FIELD_NUMBER

public static final int DESCRIPTION_FIELD_NUMBER
Field Value
TypeDescription
int

DISPLAY_NAME_FIELD_NUMBER

public static final int DISPLAY_NAME_FIELD_NUMBER
Field Value
TypeDescription
int

LIST_CONSTRAINT_FIELD_NUMBER

public static final int LIST_CONSTRAINT_FIELD_NUMBER
Field Value
TypeDescription
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Constraint getDefaultInstance()
Returns
TypeDescription
Constraint

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Constraint.Builder newBuilder()
Returns
TypeDescription
Constraint.Builder

newBuilder(Constraint prototype)

public static Constraint.Builder newBuilder(Constraint prototype)
Parameter
NameDescription
prototypeConstraint
Returns
TypeDescription
Constraint.Builder

parseDelimitedFrom(InputStream input)

public static Constraint parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Constraint parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Constraint parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Constraint parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Constraint parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Constraint parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Constraint> parser()
Returns
TypeDescription
Parser<Constraint>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getBooleanConstraint()

public Constraint.BooleanConstraint getBooleanConstraint()

Defines this constraint as being a BooleanConstraint.

.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;

Returns
TypeDescription
Constraint.BooleanConstraint

The booleanConstraint.

getBooleanConstraintOrBuilder()

public Constraint.BooleanConstraintOrBuilder getBooleanConstraintOrBuilder()

Defines this constraint as being a BooleanConstraint.

.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;

Returns
TypeDescription
Constraint.BooleanConstraintOrBuilder

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
TypeDescription
Constraint.ConstraintDefault

The constraintDefault.

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
TypeDescription
int

The enum numeric value on the wire for constraintDefault.

getConstraintTypeCase()

public Constraint.ConstraintTypeCase getConstraintTypeCase()
Returns
TypeDescription
Constraint.ConstraintTypeCase

getDefaultInstanceForType()

public Constraint getDefaultInstanceForType()
Returns
TypeDescription
Constraint

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
TypeDescription
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
TypeDescription
ByteString

The bytes for description.

getDisplayName()

public String getDisplayName()

The human readable name. Mutable.

string display_name = 2;

Returns
TypeDescription
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

The human readable name. Mutable.

string display_name = 2;

Returns
TypeDescription
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
TypeDescription
Constraint.ListConstraint

The listConstraint.

getListConstraintOrBuilder()

public Constraint.ListConstraintOrBuilder getListConstraintOrBuilder()

Defines this constraint as being a ListConstraint.

.google.cloud.orgpolicy.v2.Constraint.ListConstraint list_constraint = 5;

Returns
TypeDescription
Constraint.ListConstraintOrBuilder

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];

Returns
TypeDescription
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
TypeDescription
ByteString

The bytes for name.

getParserForType()

public Parser<Constraint> getParserForType()
Returns
TypeDescription
Parser<Constraint>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hasBooleanConstraint()

public boolean hasBooleanConstraint()

Defines this constraint as being a BooleanConstraint.

.google.cloud.orgpolicy.v2.Constraint.BooleanConstraint boolean_constraint = 6;

Returns
TypeDescription
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
TypeDescription
boolean

Whether the listConstraint field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Constraint.Builder newBuilderForType()
Returns
TypeDescription
Constraint.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Constraint.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Constraint.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Constraint.Builder toBuilder()
Returns
TypeDescription
Constraint.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides Exceptions
TypeDescription
IOException