|
34 | 34 | from google.api_core.client_options import ClientOptions |
35 | 35 | from google.auth import credentials as ga_credentials # type: ignore |
36 | 36 | 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 |
38 | 39 |
|
39 | 40 | try: |
40 | 41 | OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] |
@@ -256,7 +257,7 @@ async def list_instances( |
256 | 257 | *, |
257 | 258 | parent: Optional[str] = None, |
258 | 259 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
259 | | - timeout: Optional[float] = None, |
| 260 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
260 | 261 | metadata: Sequence[Tuple[str, str]] = (), |
261 | 262 | ) -> pagers.ListInstancesAsyncPager: |
262 | 263 | r"""List servers in a given project and location. |
@@ -371,7 +372,7 @@ async def get_instance( |
371 | 372 | *, |
372 | 373 | name: Optional[str] = None, |
373 | 374 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
374 | | - timeout: Optional[float] = None, |
| 375 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
375 | 376 | metadata: Sequence[Tuple[str, str]] = (), |
376 | 377 | ) -> instance.Instance: |
377 | 378 | r"""Get details about a single server. |
@@ -470,7 +471,7 @@ async def update_instance( |
470 | 471 | instance: Optional[gcb_instance.Instance] = None, |
471 | 472 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
472 | 473 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
473 | | - timeout: Optional[float] = None, |
| 474 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
474 | 475 | metadata: Sequence[Tuple[str, str]] = (), |
475 | 476 | ) -> operation_async.AsyncOperation: |
476 | 477 | r"""Update details of a single server. |
@@ -499,7 +500,7 @@ async def sample_update_instance(): |
499 | 500 |
|
500 | 501 | print("Waiting for operation to complete...") |
501 | 502 |
|
502 | | - response = await operation.result() |
| 503 | + response = (await operation).result() |
503 | 504 |
|
504 | 505 | # Handle the response |
505 | 506 | print(response) |
@@ -601,7 +602,7 @@ async def reset_instance( |
601 | 602 | *, |
602 | 603 | name: Optional[str] = None, |
603 | 604 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
604 | | - timeout: Optional[float] = None, |
| 605 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
605 | 606 | metadata: Sequence[Tuple[str, str]] = (), |
606 | 607 | ) -> operation_async.AsyncOperation: |
607 | 608 | r"""Perform an ungraceful, hard reset on a server. |
@@ -633,7 +634,7 @@ async def sample_reset_instance(): |
633 | 634 |
|
634 | 635 | print("Waiting for operation to complete...") |
635 | 636 |
|
636 | | - response = await operation.result() |
| 637 | + response = (await operation).result() |
637 | 638 |
|
638 | 639 | # Handle the response |
639 | 640 | print(response) |
@@ -718,7 +719,7 @@ async def start_instance( |
718 | 719 | *, |
719 | 720 | name: Optional[str] = None, |
720 | 721 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
721 | | - timeout: Optional[float] = None, |
| 722 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
722 | 723 | metadata: Sequence[Tuple[str, str]] = (), |
723 | 724 | ) -> operation_async.AsyncOperation: |
724 | 725 | r"""Starts a server that was shutdown. |
@@ -748,7 +749,7 @@ async def sample_start_instance(): |
748 | 749 |
|
749 | 750 | print("Waiting for operation to complete...") |
750 | 751 |
|
751 | | - response = await operation.result() |
| 752 | + response = (await operation).result() |
752 | 753 |
|
753 | 754 | # Handle the response |
754 | 755 | print(response) |
@@ -833,7 +834,7 @@ async def stop_instance( |
833 | 834 | *, |
834 | 835 | name: Optional[str] = None, |
835 | 836 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
836 | | - timeout: Optional[float] = None, |
| 837 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
837 | 838 | metadata: Sequence[Tuple[str, str]] = (), |
838 | 839 | ) -> operation_async.AsyncOperation: |
839 | 840 | r"""Stop a running server. |
@@ -863,7 +864,7 @@ async def sample_stop_instance(): |
863 | 864 |
|
864 | 865 | print("Waiting for operation to complete...") |
865 | 866 |
|
866 | | - response = await operation.result() |
| 867 | + response = (await operation).result() |
867 | 868 |
|
868 | 869 | # Handle the response |
869 | 870 | print(response) |
@@ -948,7 +949,7 @@ async def detach_lun( |
948 | 949 | instance: Optional[str] = None, |
949 | 950 | lun: Optional[str] = None, |
950 | 951 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
951 | | - timeout: Optional[float] = None, |
| 952 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
952 | 953 | metadata: Sequence[Tuple[str, str]] = (), |
953 | 954 | ) -> operation_async.AsyncOperation: |
954 | 955 | r"""Detach LUN from Instance. |
@@ -979,7 +980,7 @@ async def sample_detach_lun(): |
979 | 980 |
|
980 | 981 | print("Waiting for operation to complete...") |
981 | 982 |
|
982 | | - response = await operation.result() |
| 983 | + response = (await operation).result() |
983 | 984 |
|
984 | 985 | # Handle the response |
985 | 986 | print(response) |
@@ -1071,7 +1072,7 @@ async def list_volumes( |
1071 | 1072 | *, |
1072 | 1073 | parent: Optional[str] = None, |
1073 | 1074 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1074 | | - timeout: Optional[float] = None, |
| 1075 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1075 | 1076 | metadata: Sequence[Tuple[str, str]] = (), |
1076 | 1077 | ) -> pagers.ListVolumesAsyncPager: |
1077 | 1078 | r"""List storage volumes in a given project and location. |
@@ -1186,7 +1187,7 @@ async def get_volume( |
1186 | 1187 | *, |
1187 | 1188 | name: Optional[str] = None, |
1188 | 1189 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1189 | | - timeout: Optional[float] = None, |
| 1190 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1190 | 1191 | metadata: Sequence[Tuple[str, str]] = (), |
1191 | 1192 | ) -> volume.Volume: |
1192 | 1193 | r"""Get details of a single storage volume. |
@@ -1285,7 +1286,7 @@ async def update_volume( |
1285 | 1286 | volume: Optional[gcb_volume.Volume] = None, |
1286 | 1287 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
1287 | 1288 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1288 | | - timeout: Optional[float] = None, |
| 1289 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1289 | 1290 | metadata: Sequence[Tuple[str, str]] = (), |
1290 | 1291 | ) -> operation_async.AsyncOperation: |
1291 | 1292 | r"""Update details of a single storage volume. |
@@ -1314,7 +1315,7 @@ async def sample_update_volume(): |
1314 | 1315 |
|
1315 | 1316 | print("Waiting for operation to complete...") |
1316 | 1317 |
|
1317 | | - response = await operation.result() |
| 1318 | + response = (await operation).result() |
1318 | 1319 |
|
1319 | 1320 | # Handle the response |
1320 | 1321 | print(response) |
@@ -1418,7 +1419,7 @@ async def resize_volume( |
1418 | 1419 | volume: Optional[str] = None, |
1419 | 1420 | size_gib: Optional[int] = None, |
1420 | 1421 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1421 | | - timeout: Optional[float] = None, |
| 1422 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1422 | 1423 | metadata: Sequence[Tuple[str, str]] = (), |
1423 | 1424 | ) -> operation_async.AsyncOperation: |
1424 | 1425 | r"""Emergency Volume resize. |
@@ -1448,7 +1449,7 @@ async def sample_resize_volume(): |
1448 | 1449 |
|
1449 | 1450 | print("Waiting for operation to complete...") |
1450 | 1451 |
|
1451 | | - response = await operation.result() |
| 1452 | + response = (await operation).result() |
1452 | 1453 |
|
1453 | 1454 | # Handle the response |
1454 | 1455 | print(response) |
@@ -1539,7 +1540,7 @@ async def list_networks( |
1539 | 1540 | *, |
1540 | 1541 | parent: Optional[str] = None, |
1541 | 1542 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1542 | | - timeout: Optional[float] = None, |
| 1543 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1543 | 1544 | metadata: Sequence[Tuple[str, str]] = (), |
1544 | 1545 | ) -> pagers.ListNetworksAsyncPager: |
1545 | 1546 | r"""List network in a given project and location. |
@@ -1654,7 +1655,7 @@ async def list_network_usage( |
1654 | 1655 | *, |
1655 | 1656 | location: Optional[str] = None, |
1656 | 1657 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1657 | | - timeout: Optional[float] = None, |
| 1658 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1658 | 1659 | metadata: Sequence[Tuple[str, str]] = (), |
1659 | 1660 | ) -> network.ListNetworkUsageResponse: |
1660 | 1661 | r"""List all Networks (and used IPs for each Network) in |
@@ -1755,7 +1756,7 @@ async def get_network( |
1755 | 1756 | *, |
1756 | 1757 | name: Optional[str] = None, |
1757 | 1758 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1758 | | - timeout: Optional[float] = None, |
| 1759 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1759 | 1760 | metadata: Sequence[Tuple[str, str]] = (), |
1760 | 1761 | ) -> network.Network: |
1761 | 1762 | r"""Get details of a single network. |
@@ -1854,7 +1855,7 @@ async def update_network( |
1854 | 1855 | network: Optional[gcb_network.Network] = None, |
1855 | 1856 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
1856 | 1857 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1857 | | - timeout: Optional[float] = None, |
| 1858 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1858 | 1859 | metadata: Sequence[Tuple[str, str]] = (), |
1859 | 1860 | ) -> operation_async.AsyncOperation: |
1860 | 1861 | r"""Update details of a single network. |
@@ -1883,7 +1884,7 @@ async def sample_update_network(): |
1883 | 1884 |
|
1884 | 1885 | print("Waiting for operation to complete...") |
1885 | 1886 |
|
1886 | | - response = await operation.result() |
| 1887 | + response = (await operation).result() |
1887 | 1888 |
|
1888 | 1889 | # Handle the response |
1889 | 1890 | print(response) |
@@ -1984,7 +1985,7 @@ async def get_lun( |
1984 | 1985 | *, |
1985 | 1986 | name: Optional[str] = None, |
1986 | 1987 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1987 | | - timeout: Optional[float] = None, |
| 1988 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1988 | 1989 | metadata: Sequence[Tuple[str, str]] = (), |
1989 | 1990 | ) -> lun.Lun: |
1990 | 1991 | r"""Get details of a single storage logical unit |
@@ -2085,7 +2086,7 @@ async def list_luns( |
2085 | 2086 | *, |
2086 | 2087 | parent: Optional[str] = None, |
2087 | 2088 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2088 | | - timeout: Optional[float] = None, |
| 2089 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2089 | 2090 | metadata: Sequence[Tuple[str, str]] = (), |
2090 | 2091 | ) -> pagers.ListLunsAsyncPager: |
2091 | 2092 | r"""List storage volume luns for given storage volume. |
@@ -2200,7 +2201,7 @@ async def get_nfs_share( |
2200 | 2201 | *, |
2201 | 2202 | name: Optional[str] = None, |
2202 | 2203 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2203 | | - timeout: Optional[float] = None, |
| 2204 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2204 | 2205 | metadata: Sequence[Tuple[str, str]] = (), |
2205 | 2206 | ) -> nfs_share.NfsShare: |
2206 | 2207 | r"""Get details of a single NFS share. |
@@ -2298,7 +2299,7 @@ async def list_nfs_shares( |
2298 | 2299 | *, |
2299 | 2300 | parent: Optional[str] = None, |
2300 | 2301 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2301 | | - timeout: Optional[float] = None, |
| 2302 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2302 | 2303 | metadata: Sequence[Tuple[str, str]] = (), |
2303 | 2304 | ) -> pagers.ListNfsSharesAsyncPager: |
2304 | 2305 | r"""List NFS shares. |
@@ -2414,7 +2415,7 @@ async def update_nfs_share( |
2414 | 2415 | nfs_share: Optional[gcb_nfs_share.NfsShare] = None, |
2415 | 2416 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
2416 | 2417 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2417 | | - timeout: Optional[float] = None, |
| 2418 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2418 | 2419 | metadata: Sequence[Tuple[str, str]] = (), |
2419 | 2420 | ) -> operation_async.AsyncOperation: |
2420 | 2421 | r"""Update details of a single NFS share. |
@@ -2443,7 +2444,7 @@ async def sample_update_nfs_share(): |
2443 | 2444 |
|
2444 | 2445 | print("Waiting for operation to complete...") |
2445 | 2446 |
|
2446 | | - response = await operation.result() |
| 2447 | + response = (await operation).result() |
2447 | 2448 |
|
2448 | 2449 | # Handle the response |
2449 | 2450 | print(response) |
@@ -2545,14 +2546,9 @@ async def __aexit__(self, exc_type, exc, tb): |
2545 | 2546 | await self.transport.close() |
2546 | 2547 |
|
2547 | 2548 |
|
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 | +) |
2556 | 2552 |
|
2557 | 2553 |
|
2558 | 2554 | __all__ = ("BareMetalSolutionAsyncClient",) |
0 commit comments