Skip to content

Commit c2b09d2

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#362)
* 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 <[email protected]>
1 parent adc9c34 commit c2b09d2

15 files changed

+84
-84
lines changed

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

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
Type,
2828
Union,
2929
)
30-
import pkg_resources
30+
31+
from google.cloud.devtools.cloudbuild_v1 import gapic_version as package_version
3132

3233
from google.api_core.client_options import ClientOptions
3334
from google.api_core import exceptions as core_exceptions
@@ -245,7 +246,7 @@ async def create_build(
245246
project_id: Optional[str] = None,
246247
build: Optional[cloudbuild.Build] = None,
247248
retry: OptionalRetry = gapic_v1.method.DEFAULT,
248-
timeout: Optional[float] = None,
249+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
249250
metadata: Sequence[Tuple[str, str]] = (),
250251
) -> operation_async.AsyncOperation:
251252
r"""Starts a build with the specified configuration.
@@ -279,7 +280,7 @@ async def sample_create_build():
279280
280281
print("Waiting for operation to complete...")
281282
282-
response = await operation.result()
283+
response = (await operation).result()
283284
284285
# Handle the response
285286
print(response)
@@ -395,7 +396,7 @@ async def get_build(
395396
project_id: Optional[str] = None,
396397
id: Optional[str] = None,
397398
retry: OptionalRetry = gapic_v1.method.DEFAULT,
398-
timeout: Optional[float] = None,
399+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
399400
metadata: Sequence[Tuple[str, str]] = (),
400401
) -> cloudbuild.Build:
401402
r"""Returns information about a previously requested build.
@@ -543,7 +544,7 @@ async def list_builds(
543544
project_id: Optional[str] = None,
544545
filter: Optional[str] = None,
545546
retry: OptionalRetry = gapic_v1.method.DEFAULT,
546-
timeout: Optional[float] = None,
547+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
547548
metadata: Sequence[Tuple[str, str]] = (),
548549
) -> pagers.ListBuildsAsyncPager:
549550
r"""Lists previously requested builds.
@@ -678,7 +679,7 @@ async def cancel_build(
678679
project_id: Optional[str] = None,
679680
id: Optional[str] = None,
680681
retry: OptionalRetry = gapic_v1.method.DEFAULT,
681-
timeout: Optional[float] = None,
682+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
682683
metadata: Sequence[Tuple[str, str]] = (),
683684
) -> cloudbuild.Build:
684685
r"""Cancels a build in progress.
@@ -812,7 +813,7 @@ async def retry_build(
812813
project_id: Optional[str] = None,
813814
id: Optional[str] = None,
814815
retry: OptionalRetry = gapic_v1.method.DEFAULT,
815-
timeout: Optional[float] = None,
816+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
816817
metadata: Sequence[Tuple[str, str]] = (),
817818
) -> operation_async.AsyncOperation:
818819
r"""Creates a new build based on the specified build.
@@ -872,7 +873,7 @@ async def sample_retry_build():
872873
873874
print("Waiting for operation to complete...")
874875
875-
response = await operation.result()
876+
response = (await operation).result()
876877
877878
# Handle the response
878879
print(response)
@@ -993,7 +994,7 @@ async def approve_build(
993994
name: Optional[str] = None,
994995
approval_result: Optional[cloudbuild.ApprovalResult] = None,
995996
retry: OptionalRetry = gapic_v1.method.DEFAULT,
996-
timeout: Optional[float] = None,
997+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
997998
metadata: Sequence[Tuple[str, str]] = (),
998999
) -> operation_async.AsyncOperation:
9991000
r"""Approves or rejects a pending build.
@@ -1027,7 +1028,7 @@ async def sample_approve_build():
10271028
10281029
print("Waiting for operation to complete...")
10291030
1030-
response = await operation.result()
1031+
response = (await operation).result()
10311032
10321033
# Handle the response
10331034
print(response)
@@ -1144,7 +1145,7 @@ async def create_build_trigger(
11441145
project_id: Optional[str] = None,
11451146
trigger: Optional[cloudbuild.BuildTrigger] = None,
11461147
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1147-
timeout: Optional[float] = None,
1148+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11481149
metadata: Sequence[Tuple[str, str]] = (),
11491150
) -> cloudbuild.BuildTrigger:
11501151
r"""Creates a new ``BuildTrigger``.
@@ -1263,7 +1264,7 @@ async def get_build_trigger(
12631264
project_id: Optional[str] = None,
12641265
trigger_id: Optional[str] = None,
12651266
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1266-
timeout: Optional[float] = None,
1267+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12671268
metadata: Sequence[Tuple[str, str]] = (),
12681269
) -> cloudbuild.BuildTrigger:
12691270
r"""Returns information about a ``BuildTrigger``.
@@ -1393,7 +1394,7 @@ async def list_build_triggers(
13931394
*,
13941395
project_id: Optional[str] = None,
13951396
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1396-
timeout: Optional[float] = None,
1397+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13971398
metadata: Sequence[Tuple[str, str]] = (),
13981399
) -> pagers.ListBuildTriggersAsyncPager:
13991400
r"""Lists existing ``BuildTrigger``\ s.
@@ -1522,7 +1523,7 @@ async def delete_build_trigger(
15221523
project_id: Optional[str] = None,
15231524
trigger_id: Optional[str] = None,
15241525
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1525-
timeout: Optional[float] = None,
1526+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15261527
metadata: Sequence[Tuple[str, str]] = (),
15271528
) -> None:
15281529
r"""Deletes a ``BuildTrigger`` by its project ID and trigger ID.
@@ -1638,7 +1639,7 @@ async def update_build_trigger(
16381639
trigger_id: Optional[str] = None,
16391640
trigger: Optional[cloudbuild.BuildTrigger] = None,
16401641
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1641-
timeout: Optional[float] = None,
1642+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16421643
metadata: Sequence[Tuple[str, str]] = (),
16431644
) -> cloudbuild.BuildTrigger:
16441645
r"""Updates a ``BuildTrigger`` by its project ID and trigger ID.
@@ -1769,7 +1770,7 @@ async def run_build_trigger(
17691770
trigger_id: Optional[str] = None,
17701771
source: Optional[cloudbuild.RepoSource] = None,
17711772
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1772-
timeout: Optional[float] = None,
1773+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17731774
metadata: Sequence[Tuple[str, str]] = (),
17741775
) -> operation_async.AsyncOperation:
17751776
r"""Runs a ``BuildTrigger`` at a particular source revision.
@@ -1800,7 +1801,7 @@ async def sample_run_build_trigger():
18001801
18011802
print("Waiting for operation to complete...")
18021803
1803-
response = await operation.result()
1804+
response = (await operation).result()
18041805
18051806
# Handle the response
18061807
print(response)
@@ -1925,7 +1926,7 @@ async def receive_trigger_webhook(
19251926
request: Optional[Union[cloudbuild.ReceiveTriggerWebhookRequest, dict]] = None,
19261927
*,
19271928
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1928-
timeout: Optional[float] = None,
1929+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19291930
metadata: Sequence[Tuple[str, str]] = (),
19301931
) -> cloudbuild.ReceiveTriggerWebhookResponse:
19311932
r"""ReceiveTriggerWebhook [Experimental] is called when the API
@@ -2014,7 +2015,7 @@ async def create_worker_pool(
20142015
worker_pool: Optional[cloudbuild.WorkerPool] = None,
20152016
worker_pool_id: Optional[str] = None,
20162017
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2017-
timeout: Optional[float] = None,
2018+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20182019
metadata: Sequence[Tuple[str, str]] = (),
20192020
) -> operation_async.AsyncOperation:
20202021
r"""Creates a ``WorkerPool``.
@@ -2045,7 +2046,7 @@ async def sample_create_worker_pool():
20452046
20462047
print("Waiting for operation to complete...")
20472048
2048-
response = await operation.result()
2049+
response = (await operation).result()
20492050
20502051
# Handle the response
20512052
print(response)
@@ -2167,7 +2168,7 @@ async def get_worker_pool(
21672168
*,
21682169
name: Optional[str] = None,
21692170
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2170-
timeout: Optional[float] = None,
2171+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21712172
metadata: Sequence[Tuple[str, str]] = (),
21722173
) -> cloudbuild.WorkerPool:
21732174
r"""Returns details of a ``WorkerPool``.
@@ -2293,7 +2294,7 @@ async def delete_worker_pool(
22932294
*,
22942295
name: Optional[str] = None,
22952296
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2296-
timeout: Optional[float] = None,
2297+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22972298
metadata: Sequence[Tuple[str, str]] = (),
22982299
) -> operation_async.AsyncOperation:
22992300
r"""Deletes a ``WorkerPool``.
@@ -2323,7 +2324,7 @@ async def sample_delete_worker_pool():
23232324
23242325
print("Waiting for operation to complete...")
23252326
2326-
response = await operation.result()
2327+
response = (await operation).result()
23272328
23282329
# Handle the response
23292330
print(response)
@@ -2418,7 +2419,7 @@ async def update_worker_pool(
24182419
worker_pool: Optional[cloudbuild.WorkerPool] = None,
24192420
update_mask: Optional[field_mask_pb2.FieldMask] = None,
24202421
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2421-
timeout: Optional[float] = None,
2422+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24222423
metadata: Sequence[Tuple[str, str]] = (),
24232424
) -> operation_async.AsyncOperation:
24242425
r"""Updates a ``WorkerPool``.
@@ -2447,7 +2448,7 @@ async def sample_update_worker_pool():
24472448
24482449
print("Waiting for operation to complete...")
24492450
2450-
response = await operation.result()
2451+
response = (await operation).result()
24512452
24522453
# Handle the response
24532454
print(response)
@@ -2561,7 +2562,7 @@ async def list_worker_pools(
25612562
*,
25622563
parent: Optional[str] = None,
25632564
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2564-
timeout: Optional[float] = None,
2565+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
25652566
metadata: Sequence[Tuple[str, str]] = (),
25662567
) -> pagers.ListWorkerPoolsAsyncPager:
25672568
r"""Lists ``WorkerPool``\ s.
@@ -2686,14 +2687,9 @@ async def __aexit__(self, exc_type, exc, tb):
26862687
await self.transport.close()
26872688

26882689

2689-
try:
2690-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2691-
gapic_version=pkg_resources.get_distribution(
2692-
"google-cloud-build",
2693-
).version,
2694-
)
2695-
except pkg_resources.DistributionNotFound:
2696-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2690+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2691+
gapic_version=package_version.__version__
2692+
)
26972693

26982694

26992695
__all__ = ("CloudBuildAsyncClient",)

0 commit comments

Comments
 (0)