airflow.contrib.hooks.gcp_dlp_hook

This module contains a CloudDLPHook which allows you to connect to GCP Cloud DLP service.

Module Contents

airflow.contrib.hooks.gcp_dlp_hook.DLP_JOB_PATH_PATTERN = ^projects/[^/]+/dlpJobs/(?P<job>.*?)$[source]
airflow.contrib.hooks.gcp_dlp_hook.TIME_TO_SLEEP_IN_SECONDS = 1[source]
class airflow.contrib.hooks.gcp_dlp_hook.CloudDLPHook(gcp_conn_id='google_cloud_default', delegate_to=None)[source]

Bases: airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook

Hook for Google Cloud Data Loss Prevention (DLP) APIs. Cloud DLP allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data redaction and scheduling of data scans on Google Cloud Platform based data sets.

Parameters
  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • delegate_to (str) – The account to impersonate, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

get_conn(self)[source]

Provides a client for interacting with the Cloud DLP API.

Returns

GCP Cloud DLP API Client

Return type

google.cloud.dlp_v2.DlpServiceClient

cancel_dlp_job(self, dlp_job_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

Starts asynchronous cancellation on a long-running DLP job.

Parameters
  • dlp_job_id (str) – ID of the DLP job resource to be cancelled.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

create_deidentify_template(self, organization_id=None, project_id=None, deidentify_template=None, template_id=None, retry=None, timeout=None, metadata=None)[source]

Creates a deidentify template for re-using frequently used configuration for de-identifying content, images, and storage.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • deidentify_template (dict or google.cloud.dlp_v2.types.DeidentifyTemplate) – (Optional) The deidentify template to create.

  • template_id (str) – (Optional) The template ID.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.DeidentifyTemplate

create_dlp_job(self, project_id=None, inspect_job=None, risk_job=None, job_id=None, retry=None, timeout=None, metadata=None, wait_until_finished=True)[source]

Creates a new job to inspect storage or calculate risk metrics.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • inspect_job (dict or google.cloud.dlp_v2.types.InspectJobConfig) – (Optional) The configuration for the inspect job.

  • risk_job (dict or google.cloud.dlp_v2.types.RiskAnalysisJobConfig) – (Optional) The configuration for the risk job.

  • job_id (str) – (Optional) The job ID.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

  • wait_until_finished (bool) – (Optional) If true, it will keep polling the job state until it is set to DONE.

Return type

google.cloud.dlp_v2.types.DlpJob

create_inspect_template(self, organization_id=None, project_id=None, inspect_template=None, template_id=None, retry=None, timeout=None, metadata=None)[source]

Creates an inspect template for re-using frequently used configuration for inspecting content, images, and storage.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • inspect_template (dict or google.cloud.dlp_v2.types.InspectTemplate) – (Optional) The inspect template to create.

  • template_id (str) – (Optional) The template ID.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.InspectTemplate

create_job_trigger(self, project_id=None, job_trigger=None, trigger_id=None, retry=None, timeout=None, metadata=None)[source]

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • job_trigger (dict or google.cloud.dlp_v2.types.JobTrigger) – (Optional) The job trigger to create.

  • trigger_id (str) – (Optional) The job trigger ID.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.JobTrigger

create_stored_info_type(self, organization_id=None, project_id=None, config=None, stored_info_type_id=None, retry=None, timeout=None, metadata=None)[source]

Creates a pre-built stored info type to be used for inspection.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • config (dict or google.cloud.dlp_v2.types.StoredInfoTypeConfig) – (Optional) The config for the stored info type.

  • stored_info_type_id (str) – (Optional) The stored info type ID.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.StoredInfoType

deidentify_content(self, project_id=None, deidentify_config=None, inspect_config=None, item=None, inspect_template_name=None, deidentify_template_name=None, retry=None, timeout=None, metadata=None)[source]

De-identifies potentially sensitive info from a content item. This method has limits on input size and output size.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • deidentify_config (dict or google.cloud.dlp_v2.types.DeidentifyConfig) – (Optional) Configuration for the de-identification of the content item. Items specified here will override the template referenced by the deidentify_template_name argument.

  • inspect_config (dict or google.cloud.dlp_v2.types.InspectConfig) – (Optional) Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument.

  • item (dict or google.cloud.dlp_v2.types.ContentItem) – (Optional) The item to de-identify. Will be treated as text.

  • inspect_template_name (str) – (Optional) Optional template to use. Any configuration directly specified in inspect_config will override those set in the template.

  • deidentify_template_name (str) – (Optional) Optional template to use. Any configuration directly specified in deidentify_config will override those set in the template.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.DeidentifyContentResponse

delete_deidentify_template(self, template_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Deletes a deidentify template.

Parameters
  • template_id (str) – The ID of deidentify template to be deleted.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

delete_dlp_job(self, dlp_job_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

Deletes a long-running DLP job. This method indicates that the client is no longer interested in the DLP job result. The job will be cancelled if possible.

Parameters
  • dlp_job_id (str) – The ID of the DLP job resource to be cancelled.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

delete_inspect_template(self, template_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Deletes an inspect template.

Parameters
  • template_id (str) – The ID of the inspect template to be deleted.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

delete_job_trigger(self, job_trigger_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

Deletes a job trigger.

Parameters
  • job_trigger_id (str) – The ID of the DLP job trigger to be deleted.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

delete_stored_info_type(self, stored_info_type_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Deletes a stored info type.

Parameters
  • stored_info_type_id (str) – The ID of the stored info type to be deleted.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

get_deidentify_template(self, template_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Gets a deidentify template.

Parameters
  • template_id (str) – The ID of deidentify template to be read.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.DeidentifyTemplate

get_dlp_job(self, dlp_job_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

Gets the latest state of a long-running Dlp Job.

Parameters
  • dlp_job_id (str) – The ID of the DLP job resource to be read.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.DlpJob

get_inspect_template(self, template_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Gets an inspect template.

Parameters
  • template_id (str) – The ID of inspect template to be read.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.InspectTemplate

get_job_trigger(self, job_trigger_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

Gets a DLP job trigger.

Parameters
  • job_trigger_id (str) – The ID of the DLP job trigger to be read.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.JobTrigger

get_stored_info_type(self, stored_info_type_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

Gets a stored info type.

Parameters
  • stored_info_type_id (str) – The ID of the stored info type to be read.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.StoredInfoType

inspect_content(self, project_id=None, inspect_config=None, item=None, inspect_template_name=None, retry=None, timeout=None, metadata=None)[source]

Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • inspect_config (dict or google.cloud.dlp_v2.types.InspectConfig) – (Optional) Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument.

  • item (dict or google.cloud.dlp_v2.types.ContentItem) – (Optional) The item to de-identify. Will be treated as text.

  • inspect_template_name (str) – (Optional) Optional template to use. Any configuration directly specified in inspect_config will override those set in the template.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.InspectContentResponse

list_deidentify_templates(self, organization_id=None, project_id=None, page_size=None, order_by=None, retry=None, timeout=None, metadata=None)[source]

Lists deidentify templates.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • page_size (int) – (Optional) The maximum number of resources contained in the underlying API response.

  • order_by (str) – (Optional) Optional comma separated list of fields to order by, followed by asc or desc postfix.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

list[google.cloud.dlp_v2.types.DeidentifyTemplate]

list_dlp_jobs(self, project_id=None, results_filter=None, page_size=None, job_type=None, order_by=None, retry=None, timeout=None, metadata=None)[source]

Lists DLP jobs that match the specified filter in the request.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • results_filter (str) – (Optional) Filter used to specify a subset of results.

  • page_size (int) – (Optional) The maximum number of resources contained in the underlying API response.

  • job_type (str) – (Optional) The type of job.

  • order_by (str) – (Optional) Optional comma separated list of fields to order by, followed by asc or desc postfix.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

list[google.cloud.dlp_v2.types.DlpJob]

list_info_types(self, language_code=None, results_filter=None, retry=None, timeout=None, metadata=None)[source]

Returns a list of the sensitive information types that the DLP API supports.

Parameters
  • language_code (str) – (Optional) Optional BCP-47 language code for localized info type friendly names. If omitted, or if localized strings are not available, en-US strings will be returned.

  • results_filter (str) – (Optional) Filter used to specify a subset of results.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.ListInfoTypesResponse

list_inspect_templates(self, organization_id=None, project_id=None, page_size=None, order_by=None, retry=None, timeout=None, metadata=None)[source]

Lists inspect templates.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • page_size (int) – (Optional) The maximum number of resources contained in the underlying API response.

  • order_by (str) – (Optional) Optional comma separated list of fields to order by, followed by asc or desc postfix.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

list[google.cloud.dlp_v2.types.InspectTemplate]

list_job_triggers(self, project_id=None, page_size=None, order_by=None, results_filter=None, retry=None, timeout=None, metadata=None)[source]

Lists job triggers.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • page_size (int) – (Optional) The maximum number of resources contained in the underlying API response.

  • order_by (str) – (Optional) Optional comma separated list of fields to order by, followed by asc or desc postfix.

  • results_filter (str) – (Optional) Filter used to specify a subset of results.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

list[google.cloud.dlp_v2.types.JobTrigger]

list_stored_info_types(self, organization_id=None, project_id=None, page_size=None, order_by=None, retry=None, timeout=None, metadata=None)[source]

Lists stored info types.

Parameters
  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • page_size (int) – (Optional) The maximum number of resources contained in the underlying API response.

  • order_by (str) – (Optional) Optional comma separated list of fields to order by, followed by asc or desc postfix.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

list[google.cloud.dlp_v2.types.StoredInfoType]

redact_image(self, project_id=None, inspect_config=None, image_redaction_configs=None, include_findings=None, byte_item=None, retry=None, timeout=None, metadata=None)[source]

Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • inspect_config (dict or google.cloud.dlp_v2.types.InspectConfig) – (Optional) Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument.

  • image_redaction_configs (list[dict] or list[google.cloud.dlp_v2.types.ImageRedactionConfig]) – (Optional) The configuration for specifying what content to redact from images.

  • include_findings (bool) – (Optional) Whether the response should include findings along with the redacted image.

  • byte_item (dict or google.cloud.dlp_v2.types.ByteContentItem) – (Optional) The content must be PNG, JPEG, SVG or BMP.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.RedactImageResponse

reidentify_content(self, project_id=None, reidentify_config=None, inspect_config=None, item=None, inspect_template_name=None, reidentify_template_name=None, retry=None, timeout=None, metadata=None)[source]

Re-identifies content that has been de-identified.

Parameters
  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • reidentify_config (dict or google.cloud.dlp_v2.types.DeidentifyConfig) – (Optional) Configuration for the re-identification of the content item.

  • inspect_config (dict or google.cloud.dlp_v2.types.InspectConfig) – (Optional) Configuration for the inspector.

  • item (dict or google.cloud.dlp_v2.types.ContentItem) – (Optional) The item to re-identify. Will be treated as text.

  • inspect_template_name (str) – (Optional) Optional template to use. Any configuration directly specified in inspect_config will override those set in the template.

  • reidentify_template_name (str) – (Optional) Optional template to use. References an instance of deidentify template. Any configuration directly specified in reidentify_config or inspect_config will override those set in the template.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.ReidentifyContentResponse

update_deidentify_template(self, template_id, organization_id=None, project_id=None, deidentify_template=None, update_mask=None, retry=None, timeout=None, metadata=None)[source]

Updates the deidentify template.

Parameters
  • template_id (str) – The ID of deidentify template to be updated.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • deidentify_template (dict or google.cloud.dlp_v2.types.DeidentifyTemplate) – New deidentify template value.

  • update_mask (dict or google.cloud.dlp_v2.types.FieldMask) – Mask to control which fields get updated.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.DeidentifyTemplate

update_inspect_template(self, template_id, organization_id=None, project_id=None, inspect_template=None, update_mask=None, retry=None, timeout=None, metadata=None)[source]

Updates the inspect template.

Parameters
  • template_id (str) – The ID of the inspect template to be updated.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • inspect_template (dict or google.cloud.dlp_v2.types.InspectTemplate) – New inspect template value.

  • update_mask (dict or google.cloud.dlp_v2.types.FieldMask) – Mask to control which fields get updated.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.InspectTemplate

update_job_trigger(self, job_trigger_id, project_id=None, job_trigger=None, update_mask=None, retry=None, timeout=None, metadata=None)[source]

Updates a job trigger.

Parameters
  • job_trigger_id (str) – The ID of the DLP job trigger to be updated.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. If set to None or missing, the default project_id from the GCP connection is used.

  • job_trigger (dict or google.cloud.dlp_v2.types.JobTrigger) – New job trigger value.

  • update_mask (dict or google.cloud.dlp_v2.types.FieldMask) – Mask to control which fields get updated.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.JobTrigger

update_stored_info_type(self, stored_info_type_id, organization_id=None, project_id=None, config=None, update_mask=None, retry=None, timeout=None, metadata=None)[source]

Updates the stored info type by creating a new version.

Parameters
  • stored_info_type_id (str) – The ID of the stored info type to be updated.

  • organization_id (str) – (Optional) The organization ID. Required to set this field if parent resource is an organzation.

  • project_id (str) – (Optional) Google Cloud Platform project ID where the DLP Instance exists. Only set this field if the parent resource is a project instead of an organzation.

  • config (dict or google.cloud.dlp_v2.types.StoredInfoTypeConfig) – Updated configuration for the stored info type. If not provided, a new version of the stored info type will be created with the existing configuration.

  • update_mask (dict or google.cloud.dlp_v2.types.FieldMask) – Mask to control which fields get updated.

  • retry (google.api_core.retry.Retry) – (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – (Optional) Additional metadata that is provided to the method.

Return type

google.cloud.dlp_v2.types.StoredInfoType

Was this entry helpful?