Class Constraint.Builder (2.39.0)

public static final class Constraint.Builder extends 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 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 Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Constraint.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Constraint.Builder
Overrides

build()

public Constraint build()
Returns
TypeDescription
Constraint

buildPartial()

public Constraint buildPartial()
Returns
TypeDescription
Constraint

clear()

public Constraint.Builder clear()
Returns
TypeDescription
Constraint.Builder
Overrides

clearBooleanConstraint()

public Constraint.Builder clearBooleanConstraint()

Defines this constraint as being a BooleanConstraint.

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

Returns
TypeDescription
Constraint.Builder

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

This builder for chaining.

clearConstraintType()

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

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

This builder for chaining.

clearDisplayName()

public Constraint.Builder clearDisplayName()

The human readable name.

Mutable.

string display_name = 2;

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public Constraint.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
Constraint.Builder
Overrides

clearListConstraint()

public Constraint.Builder clearListConstraint()

Defines this constraint as being a ListConstraint.

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

Returns
TypeDescription
Constraint.Builder

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

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public Constraint.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
Constraint.Builder
Overrides

clearSupportsDryRun()

public Constraint.Builder clearSupportsDryRun()

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

bool supports_dry_run = 7;

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

clone()

public Constraint.Builder clone()
Returns
TypeDescription
Constraint.Builder
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.

getBooleanConstraintBuilder()

public Constraint.BooleanConstraint.Builder getBooleanConstraintBuilder()

Defines this constraint as being a BooleanConstraint.

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

Returns
TypeDescription
Constraint.BooleanConstraint.Builder

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

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

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.

getListConstraintBuilder()

public Constraint.ListConstraint.Builder getListConstraintBuilder()

Defines this constraint as being a ListConstraint.

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

Returns
TypeDescription
Constraint.ListConstraint.Builder

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.

getSupportsDryRun()

public boolean getSupportsDryRun()

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

bool supports_dry_run = 7;

Returns
TypeDescription
boolean

The supportsDryRun.

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.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeBooleanConstraint(Constraint.BooleanConstraint value)

public Constraint.Builder mergeBooleanConstraint(Constraint.BooleanConstraint value)

Defines this constraint as being a BooleanConstraint.

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

Parameter
NameDescription
valueConstraint.BooleanConstraint
Returns
TypeDescription
Constraint.Builder

mergeFrom(Constraint other)

public Constraint.Builder mergeFrom(Constraint other)
Parameter
NameDescription
otherConstraint
Returns
TypeDescription
Constraint.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Constraint.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Constraint.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public Constraint.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
Constraint.Builder
Overrides

mergeListConstraint(Constraint.ListConstraint value)

public Constraint.Builder mergeListConstraint(Constraint.ListConstraint value)

Defines this constraint as being a ListConstraint.

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

Parameter
NameDescription
valueConstraint.ListConstraint
Returns
TypeDescription
Constraint.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Constraint.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Constraint.Builder
Overrides

setBooleanConstraint(Constraint.BooleanConstraint value)

public Constraint.Builder setBooleanConstraint(Constraint.BooleanConstraint value)

Defines this constraint as being a BooleanConstraint.

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

Parameter
NameDescription
valueConstraint.BooleanConstraint
Returns
TypeDescription
Constraint.Builder

setBooleanConstraint(Constraint.BooleanConstraint.Builder builderForValue)

public Constraint.Builder setBooleanConstraint(Constraint.BooleanConstraint.Builder builderForValue)

Defines this constraint as being a BooleanConstraint.

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

Parameter
NameDescription
builderForValueConstraint.BooleanConstraint.Builder
Returns
TypeDescription
Constraint.Builder

setConstraintDefault(Constraint.ConstraintDefault value)

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;

Parameter
NameDescription
valueConstraint.ConstraintDefault

The constraintDefault to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setConstraintDefaultValue(int value)

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;

Parameter
NameDescription
valueint

The enum numeric value on the wire for constraintDefault to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setDescription(String value)

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;

Parameter
NameDescription
valueString

The description to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setDescriptionBytes(ByteString value)

public Constraint.Builder setDescriptionBytes(ByteString value)

Detailed description of what this constraint controls as well as how and where it is enforced.

Mutable.

string description = 3;

Parameter
NameDescription
valueByteString

The bytes for description to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setDisplayName(String value)

public Constraint.Builder setDisplayName(String value)

The human readable name.

Mutable.

string display_name = 2;

Parameter
NameDescription
valueString

The displayName to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setDisplayNameBytes(ByteString value)

public Constraint.Builder setDisplayNameBytes(ByteString value)

The human readable name.

Mutable.

string display_name = 2;

Parameter
NameDescription
valueByteString

The bytes for displayName to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public Constraint.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Constraint.Builder
Overrides

setListConstraint(Constraint.ListConstraint value)

public Constraint.Builder setListConstraint(Constraint.ListConstraint value)

Defines this constraint as being a ListConstraint.

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

Parameter
NameDescription
valueConstraint.ListConstraint
Returns
TypeDescription
Constraint.Builder

setListConstraint(Constraint.ListConstraint.Builder builderForValue)

public Constraint.Builder setListConstraint(Constraint.ListConstraint.Builder builderForValue)

Defines this constraint as being a ListConstraint.

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

Parameter
NameDescription
builderForValueConstraint.ListConstraint.Builder
Returns
TypeDescription
Constraint.Builder

setName(String value)

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

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setNameBytes(ByteString value)

public Constraint.Builder setNameBytes(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];

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Constraint.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
Constraint.Builder
Overrides

setSupportsDryRun(boolean value)

public Constraint.Builder setSupportsDryRun(boolean value)

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

bool supports_dry_run = 7;

Parameter
NameDescription
valueboolean

The supportsDryRun to set.

Returns
TypeDescription
Constraint.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final Constraint.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Constraint.Builder
Overrides