diff --git a/.coveragerc b/.coveragerc index f8366a49..3f27cb57 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/google/cloud/dlp_v2/gapic_version.py b/google/cloud/dlp_v2/gapic_version.py new file mode 100644 index 00000000..f829e515 --- /dev/null +++ b/google/cloud/dlp_v2/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "3.9.2" # {x-release-please-version} 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 e0d3c4a0..28741959 100644 --- a/google/cloud/dlp_v2/services/dlp_service/async_client.py +++ b/google/cloud/dlp_v2/services/dlp_service/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.dlp_v2 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -243,7 +244,7 @@ async def inspect_content( request: Optional[Union[dlp.InspectContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectContentResponse: r"""Finds potentially sensitive info in content. @@ -339,7 +340,7 @@ async def redact_image( request: Optional[Union[dlp.RedactImageRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.RedactImageResponse: r"""Redacts potentially sensitive info from an image. @@ -436,7 +437,7 @@ async def deidentify_content( request: Optional[Union[dlp.DeidentifyContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyContentResponse: r"""De-identifies potentially sensitive info from a @@ -534,7 +535,7 @@ async def reidentify_content( request: Optional[Union[dlp.ReidentifyContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ReidentifyContentResponse: r"""Re-identifies content that has been de-identified. See @@ -624,7 +625,7 @@ async def list_info_types( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ListInfoTypesResponse: r"""Returns a list of the sensitive information types @@ -737,7 +738,7 @@ async def create_inspect_template( parent: Optional[str] = None, inspect_template: Optional[dlp.InspectTemplate] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Creates an InspectTemplate for reusing frequently @@ -881,7 +882,7 @@ async def update_inspect_template( inspect_template: Optional[dlp.InspectTemplate] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Updates the InspectTemplate. @@ -1008,7 +1009,7 @@ async def get_inspect_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Gets an InspectTemplate. @@ -1129,7 +1130,7 @@ async def list_inspect_templates( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInspectTemplatesAsyncPager: r"""Lists InspectTemplates. @@ -1278,7 +1279,7 @@ async def delete_inspect_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an InspectTemplate. @@ -1383,7 +1384,7 @@ async def create_deidentify_template( parent: Optional[str] = None, deidentify_template: Optional[dlp.DeidentifyTemplate] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Creates a DeidentifyTemplate for reusing frequently @@ -1525,7 +1526,7 @@ async def update_deidentify_template( deidentify_template: Optional[dlp.DeidentifyTemplate] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Updates the DeidentifyTemplate. @@ -1651,7 +1652,7 @@ async def get_deidentify_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Gets a DeidentifyTemplate. @@ -1771,7 +1772,7 @@ async def list_deidentify_templates( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDeidentifyTemplatesAsyncPager: r"""Lists DeidentifyTemplates. @@ -1921,7 +1922,7 @@ async def delete_deidentify_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a DeidentifyTemplate. @@ -2027,7 +2028,7 @@ async def create_job_trigger( parent: Optional[str] = None, job_trigger: Optional[dlp.JobTrigger] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Creates a job trigger to run DLP actions such as @@ -2165,7 +2166,7 @@ async def update_job_trigger( job_trigger: Optional[dlp.JobTrigger] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Updates a job trigger. @@ -2289,7 +2290,7 @@ async def hybrid_inspect_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: r"""Inspect hybrid content and store findings to a @@ -2395,7 +2396,7 @@ async def get_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Gets a job trigger. @@ -2512,7 +2513,7 @@ async def list_job_triggers( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListJobTriggersAsyncPager: r"""Lists job triggers. @@ -2655,7 +2656,7 @@ async def delete_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a job trigger. @@ -2758,7 +2759,7 @@ async def activate_job_trigger( request: Optional[Union[dlp.ActivateJobTriggerRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Activate a job trigger. Causes the immediate execute @@ -2843,7 +2844,7 @@ async def create_dlp_job( inspect_job: Optional[dlp.InspectJobConfig] = None, risk_job: Optional[dlp.RiskAnalysisJobConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Creates a new job to inspect storage or calculate @@ -2991,7 +2992,7 @@ async def list_dlp_jobs( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDlpJobsAsyncPager: r"""Lists DlpJobs that match the specified filter in the @@ -3137,7 +3138,7 @@ async def get_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Gets the latest state of a long-running DlpJob. @@ -3253,7 +3254,7 @@ async def delete_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running DlpJob. This method indicates @@ -3358,7 +3359,7 @@ async def cancel_dlp_job( request: Optional[Union[dlp.CancelDlpJobRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running @@ -3434,7 +3435,7 @@ async def create_stored_info_type( parent: Optional[str] = None, config: Optional[dlp.StoredInfoTypeConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Creates a pre-built stored infoType to be used for @@ -3573,7 +3574,7 @@ async def update_stored_info_type( config: Optional[dlp.StoredInfoTypeConfig] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Updates the stored infoType by creating a new @@ -3702,7 +3703,7 @@ async def get_stored_info_type( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Gets a stored infoType. @@ -3820,7 +3821,7 @@ async def list_stored_info_types( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListStoredInfoTypesAsyncPager: r"""Lists stored infoTypes. @@ -3966,7 +3967,7 @@ async def delete_stored_info_type( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a stored infoType. @@ -4071,7 +4072,7 @@ async def hybrid_inspect_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: r"""Inspect hybrid content and store findings to a job. @@ -4175,7 +4176,7 @@ async def finish_dlp_job( request: Optional[Union[dlp.FinishDlpJobRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Finish a running hybrid DlpJob. Triggers the @@ -4247,14 +4248,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-dlp", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("DlpServiceAsyncClient",) diff --git a/google/cloud/dlp_v2/services/dlp_service/client.py b/google/cloud/dlp_v2/services/dlp_service/client.py index e0a63b9c..2e81f9f3 100644 --- a/google/cloud/dlp_v2/services/dlp_service/client.py +++ b/google/cloud/dlp_v2/services/dlp_service/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.dlp_v2 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -569,7 +570,7 @@ def inspect_content( request: Optional[Union[dlp.InspectContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectContentResponse: r"""Finds potentially sensitive info in content. @@ -656,7 +657,7 @@ def redact_image( request: Optional[Union[dlp.RedactImageRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.RedactImageResponse: r"""Redacts potentially sensitive info from an image. @@ -744,7 +745,7 @@ def deidentify_content( request: Optional[Union[dlp.DeidentifyContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyContentResponse: r"""De-identifies potentially sensitive info from a @@ -833,7 +834,7 @@ def reidentify_content( request: Optional[Union[dlp.ReidentifyContentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ReidentifyContentResponse: r"""Re-identifies content that has been de-identified. See @@ -914,7 +915,7 @@ def list_info_types( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.ListInfoTypesResponse: r"""Returns a list of the sensitive information types @@ -1017,7 +1018,7 @@ def create_inspect_template( parent: Optional[str] = None, inspect_template: Optional[dlp.InspectTemplate] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Creates an InspectTemplate for reusing frequently @@ -1161,7 +1162,7 @@ def update_inspect_template( inspect_template: Optional[dlp.InspectTemplate] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Updates the InspectTemplate. @@ -1288,7 +1289,7 @@ def get_inspect_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.InspectTemplate: r"""Gets an InspectTemplate. @@ -1399,7 +1400,7 @@ def list_inspect_templates( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInspectTemplatesPager: r"""Lists InspectTemplates. @@ -1538,7 +1539,7 @@ def delete_inspect_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an InspectTemplate. @@ -1633,7 +1634,7 @@ def create_deidentify_template( parent: Optional[str] = None, deidentify_template: Optional[dlp.DeidentifyTemplate] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Creates a DeidentifyTemplate for reusing frequently @@ -1777,7 +1778,7 @@ def update_deidentify_template( deidentify_template: Optional[dlp.DeidentifyTemplate] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Updates the DeidentifyTemplate. @@ -1905,7 +1906,7 @@ def get_deidentify_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DeidentifyTemplate: r"""Gets a DeidentifyTemplate. @@ -2015,7 +2016,7 @@ def list_deidentify_templates( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDeidentifyTemplatesPager: r"""Lists DeidentifyTemplates. @@ -2157,7 +2158,7 @@ def delete_deidentify_template( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a DeidentifyTemplate. @@ -2255,7 +2256,7 @@ def create_job_trigger( parent: Optional[str] = None, job_trigger: Optional[dlp.JobTrigger] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Creates a job trigger to run DLP actions such as @@ -2393,7 +2394,7 @@ def update_job_trigger( job_trigger: Optional[dlp.JobTrigger] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Updates a job trigger. @@ -2517,7 +2518,7 @@ def hybrid_inspect_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: r"""Inspect hybrid content and store findings to a @@ -2625,7 +2626,7 @@ def get_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.JobTrigger: r"""Gets a job trigger. @@ -2732,7 +2733,7 @@ def list_job_triggers( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListJobTriggersPager: r"""Lists job triggers. @@ -2865,7 +2866,7 @@ def delete_job_trigger( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a job trigger. @@ -2958,7 +2959,7 @@ def activate_job_trigger( request: Optional[Union[dlp.ActivateJobTriggerRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Activate a job trigger. Causes the immediate execute @@ -3044,7 +3045,7 @@ def create_dlp_job( inspect_job: Optional[dlp.InspectJobConfig] = None, risk_job: Optional[dlp.RiskAnalysisJobConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Creates a new job to inspect storage or calculate @@ -3192,7 +3193,7 @@ def list_dlp_jobs( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDlpJobsPager: r"""Lists DlpJobs that match the specified filter in the @@ -3328,7 +3329,7 @@ def get_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.DlpJob: r"""Gets the latest state of a long-running DlpJob. @@ -3434,7 +3435,7 @@ def delete_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running DlpJob. This method indicates @@ -3529,7 +3530,7 @@ def cancel_dlp_job( request: Optional[Union[dlp.CancelDlpJobRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running @@ -3606,7 +3607,7 @@ def create_stored_info_type( parent: Optional[str] = None, config: Optional[dlp.StoredInfoTypeConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Creates a pre-built stored infoType to be used for @@ -3745,7 +3746,7 @@ def update_stored_info_type( config: Optional[dlp.StoredInfoTypeConfig] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Updates the stored infoType by creating a new @@ -3874,7 +3875,7 @@ def get_stored_info_type( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.StoredInfoType: r"""Gets a stored infoType. @@ -3982,7 +3983,7 @@ def list_stored_info_types( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListStoredInfoTypesPager: r"""Lists stored infoTypes. @@ -4118,7 +4119,7 @@ def delete_stored_info_type( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a stored infoType. @@ -4213,7 +4214,7 @@ def hybrid_inspect_dlp_job( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> dlp.HybridInspectResponse: r"""Inspect hybrid content and store findings to a job. @@ -4317,7 +4318,7 @@ def finish_dlp_job( request: Optional[Union[dlp.FinishDlpJobRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Finish a running hybrid DlpJob. Triggers the @@ -4397,14 +4398,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-dlp", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("DlpServiceClient",) 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 173e8a13..7ec937f4 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/base.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.protobuf import empty_pb2 # type: ignore -import pkg_resources +from google.cloud.dlp_v2 import gapic_version as package_version from google.cloud.dlp_v2.types import dlp -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-dlp", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class DlpServiceTransport(abc.ABC): diff --git a/release-please-config.json b/release-please-config.json index d912d761..471fd7d9 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -4,6 +4,7 @@ ".": { "release-type": "python", "extra-files": [ + "google/cloud/dlp_v2/gapic_version.py", "google/cloud/dlp/gapic_version.py", { "type": "json", diff --git a/setup.py b/setup.py index 82ef2a72..26efcb62 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 6f3158cc..6c44adfe 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,6 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5