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

Commit d290938

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#34)
* 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 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 41cfb6a commit d290938

File tree

10 files changed

+63
-64
lines changed

10 files changed

+63
-64
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.1.3" # {x-release-please-version}

google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_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.beyondcorp_clientgateways_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -248,7 +249,7 @@ async def list_client_gateways(
248249
*,
249250
parent: Optional[str] = None,
250251
retry: OptionalRetry = gapic_v1.method.DEFAULT,
251-
timeout: Optional[float] = None,
252+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
252253
metadata: Sequence[Tuple[str, str]] = (),
253254
) -> pagers.ListClientGatewaysAsyncPager:
254255
r"""Lists ClientGateways in a given project and location.
@@ -365,7 +366,7 @@ async def get_client_gateway(
365366
*,
366367
name: Optional[str] = None,
367368
retry: OptionalRetry = gapic_v1.method.DEFAULT,
368-
timeout: Optional[float] = None,
369+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
369370
metadata: Sequence[Tuple[str, str]] = (),
370371
) -> client_gateways_service.ClientGateway:
371372
r"""Gets details of a single ClientGateway.
@@ -468,7 +469,7 @@ async def create_client_gateway(
468469
client_gateway: Optional[client_gateways_service.ClientGateway] = None,
469470
client_gateway_id: Optional[str] = None,
470471
retry: OptionalRetry = gapic_v1.method.DEFAULT,
471-
timeout: Optional[float] = None,
472+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
472473
metadata: Sequence[Tuple[str, str]] = (),
473474
) -> operation_async.AsyncOperation:
474475
r"""Creates a new ClientGateway in a given project and
@@ -503,7 +504,7 @@ async def sample_create_client_gateway():
503504
504505
print("Waiting for operation to complete...")
505506
506-
response = await operation.result()
507+
response = (await operation).result()
507508
508509
# Handle the response
509510
print(response)
@@ -610,7 +611,7 @@ async def delete_client_gateway(
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
) -> operation_async.AsyncOperation:
616617
r"""Deletes a single ClientGateway.
@@ -640,7 +641,7 @@ async def sample_delete_client_gateway():
640641
641642
print("Waiting for operation to complete...")
642643
643-
response = await operation.result()
644+
response = (await operation).result()
644645
645646
# Handle the response
646647
print(response)
@@ -730,7 +731,7 @@ async def list_operations(
730731
request: Optional[operations_pb2.ListOperationsRequest] = None,
731732
*,
732733
retry: OptionalRetry = gapic_v1.method.DEFAULT,
733-
timeout: Optional[float] = None,
734+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
734735
metadata: Sequence[Tuple[str, str]] = (),
735736
) -> operations_pb2.ListOperationsResponse:
736737
r"""Lists operations that match the specified filter in the request.
@@ -784,7 +785,7 @@ async def get_operation(
784785
request: Optional[operations_pb2.GetOperationRequest] = None,
785786
*,
786787
retry: OptionalRetry = gapic_v1.method.DEFAULT,
787-
timeout: Optional[float] = None,
788+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
788789
metadata: Sequence[Tuple[str, str]] = (),
789790
) -> operations_pb2.Operation:
790791
r"""Gets the latest state of a long-running operation.
@@ -838,7 +839,7 @@ async def delete_operation(
838839
request: Optional[operations_pb2.DeleteOperationRequest] = None,
839840
*,
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 long-running operation.
@@ -893,7 +894,7 @@ async def cancel_operation(
893894
request: Optional[operations_pb2.CancelOperationRequest] = None,
894895
*,
895896
retry: OptionalRetry = gapic_v1.method.DEFAULT,
896-
timeout: Optional[float] = None,
897+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
897898
metadata: Sequence[Tuple[str, str]] = (),
898899
) -> None:
899900
r"""Starts asynchronous cancellation on a long-running operation.
@@ -947,7 +948,7 @@ async def set_iam_policy(
947948
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
948949
*,
949950
retry: OptionalRetry = gapic_v1.method.DEFAULT,
950-
timeout: Optional[float] = None,
951+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
951952
metadata: Sequence[Tuple[str, str]] = (),
952953
) -> policy_pb2.Policy:
953954
r"""Sets the IAM access control policy on the specified function.
@@ -1067,7 +1068,7 @@ async def get_iam_policy(
10671068
request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
10681069
*,
10691070
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1070-
timeout: Optional[float] = None,
1071+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10711072
metadata: Sequence[Tuple[str, str]] = (),
10721073
) -> policy_pb2.Policy:
10731074
r"""Gets the IAM access control policy for a function.
@@ -1188,7 +1189,7 @@ async def test_iam_permissions(
11881189
request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
11891190
*,
11901191
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1191-
timeout: Optional[float] = None,
1192+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11921193
metadata: Sequence[Tuple[str, str]] = (),
11931194
) -> iam_policy_pb2.TestIamPermissionsResponse:
11941195
r"""Tests the specified IAM permissions against the IAM access control
@@ -1247,7 +1248,7 @@ async def get_location(
12471248
request: Optional[locations_pb2.GetLocationRequest] = None,
12481249
*,
12491250
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1250-
timeout: Optional[float] = None,
1251+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12511252
metadata: Sequence[Tuple[str, str]] = (),
12521253
) -> locations_pb2.Location:
12531254
r"""Gets information about a location.
@@ -1301,7 +1302,7 @@ async def list_locations(
13011302
request: Optional[locations_pb2.ListLocationsRequest] = None,
13021303
*,
13031304
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1304-
timeout: Optional[float] = None,
1305+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13051306
metadata: Sequence[Tuple[str, str]] = (),
13061307
) -> locations_pb2.ListLocationsResponse:
13071308
r"""Lists information about the supported locations for this service.
@@ -1357,14 +1358,9 @@ async def __aexit__(self, exc_type, exc, tb):
13571358
await self.transport.close()
13581359

13591360

1360-
try:
1361-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1362-
gapic_version=pkg_resources.get_distribution(
1363-
"google-cloud-beyondcorp-clientgateways",
1364-
).version,
1365-
)
1366-
except pkg_resources.DistributionNotFound:
1367-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1361+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1362+
gapic_version=package_version.__version__
1363+
)
13681364

