|
27 | 27 | Type, |
28 | 28 | Union, |
29 | 29 | ) |
30 | | -import pkg_resources |
| 30 | + |
| 31 | +from google.cloud.devtools.cloudbuild_v1 import gapic_version as package_version |
31 | 32 |
|
32 | 33 | from google.api_core.client_options import ClientOptions |
33 | 34 | from google.api_core import exceptions as core_exceptions |
@@ -245,7 +246,7 @@ async def create_build( |
245 | 246 | project_id: Optional[str] = None, |
246 | 247 | build: Optional[cloudbuild.Build] = None, |
247 | 248 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
248 | | - timeout: Optional[float] = None, |
| 249 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
249 | 250 | metadata: Sequence[Tuple[str, str]] = (), |
250 | 251 | ) -> operation_async.AsyncOperation: |
251 | 252 | r"""Starts a build with the specified configuration. |
@@ -279,7 +280,7 @@ async def sample_create_build(): |
279 | 280 |
|
280 | 281 | print("Waiting for operation to complete...") |
281 | 282 |
|
282 | | - response = await operation.result() |
| 283 | + response = (await operation).result() |
283 | 284 |
|
284 | 285 | # Handle the response |
285 | 286 | print(response) |
@@ -395,7 +396,7 @@ async def get_build( |
395 | 396 | project_id: Optional[str] = None, |
396 | 397 | id: Optional[str] = None, |
397 | 398 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
398 | | - timeout: Optional[float] = None, |
| 399 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
399 | 400 | metadata: Sequence[Tuple[str, str]] = (), |
400 | 401 | ) -> cloudbuild.Build: |
401 | 402 | r"""Returns information about a previously requested build. |
@@ -543,7 +544,7 @@ async def list_builds( |
543 | 544 | project_id: Optional[str] = None, |
544 | 545 | filter: Optional[str] = None, |
545 | 546 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
546 | | - timeout: Optional[float] = None, |
| 547 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
547 | 548 | metadata: Sequence[Tuple[str, str]] = (), |
548 | 549 | ) -> pagers.ListBuildsAsyncPager: |
549 | 550 | r"""Lists previously requested builds. |
@@ -678,7 +679,7 @@ async def cancel_build( |
678 | 679 | project_id: Optional[str] = None, |
679 | 680 | id: Optional[str] = None, |
680 | 681 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
681 | | - timeout: Optional[float] = None, |
| 682 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
682 | 683 | metadata: Sequence[Tuple[str, str]] = (), |
683 | 684 | ) -> cloudbuild.Build: |
684 | 685 | r"""Cancels a build in progress. |
@@ -812,7 +813,7 @@ async def retry_build( |
812 | 813 | project_id: Optional[str] = None, |
813 | 814 | id: Optional[str] = None, |
814 | 815 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
815 | | - timeout: Optional[float] = None, |
| 816 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
816 | 817 | metadata: Sequence[Tuple[str, str]] = (), |
817 | 818 | ) -> operation_async.AsyncOperation: |
818 | 819 | r"""Creates a new build based on the specified build. |
@@ -872,7 +873,7 @@ async def sample_retry_build(): |
872 | 873 |
|
873 | 874 | print("Waiting for operation to complete...") |
874 | 875 |
|
875 | | - response = await operation.result() |
| 876 | + response = (await operation).result() |
876 | 877 |
|
877 | 878 | # Handle the response |
878 | 879 | print(response) |
@@ -993,7 +994,7 @@ async def approve_build( |
993 | 994 | name: Optional[str] = None, |
994 | 995 | approval_result: Optional[cloudbuild.ApprovalResult] = None, |
995 | 996 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
996 | | - timeout: Optional[float] = None, |
| 997 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
997 | 998 | metadata: Sequence[Tuple[str, str]] = (), |
998 | 999 | ) -> operation_async.AsyncOperation: |
999 | 1000 | r"""Approves or rejects a pending build. |
@@ -1027,7 +1028,7 @@ async def sample_approve_build(): |
1027 | 1028 |
|
1028 | 1029 | print("Waiting for operation to complete...") |
1029 | 1030 |
|
1030 | | - response = await operation.result() |
| 1031 | + response = (await operation).result() |
1031 | 1032 |
|
1032 | 1033 | # Handle the response |
1033 | 1034 | print(response) |
@@ -1144,7 +1145,7 @@ async def create_build_trigger( |
1144 | 1145 | project_id: Optional[str] = None, |
1145 | 1146 | trigger: Optional[cloudbuild.BuildTrigger] = None, |
1146 | 1147 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1147 | | - timeout: Optional[float] = None, |
| 1148 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1148 | 1149 | metadata: Sequence[Tuple[str, str]] = (), |
1149 | 1150 | ) -> cloudbuild.BuildTrigger: |
1150 | 1151 | r"""Creates a new ``BuildTrigger``. |
@@ -1263,7 +1264,7 @@ async def get_build_trigger( |
1263 | 1264 | project_id: Optional[str] = None, |
1264 | 1265 | trigger_id: Optional[str] = None, |
1265 | 1266 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1266 | | - timeout: Optional[float] = None, |
| 1267 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1267 | 1268 | metadata: Sequence[Tuple[str, str]] = (), |
1268 | 1269 | ) -> cloudbuild.BuildTrigger: |
1269 | 1270 | r"""Returns information about a ``BuildTrigger``. |
@@ -1393,7 +1394,7 @@ async def list_build_triggers( |
1393 | 1394 | *, |
1394 | 1395 | project_id: Optional[str] = None, |
1395 | 1396 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1396 | | - timeout: Optional[float] = None, |
| 1397 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1397 | 1398 | metadata: Sequence[Tuple[str, str]] = (), |
1398 | 1399 | ) -> pagers.ListBuildTriggersAsyncPager: |
1399 | 1400 | r"""Lists existing ``BuildTrigger``\ s. |
@@ -1522,7 +1523,7 @@ async def delete_build_trigger( |
1522 | 1523 | project_id: Optional[str] = None, |
1523 | 1524 | trigger_id: Optional[str] = None, |
1524 | 1525 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1525 | | - timeout: Optional[float] = None, |
| 1526 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1526 | 1527 | metadata: Sequence[Tuple[str, str]] = (), |
1527 | 1528 | ) -> None: |
1528 | 1529 | r"""Deletes a ``BuildTrigger`` by its project ID and trigger ID. |
@@ -1638,7 +1639,7 @@ async def update_build_trigger( |
1638 | 1639 | trigger_id: Optional[str] = None, |
1639 | 1640 | trigger: Optional[cloudbuild.BuildTrigger] = None, |
1640 | 1641 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1641 | | - timeout: Optional[float] = None, |
| 1642 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1642 | 1643 | metadata: Sequence[Tuple[str, str]] = (), |
1643 | 1644 | ) -> cloudbuild.BuildTrigger: |
1644 | 1645 | r"""Updates a ``BuildTrigger`` by its project ID and trigger ID. |
@@ -1769,7 +1770,7 @@ async def run_build_trigger( |
1769 | 1770 | trigger_id: Optional[str] = None, |
1770 | 1771 | source: Optional[cloudbuild.RepoSource] = None, |
1771 | 1772 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1772 | | - timeout: Optional[float] = None, |
| 1773 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1773 | 1774 | metadata: Sequence[Tuple[str, str]] = (), |
1774 | 1775 | ) -> operation_async.AsyncOperation: |
1775 | 1776 | r"""Runs a ``BuildTrigger`` at a particular source revision. |
@@ -1800,7 +1801,7 @@ async def sample_run_build_trigger(): |
1800 | 1801 |
|
1801 | 1802 | print("Waiting for operation to complete...") |
1802 | 1803 |
|
1803 | | - response = await operation.result() |
| 1804 | + response = (await operation).result() |
1804 | 1805 |
|
1805 | 1806 | # Handle the response |
1806 | 1807 | print(response) |
@@ -1925,7 +1926,7 @@ async def receive_trigger_webhook( |
1925 | 1926 | request: Optional[Union[cloudbuild.ReceiveTriggerWebhookRequest, dict]] = None, |
1926 | 1927 | *, |
1927 | 1928 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1928 | | - timeout: Optional[float] = None, |
| 1929 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1929 | 1930 | metadata: Sequence[Tuple[str, str]] = (), |
1930 | 1931 | ) -> cloudbuild.ReceiveTriggerWebhookResponse: |
1931 | 1932 | r"""ReceiveTriggerWebhook [Experimental] is called when the API |
@@ -2014,7 +2015,7 @@ async def create_worker_pool( |
2014 | 2015 | worker_pool: Optional[cloudbuild.WorkerPool] = None, |
2015 | 2016 | worker_pool_id: Optional[str] = None, |
2016 | 2017 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2017 | | - timeout: Optional[float] = None, |
| 2018 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2018 | 2019 | metadata: Sequence[Tuple[str, str]] = (), |
2019 | 2020 | ) -> operation_async.AsyncOperation: |
2020 | 2021 | r"""Creates a ``WorkerPool``. |
@@ -2045,7 +2046,7 @@ async def sample_create_worker_pool(): |
2045 | 2046 |
|
2046 | 2047 | print("Waiting for operation to complete...") |
2047 | 2048 |
|
2048 | | - response = await operation.result() |
| 2049 | + response = (await operation).result() |
2049 | 2050 |
|
2050 | 2051 | # Handle the response |
2051 | 2052 | print(response) |
@@ -2167,7 +2168,7 @@ async def get_worker_pool( |
2167 | 2168 | *, |
2168 | 2169 | name: Optional[str] = None, |
2169 | 2170 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2170 | | - timeout: Optional[float] = None, |
| 2171 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2171 | 2172 | metadata: Sequence[Tuple[str, str]] = (), |
2172 | 2173 | ) -> cloudbuild.WorkerPool: |
2173 | 2174 | r"""Returns details of a ``WorkerPool``. |
@@ -2293,7 +2294,7 @@ async def delete_worker_pool( |
2293 | 2294 | *, |
2294 | 2295 | name: Optional[str] = None, |
2295 | 2296 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2296 | | - timeout: Optional[float] = None, |
| 2297 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2297 | 2298 | metadata: Sequence[Tuple[str, str]] = (), |
2298 | 2299 | ) -> operation_async.AsyncOperation: |
2299 | 2300 | r"""Deletes a ``WorkerPool``. |
@@ -2323,7 +2324,7 @@ async def sample_delete_worker_pool(): |
2323 | 2324 |
|
2324 | 2325 | print("Waiting for operation to complete...") |
2325 | 2326 |
|
2326 | | - response = await operation.result() |
| 2327 | + response = (await operation).result() |
2327 | 2328 |
|
2328 | 2329 | # Handle the response |
2329 | 2330 | print(response) |
@@ -2418,7 +2419,7 @@ async def update_worker_pool( |
2418 | 2419 | worker_pool: Optional[cloudbuild.WorkerPool] = None, |
2419 | 2420 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
2420 | 2421 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2421 | | - timeout: Optional[float] = None, |
| 2422 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2422 | 2423 | metadata: Sequence[Tuple[str, str]] = (), |
2423 | 2424 | ) -> operation_async.AsyncOperation: |
2424 | 2425 | r"""Updates a ``WorkerPool``. |
@@ -2447,7 +2448,7 @@ async def sample_update_worker_pool(): |
2447 | 2448 |
|
2448 | 2449 | print("Waiting for operation to complete...") |
2449 | 2450 |
|
2450 | | - response = await operation.result() |
| 2451 | + response = (await operation).result() |
2451 | 2452 |
|
2452 | 2453 | # Handle the response |
2453 | 2454 | print(response) |
@@ -2561,7 +2562,7 @@ async def list_worker_pools( |
2561 | 2562 | *, |
2562 | 2563 | parent: Optional[str] = None, |
2563 | 2564 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2564 | | - timeout: Optional[float] = None, |
| 2565 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2565 | 2566 | metadata: Sequence[Tuple[str, str]] = (), |
2566 | 2567 | ) -> pagers.ListWorkerPoolsAsyncPager: |
2567 | 2568 | r"""Lists ``WorkerPool``\ s. |
@@ -2686,14 +2687,9 @@ async def __aexit__(self, exc_type, exc, tb): |
2686 | 2687 | await self.transport.close() |
2687 | 2688 |
|
2688 | 2689 |
|
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 | +) |
2697 | 2693 |
|
2698 | 2694 |
|
2699 | 2695 | __all__ = ("CloudBuildAsyncClient",) |
0 commit comments