Client.Governance.Data.Policies
retrieve - Gets specified policy
update - Updates an existing policy
list - Lists policies
create - Creates new policy
download - Downloads violations CSV for policy
Fetches the specified policy version, or the latest if no version is provided.
from glean .api_client import Glean
import os
with Glean (
api_token = os .getenv ("GLEAN_API_TOKEN" , "" ),
) as glean :
res = glean .client .governance .data .policies .retrieve (id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
id
str
✔️
The id of the policy to fetch.
version
Optional[int]
➖
The version of the policy to fetch. Each time a policy is updated, the older version is still stored. If this is left empty, the latest policy is fetched.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.GetDlpReportResponse
Error Type
Status Code
Content Type
errors.GleanError
4XX, 5XX
*/*
Updates an existing policy.
from glean .api_client import Glean
import os
with Glean (
api_token = os .getenv ("GLEAN_API_TOKEN" , "" ),
) as glean :
res = glean .client .governance .data .policies .update (id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
id
str
✔️
The id of the policy to fetch.
config
Optional[models.DlpConfig]
➖
Detailed configuration of what documents and sensitive content will be scanned.
frequency
Optional[models.DlpFrequency]
➖
Interval between scans. DAILY is deprecated.
status
Optional[models.DlpReportStatus]
➖
The status of the policy/report. Only ACTIVE status will be picked for scans.
auto_hide_docs
Optional[bool]
➖
The new autoHideDoc boolean the policy will be updated to if provided.
report_name
Optional[str]
➖
The new name of the policy if provided.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.UpdateDlpReportResponse
Error Type
Status Code
Content Type
errors.GleanError
4XX, 5XX
*/*
Lists policies with filtering.
from glean .api_client import Glean
import os
with Glean (
api_token = os .getenv ("GLEAN_API_TOKEN" , "" ),
) as glean :
res = glean .client .governance .data .policies .list ()
# Handle response
print (res )
Parameter
Type
Required
Description
auto_hide
Optional[bool]
➖
Filter to return reports with a given value of auto-hide.
frequency
Optional[str]
➖
Filter to return reports with a given frequency.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.ListDlpReportsResponse
Error Type
Status Code
Content Type
errors.GleanError
4XX, 5XX
*/*
Creates a new policy with specified specifications and returns its id.
from glean .api_client import Glean
import os
with Glean (
api_token = os .getenv ("GLEAN_API_TOKEN" , "" ),
) as glean :
res = glean .client .governance .data .policies .create ()
# Handle response
print (res )
Parameter
Type
Required
Description
name
Optional[str]
➖
Name of the policy being created.
config
Optional[models.DlpConfig]
➖
Detailed configuration of what documents and sensitive content will be scanned.
frequency
Optional[models.DlpFrequency]
➖
Interval between scans. DAILY is deprecated.
auto_hide_docs
Optional[bool]
➖
Controls whether the policy should hide documents with violations.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.CreateDlpReportResponse
Error Type
Status Code
Content Type
errors.GleanError
4XX, 5XX
*/*
Downloads CSV violations report for a specific policy id. This does not support continuous policies.
from glean .api_client import Glean
import os
with Glean (
api_token = os .getenv ("GLEAN_API_TOKEN" , "" ),
) as glean :
res = glean .client .governance .data .policies .download (id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
id
str
✔️
The id of the policy to download violations for.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
str
Error Type
Status Code
Content Type
errors.GleanError
4XX, 5XX
*/*