Skip to content

Commit

Permalink
fix: Drop usage of pkg_resources (#377)
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

* add gapic_version.py

* regenerate v1beta1

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 authored Dec 8, 2022
1 parent 8c1b9ae commit fe9aad9
Show file tree
Hide file tree
Showing 60 changed files with 7,011 additions and 1,511 deletions.
5 changes: 0 additions & 5 deletions packages/google-cloud-secret-manager/.coveragerc
Original file line number Diff line number Diff line change
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
3 changes: 3 additions & 0 deletions packages/google-cloud-secret-manager/.github/.OwlBot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ deep-remove-regex:
deep-copy-regex:
- source: /google/cloud/secretmanager/(v.*)/.*-py/(.*)
dest: /owl-bot-staging/$1/$2
- source: /google/cloud/secrets/(v.*)/.*-py/(.*)
dest: /owl-bot-staging/$1/$2


begin-after-commit-hash: 219c70cd9e899bc85b467a0557b3237d4c0a41ca

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ SecretManagerService
:members:
:inherited-members:


.. automodule:: google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Secretmanager v1beta1 API

.. automodule:: google.cloud.secretmanager_v1beta1.types
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -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__ = "2.12.6" # {x-release-please-version}
Original file line number Diff line number Diff line change
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.secretmanager_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -239,7 +240,7 @@ async def list_secrets(
*,
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.ListSecretsAsyncPager:
r"""Lists [Secrets][google.cloud.secretmanager.v1.Secret].
Expand Down Expand Up @@ -358,7 +359,7 @@ async def create_secret(
secret_id: Optional[str] = None,
secret: Optional[resources.Secret] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Secret:
r"""Creates a new [Secret][google.cloud.secretmanager.v1.Secret]
Expand Down Expand Up @@ -493,7 +494,7 @@ async def add_secret_version(
parent: Optional[str] = None,
payload: Optional[resources.SecretPayload] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.SecretVersion:
r"""Creates a new
Expand Down Expand Up @@ -610,7 +611,7 @@ async def get_secret(
*,
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]] = (),
) -> resources.Secret:
r"""Gets metadata for a given
Expand Down Expand Up @@ -720,7 +721,7 @@ async def update_secret(
secret: Optional[resources.Secret] = 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]] = (),
) -> resources.Secret:
r"""Updates metadata of an existing
Expand Down Expand Up @@ -838,7 +839,7 @@ async def delete_secret(
*,
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 [Secret][google.cloud.secretmanager.v1.Secret].
Expand Down Expand Up @@ -929,7 +930,7 @@ async def list_secret_versions(
*,
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.ListSecretVersionsAsyncPager:
r"""Lists
Expand Down Expand Up @@ -1049,7 +1050,7 @@ async def get_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Gets metadata for a
Expand Down Expand Up @@ -1161,7 +1162,7 @@ async def access_secret_version(
*,
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]] = (),
) -> service.AccessSecretVersionResponse:
r"""Accesses a
Expand Down Expand Up @@ -1284,7 +1285,7 @@ async def disable_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Disables a
Expand Down Expand Up @@ -1395,7 +1396,7 @@ async def enable_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Enables a
Expand Down Expand Up @@ -1506,7 +1507,7 @@ async def destroy_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Destroys a
Expand Down Expand Up @@ -1617,7 +1618,7 @@ async def set_iam_policy(
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, 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]] = (),
) -> policy_pb2.Policy:
r"""Sets the access control policy on the specified secret. Replaces
Expand Down Expand Up @@ -1766,7 +1767,7 @@ async def get_iam_policy(
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, 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]] = (),
) -> policy_pb2.Policy:
r"""Gets the access control policy for a secret.
Expand Down Expand Up @@ -1911,7 +1912,7 @@ async def test_iam_permissions(
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, 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]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
r"""Returns permissions that a caller has for the specified secret.
Expand Down Expand Up @@ -2003,14 +2004,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-secret-manager",
).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__ = ("SecretManagerServiceAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -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.secretmanager_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -493,7 +494,7 @@ def list_secrets(
*,
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.ListSecretsPager:
r"""Lists [Secrets][google.cloud.secretmanager.v1.Secret].
Expand Down Expand Up @@ -612,7 +613,7 @@ def create_secret(
secret_id: Optional[str] = None,
secret: Optional[resources.Secret] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Secret:
r"""Creates a new [Secret][google.cloud.secretmanager.v1.Secret]
Expand Down Expand Up @@ -747,7 +748,7 @@ def add_secret_version(
parent: Optional[str] = None,
payload: Optional[resources.SecretPayload] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.SecretVersion:
r"""Creates a new
Expand Down Expand Up @@ -864,7 +865,7 @@ def get_secret(
*,
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]] = (),
) -> resources.Secret:
r"""Gets metadata for a given
Expand Down Expand Up @@ -974,7 +975,7 @@ def update_secret(
secret: Optional[resources.Secret] = 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]] = (),
) -> resources.Secret:
r"""Updates metadata of an existing
Expand Down Expand Up @@ -1092,7 +1093,7 @@ def delete_secret(
*,
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 [Secret][google.cloud.secretmanager.v1.Secret].
Expand Down Expand Up @@ -1183,7 +1184,7 @@ def list_secret_versions(
*,
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.ListSecretVersionsPager:
r"""Lists
Expand Down Expand Up @@ -1303,7 +1304,7 @@ def get_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Gets metadata for a
Expand Down Expand Up @@ -1415,7 +1416,7 @@ def access_secret_version(
*,
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]] = (),
) -> service.AccessSecretVersionResponse:
r"""Accesses a
Expand Down Expand Up @@ -1528,7 +1529,7 @@ def disable_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Disables a
Expand Down Expand Up @@ -1639,7 +1640,7 @@ def enable_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Enables a
Expand Down Expand Up @@ -1750,7 +1751,7 @@ def destroy_secret_version(
*,
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]] = (),
) -> resources.SecretVersion:
r"""Destroys a
Expand Down Expand Up @@ -1861,7 +1862,7 @@ def set_iam_policy(
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, 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]] = (),
) -> policy_pb2.Policy:
r"""Sets the access control policy on the specified secret. Replaces
Expand Down Expand Up @@ -2009,7 +2010,7 @@ def get_iam_policy(
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, 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]] = (),
) -> policy_pb2.Policy:
r"""Gets the access control policy for a secret.
Expand Down Expand Up @@ -2153,7 +2154,7 @@ def test_iam_permissions(
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, 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]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
r"""Returns permissions that a caller has for the specified secret.
Expand Down Expand Up @@ -2251,14 +2252,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-secret-manager",
).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__ = ("SecretManagerServiceClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@
from google.iam.v1 import policy_pb2 # type: ignore
from google.oauth2 import service_account # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import pkg_resources

from google.cloud.secretmanager_v1 import gapic_version as package_version
from google.cloud.secretmanager_v1.types import resources, service

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-secret-manager",
).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 SecretManagerServiceTransport(abc.ABC):
Expand Down
Loading

0 comments on commit fe9aad9

Please sign in to comment.