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

Commit 7aeaf82

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#72)
* 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 <partheniou@google.com>
1 parent ca05eb5 commit 7aeaf82

18 files changed

+92
-93
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__ = "1.2.0" # {x-release-please-version}

google/cloud/bare_metal_solution_v2/services/bare_metal_solution/async_client.py

Lines changed: 34 additions & 38 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.bare_metal_solution_v2 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -256,7 +257,7 @@ async def list_instances(
256257
*,
257258
parent: Optional[str] = None,
258259
retry: OptionalRetry = gapic_v1.method.DEFAULT,
259-
timeout: Optional[float] = None,
260+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
260261
metadata: Sequence[Tuple[str, str]] = (),
261262
) -> pagers.ListInstancesAsyncPager:
262263
r"""List servers in a given project and location.
@@ -371,7 +372,7 @@ async def get_instance(
371372
*,
372373
name: Optional[str] = None,
373374
retry: OptionalRetry = gapic_v1.method.DEFAULT,
374-
timeout: Optional[float] = None,
375+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
375376
metadata: Sequence[Tuple[str, str]] = (),
376377
) -> instance.Instance:
377378
r"""Get details about a single server.
@@ -470,7 +471,7 @@ async def update_instance(
470471
instance: Optional[gcb_instance.Instance] = None,
471472
update_mask: Optional[field_mask_pb2.FieldMask] = 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
) -> operation_async.AsyncOperation:
476477
r"""Update details of a single server.
@@ -499,7 +500,7 @@ async def sample_update_instance():
499500
500501
print("Waiting for operation to complete...")
501502
502-
response = await operation.result()
503+
response = (await operation).result()
503504
504505
# Handle the response
505506
print(response)
@@ -601,7 +602,7 @@ async def reset_instance(
601602
*,
602603
name: Optional[str] = None,
603604
retry: OptionalRetry = gapic_v1.method.DEFAULT,
604-
timeout: Optional[float] = None,
605+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
605606
metadata: Sequence[Tuple[str, str]] = (),
606607
) -> operation_async.AsyncOperation:
607608
r"""Perform an ungraceful, hard reset on a server.
@@ -633,7 +634,7 @@ async def sample_reset_instance():
633634
634635
print("Waiting for operation to complete...")
635636
636-
response = await operation.result()
637+
response = (await operation).result()
637638
638639
# Handle the response
639640
print(response)
@@ -718,7 +719,7 @@ async def start_instance(
718719
*,
719720
name: Optional[str] = None,
720721
retry: OptionalRetry = gapic_v1.method.DEFAULT,
721-
timeout: Optional[float] = None,
722+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
722723
metadata: Sequence[Tuple[str, str]] = (),
723724
) -> operation_async.AsyncOperation:
724725
r"""Starts a server that was shutdown.
@@ -748,7 +749,7 @@ async def sample_start_instance():
748749
749750
print("Waiting for operation to complete...")
750751
751-
response = await operation.result()
752+
response = (await operation).result()
752753
753754
# Handle the response
754755
print(response)
@@ -833,7 +834,7 @@ async def stop_instance(
833834
*,
834835
name: Optional[str] = None,
835836
retry: OptionalRetry = gapic_v1.method.DEFAULT,
836-
timeout: Optional[float] = None,
837+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
837838
metadata: Sequence[Tuple[str, str]] = (),
838839
) -> operation_async.AsyncOperation:
839840
r"""Stop a running server.
@@ -863,7 +864,7 @@ async def sample_stop_instance():
863864
864865
print("Waiting for operation to complete...")
865866
866-
response = await operation.result()
867+
response = (await operation).result()
867868
868869
# Handle the response
869870
print(response)
@@ -948,7 +949,7 @@ async def detach_lun(
948949
instance: Optional[str] = None,
949950
lun: Optional[str] = None,
950951
retry: OptionalRetry = gapic_v1.method.DEFAULT,
951-
timeout: Optional[float] = None,
952+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
952953
metadata: Sequence[Tuple[str, str]] = (),
953954
) -> operation_async.AsyncOperation:
954955
r"""Detach LUN from Instance.
@@ -979,7 +980,7 @@ async def sample_detach_lun():
979980
980981
print("Waiting for operation to complete...")
981982
982-
response = await operation.result()
983+
response = (await operation).result()
983984
984985
# Handle the response
985986
print(response)
@@ -1071,7 +1072,7 @@ async def list_volumes(
10711072
*,
10721073
parent: Optional[str] = None,
10731074
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1074-
timeout: Optional[float] = None,
1075+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10751076
metadata: Sequence[Tuple[str, str]] = (),
10761077
) -> pagers.ListVolumesAsyncPager:
10771078
r"""List storage volumes in a given project and location.
@@ -1186,7 +1187,7 @@ async def get_volume(
11861187
*,
11871188
name: Optional[str] = None,
11881189
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1189-
timeout: Optional[float] = None,
1190+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11901191
metadata: Sequence[Tuple[str, str]] = (),
11911192
) -> volume.Volume:
11921193
r"""Get details of a single storage volume.
@@ -1285,7 +1286,7 @@ async def update_volume(
12851286
volume: Optional[gcb_volume.Volume] = None,
12861287
update_mask: Optional[field_mask_pb2.FieldMask] = None,
12871288
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1288-
timeout: Optional[float] = None,
1289+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12891290
metadata: Sequence[Tuple[str, str]] = (),
12901291
) -> operation_async.AsyncOperation:
12911292
r"""Update details of a single storage volume.
@@ -1314,7 +1315,7 @@ async def sample_update_volume():
13141315
13151316
print("Waiting for operation to complete...")
13161317
1317-
response = await operation.result()
1318+
response = (await operation).result()
13181319
13191320
# Handle the response
13201321
print(response)
@@ -1418,7 +1419,7 @@ async def resize_volume(
14181419
volume: Optional[str] = None,
14191420
size_gib: Optional[int] = None,
14201421
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1421-
timeout: Optional[float] = None,
1422+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14221423
metadata: Sequence[Tuple[str, str]] = (),
14231424
) -> operation_async.AsyncOperation:
14241425
r"""Emergency Volume resize.
@@ -1448,7 +1449,7 @@ async def sample_resize_volume():
14481449
14491450
print("Waiting for operation to complete...")
14501451
1451-
response = await operation.result()
1452+
response = (await operation).result()
14521453
14531454
# Handle the response
14541455
print(response)
@@ -1539,7 +1540,7 @@ async def list_networks(
15391540
*,
15401541
parent: Optional[str] = None,
15411542
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1542-
timeout: Optional[float] = None,
1543+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15431544
metadata: Sequence[Tuple[str, str]] = (),
15441545
) -> pagers.ListNetworksAsyncPager:
15451546
r"""List network in a given project and location.
@@ -1654,7 +1655,7 @@ async def list_network_usage(
16541655
*,
16551656
location: Optional[str] = None,
16561657
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1657-
timeout: Optional[float] = None,
1658+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16581659
metadata: Sequence[Tuple[str, str]] = (),
16591660
) -> network.ListNetworkUsageResponse:
16601661
r"""List all Networks (and used IPs for each Network) in
@@ -1755,7 +1756,7 @@ async def get_network(
17551756
*,
17561757
name: Optional[str] = None,
17571758
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1758-
timeout: Optional[float] = None,
1759+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17591760
metadata: Sequence[Tuple[str, str]] = (),
17601761
) -> network.Network:
17611762
r"""Get details of a single network.
@@ -1854,7 +1855,7 @@ async def update_network(
18541855
network: Optional[gcb_network.Network] = None,
18551856
update_mask: Optional[field_mask_pb2.FieldMask] = None,
18561857
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1857-
timeout: Optional[float] = None,
1858+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18581859
metadata: Sequence[Tuple[str, str]] = (),
18591860
) -> operation_async.AsyncOperation:
18601861
r"""Update details of a single network.
@@ -1883,7 +1884,7 @@ async def sample_update_network():
18831884
18841885
print("Waiting for operation to complete...")
18851886
1886-
response = await operation.result()
1887+
response = (await operation).result()
18871888
18881889
# Handle the response
18891890
print(response)
@@ -1984,7 +1985,7 @@ async def get_lun(
19841985
*,
19851986
name: Optional[str] = None,
19861987
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1987-
timeout: Optional[float] = None,
1988+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19881989
metadata: Sequence[Tuple[str, str]] = (),
19891990
) -> lun.Lun:
19901991
r"""Get details of a single storage logical unit
@@ -2085,7 +2086,7 @@ async def list_luns(
20852086
*,
20862087
parent: Optional[str] = None,
20872088
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2088-
timeout: Optional[float] = None,
2089+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20892090
metadata: Sequence[Tuple[str, str]] = (),
20902091
) -> pagers.ListLunsAsyncPager:
20912092
r"""List storage volume luns for given storage volume.
@@ -2200,7 +2201,7 @@ async def get_nfs_share(
22002201
*,
22012202
name: Optional[str] = None,
22022203
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2203-
timeout: Optional[float] = None,
2204+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22042205
metadata: Sequence[Tuple[str, str]] = (),
22052206
) -> nfs_share.NfsShare:
22062207
r"""Get details of a single NFS share.
@@ -2298,7 +2299,7 @@ async def list_nfs_shares(
22982299
*,
22992300
parent: Optional[str] = None,
23002301
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2301-
timeout: Optional[float] = None,
2302+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23022303
metadata: Sequence[Tuple[str, str]] = (),
23032304
) -> pagers.ListNfsSharesAsyncPager:
23042305
r"""List NFS shares.
@@ -2414,7 +2415,7 @@ async def update_nfs_share(
24142415
nfs_share: Optional[gcb_nfs_share.NfsShare] = None,
24152416
update_mask: Optional[field_mask_pb2.FieldMask] = None,
24162417
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2417-
timeout: Optional[float] = None,
2418+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24182419
metadata: Sequence[Tuple[str, str]] = (),
24192420
) -> operation_async.AsyncOperation:
24202421
r"""Update details of a single NFS share.
@@ -2443,7 +2444,7 @@ async def sample_update_nfs_share():
24432444
24442445
print("Waiting for operation to complete...")
24452446
2446-
response = await operation.result()
2447+
response = (await operation).result()
24472448
24482449
# Handle the response
24492450
print(response)
@@ -2545,14 +2546,9 @@ async def __aexit__(self, exc_type, exc, tb):
25452546
await self.transport.close()
25462547

25472548

2548-
try:
2549-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2550-
gapic_version=pkg_resources.get_distribution(
2551-
"google-cloud-bare-metal-solution",
2552-
).version,
2553-
)
2554-
except pkg_resources.DistributionNotFound:
2555-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2549+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2550+
gapic_version=package_version.__version__
2551+
)
25562552

25572553

25582554
__all__ = ("BareMetalSolutionAsyncClient",)

0 commit comments

Comments
 (0)