Class CustomConstraint.Builder (0.1.0)

public static final class CustomConstraint.Builder extends GeneratedMessageV3.Builder<CustomConstraint.Builder> implements CustomConstraintOrBuilder

A custom constraint defined by customers which can only be applied to the given resource types and organization.

By creating a custom constraint, customers can apply policies of this custom constraint. Creating a custom constraint itself does NOT apply any policy enforcement.

Protobuf type google.cloud.securityposture.v1.CustomConstraint

Static Methods

getDescriptor()

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

Methods

addAllMethodTypes(Iterable<? extends CustomConstraint.MethodType> values)

public CustomConstraint.Builder addAllMethodTypes(Iterable<? extends CustomConstraint.MethodType> values)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.securityposture.v1.CustomConstraint.MethodType>

The methodTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addAllMethodTypesValue(Iterable<Integer> values)

public CustomConstraint.Builder addAllMethodTypesValue(Iterable<Integer> values)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
valuesIterable<Integer>

The enum numeric values on the wire for methodTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addAllResourceTypes(Iterable<String> values)

public CustomConstraint.Builder addAllResourceTypes(Iterable<String> values)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
valuesIterable<String>

The resourceTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addMethodTypes(CustomConstraint.MethodType value)

public CustomConstraint.Builder addMethodTypes(CustomConstraint.MethodType value)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
valueCustomConstraint.MethodType

The methodTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addMethodTypesValue(int value)

public CustomConstraint.Builder addMethodTypesValue(int value)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
valueint

The enum numeric value on the wire for methodTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addResourceTypes(String value)

public CustomConstraint.Builder addResourceTypes(String value)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
valueString

The resourceTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

addResourceTypesBytes(ByteString value)

public CustomConstraint.Builder addResourceTypesBytes(ByteString value)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
valueByteString

The bytes of the resourceTypes to add.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

build()

public CustomConstraint build()
Returns
TypeDescription
CustomConstraint

buildPartial()

public CustomConstraint buildPartial()
Returns
TypeDescription
CustomConstraint

clear()

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

clearActionType()

public CustomConstraint.Builder clearActionType()

Allow or deny type.

.google.cloud.securityposture.v1.CustomConstraint.ActionType action_type = 5;

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearCondition()

public CustomConstraint.Builder clearCondition()

Org policy condition/expression. For example: resource.instanceName.matches("[production|test].*(\d)+") or, resource.management.auto_upgrade == true

The max length of the condition is 1000 characters.

string condition = 4;

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearDescription()

public CustomConstraint.Builder clearDescription()

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

string description = 7;

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearDisplayName()

public CustomConstraint.Builder clearDisplayName()

One line display name for the UI. The max length of the display_name is 200 characters.

string display_name = 6;

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearMethodTypes()

public CustomConstraint.Builder clearMethodTypes()

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearName()

public CustomConstraint.Builder clearName()

Immutable. Name of the constraint. This is unique within the organization. Format of the name should be

- organizations/{organization_id}/customConstraints/{custom_constraint_id}

Example: organizations/123/customConstraints/custom.createOnlyE2TypeVms

The max length is 70 characters and the minimum length is 1. Note that the prefix organizations/{organization_id}/customConstraints/ is not counted.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearResourceTypes()

public CustomConstraint.Builder clearResourceTypes()

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

clearUpdateTime()

public CustomConstraint.Builder clearUpdateTime()

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
CustomConstraint.Builder

clone()

public CustomConstraint.Builder clone()
Returns
TypeDescription
CustomConstraint.Builder
Overrides

getActionType()

public CustomConstraint.ActionType getActionType()

Allow or deny type.

.google.cloud.securityposture.v1.CustomConstraint.ActionType action_type = 5;

Returns
TypeDescription
CustomConstraint.ActionType

The actionType.

getActionTypeValue()

public int getActionTypeValue()

Allow or deny type.

.google.cloud.securityposture.v1.CustomConstraint.ActionType action_type = 5;

Returns
TypeDescription
int

The enum numeric value on the wire for actionType.

getCondition()

public String getCondition()

Org policy condition/expression. For example: resource.instanceName.matches("[production|test].*(\d)+") or, resource.management.auto_upgrade == true

