data_policies
Creates, updates, deletes, gets or lists a data_policies
resource.
Overview
Name | data_policies |
Type | Resource |
Id | google.bigquerydatapolicy.data_policies |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
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 specifies the data masking rule to use. (id: DataMaskingPolicy) |
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 | Required. Data policy type. 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} . |
Successful response
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 specifies the data masking rule to use. (id: DataMaskingPolicy) |
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 | Required. Data policy type. 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
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , dataPoliciesId | Gets the data policy specified by its resource name. | |
list | select | projectsId , locationsId | pageSize , pageToken , filter | List all of the data policies in the specified parent project. |
create | insert | projectsId , locationsId | Creates a new data policy under a project with the given dataPolicyId (used as the display name), policy tag, and data policy type. | |
patch | update | projectsId , locationsId , dataPoliciesId | updateMask , allowMissing | Updates the metadata for an existing data policy. The target data policy can be specified by the resource name. |
delete | delete | projectsId , locationsId , dataPoliciesId | force | Deletes the data policy specified by its resource name. |
rename | exec | projectsId , locationsId , dataPoliciesId | Renames the id (display name) of the specified data policy. |
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.
Name | Datatype | Description |
---|---|---|
dataPoliciesId | string | |
locationsId | string | |
projectsId | string | |
allowMissing | boolean | |
filter | string | |
force | boolean | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Gets the data policy specified by its resource name.
SELECT
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag
FROM google.bigquerydatapolicy.data_policies
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND dataPoliciesId = '{{ dataPoliciesId }}' -- required;
List all of the data policies in the specified parent project.
SELECT
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag
FROM google.bigquerydatapolicy.data_policies
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}';
INSERT
examples
- create
- Manifest
Creates a new data policy under a project with the given dataPolicyId
(used as the display name), policy tag, and data policy type.
INSERT INTO google.bigquerydatapolicy.data_policies (
data__policyTag,
data__dataMaskingPolicy,
data__dataPolicyType,
data__dataPolicyId,
projectsId,
locationsId
)
SELECT
'{{ policyTag }}',
'{{ dataMaskingPolicy }}',
'{{ dataPolicyType }}',
'{{ dataPolicyId }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag
;
# Description fields are for documentation purposes
- name: data_policies
props:
- name: projectsId
value: string
description: Required parameter for the data_policies resource.
- name: locationsId
value: string
description: Required parameter for the data_policies resource.
- name: policyTag
value: string
description: >
Policy tag resource name, in the format of `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
- name: dataMaskingPolicy
value: object
description: >
The data masking policy that specifies the data masking rule to use.
- name: dataPolicyType
value: string
description: >
Required. Data policy type. Type of data policy.
valid_values: ['DATA_POLICY_TYPE_UNSPECIFIED', 'COLUMN_LEVEL_SECURITY_POLICY', 'DATA_MASKING_POLICY']
- name: dataPolicyId
value: string
description: >
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.
UPDATE
examples
- patch
Updates the metadata for an existing data policy. The target data policy can be specified by the resource name.
UPDATE google.bigquerydatapolicy.data_policies
SET
data__policyTag = '{{ policyTag }}',
data__dataMaskingPolicy = '{{ dataMaskingPolicy }}',
data__dataPolicyType = '{{ dataPolicyType }}',
data__dataPolicyId = '{{ dataPolicyId }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND dataPoliciesId = '{{ dataPoliciesId }}' --required
AND updateMask = '{{ updateMask}}'
AND allowMissing = {{ allowMissing}}
RETURNING
name,
dataMaskingPolicy,
dataPolicyId,
dataPolicyType,
policyTag;
DELETE
examples
- delete
Deletes the data policy specified by its resource name.
DELETE FROM google.bigquerydatapolicy.data_policies
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND dataPoliciesId = '{{ dataPoliciesId }}' --required
AND force = '{{ force }}';
Lifecycle Methods
- rename
Renames the id (display name) of the specified data policy.
EXEC google.bigquerydatapolicy.data_policies.rename
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@dataPoliciesId='{{ dataPoliciesId }}' --required
@@json=
'{
"newDataPolicyId": "{{ newDataPolicyId }}"
}';