Class Constraint (2.48.0)

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 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 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
Type Description
int

CONSTRAINT_DEFAULT_FIELD_NUMBER

public static final int CONSTRAINT_DEFAULT_FIELD_NUMBER
Field Value
Type Description
int

DESCRIPTION_FIELD_NUMBER

public static final int DESCRIPTION_FIELD_NUMBER
Field Value
Type Description
int

DISPLAY_NAME_FIELD_NUMBER

public static final int DISPLAY_NAME_FIELD_NUMBER
Field Value
Type Description
int

LIST_CONSTRAINT_FIELD_NUMBER

public static final int LIST_CONSTRAINT_FIELD_NUMBER
Field Value
Type Description
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
Type Description
int

SUPPORTS_DRY_RUN_FIELD_NUMBER

public static final int SUPPORTS_DRY_RUN_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Constraint getDefaultInstance()
Returns
Type Description
Constraint

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Constraint.Builder newBuilder()
Returns
Type Description
Constraint.Builder

newBuilder(Constraint prototype)

public static Constraint.Builder newBuilder(Constraint prototype)
Parameter
Name Description
prototype Constraint
Returns
Type Description
Constraint.Builder

parseDelimitedFrom(InputStream input)

public static Constraint parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Constraint parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Constraint parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Constraint parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Constraint parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Constraint parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Constraint parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Constraint
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Constraint> parser()
Returns
Type Description
Parser<Constraint>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getBooleanConstraint()

public Constraint.BooleanConstraint getBooleanConstraint()

Defines this constraint as being a BooleanConstraint.

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

Returns
Type Description
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
Type Description
Constraint.BooleanConstraintOrBuilder

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;

Returns
Type Description
Constraint.ConstraintDefault

The constraintDefault.

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;

Returns
Type Description
int

The enum numeric value on the wire for constraintDefault.

getConstraintTypeCase()

public Constraint.ConstraintTypeCase getConstraintTypeCase()
Returns
Type Description
Constraint.ConstraintTypeCase

getDefaultInstanceForType()

public Constraint getDefaultInstanceForType()
Returns
Type Description
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
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
Type Description
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
Type Description
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
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
Type Description
ByteString

The bytes for name.

getParserForType()

public Parser<Constraint> getParserForType()
Returns
Type Description
Parser<Constraint>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getSupportsDryRun()

public boolean getSupportsDryRun()

Shows if dry run is supported for this constraint or not.

bool supports_dry_run = 7;

Returns
Type Description
boolean

The supportsDryRun.

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()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Constraint.Builder newBuilderForType()
Returns
Type Description
Constraint.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Constraint.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Constraint.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Constraint.Builder toBuilder()
Returns
Type Description
Constraint.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException