|
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.redis_v1 import gapic_version as package_version |
38 | 39 |
|
39 | 40 | try:
|
40 | 41 | OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
|
@@ -240,7 +241,7 @@ async def list_instances(
|
240 | 241 | *,
|
241 | 242 | parent: Optional[str] = None,
|
242 | 243 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
243 |
| - timeout: Optional[float] = None, |
| 244 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
244 | 245 | metadata: Sequence[Tuple[str, str]] = (),
|
245 | 246 | ) -> pagers.ListInstancesAsyncPager:
|
246 | 247 | r"""Lists all Redis instances owned by a project in either the
|
@@ -366,7 +367,7 @@ async def get_instance(
|
366 | 367 | *,
|
367 | 368 | name: Optional[str] = None,
|
368 | 369 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
369 |
| - timeout: Optional[float] = None, |
| 370 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
370 | 371 | metadata: Sequence[Tuple[str, str]] = (),
|
371 | 372 | ) -> cloud_redis.Instance:
|
372 | 373 | r"""Gets the details of a specific Redis instance.
|
@@ -467,7 +468,7 @@ async def get_instance_auth_string(
|
467 | 468 | *,
|
468 | 469 | name: Optional[str] = None,
|
469 | 470 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
470 |
| - timeout: Optional[float] = None, |
| 471 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
471 | 472 | metadata: Sequence[Tuple[str, str]] = (),
|
472 | 473 | ) -> cloud_redis.InstanceAuthString:
|
473 | 474 | r"""Gets the AUTH string for a Redis instance. If AUTH is
|
@@ -573,7 +574,7 @@ async def create_instance(
|
573 | 574 | instance_id: Optional[str] = None,
|
574 | 575 | instance: Optional[cloud_redis.Instance] = None,
|
575 | 576 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
576 |
| - timeout: Optional[float] = None, |
| 577 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
577 | 578 | metadata: Sequence[Tuple[str, str]] = (),
|
578 | 579 | ) -> operation_async.AsyncOperation:
|
579 | 580 | r"""Creates a Redis instance based on the specified tier and memory
|
@@ -623,7 +624,7 @@ async def sample_create_instance():
|
623 | 624 |
|
624 | 625 | print("Waiting for operation to complete...")
|
625 | 626 |
|
626 |
| - response = await operation.result() |
| 627 | + response = (await operation).result() |
627 | 628 |
|
628 | 629 | # Handle the response
|
629 | 630 | print(response)
|
@@ -736,7 +737,7 @@ async def update_instance(
|
736 | 737 | update_mask: Optional[field_mask_pb2.FieldMask] = None,
|
737 | 738 | instance: Optional[cloud_redis.Instance] = None,
|
738 | 739 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
739 |
| - timeout: Optional[float] = None, |
| 740 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
740 | 741 | metadata: Sequence[Tuple[str, str]] = (),
|
741 | 742 | ) -> operation_async.AsyncOperation:
|
742 | 743 | r"""Updates the metadata and configuration of a specific
|
@@ -776,7 +777,7 @@ async def sample_update_instance():
|
776 | 777 |
|
777 | 778 | print("Waiting for operation to complete...")
|
778 | 779 |
|
779 |
| - response = await operation.result() |
| 780 | + response = (await operation).result() |
780 | 781 |
|
781 | 782 | # Handle the response
|
782 | 783 | print(response)
|
@@ -883,7 +884,7 @@ async def upgrade_instance(
|
883 | 884 | name: Optional[str] = None,
|
884 | 885 | redis_version: Optional[str] = None,
|
885 | 886 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
886 |
| - timeout: Optional[float] = None, |
| 887 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
887 | 888 | metadata: Sequence[Tuple[str, str]] = (),
|
888 | 889 | ) -> operation_async.AsyncOperation:
|
889 | 890 | r"""Upgrades Redis instance to the newer Redis version
|
@@ -915,7 +916,7 @@ async def sample_upgrade_instance():
|
915 | 916 |
|
916 | 917 | print("Waiting for operation to complete...")
|
917 | 918 |
|
918 |
| - response = await operation.result() |
| 919 | + response = (await operation).result() |
919 | 920 |
|
920 | 921 | # Handle the response
|
921 | 922 | print(response)
|
@@ -1013,7 +1014,7 @@ async def import_instance(
|
1013 | 1014 | name: Optional[str] = None,
|
1014 | 1015 | input_config: Optional[cloud_redis.InputConfig] = None,
|
1015 | 1016 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
1016 |
| - timeout: Optional[float] = None, |
| 1017 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1017 | 1018 | metadata: Sequence[Tuple[str, str]] = (),
|
1018 | 1019 | ) -> operation_async.AsyncOperation:
|
1019 | 1020 | r"""Import a Redis RDB snapshot file from Cloud Storage
|
@@ -1055,7 +1056,7 @@ async def sample_import_instance():
|
1055 | 1056 |
|
1056 | 1057 | print("Waiting for operation to complete...")
|
1057 | 1058 |
|
1058 |
| - response = await operation.result() |
| 1059 | + response = (await operation).result() |
1059 | 1060 |
|
1060 | 1061 | # Handle the response
|
1061 | 1062 | print(response)
|
@@ -1153,7 +1154,7 @@ async def export_instance(
|
1153 | 1154 | name: Optional[str] = None,
|
1154 | 1155 | output_config: Optional[cloud_redis.OutputConfig] = None,
|
1155 | 1156 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
1156 |
| - timeout: Optional[float] = None, |
| 1157 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1157 | 1158 | metadata: Sequence[Tuple[str, str]] = (),
|
1158 | 1159 | ) -> operation_async.AsyncOperation:
|
1159 | 1160 | r"""Export Redis instance data into a Redis RDB format
|
@@ -1191,7 +1192,7 @@ async def sample_export_instance():
|
1191 | 1192 |
|
1192 | 1193 | print("Waiting for operation to complete...")
|
1193 | 1194 |
|
1194 |
| - response = await operation.result() |
| 1195 | + response = (await operation).result() |
1195 | 1196 |
|
1196 | 1197 | # Handle the response
|
1197 | 1198 | print(response)
|
@@ -1291,7 +1292,7 @@ async def failover_instance(
|
1291 | 1292 | cloud_redis.FailoverInstanceRequest.DataProtectionMode
|
1292 | 1293 | ] = None,
|
1293 | 1294 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
1294 |
| - timeout: Optional[float] = None, |
| 1295 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1295 | 1296 | metadata: Sequence[Tuple[str, str]] = (),
|
1296 | 1297 | ) -> operation_async.AsyncOperation:
|
1297 | 1298 | r"""Initiates a failover of the primary node to current
|
@@ -1323,7 +1324,7 @@ async def sample_failover_instance():
|
1323 | 1324 |
|
1324 | 1325 | print("Waiting for operation to complete...")
|
1325 | 1326 |
|
1326 |
| - response = await operation.result() |
| 1327 | + response = (await operation).result() |
1327 | 1328 |
|
1328 | 1329 | # Handle the response
|
1329 | 1330 | print(response)
|
@@ -1421,7 +1422,7 @@ async def delete_instance(
|
1421 | 1422 | *,
|
1422 | 1423 | name: Optional[str] = None,
|
1423 | 1424 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
1424 |
| - timeout: Optional[float] = None, |
| 1425 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1425 | 1426 | metadata: Sequence[Tuple[str, str]] = (),
|
1426 | 1427 | ) -> operation_async.AsyncOperation:
|
1427 | 1428 | r"""Deletes a specific Redis instance. Instance stops
|
@@ -1452,7 +1453,7 @@ async def sample_delete_instance():
|
1452 | 1453 |
|
1453 | 1454 | print("Waiting for operation to complete...")
|
1454 | 1455 |
|
1455 |
| - response = await operation.result() |
| 1456 | + response = (await operation).result() |
1456 | 1457 |
|
1457 | 1458 | # Handle the response
|
1458 | 1459 | print(response)
|
@@ -1551,7 +1552,7 @@ async def reschedule_maintenance(
|
1551 | 1552 | ] = None,
|
1552 | 1553 | schedule_time: Optional[timestamp_pb2.Timestamp] = None,
|
1553 | 1554 | retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
1554 |
| - timeout: Optional[float] = None, |
| 1555 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1555 | 1556 | metadata: Sequence[Tuple[str, str]] = (),
|
1556 | 1557 | ) -> operation_async.AsyncOperation:
|
1557 | 1558 | r"""Reschedule maintenance for a given instance in a
|
@@ -1583,7 +1584,7 @@ async def sample_reschedule_maintenance():
|
1583 | 1584 |
|
1584 | 1585 | print("Waiting for operation to complete...")
|
1585 | 1586 |
|
1586 |
| - response = await operation.result() |
| 1587 | + response = (await operation).result() |
1587 | 1588 |
|
1588 | 1589 | # Handle the response
|
1589 | 1590 | print(response)
|
@@ -1691,14 +1692,9 @@ async def __aexit__(self, exc_type, exc, tb):
|
1691 | 1692 | await self.transport.close()
|
1692 | 1693 |
|
1693 | 1694 |
|
1694 |
| -try: |
1695 |
| - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( |
1696 |
| - gapic_version=pkg_resources.get_distribution( |
1697 |
| - "google-cloud-redis", |
1698 |
| - ).version, |
1699 |
| - ) |
1700 |
| -except pkg_resources.DistributionNotFound: |
1701 |
| - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() |
| 1695 | +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( |
| 1696 | + gapic_version=package_version.__version__ |
| 1697 | +) |
1702 | 1698 |
|
1703 | 1699 |
|
1704 | 1700 | __all__ = ("CloudRedisAsyncClient",)
|
0 commit comments