13691365

13701366
__all__ = ("ClientGatewaysServiceAsyncClient",)

google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/client.py

Lines changed: 18 additions & 22 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.beyondcorp_clientgateways_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -470,7 +471,7 @@ def list_client_gateways(
470471
*,
471472
parent: Optional[str] = None,
472473
retry: OptionalRetry = gapic_v1.method.DEFAULT,
473-
timeout: Optional[float] = None,
474+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
474475
metadata: Sequence[Tuple[str, str]] = (),
475476
) -> pagers.ListClientGatewaysPager:
476477
r"""Lists ClientGateways in a given project and location.
@@ -587,7 +588,7 @@ def get_client_gateway(
587588
*,
588589
name: Optional[str] = None,
589590
retry: OptionalRetry = gapic_v1.method.DEFAULT,
590-
timeout: Optional[float] = None,
591+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
591592
metadata: Sequence[Tuple[str, str]] = (),
592593
) -> client_gateways_service.ClientGateway:
593594
r"""Gets details of a single ClientGateway.
@@ -690,7 +691,7 @@ def create_client_gateway(
690691
client_gateway: Optional[client_gateways_service.ClientGateway] = None,
691692
client_gateway_id: Optional[str] = None,
692693
retry: OptionalRetry = gapic_v1.method.DEFAULT,
693-
timeout: Optional[float] = None,
694+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
694695
metadata: Sequence[Tuple[str, str]] = (),
695696
) -> operation.Operation:
696697
r"""Creates a new ClientGateway in a given project and
@@ -832,7 +833,7 @@ def delete_client_gateway(
832833
*,
833834
name: Optional[str] = None,
834835
retry: OptionalRetry = gapic_v1.method.DEFAULT,
835-
timeout: Optional[float] = None,
836+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
836837
metadata: Sequence[Tuple[str, str]] = (),
837838
) -> operation.Operation:
838839
r"""Deletes a single ClientGateway.
@@ -965,7 +966,7 @@ def list_operations(
965966
request: Optional[operations_pb2.ListOperationsRequest] = None,
966967
*,
967968
retry: OptionalRetry = gapic_v1.method.DEFAULT,
968-
timeout: Optional[float] = None,
969+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
969970
metadata: Sequence[Tuple[str, str]] = (),
970971
) -> operations_pb2.ListOperationsResponse:
971972
r"""Lists operations that match the specified filter in the request.
@@ -1019,7 +1020,7 @@ def get_operation(
10191020
request: Optional[operations_pb2.GetOperationRequest] = None,
10201021
*,
10211022
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1022-
timeout: Optional[float] = None,
1023+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10231024
metadata: Sequence[Tuple[str, str]] = (),
10241025
) -> operations_pb2.Operation:
10251026
r"""Gets the latest state of a long-running operation.
@@ -1073,7 +1074,7 @@ def delete_operation(
10731074
request: Optional[operations_pb2.DeleteOperationRequest] = None,
10741075
*,
10751076
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1076-
timeout: Optional[float] = None,
1077+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10771078
metadata: Sequence[Tuple[str, str]] = (),
10781079
) -> None:
10791080
r"""Deletes a long-running operation.
@@ -1128,7 +1129,7 @@ def cancel_operation(
11281129
request: Optional[operations_pb2.CancelOperationRequest] = None,
11291130
*,
11301131
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1131-
timeout: Optional[float] = None,
1132+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11321133
metadata: Sequence[Tuple[str, str]] = (),
11331134
) -> None:
11341135
r"""Starts asynchronous cancellation on a long-running operation.
@@ -1182,7 +1183,7 @@ def set_iam_policy(
11821183
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
11831184
*,
11841185
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1185-
timeout: Optional[float] = None,
1186+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11861187
metadata: Sequence[Tuple[str, str]] = (),
11871188
) -> policy_pb2.Policy:
11881189
r"""Sets the IAM access control policy on the specified function.
@@ -1302,7 +1303,7 @@ def get_iam_policy(
13021303
request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
13031304
*,
13041305
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1305-
timeout: Optional[float] = None,
1306+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13061307
metadata: Sequence[Tuple[str, str]] = (),
13071308
) -> policy_pb2.Policy:
13081309
r"""Gets the IAM access control policy for a function.
@@ -1423,7 +1424,7 @@ def test_iam_permissions(
14231424
request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
14241425
*,
14251426
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1426-
timeout: Optional[float] = None,
1427+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14271428
metadata: Sequence[Tuple[str, str]] = (),
14281429
) -> iam_policy_pb2.TestIamPermissionsResponse:
14291430
r"""Tests the specified IAM permissions against the IAM access control
@@ -1482,7 +1483,7 @@ def get_location(
14821483
request: Optional[locations_pb2.GetLocationRequest] = None,
14831484
*,
14841485
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1485-
timeout: Optional[float] = None,
1486+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14861487
metadata: Sequence[Tuple[str, str]] = (),
14871488
) -> locations_pb2.Location:
14881489
r"""Gets information about a location.
@@ -1536,7 +1537,7 @@ def list_locations(
15361537
request: Optional[locations_pb2.ListLocationsRequest] = None,
15371538
*,
15381539
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1539-
timeout: Optional[float] = None,
1540+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15401541
metadata: Sequence[Tuple[str, str]] = (),
15411542
) -> locations_pb2.ListLocationsResponse:
15421543
r"""Lists information about the supported locations for this service.
@@ -1586,14 +1587,9 @@ def list_locations(
15861587
return response
15871588

15881589

1589-
try:
1590-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1591-
gapic_version=pkg_resources.get_distribution(
1592-
"google-cloud-beyondcorp-clientgateways",
1593-
).version,
1594-
)
1595-
except pkg_resources.DistributionNotFound:
1596-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1590+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1591+
gapic_version=package_version.__version__
1592+
)
15971593

15981594

15991595
__all__ = ("ClientGatewaysServiceClient",)

google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,13 @@
2727
from google.iam.v1 import policy_pb2 # type: ignore
2828
from google.longrunning import operations_pb2 # type: ignore
2929
from google.oauth2 import service_account # type: ignore
30-
import pkg_resources
3130

31+
from google.cloud.beyondcorp_clientgateways_v1 import gapic_version as package_version
3232
from google.cloud.beyondcorp_clientgateways_v1.types import client_gateways_service
3333

34-
try:
35-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
36-
gapic_version=pkg_resources.get_distribution(
37-
"google-cloud-beyondcorp-clientgateways",
38-
).version,
39-
)
40-
except pkg_resources.DistributionNotFound:
41-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
34+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35+
gapic_version=package_version.__version__
36+
)
4237

4338

4439
class ClientGatewaysServiceTransport(abc.ABC):

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"release-type": "python",
66
"extra-files": [
77
"google/cloud/beyondcorp_clientgateways/gapic_version.py",
8+
"google/cloud/beyondcorp_clientgateways_v1/gapic_version.py",
89
{
910
"type": "json",
1011
"path": "samples/generated_samples/snippet_metadata_google.cloud.beyondcorp.clientgateways.v1.json",

samples/generated_samples/beyondcorp_v1_generated_client_gateways_service_create_client_gateway_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def sample_create_client_gateway():
5252

5353
print("Waiting for operation to complete...")
5454

55-
response = await operation.result()
55+
response = (await operation).result()
5656

5757
# Handle the response
5858
print(response)

samples/generated_samples/beyondcorp_v1_generated_client_gateways_service_delete_client_gateway_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_delete_client_gateway():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
release_status = "Development Status :: 5 - Production/Stable"
4141

4242
dependencies = [
43-
"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.*",
43+
"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.*",
4444
"proto-plus >= 1.22.0, <2.0.0dev",
4545
"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",
4646
"grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev",

0 commit comments

Comments
 (0)