Skip to content

Commit 4e76a13

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#183)
* 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>
1 parent a597711 commit 4e76a13

16 files changed

+103
-104
lines changed

packages/google-cloud-eventarc/.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__ = "1.6.3" # {x-release-please-version}

packages/google-cloud-eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py

Lines changed: 40 additions & 44 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.eventarc_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -255,7 +256,7 @@ async def get_trigger(
255256
*,
256257
name: Optional[str] = None,
257258
retry: OptionalRetry = gapic_v1.method.DEFAULT,
258-
timeout: Optional[float] = None,
259+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
259260
metadata: Sequence[Tuple[str, str]] = (),
260261
) -> trigger.Trigger:
261262
r"""Get a single trigger.
@@ -357,7 +358,7 @@ async def list_triggers(
357358
*,
358359
parent: Optional[str] = None,
359360
retry: OptionalRetry = gapic_v1.method.DEFAULT,
360-
timeout: Optional[float] = None,
361+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
361362
metadata: Sequence[Tuple[str, str]] = (),
362363
) -> pagers.ListTriggersAsyncPager:
363364
r"""List triggers.
@@ -473,7 +474,7 @@ async def create_trigger(
473474
trigger: Optional[gce_trigger.Trigger] = None,
474475
trigger_id: Optional[str] = None,
475476
retry: OptionalRetry = gapic_v1.method.DEFAULT,
476-
timeout: Optional[float] = None,
477+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
477478
metadata: Sequence[Tuple[str, str]] = (),
478479
) -> operation_async.AsyncOperation:
479480
r"""Create a new trigger in a particular project and
@@ -514,7 +515,7 @@ async def sample_create_trigger():
514515
515516
print("Waiting for operation to complete...")
516517
517-
response = await operation.result()
518+
response = (await operation).result()
518519
519520
# Handle the response
520521
print(response)
@@ -619,7 +620,7 @@ async def update_trigger(
619620
update_mask: Optional[field_mask_pb2.FieldMask] = None,
620621
allow_missing: Optional[bool] = None,
621622
retry: OptionalRetry = gapic_v1.method.DEFAULT,
622-
timeout: Optional[float] = None,
623+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
623624
metadata: Sequence[Tuple[str, str]] = (),
624625
) -> operation_async.AsyncOperation:
625626
r"""Update a single trigger.
@@ -649,7 +650,7 @@ async def sample_update_trigger():
649650
650651
print("Waiting for operation to complete...")
651652
652-
response = await operation.result()
653+
response = (await operation).result()
653654
654655
# Handle the response
655656
print(response)
@@ -758,7 +759,7 @@ async def delete_trigger(
758759
name: Optional[str] = None,
759760
allow_missing: Optional[bool] = None,
760761
retry: OptionalRetry = gapic_v1.method.DEFAULT,
761-
timeout: Optional[float] = None,
762+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
762763
metadata: Sequence[Tuple[str, str]] = (),
763764
) -> operation_async.AsyncOperation:
764765
r"""Delete a single trigger.
@@ -789,7 +790,7 @@ async def sample_delete_trigger():
789790
790791
print("Waiting for operation to complete...")
791792
792-
response = await operation.result()
793+
response = (await operation).result()
793794
794795
# Handle the response
795796
print(response)
@@ -886,7 +887,7 @@ async def get_channel(
886887
*,
887888
name: Optional[str] = None,
888889
retry: OptionalRetry = gapic_v1.method.DEFAULT,
889-
timeout: Optional[float] = None,
890+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
890891
metadata: Sequence[Tuple[str, str]] = (),
891892
) -> channel.Channel:
892893
r"""Get a single Channel.
@@ -994,7 +995,7 @@ async def list_channels(
994995
*,
995996
parent: Optional[str] = None,
996997
retry: OptionalRetry = gapic_v1.method.DEFAULT,
997-
timeout: Optional[float] = None,
998+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
998999
metadata: Sequence[Tuple[str, str]] = (),
9991000
) -> pagers.ListChannelsAsyncPager:
10001001
r"""List channels.
@@ -1110,7 +1111,7 @@ async def create_channel(
11101111
channel: Optional[gce_channel.Channel] = None,
11111112
channel_id: Optional[str] = None,
11121113
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1113-
timeout: Optional[float] = None,
1114+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11141115
metadata: Sequence[Tuple[str, str]] = (),
11151116
) -> operation_async.AsyncOperation:
11161117
r"""Create a new channel in a particular project and
@@ -1148,7 +1149,7 @@ async def sample_create_channel():
11481149
11491150
print("Waiting for operation to complete...")
11501151
1151-
response = await operation.result()
1152+
response = (await operation).result()
11521153
11531154
# Handle the response
11541155
print(response)
@@ -1255,7 +1256,7 @@ async def update_channel(
12551256
channel: Optional[gce_channel.Channel] = None,
12561257
update_mask: Optional[field_mask_pb2.FieldMask] = None,
12571258
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1258-
timeout: Optional[float] = None,
1259+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12591260
metadata: Sequence[Tuple[str, str]] = (),
12601261
) -> operation_async.AsyncOperation:
12611262
r"""Update a single channel.
@@ -1285,7 +1286,7 @@ async def sample_update_channel():
12851286
12861287
print("Waiting for operation to complete...")
12871288
1288-
response = await operation.result()
1289+
response = (await operation).result()
12891290
12901291
# Handle the response
12911292
print(response)
@@ -1386,7 +1387,7 @@ async def delete_channel(
13861387
*,
13871388
name: Optional[str] = None,
13881389
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1389-
timeout: Optional[float] = None,
1390+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13901391
metadata: Sequence[Tuple[str, str]] = (),
13911392
) -> operation_async.AsyncOperation:
13921393
r"""Delete a single channel.
@@ -1417,7 +1418,7 @@ async def sample_delete_channel():
14171418
14181419
print("Waiting for operation to complete...")
14191420
1420-
response = await operation.result()
1421+
response = (await operation).result()
14211422
14221423
# Handle the response
14231424
print(response)
@@ -1507,7 +1508,7 @@ async def get_provider(
15071508
*,
15081509
name: Optional[str] = None,
15091510
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1510-
timeout: Optional[float] = None,
1511+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15111512
metadata: Sequence[Tuple[str, str]] = (),
15121513
) -> discovery.Provider:
15131514
r"""Get a single Provider.
@@ -1609,7 +1610,7 @@ async def list_providers(
16091610
*,
16101611
parent: Optional[str] = None,
16111612
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1612-
timeout: Optional[float] = None,
1613+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16131614
metadata: Sequence[Tuple[str, str]] = (),
16141615
) -> pagers.ListProvidersAsyncPager:
16151616
r"""List providers.
@@ -1723,7 +1724,7 @@ async def get_channel_connection(
17231724
*,
17241725
name: Optional[str] = None,
17251726
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1726-
timeout: Optional[float] = None,
1727+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17271728
metadata: Sequence[Tuple[str, str]] = (),
17281729
) -> channel_connection.ChannelConnection:
17291730
r"""Get a single ChannelConnection.
@@ -1830,7 +1831,7 @@ async def list_channel_connections(
18301831
*,
18311832
parent: Optional[str] = None,
18321833
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1833-
timeout: Optional[float] = None,
1834+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18341835
metadata: Sequence[Tuple[str, str]] = (),
18351836
) -> pagers.ListChannelConnectionsAsyncPager:
18361837
r"""List channel connections.
@@ -1947,7 +1948,7 @@ async def create_channel_connection(
19471948
channel_connection: Optional[gce_channel_connection.ChannelConnection] = None,
19481949
channel_connection_id: Optional[str] = None,
19491950
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1950-
timeout: Optional[float] = None,
1951+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19511952
metadata: Sequence[Tuple[str, str]] = (),
19521953
) -> operation_async.AsyncOperation:
19531954
r"""Create a new ChannelConnection in a particular
@@ -1984,7 +1985,7 @@ async def sample_create_channel_connection():
19841985
19851986
print("Waiting for operation to complete...")
19861987
1987-
response = await operation.result()
1988+
response = (await operation).result()
19881989
19891990
# Handle the response
19901991
print(response)
@@ -2091,7 +2092,7 @@ async def delete_channel_connection(
20912092
*,
20922093
name: Optional[str] = None,
20932094
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2094-
timeout: Optional[float] = None,
2095+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20952096
metadata: Sequence[Tuple[str, str]] = (),
20962097
) -> operation_async.AsyncOperation:
20972098
r"""Delete a single ChannelConnection.
@@ -2121,7 +2122,7 @@ async def sample_delete_channel_connection():
21212122
21222123
print("Waiting for operation to complete...")
21232124
2124-
response = await operation.result()
2125+
response = (await operation).result()
21252126
21262127
# Handle the response
21272128
print(response)
@@ -2210,7 +2211,7 @@ async def get_google_channel_config(
22102211
*,
22112212
name: Optional[str] = None,
22122213
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2213-
timeout: Optional[float] = None,
2214+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22142215
metadata: Sequence[Tuple[str, str]] = (),
22152216
) -> google_channel_config.GoogleChannelConfig:
22162217
r"""Get a GoogleChannelConfig
@@ -2323,7 +2324,7 @@ async def update_google_channel_config(
23232324
] = None,
23242325
update_mask: Optional[field_mask_pb2.FieldMask] = None,
23252326
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2326-
timeout: Optional[float] = None,
2327+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23272328
metadata: Sequence[Tuple[str, str]] = (),
23282329
) -> gce_google_channel_config.GoogleChannelConfig:
23292330
r"""Update a single GoogleChannelConfig
@@ -2444,7 +2445,7 @@ async def list_operations(
24442445
request: Optional[operations_pb2.ListOperationsRequest] = None,
24452446
*,
24462447
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2447-
timeout: Optional[float] = None,
2448+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24482449
metadata: Sequence[Tuple[str, str]] = (),
24492450
) -> operations_pb2.ListOperationsResponse:
24502451
r"""Lists operations that match the specified filter in the request.
@@ -2498,7 +2499,7 @@ async def get_operation(
24982499
request: Optional[operations_pb2.GetOperationRequest] = None,
24992500
*,
25002501
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2501-
timeout: Optional[float] = None,
2502+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
25022503
metadata: Sequence[Tuple[str, str]] = (),
25032504
) -> operations_pb2.Operation:
25042505
r"""Gets the latest state of a long-running operation.
@@ -2552,7 +2553,7 @@ async def delete_operation(
25522553
request: Optional[operations_pb2.DeleteOperationRequest] = None,
25532554
*,
25542555
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2555-
timeout: Optional[float] = None,
2556+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
25562557
metadata: Sequence[Tuple[str, str]] = (),
25572558
) -> None:
25582559
r"""Deletes a long-running operation.
@@ -2607,7 +2608,7 @@ async def cancel_operation(
26072608
request: Optional[operations_pb2.CancelOperationRequest] = None,
26082609
*,
26092610
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2610-
timeout: Optional[float] = None,
2611+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
26112612
metadata: Sequence[Tuple[str, str]] = (),
26122613
) -> None:
26132614
r"""Starts asynchronous cancellation on a long-running operation.
@@ -2661,7 +2662,7 @@ async def set_iam_policy(
26612662
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
26622663
*,
26632664
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2664-
timeout: Optional[float] = None,
2665+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
26652666
metadata: Sequence[Tuple[str, str]] = (),
26662667
) -> policy_pb2.Policy:
26672668
r"""Sets the IAM access control policy on the specified function.
@@ -2781,7 +2782,7 @@ async def get_iam_policy(
27812782
request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
27822783
*,
27832784
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2784-
timeout: Optional[float] = None,
2785+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
27852786
metadata: Sequence[Tuple[str, str]] = (),
27862787
) -> policy_pb2.Policy:
27872788
r"""Gets the IAM access control policy for a function.
@@ -2902,7 +2903,7 @@ async def test_iam_permissions(
29022903
request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
29032904
*,
29042905
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2905-
timeout: Optional[float] = None,
2906+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
29062907
metadata: Sequence[Tuple[str, str]] = (),
29072908
) -> iam_policy_pb2.TestIamPermissionsResponse:
29082909
r"""Tests the specified IAM permissions against the IAM access control
@@ -2961,7 +2962,7 @@ async def get_location(
29612962
request: Optional[locations_pb2.GetLocationRequest] = None,
29622963
*,
29632964
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2964-
timeout: Optional[float] = None,
2965+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
29652966
metadata: Sequence[Tuple[str, str]] = (),
29662967
) -> locations_pb2.Location:
29672968
r"""Gets information about a location.
@@ -3015,7 +3016,7 @@ async def list_locations(
30153016
request: Optional[locations_pb2.ListLocationsRequest] = None,
30163017
*,
30173018
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3018-
timeout: Optional[float] = None,
3019+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
30193020
metadata: Sequence[Tuple[str, str]] = (),
30203021
) -> locations_pb2.ListLocationsResponse:
30213022
r"""Lists information about the supported locations for this service.
@@ -3071,14 +3072,9 @@ async def __aexit__(self, exc_type, exc, tb):
30713072
await self.transport.close()
30723073

30733074

3074-
try:
3075-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
3076-
gapic_version=pkg_resources.get_distribution(
3077-
"google-cloud-eventarc",
3078-
).version,
3079-
)
3080-
except pkg_resources.DistributionNotFound:
3081-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
3075+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
3076+
gapic_version=package_version.__version__
3077+
)
30823078

30833079

30843080
__all__ = ("EventarcAsyncClient",)

0 commit comments

Comments
 (0)