Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#362)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Dec 7, 2022
1 parent c9e398b commit 601b46c
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 84 deletions.
5 changes: 0 additions & 5 deletions .coveragerc
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
16 changes: 16 additions & 0 deletions google/cloud/devtools/cloudbuild_v1/gapic_version.py
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.9.3" # {x-release-please-version}
Expand Up @@ -27,7 +27,8 @@
Type,
Union,
)
import pkg_resources

from google.cloud.devtools.cloudbuild_v1 import gapic_version as package_version

from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
Expand Down Expand Up @@ -245,7 +246,7 @@ async def create_build(
project_id: Optional[str] = None,
build: Optional[cloudbuild.Build] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Starts a build with the specified configuration.
Expand Down Expand Up @@ -279,7 +280,7 @@ async def sample_create_build():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -395,7 +396,7 @@ async def get_build(
project_id: Optional[str] = None,
id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.Build:
r"""Returns information about a previously requested build.
Expand Down Expand Up @@ -543,7 +544,7 @@ async def list_builds(
project_id: Optional[str] = None,
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBuildsAsyncPager:
r"""Lists previously requested builds.
Expand Down Expand Up @@ -678,7 +679,7 @@ async def cancel_build(
project_id: Optional[str] = None,
id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.Build:
r"""Cancels a build in progress.
Expand Down Expand Up @@ -812,7 +813,7 @@ async def retry_build(
project_id: Optional[str] = None,
id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new build based on the specified build.
Expand Down Expand Up @@ -872,7 +873,7 @@ async def sample_retry_build():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -993,7 +994,7 @@ async def approve_build(
name: Optional[str] = None,
approval_result: Optional[cloudbuild.ApprovalResult] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Approves or rejects a pending build.
Expand Down Expand Up @@ -1027,7 +1028,7 @@ async def sample_approve_build():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1144,7 +1145,7 @@ async def create_build_trigger(
project_id: Optional[str] = None,
trigger: Optional[cloudbuild.BuildTrigger] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.BuildTrigger:
r"""Creates a new ``BuildTrigger``.
Expand Down Expand Up @@ -1263,7 +1264,7 @@ async def get_build_trigger(
project_id: Optional[str] = None,
trigger_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.BuildTrigger:
r"""Returns information about a ``BuildTrigger``.
Expand Down Expand Up @@ -1393,7 +1394,7 @@ async def list_build_triggers(
*,
project_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBuildTriggersAsyncPager:
r"""Lists existing ``BuildTrigger``\ s.
Expand Down Expand Up @@ -1522,7 +1523,7 @@ async def delete_build_trigger(
project_id: Optional[str] = None,
trigger_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a ``BuildTrigger`` by its project ID and trigger ID.
Expand Down Expand Up @@ -1638,7 +1639,7 @@ async def update_build_trigger(
trigger_id: Optional[str] = None,
trigger: Optional[cloudbuild.BuildTrigger] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.BuildTrigger:
r"""Updates a ``BuildTrigger`` by its project ID and trigger ID.
Expand Down Expand Up @@ -1769,7 +1770,7 @@ async def run_build_trigger(
trigger_id: Optional[str] = None,
source: Optional[cloudbuild.RepoSource] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Runs a ``BuildTrigger`` at a particular source revision.
Expand Down Expand Up @@ -1800,7 +1801,7 @@ async def sample_run_build_trigger():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1925,7 +1926,7 @@ async def receive_trigger_webhook(
request: Optional[Union[cloudbuild.ReceiveTriggerWebhookRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.ReceiveTriggerWebhookResponse:
r"""ReceiveTriggerWebhook [Experimental] is called when the API
Expand Down Expand Up @@ -2014,7 +2015,7 @@ async def create_worker_pool(
worker_pool: Optional[cloudbuild.WorkerPool] = None,
worker_pool_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a ``WorkerPool``.
Expand Down Expand Up @@ -2045,7 +2046,7 @@ async def sample_create_worker_pool():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2167,7 +2168,7 @@ async def get_worker_pool(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloudbuild.WorkerPool:
r"""Returns details of a ``WorkerPool``.
Expand Down Expand Up @@ -2293,7 +2294,7 @@ async def delete_worker_pool(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes a ``WorkerPool``.
Expand Down Expand Up @@ -2323,7 +2324,7 @@ async def sample_delete_worker_pool():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2418,7 +2419,7 @@ async def update_worker_pool(
worker_pool: Optional[cloudbuild.WorkerPool] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Updates a ``WorkerPool``.
Expand Down Expand Up @@ -2447,7 +2448,7 @@ async def sample_update_worker_pool():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2561,7 +2562,7 @@ async def list_worker_pools(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListWorkerPoolsAsyncPager:
r"""Lists ``WorkerPool``\ s.
Expand Down Expand Up @@ -2686,14 +2687,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-build",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("CloudBuildAsyncClient",)

0 comments on commit 601b46c

Please sign in to comment.