Skip to content

Latest commit

 

History

History
221 lines (143 loc) · 14.7 KB

File metadata and controls

221 lines (143 loc) · 14.7 KB

Client.Governance.Data.Policies

Overview

Available Operations

  • retrieve - Gets specified policy
  • update - Updates an existing policy
  • list - Lists policies
  • create - Creates new policy
  • download - Downloads violations CSV for policy

retrieve

Fetches the specified policy version, or the latest if no version is provided.

Example Usage

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)

Parameters

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.

Response

models.GetDlpReportResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

update

Updates an existing policy.

Example Usage

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)

Parameters

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.

Response

models.UpdateDlpReportResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

list

Lists policies with filtering.

Example Usage

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)

Parameters

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.

Response

models.ListDlpReportsResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

create

Creates a new policy with specified specifications and returns its id.

Example Usage

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)

Parameters

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.

Response

models.CreateDlpReportResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

download

Downloads CSV violations report for a specific policy id. This does not support continuous policies.

Example Usage

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)

Parameters

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.

Response

str

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*