diff --git a/google/cloud/dlp_v2/services/dlp_service/async_client.py b/google/cloud/dlp_v2/services/dlp_service/async_client.py index c299f82c..0e6d7ebf 100644 --- a/google/cloud/dlp_v2/services/dlp_service/async_client.py +++ b/google/cloud/dlp_v2/services/dlp_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.dlp_v2.services.dlp_service import pagers from google.cloud.dlp_v2.types import dlp from google.protobuf import field_mask_pb2 # type: ignore @@ -186,9 +188,9 @@ def __init__( async def inspect_content( self, - request: dlp.InspectContentRequest = None, + request: Union[dlp.InspectContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectContentResponse: @@ -204,7 +206,7 @@ async def inspect_content( https://cloud.google.com/dlp/docs/inspecting-text, Args: - request (:class:`google.cloud.dlp_v2.types.InspectContentRequest`): + request (Union[google.cloud.dlp_v2.types.InspectContentRequest, dict]): The request object. Request to search for potentially sensitive info in a ContentItem. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -252,9 +254,9 @@ async def inspect_content( async def redact_image( self, - request: dlp.RedactImageRequest = None, + request: Union[dlp.RedactImageRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.RedactImageResponse: @@ -270,7 +272,7 @@ async def redact_image( may change over time as detectors are updated. Args: - request (:class:`google.cloud.dlp_v2.types.RedactImageRequest`): + request (Union[google.cloud.dlp_v2.types.RedactImageRequest, dict]): The request object. Request to search for potentially sensitive info in an image and redact it by covering it with a colored rectangle. @@ -319,9 +321,9 @@ async def redact_image( async def deidentify_content( self, - request: dlp.DeidentifyContentRequest = None, + request: Union[dlp.DeidentifyContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyContentResponse: @@ -337,7 +339,7 @@ async def deidentify_content( may change over time as detectors are updated. Args: - request (:class:`google.cloud.dlp_v2.types.DeidentifyContentRequest`): + request (Union[google.cloud.dlp_v2.types.DeidentifyContentRequest, dict]): The request object. Request to de-identify a list of items. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -387,9 +389,9 @@ async def deidentify_content( async def reidentify_content( self, - request: dlp.ReidentifyContentRequest = None, + request: Union[dlp.ReidentifyContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ReidentifyContentResponse: @@ -398,7 +400,7 @@ async def reidentify_content( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ReidentifyContentRequest`): + request (Union[google.cloud.dlp_v2.types.ReidentifyContentRequest, dict]): The request object. Request to re-identify an item. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -445,10 +447,10 @@ async def reidentify_content( async def list_info_types( self, - request: dlp.ListInfoTypesRequest = None, + request: Union[dlp.ListInfoTypesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ListInfoTypesResponse: @@ -458,7 +460,7 @@ async def list_info_types( learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListInfoTypesRequest`): + request (Union[google.cloud.dlp_v2.types.ListInfoTypesRequest, dict]): The request object. Request for the list of infoTypes. parent (:class:`str`): The parent resource name. @@ -527,11 +529,11 @@ async def list_info_types( async def create_inspect_template( self, - request: dlp.CreateInspectTemplateRequest = None, + request: Union[dlp.CreateInspectTemplateRequest, dict] = None, *, parent: str = None, inspect_template: dlp.InspectTemplate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -541,7 +543,7 @@ async def create_inspect_template( templates to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.CreateInspectTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.CreateInspectTemplateRequest, dict]): The request object. Request message for CreateInspectTemplate. parent (:class:`str`): @@ -638,12 +640,12 @@ async def create_inspect_template( async def update_inspect_template( self, - request: dlp.UpdateInspectTemplateRequest = None, + request: Union[dlp.UpdateInspectTemplateRequest, dict] = None, *, name: str = None, inspect_template: dlp.InspectTemplate = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -652,7 +654,7 @@ async def update_inspect_template( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.UpdateInspectTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.UpdateInspectTemplateRequest, dict]): The request object. Request message for UpdateInspectTemplate. name (:class:`str`): @@ -736,10 +738,10 @@ async def update_inspect_template( async def get_inspect_template( self, - request: dlp.GetInspectTemplateRequest = None, + request: Union[dlp.GetInspectTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -748,7 +750,7 @@ async def get_inspect_template( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.GetInspectTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.GetInspectTemplateRequest, dict]): The request object. Request message for GetInspectTemplate. name (:class:`str`): @@ -826,10 +828,10 @@ async def get_inspect_template( async def list_inspect_templates( self, - request: dlp.ListInspectTemplatesRequest = None, + request: Union[dlp.ListInspectTemplatesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInspectTemplatesAsyncPager: @@ -838,7 +840,7 @@ async def list_inspect_templates( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListInspectTemplatesRequest`): + request (Union[google.cloud.dlp_v2.types.ListInspectTemplatesRequest, dict]): The request object. Request message for ListInspectTemplates. parent (:class:`str`): @@ -940,10 +942,10 @@ async def list_inspect_templates( async def delete_inspect_template( self, - request: dlp.DeleteInspectTemplateRequest = None, + request: Union[dlp.DeleteInspectTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -952,7 +954,7 @@ async def delete_inspect_template( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.DeleteInspectTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.DeleteInspectTemplateRequest, dict]): The request object. Request message for DeleteInspectTemplate. name (:class:`str`): @@ -1018,11 +1020,11 @@ async def delete_inspect_template( async def create_deidentify_template( self, - request: dlp.CreateDeidentifyTemplateRequest = None, + request: Union[dlp.CreateDeidentifyTemplateRequest, dict] = None, *, parent: str = None, deidentify_template: dlp.DeidentifyTemplate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1033,7 +1035,7 @@ async def create_deidentify_template( deid to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.CreateDeidentifyTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.CreateDeidentifyTemplateRequest, dict]): The request object. Request message for CreateDeidentifyTemplate. parent (:class:`str`): @@ -1128,12 +1130,12 @@ async def create_deidentify_template( async def update_deidentify_template( self, - request: dlp.UpdateDeidentifyTemplateRequest = None, + request: Union[dlp.UpdateDeidentifyTemplateRequest, dict] = None, *, name: str = None, deidentify_template: dlp.DeidentifyTemplate = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1142,7 +1144,7 @@ async def update_deidentify_template( templates-deid to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.UpdateDeidentifyTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.UpdateDeidentifyTemplateRequest, dict]): The request object. Request message for UpdateDeidentifyTemplate. name (:class:`str`): @@ -1224,10 +1226,10 @@ async def update_deidentify_template( async def get_deidentify_template( self, - request: dlp.GetDeidentifyTemplateRequest = None, + request: Union[dlp.GetDeidentifyTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1236,7 +1238,7 @@ async def get_deidentify_template( templates-deid to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.GetDeidentifyTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.GetDeidentifyTemplateRequest, dict]): The request object. Request message for GetDeidentifyTemplate. name (:class:`str`): @@ -1312,10 +1314,10 @@ async def get_deidentify_template( async def list_deidentify_templates( self, - request: dlp.ListDeidentifyTemplatesRequest = None, + request: Union[dlp.ListDeidentifyTemplatesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDeidentifyTemplatesAsyncPager: @@ -1324,7 +1326,7 @@ async def list_deidentify_templates( templates-deid to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest`): + request (Union[google.cloud.dlp_v2.types.ListDeidentifyTemplatesRequest, dict]): The request object. Request message for ListDeidentifyTemplates. parent (:class:`str`): @@ -1426,10 +1428,10 @@ async def list_deidentify_templates( async def delete_deidentify_template( self, - request: dlp.DeleteDeidentifyTemplateRequest = None, + request: Union[dlp.DeleteDeidentifyTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1438,7 +1440,7 @@ async def delete_deidentify_template( templates-deid to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.DeleteDeidentifyTemplateRequest`): + request (Union[google.cloud.dlp_v2.types.DeleteDeidentifyTemplateRequest, dict]): The request object. Request message for DeleteDeidentifyTemplate. name (:class:`str`): @@ -1504,11 +1506,11 @@ async def delete_deidentify_template( async def create_job_trigger( self, - request: dlp.CreateJobTriggerRequest = None, + request: Union[dlp.CreateJobTriggerRequest, dict] = None, *, parent: str = None, job_trigger: dlp.JobTrigger = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -1519,7 +1521,7 @@ async def create_job_trigger( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.CreateJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.CreateJobTriggerRequest, dict]): The request object. Request message for CreateJobTrigger. parent (:class:`str`): @@ -1606,12 +1608,12 @@ async def create_job_trigger( async def update_job_trigger( self, - request: dlp.UpdateJobTriggerRequest = None, + request: Union[dlp.UpdateJobTriggerRequest, dict] = None, *, name: str = None, job_trigger: dlp.JobTrigger = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -1620,7 +1622,7 @@ async def update_job_trigger( triggers to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.UpdateJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.UpdateJobTriggerRequest, dict]): The request object. Request message for UpdateJobTrigger. name (:class:`str`): @@ -1700,10 +1702,10 @@ async def update_job_trigger( async def hybrid_inspect_job_trigger( self, - request: dlp.HybridInspectJobTriggerRequest = None, + request: Union[dlp.HybridInspectJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: @@ -1717,7 +1719,7 @@ async def hybrid_inspect_job_trigger( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`google.cloud.dlp_v2.types.HybridInspectJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.HybridInspectJobTriggerRequest, dict]): The request object. Request to search for potentially sensitive info in a custom location. name (:class:`str`): @@ -1779,10 +1781,10 @@ async def hybrid_inspect_job_trigger( async def get_job_trigger( self, - request: dlp.GetJobTriggerRequest = None, + request: Union[dlp.GetJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -1791,7 +1793,7 @@ async def get_job_trigger( triggers to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.GetJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.GetJobTriggerRequest, dict]): The request object. Request message for GetJobTrigger. name (:class:`str`): Required. Resource name of the project and the @@ -1864,10 +1866,10 @@ async def get_job_trigger( async def list_job_triggers( self, - request: dlp.ListJobTriggersRequest = None, + request: Union[dlp.ListJobTriggersRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListJobTriggersAsyncPager: @@ -1876,7 +1878,7 @@ async def list_job_triggers( triggers to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListJobTriggersRequest`): + request (Union[google.cloud.dlp_v2.types.ListJobTriggersRequest, dict]): The request object. Request message for ListJobTriggers. parent (:class:`str`): Required. Parent resource name. @@ -1971,10 +1973,10 @@ async def list_job_triggers( async def delete_job_trigger( self, - request: dlp.DeleteJobTriggerRequest = None, + request: Union[dlp.DeleteJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1983,7 +1985,7 @@ async def delete_job_trigger( triggers to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.DeleteJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.DeleteJobTriggerRequest, dict]): The request object. Request message for DeleteJobTrigger. name (:class:`str`): @@ -2048,9 +2050,9 @@ async def delete_job_trigger( async def activate_job_trigger( self, - request: dlp.ActivateJobTriggerRequest = None, + request: Union[dlp.ActivateJobTriggerRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2059,7 +2061,7 @@ async def activate_job_trigger( occur. Args: - request (:class:`google.cloud.dlp_v2.types.ActivateJobTriggerRequest`): + request (Union[google.cloud.dlp_v2.types.ActivateJobTriggerRequest, dict]): The request object. Request message for ActivateJobTrigger. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -2099,12 +2101,12 @@ async def activate_job_trigger( async def create_dlp_job( self, - request: dlp.CreateDlpJobRequest = None, + request: Union[dlp.CreateDlpJobRequest, dict] = None, *, parent: str = None, inspect_job: dlp.InspectJobConfig = None, risk_job: dlp.RiskAnalysisJobConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2119,7 +2121,7 @@ async def create_dlp_job( may change over time as detectors are updated. Args: - request (:class:`google.cloud.dlp_v2.types.CreateDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.CreateDlpJobRequest, dict]): The request object. Request message for CreateDlpJobRequest. Used to initiate long running jobs such as calculating risk metrics or inspecting Google @@ -2217,10 +2219,10 @@ async def create_dlp_job( async def list_dlp_jobs( self, - request: dlp.ListDlpJobsRequest = None, + request: Union[dlp.ListDlpJobsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDlpJobsAsyncPager: @@ -2231,7 +2233,7 @@ async def list_dlp_jobs( to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListDlpJobsRequest`): + request (Union[google.cloud.dlp_v2.types.ListDlpJobsRequest, dict]): The request object. The request message for listing DLP jobs. parent (:class:`str`): @@ -2328,10 +2330,10 @@ async def list_dlp_jobs( async def get_dlp_job( self, - request: dlp.GetDlpJobRequest = None, + request: Union[dlp.GetDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2341,7 +2343,7 @@ async def get_dlp_job( analysis to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.GetDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.GetDlpJobRequest, dict]): The request object. The request message for [DlpJobs.GetDlpJob][]. name (:class:`str`): @@ -2412,10 +2414,10 @@ async def get_dlp_job( async def delete_dlp_job( self, - request: dlp.DeleteDlpJobRequest = None, + request: Union[dlp.DeleteDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2427,7 +2429,7 @@ async def delete_dlp_job( analysis to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.DeleteDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.DeleteDlpJobRequest, dict]): The request object. The request message for deleting a DLP job. name (:class:`str`): @@ -2491,9 +2493,9 @@ async def delete_dlp_job( async def cancel_dlp_job( self, - request: dlp.CancelDlpJobRequest = None, + request: Union[dlp.CancelDlpJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2505,7 +2507,7 @@ async def cancel_dlp_job( analysis to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.CancelDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.CancelDlpJobRequest, dict]): The request object. The request message for canceling a DLP job. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -2538,11 +2540,11 @@ async def cancel_dlp_job( async def create_stored_info_type( self, - request: dlp.CreateStoredInfoTypeRequest = None, + request: Union[dlp.CreateStoredInfoTypeRequest, dict] = None, *, parent: str = None, config: dlp.StoredInfoTypeConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2552,7 +2554,7 @@ async def create_stored_info_type( infotypes to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.CreateStoredInfoTypeRequest`): + request (Union[google.cloud.dlp_v2.types.CreateStoredInfoTypeRequest, dict]): The request object. Request message for CreateStoredInfoType. parent (:class:`str`): @@ -2645,12 +2647,12 @@ async def create_stored_info_type( async def update_stored_info_type( self, - request: dlp.UpdateStoredInfoTypeRequest = None, + request: Union[dlp.UpdateStoredInfoTypeRequest, dict] = None, *, name: str = None, config: dlp.StoredInfoTypeConfig = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2661,7 +2663,7 @@ async def update_stored_info_type( infotypes to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.UpdateStoredInfoTypeRequest`): + request (Union[google.cloud.dlp_v2.types.UpdateStoredInfoTypeRequest, dict]): The request object. Request message for UpdateStoredInfoType. name (:class:`str`): @@ -2745,10 +2747,10 @@ async def update_stored_info_type( async def get_stored_info_type( self, - request: dlp.GetStoredInfoTypeRequest = None, + request: Union[dlp.GetStoredInfoTypeRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2757,7 +2759,7 @@ async def get_stored_info_type( infotypes to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.GetStoredInfoTypeRequest`): + request (Union[google.cloud.dlp_v2.types.GetStoredInfoTypeRequest, dict]): The request object. Request message for GetStoredInfoType. name (:class:`str`): @@ -2831,10 +2833,10 @@ async def get_stored_info_type( async def list_stored_info_types( self, - request: dlp.ListStoredInfoTypesRequest = None, + request: Union[dlp.ListStoredInfoTypesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListStoredInfoTypesAsyncPager: @@ -2843,7 +2845,7 @@ async def list_stored_info_types( infotypes to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.ListStoredInfoTypesRequest`): + request (Union[google.cloud.dlp_v2.types.ListStoredInfoTypesRequest, dict]): The request object. Request message for ListStoredInfoTypes. parent (:class:`str`): @@ -2945,10 +2947,10 @@ async def list_stored_info_types( async def delete_stored_info_type( self, - request: dlp.DeleteStoredInfoTypeRequest = None, + request: Union[dlp.DeleteStoredInfoTypeRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2957,7 +2959,7 @@ async def delete_stored_info_type( infotypes to learn more. Args: - request (:class:`google.cloud.dlp_v2.types.DeleteStoredInfoTypeRequest`): + request (Union[google.cloud.dlp_v2.types.DeleteStoredInfoTypeRequest, dict]): The request object. Request message for DeleteStoredInfoType. name (:class:`str`): @@ -3023,10 +3025,10 @@ async def delete_stored_info_type( async def hybrid_inspect_dlp_job( self, - request: dlp.HybridInspectDlpJobRequest = None, + request: Union[dlp.HybridInspectDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: @@ -3039,7 +3041,7 @@ async def hybrid_inspect_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`google.cloud.dlp_v2.types.HybridInspectDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.HybridInspectDlpJobRequest, dict]): The request object. Request to search for potentially sensitive info in a custom location. name (:class:`str`): @@ -3101,9 +3103,9 @@ async def hybrid_inspect_dlp_job( async def finish_dlp_job( self, - request: dlp.FinishDlpJobRequest = None, + request: Union[dlp.FinishDlpJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -3115,7 +3117,7 @@ async def finish_dlp_job( https://cloud.google.com/products#product-launch-stages. Args: - request (:class:`google.cloud.dlp_v2.types.FinishDlpJobRequest`): + request (Union[google.cloud.dlp_v2.types.FinishDlpJobRequest, dict]): The request object. The request message for finishing a DLP hybrid job. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/dlp_v2/services/dlp_service/client.py b/google/cloud/dlp_v2/services/dlp_service/client.py index 62f63ef8..236dfaa0 100644 --- a/google/cloud/dlp_v2/services/dlp_service/client.py +++ b/google/cloud/dlp_v2/services/dlp_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.dlp_v2.services.dlp_service import pagers from google.cloud.dlp_v2.types import dlp from google.protobuf import field_mask_pb2 # type: ignore @@ -447,7 +449,7 @@ def inspect_content( self, request: Union[dlp.InspectContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectContentResponse: @@ -504,7 +506,7 @@ def redact_image( self, request: Union[dlp.RedactImageRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.RedactImageResponse: @@ -562,7 +564,7 @@ def deidentify_content( self, request: Union[dlp.DeidentifyContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyContentResponse: @@ -621,7 +623,7 @@ def reidentify_content( self, request: Union[dlp.ReidentifyContentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ReidentifyContentResponse: @@ -671,7 +673,7 @@ def list_info_types( request: Union[dlp.ListInfoTypesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ListInfoTypesResponse: @@ -744,7 +746,7 @@ def create_inspect_template( *, parent: str = None, inspect_template: dlp.InspectTemplate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -856,7 +858,7 @@ def update_inspect_template( name: str = None, inspect_template: dlp.InspectTemplate = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -952,7 +954,7 @@ def get_inspect_template( request: Union[dlp.GetInspectTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: @@ -1032,7 +1034,7 @@ def list_inspect_templates( request: Union[dlp.ListInspectTemplatesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInspectTemplatesPager: @@ -1136,7 +1138,7 @@ def delete_inspect_template( request: Union[dlp.DeleteInspectTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1205,7 +1207,7 @@ def create_deidentify_template( *, parent: str = None, deidentify_template: dlp.DeidentifyTemplate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1318,7 +1320,7 @@ def update_deidentify_template( name: str = None, deidentify_template: dlp.DeidentifyTemplate = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1414,7 +1416,7 @@ def get_deidentify_template( request: Union[dlp.GetDeidentifyTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: @@ -1492,7 +1494,7 @@ def list_deidentify_templates( request: Union[dlp.ListDeidentifyTemplatesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDeidentifyTemplatesPager: @@ -1598,7 +1600,7 @@ def delete_deidentify_template( request: Union[dlp.DeleteDeidentifyTemplateRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1669,7 +1671,7 @@ def create_job_trigger( *, parent: str = None, job_trigger: dlp.JobTrigger = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -1772,7 +1774,7 @@ def update_job_trigger( name: str = None, job_trigger: dlp.JobTrigger = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -1864,7 +1866,7 @@ def hybrid_inspect_job_trigger( request: Union[dlp.HybridInspectJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: @@ -1945,7 +1947,7 @@ def get_job_trigger( request: Union[dlp.GetJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: @@ -2020,7 +2022,7 @@ def list_job_triggers( request: Union[dlp.ListJobTriggersRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListJobTriggersPager: @@ -2117,7 +2119,7 @@ def delete_job_trigger( request: Union[dlp.DeleteJobTriggerRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2183,7 +2185,7 @@ def activate_job_trigger( self, request: Union[dlp.ActivateJobTriggerRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2238,7 +2240,7 @@ def create_dlp_job( parent: str = None, inspect_job: dlp.InspectJobConfig = None, risk_job: dlp.RiskAnalysisJobConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2354,7 +2356,7 @@ def list_dlp_jobs( request: Union[dlp.ListDlpJobsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDlpJobsPager: @@ -2455,7 +2457,7 @@ def get_dlp_job( request: Union[dlp.GetDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: @@ -2529,7 +2531,7 @@ def delete_dlp_job( request: Union[dlp.DeleteDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2597,7 +2599,7 @@ def cancel_dlp_job( self, request: Union[dlp.CancelDlpJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2647,7 +2649,7 @@ def create_stored_info_type( *, parent: str = None, config: dlp.StoredInfoTypeConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2755,7 +2757,7 @@ def update_stored_info_type( name: str = None, config: dlp.StoredInfoTypeConfig = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2853,7 +2855,7 @@ def get_stored_info_type( request: Union[dlp.GetStoredInfoTypeRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: @@ -2929,7 +2931,7 @@ def list_stored_info_types( request: Union[dlp.ListStoredInfoTypesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListStoredInfoTypesPager: @@ -3033,7 +3035,7 @@ def delete_stored_info_type( request: Union[dlp.DeleteStoredInfoTypeRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -3101,7 +3103,7 @@ def hybrid_inspect_dlp_job( request: Union[dlp.HybridInspectDlpJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: @@ -3178,7 +3180,7 @@ def finish_dlp_job( self, request: Union[dlp.FinishDlpJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/base.py b/google/cloud/dlp_v2/services/dlp_service/transports/base.py index 50ec0cc1..488efb05 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/base.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -36,15 +35,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class DlpServiceTransport(abc.ABC): """Abstract transport class for DlpService.""" @@ -94,7 +84,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -127,29 +117,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py b/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py index 8594da4f..5b434d45 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/google/cloud/dlp_v2/types/dlp.py b/google/cloud/dlp_v2/types/dlp.py index f050b132..92a7da7c 100644 --- a/google/cloud/dlp_v2/types/dlp.py +++ b/google/cloud/dlp_v2/types/dlp.py @@ -248,14 +248,24 @@ class ExclusionRule(proto.Message): r"""The rule that specifies conditions when findings of infoTypes specified in ``InspectionRuleSet`` are removed from results. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): Dictionary which defines the rule. + This field is a member of `oneof`_ ``type``. regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Regular expression which defines the rule. + This field is a member of `oneof`_ ``type``. exclude_info_types (google.cloud.dlp_v2.types.ExcludeInfoTypes): Set of infoTypes for which findings would affect this rule. + This field is a member of `oneof`_ ``type``. matching_type (google.cloud.dlp_v2.types.MatchingType): How the rule is applied, see MatchingType documentation for details. @@ -280,11 +290,20 @@ class InspectionRule(proto.Message): r"""A single inspection rule to be applied to infoTypes, specified in ``InspectionRuleSet``. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: hotword_rule (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.HotwordRule): Hotword-based detection rule. + This field is a member of `oneof`_ ``type``. exclusion_rule (google.cloud.dlp_v2.types.ExclusionRule): Exclusion rule. + This field is a member of `oneof`_ ``type``. """ hotword_rule = proto.Field( @@ -458,16 +477,26 @@ class BytesType(proto.Enum): class ContentItem(proto.Message): r"""Container structure for the content to inspect. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: value (str): String data to inspect or redact. + This field is a member of `oneof`_ ``data_item``. table (google.cloud.dlp_v2.types.Table): Structured content for inspection. See https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to learn more. + This field is a member of `oneof`_ ``data_item``. byte_item (google.cloud.dlp_v2.types.ByteContentItem): Content data to inspect or redact. Replaces ``type`` and ``data``. + This field is a member of `oneof`_ ``data_item``. """ value = proto.Field(proto.STRING, number=3, oneof="data_item",) @@ -638,6 +667,13 @@ class ContentLocation(proto.Message): r"""Precise location of the finding within a document, record, image, or metadata container. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: container_name (str): Name of the container where the finding is located. The top @@ -654,13 +690,17 @@ class ContentLocation(proto.Message): record_location (google.cloud.dlp_v2.types.RecordLocation): Location within a row or record of a database table. + This field is a member of `oneof`_ ``location``. image_location (google.cloud.dlp_v2.types.ImageLocation): Location within an image's pixels. + This field is a member of `oneof`_ ``location``. document_location (google.cloud.dlp_v2.types.DocumentLocation): Location data for document files. + This field is a member of `oneof`_ ``location``. metadata_location (google.cloud.dlp_v2.types.MetadataLocation): Location within the metadata for inspected content. + This field is a member of `oneof`_ ``location``. container_timestamp (google.protobuf.timestamp_pb2.Timestamp): Findings container modification timestamp, if applicable. For Google Cloud Storage contains last file modification @@ -693,11 +733,14 @@ class ContentLocation(proto.Message): class MetadataLocation(proto.Message): r"""Metadata Location + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: type_ (google.cloud.dlp_v2.types.MetadataType): Type of metadata containing the finding. storage_label (google.cloud.dlp_v2.types.StorageMetadataLabel): Storage metadata. + This field is a member of `oneof`_ ``label``. """ type_ = proto.Field(proto.ENUM, number=1, enum="MetadataType",) @@ -912,6 +955,13 @@ class ImageRedactionConfig(proto.Message): r"""Configuration for determining how redaction of images should occur. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: info_type (google.cloud.dlp_v2.types.InfoType): Only one per info_type should be provided per request. If @@ -919,10 +969,12 @@ class ImageRedactionConfig(proto.Message): will redact all text that it matches against all info_types that are found, but not specified in another ImageRedactionConfig. + This field is a member of `oneof`_ ``target``. redact_all_text (bool): If true, all text found in the image, regardless whether it matches an info_type, is redacted. Only one should be provided. + This field is a member of `oneof`_ ``target``. redaction_color (google.cloud.dlp_v2.types.Color): The color to use when redacting content from an image. If not specified, the default is @@ -1212,6 +1264,8 @@ class InspectContentResponse(proto.Message): class OutputStorageConfig(proto.Message): r"""Cloud repository for storing output. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: table (google.cloud.dlp_v2.types.BigQueryTable): Store findings in an existing table or a new table in an @@ -1230,6 +1284,7 @@ class OutputStorageConfig(proto.Message): jobs that analyze the same table but compute a different privacy metric, or use different sets of quasi-identifiers, cannot store their results in the same table. + This field is a member of `oneof`_ ``type``. output_schema (google.cloud.dlp_v2.types.OutputStorageConfig.OutputSchema): Schema used for writing the findings for Inspect jobs. This field is only used for Inspect and must be unspecified for @@ -1450,6 +1505,13 @@ class RiskAnalysisJobConfig(proto.Message): class QuasiId(proto.Message): r"""A column with a semantic tag attached. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: field (google.cloud.dlp_v2.types.FieldId): Required. Identifies the column. @@ -1460,15 +1522,18 @@ class QuasiId(proto.Message): ages and genders. To programmatically obtain the list of supported InfoTypes, use ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + This field is a member of `oneof`_ ``tag``. custom_tag (str): A column can be tagged with a custom tag. In this case, the user must indicate an auxiliary table that contains statistical information on the possible values of this column (below). + This field is a member of `oneof`_ ``tag``. inferred (google.protobuf.empty_pb2.Empty): If no semantic tag is indicated, we infer the statistical model from the distribution of values in the input data + This field is a member of `oneof`_ ``tag``. """ field = proto.Field(proto.MESSAGE, number=1, message=storage.FieldId,) @@ -1529,19 +1594,32 @@ class QuasiIdentifierField(proto.Message): class PrivacyMetric(proto.Message): r"""Privacy metric to compute for reidentification risk analysis. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: numerical_stats_config (google.cloud.dlp_v2.types.PrivacyMetric.NumericalStatsConfig): Numerical stats + This field is a member of `oneof`_ ``type``. categorical_stats_config (google.cloud.dlp_v2.types.PrivacyMetric.CategoricalStatsConfig): Categorical stats + This field is a member of `oneof`_ ``type``. k_anonymity_config (google.cloud.dlp_v2.types.PrivacyMetric.KAnonymityConfig): K-anonymity + This field is a member of `oneof`_ ``type``. l_diversity_config (google.cloud.dlp_v2.types.PrivacyMetric.LDiversityConfig): l-diversity + This field is a member of `oneof`_ ``type``. k_map_estimation_config (google.cloud.dlp_v2.types.PrivacyMetric.KMapEstimationConfig): k-map + This field is a member of `oneof`_ ``type``. delta_presence_estimation_config (google.cloud.dlp_v2.types.PrivacyMetric.DeltaPresenceEstimationConfig): delta-presence + This field is a member of `oneof`_ ``type``. """ class NumericalStatsConfig(proto.Message): @@ -1654,6 +1732,13 @@ class KMapEstimationConfig(proto.Message): class TaggedField(proto.Message): r"""A column with a semantic tag attached. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: field (google.cloud.dlp_v2.types.FieldId): Required. Identifies the column. @@ -1664,15 +1749,18 @@ class TaggedField(proto.Message): ages and genders. To programmatically obtain the list of supported InfoTypes, use ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + This field is a member of `oneof`_ ``tag``. custom_tag (str): A column can be tagged with a custom tag. In this case, the user must indicate an auxiliary table that contains statistical information on the possible values of this column (below). + This field is a member of `oneof`_ ``tag``. inferred (google.protobuf.empty_pb2.Empty): If no semantic tag is indicated, we infer the statistical model from the distribution of values in the input data + This field is a member of `oneof`_ ``tag``. """ field = proto.Field(proto.MESSAGE, number=1, message=storage.FieldId,) @@ -1791,6 +1879,13 @@ class DeltaPresenceEstimationConfig(proto.Message): class AnalyzeDataSourceRiskDetails(proto.Message): r"""Result of a risk analysis operation request. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: requested_privacy_metric (google.cloud.dlp_v2.types.PrivacyMetric): Privacy metric to compute. @@ -1798,16 +1893,22 @@ class AnalyzeDataSourceRiskDetails(proto.Message): Input dataset to compute metrics over. numerical_stats_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.NumericalStatsResult): Numerical stats result + This field is a member of `oneof`_ ``result``. categorical_stats_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.CategoricalStatsResult): Categorical stats result + This field is a member of `oneof`_ ``result``. k_anonymity_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KAnonymityResult): K-anonymity result + This field is a member of `oneof`_ ``result``. l_diversity_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.LDiversityResult): L-divesity result + This field is a member of `oneof`_ ``result``. k_map_estimation_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.KMapEstimationResult): K-map result + This field is a member of `oneof`_ ``result``. delta_presence_estimation_result (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult): Delta-presence result + This field is a member of `oneof`_ ``result``. requested_options (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails.RequestedRiskAnalysisOptions): The configuration used for this job. """ @@ -2235,23 +2336,38 @@ class Value(proto.Message): 123456789, the number of bytes would be counted as 9, even though an int64 only holds up to 8 bytes of data. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: integer_value (int): integer + This field is a member of `oneof`_ ``type``. float_value (float): float + This field is a member of `oneof`_ ``type``. string_value (str): string + This field is a member of `oneof`_ ``type``. boolean_value (bool): boolean + This field is a member of `oneof`_ ``type``. timestamp_value (google.protobuf.timestamp_pb2.Timestamp): timestamp + This field is a member of `oneof`_ ``type``. time_value (google.type.timeofday_pb2.TimeOfDay): time of day + This field is a member of `oneof`_ ``type``. date_value (google.type.date_pb2.Date): date + This field is a member of `oneof`_ ``type``. day_of_week_value (google.type.dayofweek_pb2.DayOfWeek): day of week + This field is a member of `oneof`_ ``type``. """ integer_value = proto.Field(proto.INT64, number=1, oneof="type",) @@ -2275,9 +2391,12 @@ class Value(proto.Message): class QuoteInfo(proto.Message): r"""Message for infoType-dependent details parsed from quote. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: date_time (google.cloud.dlp_v2.types.DateTime): The date time indicated by the quote. + This field is a member of `oneof`_ ``parsed_quote``. """ date_time = proto.Field( @@ -2322,15 +2441,24 @@ class TimeZone(proto.Message): class DeidentifyConfig(proto.Message): r"""The configuration that controls how the data will change. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: info_type_transformations (google.cloud.dlp_v2.types.InfoTypeTransformations): Treat the dataset as free-form text and apply the same free text transformation everywhere. + This field is a member of `oneof`_ ``transformation``. record_transformations (google.cloud.dlp_v2.types.RecordTransformations): Treat the dataset as structured. Transformations can be applied to specific locations within structured datasets, such as transforming a column within a table. + This field is a member of `oneof`_ ``transformation``. transformation_error_handling (google.cloud.dlp_v2.types.TransformationErrorHandling): Mode for handling transformation errors. If left unspecified, the default mode is @@ -2364,11 +2492,20 @@ class TransformationErrorHandling(proto.Message): they were handled, is returned in the response as part of the ``TransformationOverviews``. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: throw_error (google.cloud.dlp_v2.types.TransformationErrorHandling.ThrowError): Throw an error + This field is a member of `oneof`_ ``mode``. leave_untransformed (google.cloud.dlp_v2.types.TransformationErrorHandling.LeaveUntransformed): Ignore errors + This field is a member of `oneof`_ ``mode``. """ class ThrowError(proto.Message): @@ -2396,29 +2533,47 @@ class LeaveUntransformed(proto.Message): class PrimitiveTransformation(proto.Message): r"""A rule for transforming a value. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: replace_config (google.cloud.dlp_v2.types.ReplaceValueConfig): Replace + This field is a member of `oneof`_ ``transformation``. redact_config (google.cloud.dlp_v2.types.RedactConfig): Redact + This field is a member of `oneof`_ ``transformation``. character_mask_config (google.cloud.dlp_v2.types.CharacterMaskConfig): Mask + This field is a member of `oneof`_ ``transformation``. crypto_replace_ffx_fpe_config (google.cloud.dlp_v2.types.CryptoReplaceFfxFpeConfig): Ffx-Fpe + This field is a member of `oneof`_ ``transformation``. fixed_size_bucketing_config (google.cloud.dlp_v2.types.FixedSizeBucketingConfig): Fixed size bucketing + This field is a member of `oneof`_ ``transformation``. bucketing_config (google.cloud.dlp_v2.types.BucketingConfig): Bucketing + This field is a member of `oneof`_ ``transformation``. replace_with_info_type_config (google.cloud.dlp_v2.types.ReplaceWithInfoTypeConfig): Replace with infotype + This field is a member of `oneof`_ ``transformation``. time_part_config (google.cloud.dlp_v2.types.TimePartConfig): Time extraction + This field is a member of `oneof`_ ``transformation``. crypto_hash_config (google.cloud.dlp_v2.types.CryptoHashConfig): Crypto + This field is a member of `oneof`_ ``transformation``. date_shift_config (google.cloud.dlp_v2.types.DateShiftConfig): Date Shift + This field is a member of `oneof`_ ``transformation``. crypto_deterministic_config (google.cloud.dlp_v2.types.CryptoDeterministicConfig): Deterministic Crypto + This field is a member of `oneof`_ ``transformation``. """ replace_config = proto.Field( @@ -2615,12 +2770,21 @@ class CharsToIgnore(proto.Message): r"""Characters to skip when doing deidentification of a value. These will be left alone and skipped. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: characters_to_skip (str): Characters to not transform when masking. + This field is a member of `oneof`_ ``characters``. common_characters_to_ignore (google.cloud.dlp_v2.types.CharsToIgnore.CommonCharsToIgnore): Common characters to not transform when masking. Useful to avoid removing punctuation. + This field is a member of `oneof`_ ``characters``. """ class CommonCharsToIgnore(proto.Enum): @@ -2783,6 +2947,13 @@ class CryptoReplaceFfxFpeConfig(proto.Message): which do not require preserving the input alphabet space and size, plus warrant referential integrity. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: crypto_key (google.cloud.dlp_v2.types.CryptoKey): Required. The key used by the encryption @@ -2815,6 +2986,7 @@ class CryptoReplaceFfxFpeConfig(proto.Message): byte of value 2 common_alphabet (google.cloud.dlp_v2.types.CryptoReplaceFfxFpeConfig.FfxCommonNativeAlphabet): Common alphabets. + This field is a member of `oneof`_ ``alphabet``. custom_alphabet (str): This is supported by mapping these to the alphanumeric characters that the FFX mode natively supports. This happens @@ -2825,9 +2997,11 @@ class CryptoReplaceFfxFpeConfig(proto.Message): characters is: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ~`!@#$%^&*()_-+={[}]|:;"'<,>.?/ + This field is a member of `oneof`_ ``alphabet``. radix (int): The native way to select the alphabet. Must be in the range [2, 95]. + This field is a member of `oneof`_ ``alphabet``. surrogate_info_type (google.cloud.dlp_v2.types.InfoType): The custom infoType to annotate the surrogate with. This annotation will be applied to the surrogate by prefixing it @@ -2890,13 +3064,23 @@ class CryptoKey(proto.Message): appropriate IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot unwrap the data crypto key. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: transient (google.cloud.dlp_v2.types.TransientCryptoKey): Transient crypto key + This field is a member of `oneof`_ ``source``. unwrapped (google.cloud.dlp_v2.types.UnwrappedCryptoKey): Unwrapped crypto key + This field is a member of `oneof`_ ``source``. kms_wrapped (google.cloud.dlp_v2.types.KmsWrappedCryptoKey): Kms wrapped key + This field is a member of `oneof`_ ``source``. """ transient = proto.Field( @@ -2965,6 +3149,9 @@ class DateShiftConfig(proto.Message): https://cloud.google.com/dlp/docs/concepts-date-shifting to learn more. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: upper_bound_days (int): Required. Range of shift in days. Actual @@ -2987,6 +3174,7 @@ class DateShiftConfig(proto.Message): context. This results in the same shift for the same context and crypto_key. If set, must also set context. Can only be applied to table items. + This field is a member of `oneof`_ ``method``. """ upper_bound_days = proto.Field(proto.INT32, number=1,) @@ -3040,6 +3228,13 @@ class InfoTypeTransformation(proto.Message): class FieldTransformation(proto.Message): r"""The transformation to apply to the field. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: fields (Sequence[google.cloud.dlp_v2.types.FieldId]): Required. Input field(s) to apply the @@ -3059,9 +3254,11 @@ class FieldTransformation(proto.Message): 85. primitive_transformation (google.cloud.dlp_v2.types.PrimitiveTransformation): Apply the transformation to the entire field. + This field is a member of `oneof`_ ``transformation``. info_type_transformations (google.cloud.dlp_v2.types.InfoTypeTransformations): Treat the contents of the field as free text, and selectively transform content that matches an ``InfoType``. + This field is a member of `oneof`_ ``transformation``. """ fields = proto.RepeatedField(proto.MESSAGE, number=1, message=storage.FieldId,) @@ -3177,12 +3374,15 @@ class Conditions(proto.Message): class Expressions(proto.Message): r"""An expression, consisting or an operator and conditions. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: logical_operator (google.cloud.dlp_v2.types.RecordCondition.Expressions.LogicalOperator): The operator to apply to the result of conditions. Default and currently only supported value is ``AND``. conditions (google.cloud.dlp_v2.types.RecordCondition.Conditions): Conditions to apply to the expression. + This field is a member of `oneof`_ ``type``. """ class LogicalOperator(proto.Enum): @@ -3290,6 +3490,8 @@ class SummaryResult(proto.Message): class Schedule(proto.Message): r"""Schedule for triggeredJobs. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: recurrence_period_duration (google.protobuf.duration_pb2.Duration): With this option a job is started a regular @@ -3301,6 +3503,7 @@ class Schedule(proto.Message): This value must be set to a time duration greater than or equal to 1 day and can be no longer than 60 days. + This field is a member of `oneof`_ ``option``. """ recurrence_period_duration = proto.Field( @@ -3412,6 +3615,9 @@ class JobTrigger(proto.Message): basis. See https://cloud.google.com/dlp/docs/concepts-job- triggers to learn more. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): Unique resource name for the triggeredJob, assigned by the @@ -3424,6 +3630,7 @@ class JobTrigger(proto.Message): inspect_job (google.cloud.dlp_v2.types.InspectJobConfig): For inspect jobs, a snapshot of the configuration. + This field is a member of `oneof`_ ``job``. triggers (Sequence[google.cloud.dlp_v2.types.JobTrigger.Trigger]): A list of triggers which will be OR'ed together. Only one in the list needs to trigger @@ -3465,10 +3672,18 @@ class Status(proto.Enum): class Trigger(proto.Message): r"""What event needs to occur for a new job to be started. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: schedule (google.cloud.dlp_v2.types.Schedule): Create a job on a repeating basis based on the elapse of time. + This field is a member of `oneof`_ ``trigger``. manual (google.cloud.dlp_v2.types.Manual): For use with hybrid jobs. Jobs must be manually created and finished. Early access @@ -3477,6 +3692,7 @@ class Trigger(proto.Message): information, see https://cloud.google.com/products#product- launch-stages. + This field is a member of `oneof`_ ``trigger``. """ schedule = proto.Field( @@ -3507,22 +3723,35 @@ class Action(proto.Message): See https://cloud.google.com/dlp/docs/concepts-actions to learn more. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: save_findings (google.cloud.dlp_v2.types.Action.SaveFindings): Save resulting findings in a provided location. + This field is a member of `oneof`_ ``action``. pub_sub (google.cloud.dlp_v2.types.Action.PublishToPubSub): Publish a notification to a pubsub topic. + This field is a member of `oneof`_ ``action``. publish_summary_to_cscc (google.cloud.dlp_v2.types.Action.PublishSummaryToCscc): Publish summary to Cloud Security Command Center (Alpha). + This field is a member of `oneof`_ ``action``. publish_findings_to_cloud_data_catalog (google.cloud.dlp_v2.types.Action.PublishFindingsToCloudDataCatalog): Publish findings to Cloud Datahub. + This field is a member of `oneof`_ ``action``. job_notification_emails (google.cloud.dlp_v2.types.Action.JobNotificationEmails): Enable email notification for project owners and editors on job's completion/failure. + This field is a member of `oneof`_ ``action``. publish_to_stackdriver (google.cloud.dlp_v2.types.Action.PublishToStackdriver): Enable Stackdriver metric dlp.googleapis.com/finding_count. + This field is a member of `oneof`_ ``action``. """ class SaveFindings(proto.Message): @@ -3898,6 +4127,13 @@ class CreateDlpJobRequest(proto.Message): long running jobs such as calculating risk metrics or inspecting Google Cloud Storage. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: parent (str): Required. Parent resource name. @@ -3920,8 +4156,10 @@ class CreateDlpJobRequest(proto.Message): parent=projects/example-project/locations/europe-west3 inspect_job (google.cloud.dlp_v2.types.InspectJobConfig): Set to control what and how to inspect. + This field is a member of `oneof`_ ``job``. risk_job (google.cloud.dlp_v2.types.RiskAnalysisJobConfig): Set to choose what metric to calculate. + This field is a member of `oneof`_ ``job``. job_id (str): The job id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular @@ -4103,6 +4341,13 @@ class InspectJobConfig(proto.Message): class DlpJob(proto.Message): r"""Combines all of the information about a DLP job. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): The server-assigned name. @@ -4112,8 +4357,10 @@ class DlpJob(proto.Message): State of a job. risk_details (google.cloud.dlp_v2.types.AnalyzeDataSourceRiskDetails): Results from analyzing risk of a data source. + This field is a member of `oneof`_ ``details``. inspect_details (google.cloud.dlp_v2.types.InspectDataSourceDetails): Results from inspecting a data source. + This field is a member of `oneof`_ ``details``. create_time (google.protobuf.timestamp_pb2.Timestamp): Time when the job was created. start_time (google.protobuf.timestamp_pb2.Timestamp): @@ -4512,6 +4759,13 @@ class LargeCustomDictionaryConfig(proto.Message): Storage location. Consider using ``CustomInfoType.Dictionary`` for smaller dictionaries that satisfy the size requirements. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: output_path (google.cloud.dlp_v2.types.CloudStoragePath): Location to store dictionary artifacts in @@ -4523,9 +4777,11 @@ class LargeCustomDictionaryConfig(proto.Message): cloud_storage_file_set (google.cloud.dlp_v2.types.CloudStorageFileSet): Set of files containing newline-delimited lists of dictionary phrases. + This field is a member of `oneof`_ ``source``. big_query_field (google.cloud.dlp_v2.types.BigQueryField): Field in a BigQuery table where each cell represents a dictionary phrase. + This field is a member of `oneof`_ ``source``. """ output_path = proto.Field( @@ -4556,6 +4812,13 @@ class StoredInfoTypeConfig(proto.Message): are provided by the user. For more information, see https://cloud.google.com/dlp/docs/creating-custom-infotypes. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: display_name (str): Display name of the StoredInfoType (max 256 @@ -4566,11 +4829,14 @@ class StoredInfoTypeConfig(proto.Message): large_custom_dictionary (google.cloud.dlp_v2.types.LargeCustomDictionaryConfig): StoredInfoType where findings are defined by a dictionary of phrases. + This field is a member of `oneof`_ ``type``. dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): Store dictionary-based CustomInfoType. + This field is a member of `oneof`_ ``type``. regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Store regular expression-based StoredInfoType. + This field is a member of `oneof`_ ``type``. """ display_name = proto.Field(proto.STRING, number=1,) @@ -4592,10 +4858,13 @@ class StoredInfoTypeConfig(proto.Message): class StoredInfoTypeStats(proto.Message): r"""Statistics for a StoredInfoType. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: large_custom_dictionary (google.cloud.dlp_v2.types.LargeCustomDictionaryStats): StoredInfoType where findings are defined by a dictionary of phrases. + This field is a member of `oneof`_ ``type``. """ large_custom_dictionary = proto.Field( diff --git a/google/cloud/dlp_v2/types/storage.py b/google/cloud/dlp_v2/types/storage.py index 8b8d724d..9b4e2b3b 100644 --- a/google/cloud/dlp_v2/types/storage.py +++ b/google/cloud/dlp_v2/types/storage.py @@ -117,6 +117,13 @@ class CustomInfoType(proto.Message): domain-specific sensitive information configurable to the data in question. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: info_type (google.cloud.dlp_v2.types.InfoType): CustomInfoType can either be a new infoType, or an extension @@ -134,16 +141,20 @@ class CustomInfoType(proto.Message): dictionary (google.cloud.dlp_v2.types.CustomInfoType.Dictionary): A list of phrases to detect as a CustomInfoType. + This field is a member of `oneof`_ ``type``. regex (google.cloud.dlp_v2.types.CustomInfoType.Regex): Regular expression based CustomInfoType. + This field is a member of `oneof`_ ``type``. surrogate_type (google.cloud.dlp_v2.types.CustomInfoType.SurrogateType): Message for detecting output from deidentification transformations that support reversing. + This field is a member of `oneof`_ ``type``. stored_type (google.cloud.dlp_v2.types.StoredType): Load an existing ``StoredInfoType`` resource for use in ``InspectDataSource``. Not currently supported in ``InspectContent``. + This field is a member of `oneof`_ ``type``. detection_rules (Sequence[google.cloud.dlp_v2.types.CustomInfoType.DetectionRule]): Set of detection rules to apply to all findings of this CustomInfoType. Rules are applied in order that they are @@ -185,12 +196,21 @@ class Dictionary(proto.Message): do not fit within these constraints, consider using ``LargeCustomDictionaryConfig`` in the ``StoredInfoType`` API. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: word_list (google.cloud.dlp_v2.types.CustomInfoType.Dictionary.WordList): List of words or phrases to search for. + This field is a member of `oneof`_ ``source``. cloud_storage_path (google.cloud.dlp_v2.types.CloudStoragePath): Newline-delimited file of words in Cloud Storage. Only a single file is accepted. + This field is a member of `oneof`_ ``source``. """ class WordList(proto.Message): @@ -254,9 +274,13 @@ class DetectionRule(proto.Message): depending on the specific details of the rule. Not supported for the ``surrogate_type`` custom infoType. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: hotword_rule (google.cloud.dlp_v2.types.CustomInfoType.DetectionRule.HotwordRule): Hotword-based detection rule. + This field is a member of `oneof`_ ``type``. """ class Proximity(proto.Message): @@ -279,10 +303,18 @@ class LikelihoodAdjustment(proto.Message): r"""Message for specifying an adjustment to the likelihood of a finding as part of a detection rule. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: fixed_likelihood (google.cloud.dlp_v2.types.Likelihood): Set the likelihood of a finding to a fixed value. + This field is a member of `oneof`_ ``adjustment``. relative_likelihood (int): Increase or decrease the likelihood by the specified number of levels. For example, if a finding would be ``POSSIBLE`` @@ -293,6 +325,7 @@ class LikelihoodAdjustment(proto.Message): applying an adjustment of 1 followed by an adjustment of -1 when base likelihood is ``VERY_LIKELY`` will result in a final likelihood of ``LIKELY``. + This field is a member of `oneof`_ ``adjustment``. """ fixed_likelihood = proto.Field( @@ -653,13 +686,23 @@ class SampleMethod(proto.Enum): class StorageConfig(proto.Message): r"""Shared message indicating Cloud storage type. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: datastore_options (google.cloud.dlp_v2.types.DatastoreOptions): Google Cloud Datastore options. + This field is a member of `oneof`_ ``type``. cloud_storage_options (google.cloud.dlp_v2.types.CloudStorageOptions): Google Cloud Storage options. + This field is a member of `oneof`_ ``type``. big_query_options (google.cloud.dlp_v2.types.BigQueryOptions): BigQuery options. + This field is a member of `oneof`_ ``type``. hybrid_options (google.cloud.dlp_v2.types.HybridOptions): Hybrid inspection options. Early access feature is in a pre-release state @@ -667,6 +710,7 @@ class StorageConfig(proto.Message): more information, see https://cloud.google.com/products#product- launch-stages. + This field is a member of `oneof`_ ``type``. timespan_config (google.cloud.dlp_v2.types.StorageConfig.TimespanConfig): """ @@ -849,6 +893,13 @@ class PathElement(proto.Message): If either name or ID is set, the element is complete. If neither is set, the element is incomplete. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: kind (str): The kind of the entity. A kind matching regex ``__.*__`` is @@ -859,10 +910,12 @@ class PathElement(proto.Message): Never equal to zero. Values less than zero are discouraged and may not be supported in the future. + This field is a member of `oneof`_ ``id_type``. name (str): The name of the entity. A name matching regex ``__.*__`` is reserved/read-only. A name must not be more than 1500 bytes when UTF-8 encoded. Cannot be ``""``. + This field is a member of `oneof`_ ``id_type``. """ kind = proto.Field(proto.STRING, number=1,) @@ -877,11 +930,20 @@ class RecordKey(proto.Message): r"""Message for a unique key indicating a record that contains a finding. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: datastore_key (google.cloud.dlp_v2.types.DatastoreKey): + This field is a member of `oneof`_ ``type``. big_query_key (google.cloud.dlp_v2.types.BigQueryKey): + This field is a member of `oneof`_ ``type``. id_values (Sequence[str]): Values of identifying columns in the given row. Order of values matches the order of ``identifying_fields`` specified diff --git a/setup.py b/setup.py index 25dd2daf..021ddba3 100644 --- a/setup.py +++ b/setup.py @@ -27,9 +27,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 0.4.0", - "packaging >= 14.3", "pytz >= 2021.1", ] @@ -76,7 +75,7 @@ packages=packages, namespace_packages=namespaces, install_requires=dependencies, - extras_requires=extras, + extras_require=extras, python_requires=">=3.6", scripts=["scripts/fixup_dlp_v2_keywords.py"], include_package_data=True, diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 8861d9b4..79536abc 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,8 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.26.0 +google-api-core==1.28.0 proto-plus==0.4.0 libcst==0.2.5 -packaging==14.3 -google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is required through google-api-core diff --git a/tests/unit/gapic/dlp_v2/test_dlp_service.py b/tests/unit/gapic/dlp_v2/test_dlp_service.py index c3508def..da82a356 100644 --- a/tests/unit/gapic/dlp_v2/test_dlp_service.py +++ b/tests/unit/gapic/dlp_v2/test_dlp_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -36,9 +35,6 @@ from google.cloud.dlp_v2.services.dlp_service import DlpServiceClient from google.cloud.dlp_v2.services.dlp_service import pagers from google.cloud.dlp_v2.services.dlp_service import transports -from google.cloud.dlp_v2.services.dlp_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.dlp_v2.types import dlp from google.cloud.dlp_v2.types import storage from google.oauth2 import service_account @@ -53,20 +49,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -214,7 +196,7 @@ def test_dlp_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -231,7 +213,7 @@ def test_dlp_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -248,7 +230,7 @@ def test_dlp_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -277,7 +259,7 @@ def test_dlp_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -334,7 +316,7 @@ def test_dlp_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -376,7 +358,7 @@ def test_dlp_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -398,7 +380,7 @@ def test_dlp_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -429,7 +411,7 @@ def test_dlp_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -460,7 +442,7 @@ def test_dlp_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -8131,7 +8113,6 @@ def test_dlp_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_dlp_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -8152,26 +8133,6 @@ def test_dlp_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_dlp_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.dlp_v2.services.dlp_service.transports.DlpServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DlpServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_dlp_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -8183,7 +8144,6 @@ def test_dlp_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_dlp_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -8196,23 +8156,10 @@ def test_dlp_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_dlp_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - DlpServiceClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport,], ) -@requires_google_auth_gte_1_25_0 def test_dlp_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -8226,23 +8173,6 @@ def test_dlp_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [transports.DlpServiceGrpcTransport, transports.DlpServiceGrpcAsyncIOTransport,], -) -@requires_google_auth_lt_1_25_0 -def test_dlp_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [