Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#464)
Browse files Browse the repository at this point in the history
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Dec 7, 2022
1 parent bf3e815 commit 2e9826d
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 102 deletions.
5 changes: 0 additions & 5 deletions .coveragerc
Expand Up @@ -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
16 changes: 16 additions & 0 deletions 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}
82 changes: 39 additions & 43 deletions google/cloud/dlp_v2/services/dlp_service/async_client.py
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",)

0 comments on commit 2e9826d

Please sign in to comment.