Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit dc9b1e3

Browse files
fix: Drop usage of pkg_resources (#377)
* 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: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b 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 <[email protected]>
1 parent 5530112 commit dc9b1e3

File tree

60 files changed

+7011
-1511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+7011
-1511
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound

.github/.OwlBot.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ deep-remove-regex:
2121
deep-copy-regex:
2222
- source: /google/cloud/secretmanager/(v.*)/.*-py/(.*)
2323
dest: /owl-bot-staging/$1/$2
24+
- source: /google/cloud/secrets/(v.*)/.*-py/(.*)
25+
dest: /owl-bot-staging/$1/$2
26+
2427

2528
begin-after-commit-hash: 219c70cd9e899bc85b467a0557b3237d4c0a41ca
2629

docs/secretmanager_v1beta1/secret_manager_service.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ SecretManagerService
55
:members:
66
:inherited-members:
77

8-
98
.. automodule:: google.cloud.secretmanager_v1beta1.services.secret_manager_service.pagers
109
:members:
1110
:inherited-members:

docs/secretmanager_v1beta1/types.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ Types for Google Cloud Secretmanager v1beta1 API
33

44
.. automodule:: google.cloud.secretmanager_v1beta1.types
55
:members:
6-
:undoc-members:
76
:show-inheritance:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "2.12.6" # {x-release-please-version}

google/cloud/secretmanager_v1/services/secret_manager_service/async_client.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.secretmanager_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -239,7 +240,7 @@ async def list_secrets(
239240
*,
240241
parent: Optional[str] = None,
241242
retry: OptionalRetry = gapic_v1.method.DEFAULT,
242-
timeout: Optional[float] = None,
243+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
243244
metadata: Sequence[Tuple[str, str]] = (),
244245
) -> pagers.ListSecretsAsyncPager:
245246
r"""Lists [Secrets][google.cloud.secretmanager.v1.Secret].
@@ -358,7 +359,7 @@ async def create_secret(
358359
secret_id: Optional[str] = None,
359360
secret: Optional[resources.Secret] = None,
360361
retry: OptionalRetry = gapic_v1.method.DEFAULT,
361-
timeout: Optional[float] = None,
362+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
362363
metadata: Sequence[Tuple[str, str]] = (),
363364
) -> resources.Secret:
364365
r"""Creates a new [Secret][google.cloud.secretmanager.v1.Secret]
@@ -493,7 +494,7 @@ async def add_secret_version(
493494
parent: Optional[str] = None,
494495
payload: Optional[resources.SecretPayload] = None,
495496
retry: OptionalRetry = gapic_v1.method.DEFAULT,
496-
timeout: Optional[float] = None,
497+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
497498
metadata: Sequence[Tuple[str, str]] = (),
498499
) -> resources.SecretVersion:
499500
r"""Creates a new
@@ -610,7 +611,7 @@ async def get_secret(
610611
*,
611612
name: Optional[str] = None,
612613
retry: OptionalRetry = gapic_v1.method.DEFAULT,
613-
timeout: Optional[float] = None,
614+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
614615
metadata: Sequence[Tuple[str, str]] = (),
615616
) -> resources.Secret:
616617
r"""Gets metadata for a given
@@ -720,7 +721,7 @@ async def update_secret(
720721
secret: Optional[resources.Secret] = None,
721722
update_mask: Optional[field_mask_pb2.FieldMask] = None,
722723
retry: OptionalRetry = gapic_v1.method.DEFAULT,
723-
timeout: Optional[float] = None,
724+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
724725
metadata: Sequence[Tuple[str, str]] = (),
725726
) -> resources.Secret:
726727
r"""Updates metadata of an existing
@@ -838,7 +839,7 @@ async def delete_secret(
838839
*,
839840
name: Optional[str] = None,
840841
retry: OptionalRetry = gapic_v1.method.DEFAULT,
841-
timeout: Optional[float] = None,
842+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
842843
metadata: Sequence[Tuple[str, str]] = (),
843844
) -> None:
844845
r"""Deletes a [Secret][google.cloud.secretmanager.v1.Secret].
@@ -929,7 +930,7 @@ async def list_secret_versions(
929930
*,
930931
parent: Optional[str] = None,
931932
retry: OptionalRetry = gapic_v1.method.DEFAULT,
932-
timeout: Optional[float] = None,
933+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
933934
metadata: Sequence[Tuple[str, str]] = (),
934935
) -> pagers.ListSecretVersionsAsyncPager:
935936
r"""Lists
@@ -1049,7 +1050,7 @@ async def get_secret_version(
10491050
*,
10501051
name: Optional[str] = None,
10511052
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1052-
timeout: Optional[float] = None,
1053+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10531054
metadata: Sequence[Tuple[str, str]] = (),
10541055
) -> resources.SecretVersion:
10551056
r"""Gets metadata for a
@@ -1161,7 +1162,7 @@ async def access_secret_version(
11611162
*,
11621163
name: Optional[str] = None,
11631164
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1164-
timeout: Optional[float] = None,
1165+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11651166
metadata: Sequence[Tuple[str, str]] = (),
11661167
) -> service.AccessSecretVersionResponse:
11671168
r"""Accesses a
@@ -1284,7 +1285,7 @@ async def disable_secret_version(
12841285
*,
12851286
name: Optional[str] = None,
12861287
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1287-
timeout: Optional[float] = None,
1288+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12881289
metadata: Sequence[Tuple[str, str]] = (),
12891290
) -> resources.SecretVersion:
12901291
r"""Disables a
@@ -1395,7 +1396,7 @@ async def enable_secret_version(
13951396
*,
13961397
name: Optional[str] = None,
13971398
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1398-
timeout: Optional[float] = None,
1399+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13991400
metadata: Sequence[Tuple[str, str]] = (),
14001401
) -> resources.SecretVersion:
14011402
r"""Enables a
@@ -1506,7 +1507,7 @@ async def destroy_secret_version(
15061507
*,
15071508
name: Optional[str] = None,
15081509
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1509-
timeout: Optional[float] = None,
1510+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15101511
metadata: Sequence[Tuple[str, str]] = (),
15111512
) -> resources.SecretVersion:
15121513
r"""Destroys a
@@ -1617,7 +1618,7 @@ async def set_iam_policy(
16171618
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
16181619
*,
16191620
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1620-
timeout: Optional[float] = None,
1621+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16211622
metadata: Sequence[Tuple[str, str]] = (),
16221623
) -> policy_pb2.Policy:
16231624
r"""Sets the access control policy on the specified secret. Replaces
@@ -1766,7 +1767,7 @@ async def get_iam_policy(
17661767
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
17671768
*,
17681769
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1769-
timeout: Optional[float] = None,
1770+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17701771
metadata: Sequence[Tuple[str, str]] = (),
17711772
) -> policy_pb2.Policy:
17721773
r"""Gets the access control policy for a secret.
@@ -1911,7 +1912,7 @@ async def test_iam_permissions(
19111912
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
19121913
*,
19131914
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1914-
timeout: Optional[float] = None,
1915+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19151916
metadata: Sequence[Tuple[str, str]] = (),
19161917
) -> iam_policy_pb2.TestIamPermissionsResponse:
19171918
r"""Returns permissions that a caller has for the specified secret.
@@ -2003,14 +2004,9 @@ async def __aexit__(self, exc_type, exc, tb):
20032004
await self.transport.close()
20042005

20052006

2006-
try:
2007-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2008-
gapic_version=pkg_resources.get_distribution(
2009-
"google-cloud-secret-manager",
2010-
).version,
2011-
)
2012-
except pkg_resources.DistributionNotFound:
2013-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2007+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2008+
gapic_version=package_version.__version__
2009+
)
20142010

20152011

20162012
__all__ = ("SecretManagerServiceAsyncClient",)

google/cloud/secretmanager_v1/services/secret_manager_service/client.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.secretmanager_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -493,7 +494,7 @@ def list_secrets(
493494
*,
494495
parent: Optional[str] = None,
495496
retry: OptionalRetry = gapic_v1.method.DEFAULT,
496-
timeout: Optional[float] = None,
497+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
497498
metadata: Sequence[Tuple[str, str]] = (),
498499
) -> pagers.ListSecretsPager:
499500
r"""Lists [Secrets][google.cloud.secretmanager.v1.Secret].
@@ -612,7 +613,7 @@ def create_secret(
612613
secret_id: Optional[str] = None,
613614
secret: Optional[resources.Secret] = None,
614615
retry: OptionalRetry = gapic_v1.method.DEFAULT,
615-
timeout: Optional[float] = None,
616+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
616617
metadata: Sequence[Tuple[str, str]] = (),
617618
) -> resources.Secret:
618619
r"""Creates a new [Secret][google.cloud.secretmanager.v1.Secret]
@@ -747,7 +748,7 @@ def add_secret_version(
747748
parent: Optional[str] = None,
748749
payload: Optional[resources.SecretPayload] = None,
749750
retry: OptionalRetry = gapic_v1.method.DEFAULT,
750-
timeout: Optional[float] = None,
751+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
751752
metadata: Sequence[Tuple[str, str]] = (),
752753
) -> resources.SecretVersion:
753754
r"""Creates a new
@@ -864,7 +865,7 @@ def get_secret(
864865
*,
865866
name: Optional[str] = None,
866867
retry: OptionalRetry = gapic_v1.method.DEFAULT,
867-
timeout: Optional[float] = None,
868+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
868869
metadata: Sequence[Tuple[str, str]] = (),
869870
) -> resources.Secret:
870871
r"""Gets metadata for a given
@@ -974,7 +975,7 @@ def update_secret(
974975
secret: Optional[resources.Secret] = None,
975976
update_mask: Optional[field_mask_pb2.FieldMask] = None,
976977
retry: OptionalRetry = gapic_v1.method.DEFAULT,
977-
timeout: Optional[float] = None,
978+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
978979
metadata: Sequence[Tuple[str, str]] = (),
979980
) -> resources.Secret:
980981
r"""Updates metadata of an existing
@@ -1092,7 +1093,7 @@ def delete_secret(
10921093
*,
10931094
name: Optional[str] = None,
10941095
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1095-
timeout: Optional[float] = None,
1096+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10961097
metadata: Sequence[Tuple[str, str]] = (),
10971098
) -> None:
10981099
r"""Deletes a [Secret][google.cloud.secretmanager.v1.Secret].
@@ -1183,7 +1184,7 @@ def list_secret_versions(
11831184
*,
11841185
parent: Optional[str] = None,
11851186
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1186-
timeout: Optional[float] = None,
1187+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11871188
metadata: Sequence[Tuple[str, str]] = (),
11881189
) -> pagers.ListSecretVersionsPager:
11891190
r"""Lists
@@ -1303,7 +1304,7 @@ def get_secret_version(
13031304
*,
13041305
name: Optional[str] = None,
13051306
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1306-
timeout: Optional[float] = None,
1307+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13071308
metadata: Sequence[Tuple[str, str]] = (),
13081309
) -> resources.SecretVersion:
13091310
r"""Gets metadata for a
@@ -1415,7 +1416,7 @@ def access_secret_version(
14151416
*,
14161417
name: Optional[str] = None,
14171418
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1418-
timeout: Optional[float] = None,
1419+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14191420
metadata: Sequence[Tuple[str, str]] = (),
14201421
) -> service.AccessSecretVersionResponse:
14211422
r"""Accesses a
@@ -1528,7 +1529,7 @@ def disable_secret_version(
15281529
*,
15291530
name: Optional[str] = None,
15301531
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1531-
timeout: Optional[float] = None,
1532+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15321533
metadata: Sequence[Tuple[str, str]] = (),
15331534
) -> resources.SecretVersion:
15341535
r"""Disables a
@@ -1639,7 +1640,7 @@ def enable_secret_version(
16391640
*,
16401641
name: Optional[str] = None,
16411642
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1642-
timeout: Optional[float] = None,
1643+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16431644
metadata: Sequence[Tuple[str, str]] = (),
16441645
) -> resources.SecretVersion:
16451646
r"""Enables a
@@ -1750,7 +1751,7 @@ def destroy_secret_version(
17501751
*,
17511752
name: Optional[str] = None,
17521753
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1753-
timeout: Optional[float] = None,
1754+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17541755
metadata: Sequence[Tuple[str, str]] = (),
17551756
) -> resources.SecretVersion:
17561757
r"""Destroys a
@@ -1861,7 +1862,7 @@ def set_iam_policy(
18611862
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
18621863
*,
18631864
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1864-
timeout: Optional[float] = None,
1865+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18651866
metadata: Sequence[Tuple[str, str]] = (),
18661867
) -> policy_pb2.Policy:
18671868
r"""Sets the access control policy on the specified secret. Replaces
@@ -2009,7 +2010,7 @@ def get_iam_policy(
20092010
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
20102011
*,
20112012
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2012-
timeout: Optional[float] = None,
2013+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20132014
metadata: Sequence[Tuple[str, str]] = (),
20142015
) -> policy_pb2.Policy:
20152016
r"""Gets the access control policy for a secret.
@@ -2153,7 +2154,7 @@ def test_iam_permissions(
21532154
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
21542155
*,
21552156
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2156-
timeout: Optional[float] = None,
2157+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21572158
metadata: Sequence[Tuple[str, str]] = (),
21582159
) -> iam_policy_pb2.TestIamPermissionsResponse:
21592160
r"""Returns permissions that a caller has for the specified secret.
@@ -2251,14 +2252,9 @@ def __exit__(self, type, value, traceback):
22512252
self.transport.close()
22522253

22532254

2254-
try:
2255-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2256-
gapic_version=pkg_resources.get_distribution(
2257-
"google-cloud-secret-manager",
2258-
).version,
2259-
)
2260-
except pkg_resources.DistributionNotFound:
2261-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2255+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2256+
gapic_version=package_version.__version__
2257+
)
22622258

22632259

22642260
__all__ = ("SecretManagerServiceClient",)

google/cloud/secretmanager_v1/services/secret_manager_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@
2626
from google.iam.v1 import policy_pb2 # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828
from google.protobuf import empty_pb2 # type: ignore
29-
import pkg_resources
3029

30+
from google.cloud.secretmanager_v1 import gapic_version as package_version
3131
from google.cloud.secretmanager_v1.types import resources, service
3232

33-
try:
34-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35-
gapic_version=pkg_resources.get_distribution(
36-
"google-cloud-secret-manager",
37-
).version,
38-
)
39-
except pkg_resources.DistributionNotFound:
40-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
33+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
34+
gapic_version=package_version.__version__
35+
)
4136

4237

4338
class SecretManagerServiceTransport(abc.ABC):

0 commit comments

Comments
 (0)