data_policies
Creates, updates, deletes, gets or lists a data_policies
resource.
Overview
Name | data_policies |
Type | Resource |
Id | google.bigquerydatapolicy.data_policies |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Output only. Resource name of this data policy, in the format of projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id} . |
dataMaskingPolicy | object | The data masking policy that is used to specify data masking rule. |
dataPolicyId | string | User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {data_policy_id} in part of the resource name. |
dataPolicyType | string | Type of data policy. |
policyTag | string | Policy tag resource name, in the format of projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id} . |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | dataPoliciesId, locationsId, projectsId | Gets the data policy specified by its resource name. |
list | SELECT | locationsId, projectsId | List all of the data policies in the specified parent project. |
create | INSERT | locationsId, projectsId | Creates a new data policy under a project with the given dataPolicyId (used as the display name), policy tag, and data policy type. |
delete | DELETE | dataPoliciesId, locationsId, projectsId | Deletes the data policy specified by its resource name. |
patch | UPDATE | dataPoliciesId, locationsId, projectsId | Updates the metadata for an existing data policy. The target data policy can be specified by the resource name. |
rename | EXEC | dataPoliciesId, locationsId, projectsId | Renames the id (display name) of the specified data policy. |
SELECT
examples
List all of the data policies in the specified parent project.
SELECT
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag
FROM google.bigquerydatapolicy.data_policies
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new data_policies
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.bigquerydatapolicy.data_policies (
locationsId,
projectsId,
policyTag,
dataMaskingPolicy,
dataPolicyType,
dataPolicyId
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ policyTag }}',
'{{ dataMaskingPolicy }}',
'{{ dataPolicyType }}',
'{{ dataPolicyId }}'
;
- name: your_resource_model_name
props:
- name: policyTag
value: string
- name: dataMaskingPolicy
value:
- name: predefinedExpression
value: string
- name: routine
value: string
- name: name
value: string
- name: dataPolicyType
value: string
- name: dataPolicyId
value: string
UPDATE
example
Updates a data_policies
resource.
/*+ update */
UPDATE google.bigquerydatapolicy.data_policies
SET
policyTag = '{{ policyTag }}',
dataMaskingPolicy = '{{ dataMaskingPolicy }}',
dataPolicyType = '{{ dataPolicyType }}',
dataPolicyId = '{{ dataPolicyId }}'
WHERE
dataPoliciesId = '{{ dataPoliciesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
DELETE
example
Deletes the specified data_policies
resource.
/*+ delete */
DELETE FROM google.bigquerydatapolicy.data_policies
WHERE dataPoliciesId = '{{ dataPoliciesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';