Skip to main content

org_policy_violations_previews

Creates, updates, deletes, gets or lists an org_policy_violations_previews resource.

Overview

Nameorg_policy_violations_previews
TypeResource
Idgoogle.policysimulator.org_policy_violations_previews

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput 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
createTimestring (google-datetime)Output only. Time when this OrgPolicyViolationsPreview was created.
customConstraintsarrayOutput 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
overlayobjectRequired. The proposed changes we are previewing violations for. (id: GoogleCloudPolicysimulatorV1OrgPolicyOverlay)
resourceCountsobjectOutput only. A summary of the state of all resources scanned for compliance with the changed OrgPolicy. (id: GoogleCloudPolicysimulatorV1OrgPolicyViolationsPreviewResourceCounts)
statestringOutput only. The state of the OrgPolicyViolationsPreview.
violationsCountinteger (int32)Output only. The number of OrgPolicyViolations in this OrgPolicyViolationsPreview. This count may differ from resource_summary.noncompliant_count because each 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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
organizations_locations_org_policy_violations_previews_getselectorganizationsId, locationsId, orgPolicyViolationsPreviewsIdGetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each OrgPolicyViolationsPreview is available for at least 7 days.
organizations_locations_org_policy_violations_previews_listselectorganizationsId, locationsIdpageSize, pageTokenListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each OrgPolicyViolationsPreview is available for at least 7 days.
organizations_locations_org_policy_violations_previews_createinsertorganizationsId, locationsIdorgPolicyViolationsPreviewIdCreateOrgPolicyViolationsPreview creates an OrgPolicyViolationsPreview for the proposed changes in the provided OrgPolicyViolationsPreview.OrgPolicyOverlay. The changes to OrgPolicy are specified by this OrgPolicyOverlay. The resources to scan are inferred from these specified changes.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
orgPolicyViolationsPreviewsIdstring
organizationsIdstring
orgPolicyViolationsPreviewIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each OrgPolicyViolationsPreview is available for at least 7 days.

SELECT
name,
createTime,
customConstraints,
overlay,
resourceCounts,
state,
violationsCount
FROM google.policysimulator.org_policy_violations_previews
WHERE organizationsId = '{{ organizationsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND orgPolicyViolationsPreviewsId = '{{ orgPolicyViolationsPreviewsId }}' -- required;

INSERT examples

CreateOrgPolicyViolationsPreview creates an OrgPolicyViolationsPreview for the proposed changes in the provided OrgPolicyViolationsPreview.OrgPolicyOverlay. The changes to OrgPolicy are specified by this OrgPolicyOverlay. The resources to scan are inferred from these specified changes.

INSERT INTO google.policysimulator.org_policy_violations_previews (
data__overlay,
organizationsId,
locationsId,
orgPolicyViolationsPreviewId
)
SELECT
'{{ overlay }}',
'{{ organizationsId }}',
'{{ locationsId }}',
'{{ orgPolicyViolationsPreviewId }}'
RETURNING
name,
done,
error,
metadata,
response
;