# Policy Simulator V1 API - Class Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview (v1.9.0)

1.9.0 (latest) 1.8.1 1.7.0 1.6.1 1.5.0 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.4.0 0.3.2 0.2.0 0.1.1 Reference documentation and code samples for the Policy Simulator V1 API class Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview.

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


<br />

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.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #create_time

    def create_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Protobuf-Timestamp)) --- Output only. Time when this `OrgPolicyViolationsPreview` was created.

### #custom_constraints

    def custom_constraints() -> ::Array<::String>

**Returns**

- (::Array\<::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`

### #name

    def name() -> ::String

**Returns**

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

### #overlay

    def overlay() -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay

**Returns**

- ([::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyOverlay)) --- Required. The proposed changes we are previewing violations for.

### #overlay=

    def overlay=(value) -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay

**Parameter**

- **value** ([::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyOverlay)) --- Required. The proposed changes we are previewing violations for.
**Returns**

- ([::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyOverlay)) --- Required. The proposed changes we are previewing violations for.

### #resource_counts

    def resource_counts() -> ::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview::ResourceCounts

**Returns**

- ([::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview::ResourceCounts](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyViolationsPreview-ResourceCounts)) --- Output only. A summary of the state of all resources scanned for compliance with the changed OrgPolicy.

### #state

    def state() -> ::Google::Cloud::PolicySimulator::V1::PreviewState

**Returns**

- ([::Google::Cloud::PolicySimulator::V1::PreviewState](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-PreviewState)) --- Output only. The state of the `OrgPolicyViolationsPreview`.

### #violations_count

    def violations_count() -> ::Integer

**Returns**

- (::Integer) --- 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/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-OrgPolicyViolation "Google::Cloud::PolicySimulator::V1::OrgPolicyViolation (class)") 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.