# Google Cloud Policy Simulator V1 Client - Class OrgPolicyViolation (1.3.4)

1.3.4 (latest) 1.3.3 1.2.0 1.1.1 1.0.3 0.2.5 0.1.1 Reference documentation and code samples for the Google Cloud Policy Simulator V1 Client class OrgPolicyViolation.

OrgPolicyViolation is a resource representing a single resource violating a
single OrgPolicy constraint.

Generated from protobuf message `google.cloud.policysimulator.v1.OrgPolicyViolation`

## Namespace

Google \\ Cloud \\ PolicySimulator \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` The name of the `OrgPolicyViolation`. Example: organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f/orgPolicyViolations/38ce\` |
| `↳ resource` | `https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.ResourceContext` The resource violating the constraint. |
| `↳ custom_constraint` | `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.CustomConstraint.html` The custom constraint being violated. |
| `↳ error` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` Any error encountered during the evaluation. |

### getName

The name of the `OrgPolicyViolation`. Example:
organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f/orgPolicyViolations/38ce\`

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

### setName

The name of the `OrgPolicyViolation`. Example:
organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f/orgPolicyViolations/38ce\`

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

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

### getResource

The resource violating the constraint.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.ResourceContext|null` |   |

### hasResource

### clearResource

### setResource

The resource violating the constraint.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.ResourceContext` |

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

### getCustomConstraint

The custom constraint being violated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.CustomConstraint.html|null` |   |

### hasCustomConstraint

### clearCustomConstraint

### setCustomConstraint

The custom constraint being violated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-org-policy/latest/V2.CustomConstraint.html` |

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

### getError

Any error encountered during the evaluation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html|null` |   |

### hasError

### clearError

### setError

Any error encountered during the evaluation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` |

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