# Google Cloud Org Policy V2 Client - Class CustomConstraintDefinition (1.3.3)

1.3.3 (latest) 1.3.2 1.2.2 1.1.3 1.0.0 0.7.0 0.6.5 0.5.3 0.4.2 0.3.7 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` | `string[]` 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` | `int[]` 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. |
| `↳ action_type` | `int` Allow or deny type. |
| `↳ parameters` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Stores the structure of [`Parameters`](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.Parameter) used by the constraint condition. The key of `map` represents the name of the parameter. |

### getResourceTypes

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

- `compute.googleapis.com/Instance`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setResourceTypes

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

- `compute.googleapis.com/Instance`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMethodTypes

All the operations being applied for this constraint.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### setMethodTypes

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` | Enum of type [ActionType](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.ActionType). |

### setActionType

Allow or deny type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ActionType](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.ActionType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getParameters

Stores the structure of
[`Parameters`](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.Parameter)
used by the constraint condition. The key of `map` represents the name of
the parameter.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setParameters

Stores the structure of
[`Parameters`](https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.Constraint.CustomConstraintDefinition.Parameter)
used by the constraint condition. The key of `map` represents the name of
the parameter.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |