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

Commit 71ad415

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#43)
* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java) PiperOrigin-RevId: 493113566 Source-Link: googleapis/googleapis@758f0d1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/78bd8f05e1276363eb14eae70e91fe4bc20703ab Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 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 * restore REST Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 7c88a6e commit 71ad415

27 files changed

+217
-201
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
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__ = "0.2.2" # {x-release-please-version}

google/cloud/gke_multicloud_v1/services/aws_clusters/async_client.py

Lines changed: 23 additions & 27 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.gke_multicloud_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -236,7 +237,7 @@ async def create_aws_cluster(
236237
aws_cluster: Optional[aws_resources.AwsCluster] = None,
237238
aws_cluster_id: Optional[str] = None,
238239
retry: OptionalRetry = gapic_v1.method.DEFAULT,
239-
timeout: Optional[float] = None,
240+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
240241
metadata: Sequence[Tuple[str, str]] = (),
241242
) -> operation_async.AsyncOperation:
242243
r"""Creates a new
@@ -287,7 +288,7 @@ async def sample_create_aws_cluster():
287288
288289
print("Waiting for operation to complete...")
289290
290-
response = await operation.result()
291+
response = (await operation).result()
291292
292293
# Handle the response
293294
print(response)
@@ -410,7 +411,7 @@ async def update_aws_cluster(
410411
aws_cluster: Optional[aws_resources.AwsCluster] = None,
411412
update_mask: Optional[field_mask_pb2.FieldMask] = None,
412413
retry: OptionalRetry = gapic_v1.method.DEFAULT,
413-
timeout: Optional[float] = None,
414+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
414415
metadata: Sequence[Tuple[str, str]] = (),
415416
) -> operation_async.AsyncOperation:
416417
r"""Updates an
@@ -454,7 +455,7 @@ async def sample_update_aws_cluster():
454455
455456
print("Waiting for operation to complete...")
456457
457-
response = await operation.result()
458+
response = (await operation).result()
458459
459460
# Handle the response
460461
print(response)
@@ -576,7 +577,7 @@ async def get_aws_cluster(
576577
*,
577578
name: Optional[str] = None,
578579
retry: OptionalRetry = gapic_v1.method.DEFAULT,
579-
timeout: Optional[float] = None,
580+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
580581
metadata: Sequence[Tuple[str, str]] = (),
581582
) -> aws_resources.AwsCluster:
582583
r"""Describes a specific
@@ -694,7 +695,7 @@ async def list_aws_clusters(
694695
*,
695696
parent: Optional[str] = None,
696697
retry: OptionalRetry = gapic_v1.method.DEFAULT,
697-
timeout: Optional[float] = None,
698+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
698699
metadata: Sequence[Tuple[str, str]] = (),
699700
) -> pagers.ListAwsClustersAsyncPager:
700701
r"""Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]
@@ -827,7 +828,7 @@ async def delete_aws_cluster(
827828
*,
828829
name: Optional[str] = None,
829830
retry: OptionalRetry = gapic_v1.method.DEFAULT,
830-
timeout: Optional[float] = None,
831+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
831832
metadata: Sequence[Tuple[str, str]] = (),
832833
) -> operation_async.AsyncOperation:
833834
r"""Deletes a specific
@@ -866,7 +867,7 @@ async def sample_delete_aws_cluster():
866867
867868
print("Waiting for operation to complete...")
868869
869-
response = await operation.result()
870+
response = (await operation).result()
870871
871872
# Handle the response
872873
print(response)
@@ -969,7 +970,7 @@ async def generate_aws_access_token(
969970
] = None,
970971
*,
971972
retry: OptionalRetry = gapic_v1.method.DEFAULT,
972-
timeout: Optional[float] = None,
973+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
973974
metadata: Sequence[Tuple[str, str]] = (),
974975
) -> aws_service.GenerateAwsAccessTokenResponse:
975976
r"""Generates a short-lived access token to authenticate to a given
@@ -1064,7 +1065,7 @@ async def create_aws_node_pool(
10641065
aws_node_pool: Optional[aws_resources.AwsNodePool] = None,
10651066
aws_node_pool_id: Optional[str] = None,
10661067
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1067-
timeout: Optional[float] = None,
1068+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10681069
metadata: Sequence[Tuple[str, str]] = (),
10691070
) -> operation_async.AsyncOperation:
10701071
r"""Creates a new
@@ -1112,7 +1113,7 @@ async def sample_create_aws_node_pool():
11121113
11131114
print("Waiting for operation to complete...")
11141115
1115-
response = await operation.result()
1116+
response = (await operation).result()
11161117
11171118
# Handle the response
11181119
print(response)
@@ -1235,7 +1236,7 @@ async def update_aws_node_pool(
12351236
aws_node_pool: Optional[aws_resources.AwsNodePool] = None,
12361237
update_mask: Optional[field_mask_pb2.FieldMask] = None,
12371238
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1238-
timeout: Optional[float] = None,
1239+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12391240
metadata: Sequence[Tuple[str, str]] = (),
12401241
) -> operation_async.AsyncOperation:
12411242
r"""Updates an
@@ -1275,7 +1276,7 @@ async def sample_update_aws_node_pool():
12751276
12761277
print("Waiting for operation to complete...")
12771278
1278-
response = await operation.result()
1279+
response = (await operation).result()
12791280
12801281
# Handle the response
12811282
print(response)
@@ -1392,7 +1393,7 @@ async def get_aws_node_pool(
13921393
*,
13931394
name: Optional[str] = None,
13941395
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1395-
timeout: Optional[float] = None,
1396+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13961397
metadata: Sequence[Tuple[str, str]] = (),
13971398
) -> aws_resources.AwsNodePool:
13981399
r"""Describes a specific
@@ -1511,7 +1512,7 @@ async def list_aws_node_pools(
15111512
*,
15121513
parent: Optional[str] = None,
15131514
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1514-
timeout: Optional[float] = None,
1515+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15151516
metadata: Sequence[Tuple[str, str]] = (),
15161517
) -> pagers.ListAwsNodePoolsAsyncPager:
15171518
r"""Lists all
@@ -1647,7 +1648,7 @@ async def delete_aws_node_pool(
16471648
*,
16481649
name: Optional[str] = None,
16491650
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1650-
timeout: Optional[float] = None,
1651+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16511652
metadata: Sequence[Tuple[str, str]] = (),
16521653
) -> operation_async.AsyncOperation:
16531654
r"""Deletes a specific
@@ -1683,7 +1684,7 @@ async def sample_delete_aws_node_pool():
16831684
16841685
print("Waiting for operation to complete...")
16851686
1686-
response = await operation.result()
1687+
response = (await operation).result()
16871688
16881689
# Handle the response
16891690
print(response)
@@ -1785,7 +1786,7 @@ async def get_aws_server_config(
17851786
*,
17861787
name: Optional[str] = None,
17871788
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1788-
timeout: Optional[float] = None,
1789+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17891790
metadata: Sequence[Tuple[str, str]] = (),
17901791
) -> aws_resources.AwsServerConfig:
17911792
r"""Returns information, such as supported AWS regions
@@ -1907,14 +1908,9 @@ async def __aexit__(self, exc_type, exc, tb):
19071908
await self.transport.close()
19081909

19091910

1910-
try:
1911-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1912-
gapic_version=pkg_resources.get_distribution(
1913-
"google-cloud-gke-multicloud",
1914-
).version,
1915-
)
1916-
except pkg_resources.DistributionNotFound:
1917-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1911+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1912+
gapic_version=package_version.__version__
1913+
)
19181914

19191915

19201916
__all__ = ("AwsClustersAsyncClient",)

google/cloud/gke_multicloud_v1/services/aws_clusters/client.py

Lines changed: 17 additions & 21 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.gke_multicloud_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -510,7 +511,7 @@ def create_aws_cluster(
510511
aws_cluster: Optional[aws_resources.AwsCluster] = None,
511512
aws_cluster_id: Optional[str] = None,
512513
retry: OptionalRetry = gapic_v1.method.DEFAULT,
513-
timeout: Optional[float] = None,
514+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
514515
metadata: Sequence[Tuple[str, str]] = (),
515516
) -> operation.Operation:
516517
r"""Creates a new
@@ -684,7 +685,7 @@ def update_aws_cluster(
684685
aws_cluster: Optional[aws_resources.AwsCluster] = None,
685686
update_mask: Optional[field_mask_pb2.FieldMask] = None,
686687
retry: OptionalRetry = gapic_v1.method.DEFAULT,
687-
timeout: Optional[float] = None,
688+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
688689
metadata: Sequence[Tuple[str, str]] = (),
689690
) -> operation.Operation:
690691
r"""Updates an
@@ -850,7 +851,7 @@ def get_aws_cluster(
850851
*,
851852
name: Optional[str] = None,
852853
retry: OptionalRetry = gapic_v1.method.DEFAULT,
853-
timeout: Optional[float] = None,
854+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
854855
metadata: Sequence[Tuple[str, str]] = (),
855856
) -> aws_resources.AwsCluster:
856857
r"""Describes a specific
@@ -959,7 +960,7 @@ def list_aws_clusters(
959960
*,
960961
parent: Optional[str] = None,
961962
retry: OptionalRetry = gapic_v1.method.DEFAULT,
962-
timeout: Optional[float] = None,
963+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
963964
metadata: Sequence[Tuple[str, str]] = (),
964965
) -> pagers.ListAwsClustersPager:
965966
r"""Lists all [AwsCluster][google.cloud.gkemulticloud.v1.AwsCluster]
@@ -1083,7 +1084,7 @@ def delete_aws_cluster(
10831084
*,
10841085
name: Optional[str] = None,
10851086
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1086-
timeout: Optional[float] = None,
1087+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10871088
metadata: Sequence[Tuple[str, str]] = (),
10881089
) -> operation.Operation:
10891090
r"""Deletes a specific
@@ -1225,7 +1226,7 @@ def generate_aws_access_token(
12251226
] = None,
12261227
*,
12271228
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1228-
timeout: Optional[float] = None,
1229+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12291230
metadata: Sequence[Tuple[str, str]] = (),
12301231
) -> aws_service.GenerateAwsAccessTokenResponse:
12311232
r"""Generates a short-lived access token to authenticate to a given
@@ -1314,7 +1315,7 @@ def create_aws_node_pool(
13141315
aws_node_pool: Optional[aws_resources.AwsNodePool] = None,
13151316
aws_node_pool_id: Optional[str] = None,
13161317
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1317-
timeout: Optional[float] = None,
1318+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13181319
metadata: Sequence[Tuple[str, str]] = (),
13191320
) -> operation.Operation:
13201321
r"""Creates a new
@@ -1485,7 +1486,7 @@ def update_aws_node_pool(
14851486
aws_node_pool: Optional[aws_resources.AwsNodePool] = None,
14861487
update_mask: Optional[field_mask_pb2.FieldMask] = None,
14871488
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1488-
timeout: Optional[float] = None,
1489+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14891490
metadata: Sequence[Tuple[str, str]] = (),
14901491
) -> operation.Operation:
14911492
r"""Updates an
@@ -1642,7 +1643,7 @@ def get_aws_node_pool(
16421643
*,
16431644
name: Optional[str] = None,
16441645
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1645-
timeout: Optional[float] = None,
1646+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16461647
metadata: Sequence[Tuple[str, str]] = (),
16471648
) -> aws_resources.AwsNodePool:
16481649
r"""Describes a specific
@@ -1752,7 +1753,7 @@ def list_aws_node_pools(
17521753
*,
17531754
parent: Optional[str] = None,
17541755
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1755-
timeout: Optional[float] = None,
1756+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17561757
metadata: Sequence[Tuple[str, str]] = (),
17571758
) -> pagers.ListAwsNodePoolsPager:
17581759
r"""Lists all
@@ -1879,7 +1880,7 @@ def delete_aws_node_pool(
18791880
*,
18801881
name: Optional[str] = None,
18811882
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1882-
timeout: Optional[float] = None,
1883+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18831884
metadata: Sequence[Tuple[str, str]] = (),
18841885
) -> operation.Operation:
18851886
r"""Deletes a specific
@@ -2017,7 +2018,7 @@ def get_aws_server_config(
20172018
*,
20182019
name: Optional[str] = None,
20192020
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2020-
timeout: Optional[float] = None,
2021+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20212022
metadata: Sequence[Tuple[str, str]] = (),
20222023
) -> aws_resources.AwsServerConfig:
20232024
r"""Returns information, such as supported AWS regions
@@ -2137,14 +2138,9 @@ def __exit__(self, type, value, traceback):
21372138
self.transport.close()
21382139

21392140

2140-
try:
2141-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2142-
gapic_version=pkg_resources.get_distribution(
2143-
"google-cloud-gke-multicloud",
2144-
).version,
2145-
)
2146-
except pkg_resources.DistributionNotFound:
2147-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2141+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2142+
gapic_version=package_version.__version__
2143+
)
21482144

21492145

21502146
__all__ = ("AwsClustersClient",)

google/cloud/gke_multicloud_v1/services/aws_clusters/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.longrunning import operations_pb2 # type: ignore
2626
from google.oauth2 import service_account # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.gke_multicloud_v1 import gapic_version as package_version
2929
from google.cloud.gke_multicloud_v1.types import aws_resources, aws_service
3030

31-
try:
32-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33-
gapic_version=pkg_resources.get_distribution(
34-
"google-cloud-gke-multicloud",
35-
).version,
36-
)
37-
except pkg_resources.DistributionNotFound:
38-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
31+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32+
gapic_version=package_version.__version__
33+
)
3934

4035

4136
class AwsClustersTransport(abc.ABC):

0 commit comments

Comments
 (0)