# Google Cloud Policy Simulator V1 Client - Class OrgPolicyViolationsPreview (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 OrgPolicyViolationsPreview.

OrgPolicyViolationsPreview is a resource providing a preview of the
violations that will exist if an OrgPolicy change is made.

The list of violations are modeled as child resources and retrieved via a
ListOrgPolicyViolations API call. There are potentially more
OrgPolicyViolations than could fit in an embedded field. Thus, the use of
a child resource instead of a field.

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

## Namespace

Google \\ Cloud \\ PolicySimulator \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. The resource name of the `OrgPolicyViolationsPreview`. It has the following format: `organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}` Example: `organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f` |
| `↳ state` | `int` Output only. The state of the `OrgPolicyViolationsPreview`. |
| `↳ overlay` | `https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.OrgPolicyOverlay` Required. The proposed changes we are previewing violations for. |
| `↳ violations_count` | `int` Output only. The number of OrgPolicyViolations in this `OrgPolicyViolationsPreview`. This count may differ from `resource_summary.noncompliant_count` because each [OrgPolicyViolation](https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.OrgPolicyViolation) is specific to a resource **and** constraint. If there are multiple constraints being evaluated (i.e. multiple policies in the overlay), a single resource may violate multiple constraints. |
| `↳ resource_counts` | `https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.OrgPolicyViolationsPreview.ResourceCounts` Output only. A summary of the state of all resources scanned for compliance with the changed OrgPolicy. |
| `↳ custom_constraints` | `string[]` Output only. The names of the constraints against which all `OrgPolicyViolations` were evaluated. If `OrgPolicyOverlay` only contains `PolicyOverlay` then it contains the name of the configured custom constraint, applicable to the specified policies. Otherwise it contains the name of the constraint specified in `CustomConstraintOverlay`. Format: `organizations/{organization_id}/customConstraints/{custom_constraint_id}` Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms` |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when this `OrgPolicyViolationsPreview` was created. |

### getName

Output only. The resource name of the `OrgPolicyViolationsPreview`. It has
the following format:
`organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}`
Example:
`organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f`

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

### setName

Output only. The resource name of the `OrgPolicyViolationsPreview`. It has
the following format:
`organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}`
Example:
`organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f`

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

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

### getState

Output only. The state of the `OrgPolicyViolationsPreview`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [PreviewState](https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.PreviewState). |

### setState

Output only. The state of the `OrgPolicyViolationsPreview`.

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

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

### getOverlay

Required. The proposed changes we are previewing violations for.

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

### hasOverlay

### clearOverlay

### setOverlay

Required. The proposed changes we are previewing violations for.

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

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

### getViolationsCount

Output only. The number of OrgPolicyViolations in this
`OrgPolicyViolationsPreview`. This count may differ from
`resource_summary.noncompliant_count` because each
[OrgPolicyViolation](https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.OrgPolicyViolation) is
specific to a resource **and** constraint. If there are multiple
constraints being evaluated (i.e. multiple policies in the overlay), a
single resource may violate multiple constraints.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setViolationsCount

Output only. The number of OrgPolicyViolations in this
`OrgPolicyViolationsPreview`. This count may differ from
`resource_summary.noncompliant_count` because each
[OrgPolicyViolation](https://docs.cloud.google.com/php/docs/reference/cloud-policysimulator/latest/V1.OrgPolicyViolation) is
specific to a resource **and** constraint. If there are multiple
constraints being evaluated (i.e. multiple policies in the overlay), a
single resource may violate multiple constraints.

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

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

### getResourceCounts

Output only. A summary of the state of all resources scanned for compliance
with the changed OrgPolicy.

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

### hasResourceCounts

### clearResourceCounts

### setResourceCounts

Output only. A summary of the state of all resources scanned for compliance
with the changed OrgPolicy.

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

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

### getCustomConstraints

Output only. The names of the constraints against which all
`OrgPolicyViolations` were evaluated.

If `OrgPolicyOverlay` only contains `PolicyOverlay` then it contains
the name of the configured custom constraint, applicable to the specified
policies. Otherwise it contains the name of the constraint specified in
`CustomConstraintOverlay`.
Format:
`organizations/{organization_id}/customConstraints/{custom_constraint_id}`
Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`

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

### setCustomConstraints

Output only. The names of the constraints against which all
`OrgPolicyViolations` were evaluated.

If `OrgPolicyOverlay` only contains `PolicyOverlay` then it contains
the name of the configured custom constraint, applicable to the specified
policies. Otherwise it contains the name of the constraint specified in
`CustomConstraintOverlay`.
Format:
`organizations/{organization_id}/customConstraints/{custom_constraint_id}`
Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`

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

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

### getCreateTime

Output only. Time when this `OrgPolicyViolationsPreview` was created.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Time when this `OrgPolicyViolationsPreview` was created.

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

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