|
27 | 27 | Type, |
28 | 28 | Union, |
29 | 29 | ) |
30 | | -import pkg_resources |
| 30 | + |
| 31 | +from google.cloud.firestore_admin_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 |
@@ -271,7 +272,7 @@ async def create_index( |
271 | 272 | parent: Optional[str] = None, |
272 | 273 | index: Optional[gfa_index.Index] = None, |
273 | 274 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
274 | | - timeout: Optional[float] = None, |
| 275 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
275 | 276 | metadata: Sequence[Tuple[str, str]] = (), |
276 | 277 | ) -> operation_async.AsyncOperation: |
277 | 278 | r"""Creates a composite index. This returns a |
@@ -305,7 +306,7 @@ async def sample_create_index(): |
305 | 306 |
|
306 | 307 | print("Waiting for operation to complete...") |
307 | 308 |
|
308 | | - response = await operation.result() |
| 309 | + response = (await operation).result() |
309 | 310 |
|
310 | 311 | # Handle the response |
311 | 312 | print(response) |
@@ -400,7 +401,7 @@ async def list_indexes( |
400 | 401 | *, |
401 | 402 | parent: Optional[str] = None, |
402 | 403 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
403 | | - timeout: Optional[float] = None, |
| 404 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
404 | 405 | metadata: Sequence[Tuple[str, str]] = (), |
405 | 406 | ) -> pagers.ListIndexesAsyncPager: |
406 | 407 | r"""Lists composite indexes. |
@@ -526,7 +527,7 @@ async def get_index( |
526 | 527 | *, |
527 | 528 | name: Optional[str] = None, |
528 | 529 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
529 | | - timeout: Optional[float] = None, |
| 530 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
530 | 531 | metadata: Sequence[Tuple[str, str]] = (), |
531 | 532 | ) -> index.Index: |
532 | 533 | r"""Gets a composite index. |
@@ -640,7 +641,7 @@ async def delete_index( |
640 | 641 | *, |
641 | 642 | name: Optional[str] = None, |
642 | 643 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
643 | | - timeout: Optional[float] = None, |
| 644 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
644 | 645 | metadata: Sequence[Tuple[str, str]] = (), |
645 | 646 | ) -> None: |
646 | 647 | r"""Deletes a composite index. |
@@ -741,7 +742,7 @@ async def get_field( |
741 | 742 | *, |
742 | 743 | name: Optional[str] = None, |
743 | 744 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
744 | | - timeout: Optional[float] = None, |
| 745 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
745 | 746 | metadata: Sequence[Tuple[str, str]] = (), |
746 | 747 | ) -> field.Field: |
747 | 748 | r"""Gets the metadata and configuration for a Field. |
@@ -857,7 +858,7 @@ async def update_field( |
857 | 858 | *, |
858 | 859 | field: Optional[gfa_field.Field] = None, |
859 | 860 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
860 | | - timeout: Optional[float] = None, |
| 861 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
861 | 862 | metadata: Sequence[Tuple[str, str]] = (), |
862 | 863 | ) -> operation_async.AsyncOperation: |
863 | 864 | r"""Updates a field configuration. Currently, field updates apply |
@@ -905,7 +906,7 @@ async def sample_update_field(): |
905 | 906 |
|
906 | 907 | print("Waiting for operation to complete...") |
907 | 908 |
|
908 | | - response = await operation.result() |
| 909 | + response = (await operation).result() |
909 | 910 |
|
910 | 911 | # Handle the response |
911 | 912 | print(response) |
@@ -996,7 +997,7 @@ async def list_fields( |
996 | 997 | *, |
997 | 998 | parent: Optional[str] = None, |
998 | 999 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
999 | | - timeout: Optional[float] = None, |
| 1000 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1000 | 1001 | metadata: Sequence[Tuple[str, str]] = (), |
1001 | 1002 | ) -> pagers.ListFieldsAsyncPager: |
1002 | 1003 | r"""Lists the field configuration and metadata for this database. |
@@ -1130,7 +1131,7 @@ async def export_documents( |
1130 | 1131 | *, |
1131 | 1132 | name: Optional[str] = None, |
1132 | 1133 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1133 | | - timeout: Optional[float] = None, |
| 1134 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1134 | 1135 | metadata: Sequence[Tuple[str, str]] = (), |
1135 | 1136 | ) -> operation_async.AsyncOperation: |
1136 | 1137 | r"""Exports a copy of all or a subset of documents from |
@@ -1173,7 +1174,7 @@ async def sample_export_documents(): |
1173 | 1174 |
|
1174 | 1175 | print("Waiting for operation to complete...") |
1175 | 1176 |
|
1176 | | - response = await operation.result() |
| 1177 | + response = (await operation).result() |
1177 | 1178 |
|
1178 | 1179 | # Handle the response |
1179 | 1180 | print(response) |
@@ -1262,7 +1263,7 @@ async def import_documents( |
1262 | 1263 | *, |
1263 | 1264 | name: Optional[str] = None, |
1264 | 1265 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1265 | | - timeout: Optional[float] = None, |
| 1266 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1266 | 1267 | metadata: Sequence[Tuple[str, str]] = (), |
1267 | 1268 | ) -> operation_async.AsyncOperation: |
1268 | 1269 | r"""Imports documents into Google Cloud Firestore. |
@@ -1298,7 +1299,7 @@ async def sample_import_documents(): |
1298 | 1299 |
|
1299 | 1300 | print("Waiting for operation to complete...") |
1300 | 1301 |
|
1301 | | - response = await operation.result() |
| 1302 | + response = (await operation).result() |
1302 | 1303 |
|
1303 | 1304 | # Handle the response |
1304 | 1305 | print(response) |
@@ -1392,7 +1393,7 @@ async def get_database( |
1392 | 1393 | *, |
1393 | 1394 | name: Optional[str] = None, |
1394 | 1395 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1395 | | - timeout: Optional[float] = None, |
| 1396 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1396 | 1397 | metadata: Sequence[Tuple[str, str]] = (), |
1397 | 1398 | ) -> database.Database: |
1398 | 1399 | r"""Gets information about a database. |
@@ -1496,7 +1497,7 @@ async def list_databases( |
1496 | 1497 | *, |
1497 | 1498 | parent: Optional[str] = None, |
1498 | 1499 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1499 | | - timeout: Optional[float] = None, |
| 1500 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1500 | 1501 | metadata: Sequence[Tuple[str, str]] = (), |
1501 | 1502 | ) -> firestore_admin.ListDatabasesResponse: |
1502 | 1503 | r"""List all the databases in the project. |
@@ -1597,7 +1598,7 @@ async def update_database( |
1597 | 1598 | database: Optional[gfa_database.Database] = None, |
1598 | 1599 | update_mask: Optional[field_mask_pb2.FieldMask] = None, |
1599 | 1600 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1600 | | - timeout: Optional[float] = None, |
| 1601 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1601 | 1602 | metadata: Sequence[Tuple[str, str]] = (), |
1602 | 1603 | ) -> operation_async.AsyncOperation: |
1603 | 1604 | r"""Updates a database. |
@@ -1626,7 +1627,7 @@ async def sample_update_database(): |
1626 | 1627 |
|
1627 | 1628 | print("Waiting for operation to complete...") |
1628 | 1629 |
|
1629 | | - response = await operation.result() |
| 1630 | + response = (await operation).result() |
1630 | 1631 |
|
1631 | 1632 | # Handle the response |
1632 | 1633 | print(response) |
@@ -1720,7 +1721,7 @@ async def list_operations( |
1720 | 1721 | request: Optional[operations_pb2.ListOperationsRequest] = None, |
1721 | 1722 | *, |
1722 | 1723 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1723 | | - timeout: Optional[float] = None, |
| 1724 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1724 | 1725 | metadata: Sequence[Tuple[str, str]] = (), |
1725 | 1726 | ) -> operations_pb2.ListOperationsResponse: |
1726 | 1727 | r"""Lists operations that match the specified filter in the request. |
@@ -1774,7 +1775,7 @@ async def get_operation( |
1774 | 1775 | request: Optional[operations_pb2.GetOperationRequest] = None, |
1775 | 1776 | *, |
1776 | 1777 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1777 | | - timeout: Optional[float] = None, |
| 1778 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1778 | 1779 | metadata: Sequence[Tuple[str, str]] = (), |
1779 | 1780 | ) -> operations_pb2.Operation: |
1780 | 1781 | r"""Gets the latest state of a long-running operation. |
@@ -1828,7 +1829,7 @@ async def delete_operation( |
1828 | 1829 | request: Optional[operations_pb2.DeleteOperationRequest] = None, |
1829 | 1830 | *, |
1830 | 1831 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1831 | | - timeout: Optional[float] = None, |
| 1832 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1832 | 1833 | metadata: Sequence[Tuple[str, str]] = (), |
1833 | 1834 | ) -> None: |
1834 | 1835 | r"""Deletes a long-running operation. |
@@ -1883,7 +1884,7 @@ async def cancel_operation( |
1883 | 1884 | request: Optional[operations_pb2.CancelOperationRequest] = None, |
1884 | 1885 | *, |
1885 | 1886 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1886 | | - timeout: Optional[float] = None, |
| 1887 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1887 | 1888 | metadata: Sequence[Tuple[str, str]] = (), |
1888 | 1889 | ) -> None: |
1889 | 1890 | r"""Starts asynchronous cancellation on a long-running operation. |
@@ -1939,14 +1940,9 @@ async def __aexit__(self, exc_type, exc, tb): |
1939 | 1940 | await self.transport.close() |
1940 | 1941 |
|
1941 | 1942 |
|
1942 | | -try: |
1943 | | - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( |
1944 | | - gapic_version=pkg_resources.get_distribution( |
1945 | | - "google-cloud-firestore-admin", |
1946 | | - ).version, |
1947 | | - ) |
1948 | | -except pkg_resources.DistributionNotFound: |
1949 | | - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() |
| 1943 | +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( |
| 1944 | + gapic_version=package_version.__version__ |
| 1945 | +) |
1950 | 1946 |
|
1951 | 1947 |
|
1952 | 1948 | __all__ = ("FirestoreAdminAsyncClient",) |
0 commit comments