Skip to main content

policy_tags

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

Overview

Namepolicy_tags
TypeResource
Idgoogle.datacatalog.policy_tags

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. Resource name of this policy tag in the URL format. The policy tag manager generates unique taxonomy IDs and policy tag IDs.
childPolicyTagsarrayOutput only. Resource names of child policy tags of this policy tag.
descriptionstringDescription of this policy tag. If not set, defaults to empty. The description must contain only Unicode characters, tabs, newlines, carriage returns and page breaks, and be at most 2000 bytes long when encoded in UTF-8.
displayNamestringRequired. User-defined name of this policy tag. The name can't start or end with spaces and must be unique within the parent taxonomy, contain only Unicode letters, numbers, underscores, dashes and spaces, and be at most 200 bytes long when encoded in UTF-8.
parentPolicyTagstringResource name of this policy tag's parent policy tag. If empty, this is a top level tag. If not set, defaults to an empty string. For example, for the "LatLong" policy tag in the example above, this field contains the resource name of the "Geolocation" policy tag, and, for "Geolocation", this field is empty.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_taxonomies_policy_tags_getselectprojectsId, locationsId, taxonomiesId, policyTagsIdGets a policy tag.
projects_locations_taxonomies_policy_tags_listselectprojectsId, locationsId, taxonomiesIdpageSize, pageTokenLists all policy tags in a taxonomy.
projects_locations_taxonomies_policy_tags_createinsertprojectsId, locationsId, taxonomiesIdCreates a policy tag in a taxonomy.
projects_locations_taxonomies_policy_tags_patchupdateprojectsId, locationsId, taxonomiesId, policyTagsIdupdateMaskUpdates a policy tag, including its display name, description, and parent policy tag.
projects_locations_taxonomies_policy_tags_deletedeleteprojectsId, locationsId, taxonomiesId, policyTagsIdDeletes a policy tag together with the following: * All of its descendant policy tags, if any * Policies associated with the policy tag and its descendants * References from BigQuery table schema of the policy tag and its descendants

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
policyTagsIdstring
projectsIdstring
taxonomiesIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a policy tag.

SELECT
name,
childPolicyTags,
description,
displayName,
parentPolicyTag
FROM google.datacatalog.policy_tags
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND taxonomiesId = '{{ taxonomiesId }}' -- required
AND policyTagsId = '{{ policyTagsId }}' -- required;

INSERT examples

Creates a policy tag in a taxonomy.

INSERT INTO google.datacatalog.policy_tags (
data__name,
data__displayName,
data__description,
data__parentPolicyTag,
projectsId,
locationsId,
taxonomiesId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ description }}',
'{{ parentPolicyTag }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ taxonomiesId }}'
RETURNING
name,
childPolicyTags,
description,
displayName,
parentPolicyTag
;

UPDATE examples

Updates a policy tag, including its display name, description, and parent policy tag.

UPDATE google.datacatalog.policy_tags
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__description = '{{ description }}',
data__parentPolicyTag = '{{ parentPolicyTag }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND taxonomiesId = '{{ taxonomiesId }}' --required
AND policyTagsId = '{{ policyTagsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
childPolicyTags,
description,
displayName,
parentPolicyTag;

DELETE examples

Deletes a policy tag together with the following: * All of its descendant policy tags, if any * Policies associated with the policy tag and its descendants * References from BigQuery table schema of the policy tag and its descendants

DELETE FROM google.datacatalog.policy_tags
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND taxonomiesId = '{{ taxonomiesId }}' --required
AND policyTagsId = '{{ policyTagsId }}' --required;