Skip to main content

content_policies

Creates, updates, deletes, gets or lists a content_policies resource.

Overview

Namecontent_policies
TypeResource
Idgoogle.dlp.content_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringOutput only. Resource name of the policy.
createTimestring (google-datetime)Output only. The creation timestamp of a contentPolicy; output-only field.
defaultActionobjectAction to take if the content is scanned and no rules match. Defaults to returning an ALLOW verdict if not set. (id: GooglePrivacyDlpV2PolicyAction)
displayNamestringOptional. Display name (max 63 chars)
errorsarrayOutput only. A stream of errors encountered when the policy was applied. Output only field. Will return the last 100 errors. Whenever the policy is modified this list will be cleared.
failedToScanSupportedFileTypeobjectOptional. Action to take if the content is a supported file type and size but fails to be scanned, for example because the file is encrypted or corrupted. (id: GooglePrivacyDlpV2PolicyAction)
inputTooLargeobjectOptional. Action to take if the content is a supported file type but is too large to be scanned. (id: GooglePrivacyDlpV2PolicyAction)
inspectConfigobjectOptional. InspectConfig to use to produce findings. (id: GooglePrivacyDlpV2InspectConfig)
inspectTemplateobjectOptional. InspectTemplate to use to produce findings. Deprecated: use inspect_config instead. (id: GooglePrivacyDlpV2InspectTemplate)
loggingConfigsarrayOptional. Log the actions taken by the content policy to external systems.
rulesarrayRequired. Policies to apply, based on the findings returned by inspection. The first rule to match applies.
unsupportedFileTypeobjectOptional. Action to take if the content is an unsupported file type. (id: GooglePrivacyDlpV2PolicyAction)
updateTimestring (google-datetime)Output only. The last update timestamp of a contentPolicy; output-only field.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_content_policies_getselectprojectsId, locationsId, contentPoliciesIdGet a ContentPolicy.
projects_locations_content_policies_listselectprojectsId, locationsIdpageToken, pageSizeLists ContentPolicies in a parent.
projects_locations_content_policies_createinsertprojectsId, locationsIdCreate a ContentPolicy.
projects_locations_content_policies_patchupdateprojectsId, locationsId, contentPoliciesIdUpdate a ContentPolicy.
projects_locations_content_policies_deletedeleteprojectsId, locationsId, contentPoliciesIdDelete a ContentPolicy.

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
contentPoliciesIdstring
locationsIdstring
projectsIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Get a ContentPolicy.

SELECT
name,
createTime,
defaultAction,
displayName,
errors,
failedToScanSupportedFileType,
inputTooLarge,
inspectConfig,
inspectTemplate,
loggingConfigs,
rules,
unsupportedFileType,
updateTime
FROM google.dlp.content_policies
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND contentPoliciesId = '{{ contentPoliciesId }}' -- required
;

INSERT examples

Create a ContentPolicy.

INSERT INTO google.dlp.content_policies (
data__contentPolicy,
data__contentPolicyId,
projectsId,
locationsId
)
SELECT
'{{ contentPolicy }}',
'{{ contentPolicyId }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
createTime,
defaultAction,
displayName,
errors,
failedToScanSupportedFileType,
inputTooLarge,
inspectConfig,
inspectTemplate,
loggingConfigs,
rules,
unsupportedFileType,
updateTime
;

UPDATE examples

Update a ContentPolicy.

UPDATE google.dlp.content_policies
SET
data__contentPolicy = '{{ contentPolicy }}',
data__updateMask = '{{ updateMask }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND contentPoliciesId = '{{ contentPoliciesId }}' --required
RETURNING
name,
createTime,
defaultAction,
displayName,
errors,
failedToScanSupportedFileType,
inputTooLarge,
inspectConfig,
inspectTemplate,
loggingConfigs,
rules,
unsupportedFileType,
updateTime;

DELETE examples

Delete a ContentPolicy.

DELETE FROM google.dlp.content_policies
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND contentPoliciesId = '{{ contentPoliciesId }}' --required
;