The max length of the condition is 1000 characters.

string condition = 4;

Returns
TypeDescription
String

The condition.

getConditionBytes()

public ByteString getConditionBytes()

Org policy condition/expression. For example: resource.instanceName.matches("[production|test].*(\d)+") or, resource.management.auto_upgrade == true

The max length of the condition is 1000 characters.

string condition = 4;

Returns
TypeDescription
ByteString

The bytes for condition.

getDefaultInstanceForType()

public CustomConstraint getDefaultInstanceForType()
Returns
TypeDescription
CustomConstraint

getDescription()

public String getDescription()

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

string description = 7;

Returns
TypeDescription
String

The description.

getDescriptionBytes()

public ByteString getDescriptionBytes()

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

string description = 7;

Returns
TypeDescription
ByteString

The bytes for description.

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getDisplayName()

public String getDisplayName()

One line display name for the UI. The max length of the display_name is 200 characters.

string display_name = 6;

Returns
TypeDescription
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

One line display name for the UI. The max length of the display_name is 200 characters.

string display_name = 6;

Returns
TypeDescription
ByteString

The bytes for displayName.

getMethodTypes(int index)

public CustomConstraint.MethodType getMethodTypes(int index)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
CustomConstraint.MethodType

The methodTypes at the given index.

getMethodTypesCount()

public int getMethodTypesCount()

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Returns
TypeDescription
int

The count of methodTypes.

getMethodTypesList()

public List<CustomConstraint.MethodType> getMethodTypesList()

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Returns
TypeDescription
List<MethodType>

A list containing the methodTypes.

getMethodTypesValue(int index)

public int getMethodTypesValue(int index)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
int

The enum numeric value on the wire of methodTypes at the given index.

getMethodTypesValueList()

public List<Integer> getMethodTypesValueList()

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Returns
TypeDescription
List<Integer>

A list containing the enum numeric values on the wire for methodTypes.

getName()

public String getName()

Immutable. Name of the constraint. This is unique within the organization. Format of the name should be

- organizations/{organization_id}/customConstraints/{custom_constraint_id}

Example: organizations/123/customConstraints/custom.createOnlyE2TypeVms

The max length is 70 characters and the minimum length is 1. Note that the prefix organizations/{organization_id}/customConstraints/ is not counted.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

Immutable. Name of the constraint. This is unique within the organization. Format of the name should be

- organizations/{organization_id}/customConstraints/{custom_constraint_id}

Example: organizations/123/customConstraints/custom.createOnlyE2TypeVms

The max length is 70 characters and the minimum length is 1. Note that the prefix organizations/{organization_id}/customConstraints/ is not counted.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
ByteString

The bytes for name.

getResourceTypes(int index)

public String getResourceTypes(int index)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
String

The resourceTypes at the given index.

getResourceTypesBytes(int index)

public ByteString getResourceTypesBytes(int index)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
ByteString

The bytes of the resourceTypes at the given index.

getResourceTypesCount()

public int getResourceTypesCount()

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
int

The count of resourceTypes.

getResourceTypesList()

public ProtocolStringList getResourceTypesList()

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Returns
TypeDescription
ProtocolStringList

A list containing the resourceTypes.

getUpdateTime()

public Timestamp getUpdateTime()

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
Timestamp

The updateTime.

getUpdateTimeBuilder()

public Timestamp.Builder getUpdateTimeBuilder()

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
Builder

getUpdateTimeOrBuilder()

public TimestampOrBuilder getUpdateTimeOrBuilder()

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
TimestampOrBuilder

hasUpdateTime()

public boolean hasUpdateTime()

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
boolean

Whether the updateTime field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(CustomConstraint other)

public CustomConstraint.Builder mergeFrom(CustomConstraint other)
Parameter
NameDescription
otherCustomConstraint
Returns
TypeDescription
CustomConstraint.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

mergeUpdateTime(Timestamp value)

public CustomConstraint.Builder mergeUpdateTime(Timestamp value)

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
CustomConstraint.Builder

setActionType(CustomConstraint.ActionType value)

public CustomConstraint.Builder setActionType(CustomConstraint.ActionType value)

Allow or deny type.

.google.cloud.securityposture.v1.CustomConstraint.ActionType action_type = 5;

Parameter
NameDescription
valueCustomConstraint.ActionType

The actionType to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setActionTypeValue(int value)

public CustomConstraint.Builder setActionTypeValue(int value)

Allow or deny type.

.google.cloud.securityposture.v1.CustomConstraint.ActionType action_type = 5;

Parameter
NameDescription
valueint

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

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setCondition(String value)

public CustomConstraint.Builder setCondition(String value)

Org policy condition/expression. For example: resource.instanceName.matches("[production|test].*(\d)+") or, resource.management.auto_upgrade == true

The max length of the condition is 1000 characters.

string condition = 4;

Parameter
NameDescription
valueString

The condition to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setConditionBytes(ByteString value)

public CustomConstraint.Builder setConditionBytes(ByteString value)

Org policy condition/expression. For example: resource.instanceName.matches("[production|test].*(\d)+") or, resource.management.auto_upgrade == true

The max length of the condition is 1000 characters.

string condition = 4;

Parameter
NameDescription
valueByteString

The bytes for condition to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setDescription(String value)

public CustomConstraint.Builder setDescription(String value)

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

string description = 7;

Parameter
NameDescription
valueString

The description to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setDescriptionBytes(ByteString value)

public CustomConstraint.Builder setDescriptionBytes(ByteString value)

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

string description = 7;

Parameter
NameDescription
valueByteString

The bytes for description to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setDisplayName(String value)

public CustomConstraint.Builder setDisplayName(String value)

One line display name for the UI. The max length of the display_name is 200 characters.

string display_name = 6;

Parameter
NameDescription
valueString

The displayName to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setDisplayNameBytes(ByteString value)

public CustomConstraint.Builder setDisplayNameBytes(ByteString value)

One line display name for the UI. The max length of the display_name is 200 characters.

string display_name = 6;

Parameter
NameDescription
valueByteString

The bytes for displayName to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setMethodTypes(int index, CustomConstraint.MethodType value)

public CustomConstraint.Builder setMethodTypes(int index, CustomConstraint.MethodType value)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameters
NameDescription
indexint

The index to set the value at.

valueCustomConstraint.MethodType

The methodTypes to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setMethodTypesValue(int index, int value)

public CustomConstraint.Builder setMethodTypesValue(int index, int value)

All the operations being applied for this constraint.

repeated .google.cloud.securityposture.v1.CustomConstraint.MethodType method_types = 3;

Parameters
NameDescription
indexint

The index to set the value at.

valueint

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

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setName(String value)

public CustomConstraint.Builder setName(String value)

Immutable. Name of the constraint. This is unique within the organization. Format of the name should be

- organizations/{organization_id}/customConstraints/{custom_constraint_id}

Example: organizations/123/customConstraints/custom.createOnlyE2TypeVms

The max length is 70 characters and the minimum length is 1. Note that the prefix organizations/{organization_id}/customConstraints/ is not counted.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setNameBytes(ByteString value)

public CustomConstraint.Builder setNameBytes(ByteString value)

Immutable. Name of the constraint. This is unique within the organization. Format of the name should be

- organizations/{organization_id}/customConstraints/{custom_constraint_id}

Example: organizations/123/customConstraints/custom.createOnlyE2TypeVms

The max length is 70 characters and the minimum length is 1. Note that the prefix organizations/{organization_id}/customConstraints/ is not counted.

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

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

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

setResourceTypes(int index, String value)

public CustomConstraint.Builder setResourceTypes(int index, String value)

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.

repeated string resource_types = 2 [(.google.api.field_behavior) = IMMUTABLE];

Parameters
NameDescription
indexint

The index to set the value at.

valueString

The resourceTypes to set.

Returns
TypeDescription
CustomConstraint.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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

setUpdateTime(Timestamp value)

public CustomConstraint.Builder setUpdateTime(Timestamp value)

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
CustomConstraint.Builder

setUpdateTime(Timestamp.Builder builderForValue)

public CustomConstraint.Builder setUpdateTime(Timestamp.Builder builderForValue)

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

.google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
CustomConstraint.Builder