Reference documentation and code samples for the Google Cloud Org Policy V2 Client class CustomConstraintDefinition.
Custom constraint definition. Defines this as a managed constraint.
Generated from protobuf message google.cloud.orgpolicy.v2.Constraint.CustomConstraintDefinition
Namespace
Google \ Cloud \ OrgPolicy \ V2 \ Constraint
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ resource_types
array
The resource instance type on which this policy applies. Format will be of the form : <service name>/<type> Example: * * compute.googleapis.com/Instance.
↳ method_types
array
All the operations being applied for this constraint.
↳ condition
string
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.
All the operations being applied for this constraint.
Parameter
Name
Description
var
int[]
Returns
Type
Description
$this
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.
Returns
Type
Description
string
setCondition
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.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getActionType
Allow or deny type.
Returns
Type
Description
int
setActionType
Allow or deny type.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getParameters
Stores the structure of
Parameters
used by the constraint condition. The key of map represents the name of
the parameter.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Org Policy V2 Client - Class CustomConstraintDefinition (1.2.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.2.2 (latest)](/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition)\n- [1.2.1](/php/docs/reference/cloud-org-policy/1.2.1/V2.Constraint.CustomConstraintDefinition)\n- [1.1.3](/php/docs/reference/cloud-org-policy/1.1.3/V2.Constraint.CustomConstraintDefinition)\n- [1.0.0](/php/docs/reference/cloud-org-policy/1.0.0/V2.Constraint.CustomConstraintDefinition)\n- [0.7.0](/php/docs/reference/cloud-org-policy/0.7.0/V2.Constraint.CustomConstraintDefinition)\n- [0.6.5](/php/docs/reference/cloud-org-policy/0.6.5/V2.Constraint.CustomConstraintDefinition)\n- [0.5.3](/php/docs/reference/cloud-org-policy/0.5.3/V2.Constraint.CustomConstraintDefinition)\n- [0.4.2](/php/docs/reference/cloud-org-policy/0.4.2/V2.Constraint.CustomConstraintDefinition)\n- [0.3.7](/php/docs/reference/cloud-org-policy/0.3.7/V2.Constraint.CustomConstraintDefinition) \nReference documentation and code samples for the Google Cloud Org Policy V2 Client class CustomConstraintDefinition.\n\nCustom constraint definition. Defines this as a managed constraint.\n\nGenerated from protobuf message `google.cloud.orgpolicy.v2.Constraint.CustomConstraintDefinition`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ OrgPolicy \\\\ V2 \\\\ Constraint\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getResourceTypes\n\nThe resource instance type on which this policy applies. Format will be\nof the form : `\u003cservice name\u003e/\u003ctype\u003e` Example:\n\n- `compute.googleapis.com/Instance`.\n\n### setResourceTypes\n\nThe resource instance type on which this policy applies. Format will be\nof the form : `\u003cservice name\u003e/\u003ctype\u003e` Example:\n\n- `compute.googleapis.com/Instance`.\n\n### getMethodTypes\n\nAll the operations being applied for this constraint.\n\n### setMethodTypes\n\nAll the operations being applied for this constraint.\n\n### getCondition\n\nOrg policy condition/expression. For example:\n`resource.instanceName.matches(\"[production|test]_.*_(\\d)+\")` or,\n`resource.management.auto_upgrade == true`\nThe max length of the condition is 1000 characters.\n\n### setCondition\n\nOrg policy condition/expression. For example:\n`resource.instanceName.matches(\"[production|test]_.*_(\\d)+\")` or,\n`resource.management.auto_upgrade == true`\nThe max length of the condition is 1000 characters.\n\n### getActionType\n\nAllow or deny type.\n\n### setActionType\n\nAllow or deny type.\n\n### getParameters\n\nStores the structure of\n[`Parameters`](/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.Parameter)\nused by the constraint condition. The key of `map` represents the name of\nthe parameter.\n\n### setParameters\n\nStores the structure of\n[`Parameters`](/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.Parameter)\nused by the constraint condition. The key of `map` represents the name of\nthe parameter."]]