# Google Cloud Asset V1 Client - Class CustomConstraint (2.3.3)

2.3.3 (latest) 2.3.2 2.2.3 2.1.3 2.0.1 1.16.4 1.14.1 1.13.2 1.12.2 1.11.3 1.10.2 1.9.2 Reference documentation and code samples for the Google Cloud Asset V1 Client class CustomConstraint.

The definition of a custom constraint.

Generated from protobuf message `google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint`

## Namespace

Google \\ Cloud \\ Asset \\ V1 \\ AnalyzerOrgPolicyConstraint

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` 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" |
| `↳ resource_types` | `string[]` The Resource Instance type on which this policy applies to. Format will be of the form : " |
| `↳ method_types` | `int[]` All the operations being applied for this constraint. |
| `↳ condition` | `string` Organization Policy condition/expression. For example: `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or, `resource.management.auto_upgrade == true` |
| `↳ action_type` | `int` Allow or deny type. |
| `↳ display_name` | `string` One line display name for the UI. |
| `↳ description` | `string` Detailed information about this custom policy constraint. |

### getName

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"

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

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"

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

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

### getResourceTypes

The Resource Instance type on which this policy applies to. Format will
be of the form : "


- `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 to. Format will
be of the form : "


- `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

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCondition

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

| **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-asset/latest/V1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType). |

### setActionType

Allow or deny type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ActionType](https://docs.cloud.google.com/php/docs/reference/cloud-asset/latest/V1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType). |

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

### getDisplayName

One line display name for the UI.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

One line display name for the UI.

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

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

### getDescription

Detailed information about this custom policy constraint.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Detailed information about this custom policy constraint.

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

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