|
42 | 42 | from google.cloud.firestore_admin_v1.types import index
|
43 | 43 | from google.cloud.firestore_admin_v1.types import index as gfa_index
|
44 | 44 | from google.cloud.firestore_admin_v1.types import operation as gfa_operation
|
| 45 | +from google.cloud.location import locations_pb2 # type: ignore |
| 46 | +from google.longrunning import operations_pb2 |
45 | 47 | from google.protobuf import empty_pb2 # type: ignore
|
46 | 48 | from google.protobuf import field_mask_pb2 # type: ignore
|
47 | 49 | from .transports.base import FirestoreAdminTransport, DEFAULT_CLIENT_INFO
|
@@ -1703,6 +1705,223 @@ async def sample_update_database():
|
1703 | 1705 | # Done; return the response.
|
1704 | 1706 | return response
|
1705 | 1707 |
|
| 1708 | + async def list_operations( |
| 1709 | + self, |
| 1710 | + request: operations_pb2.ListOperationsRequest = None, |
| 1711 | + *, |
| 1712 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1713 | + timeout: float = None, |
| 1714 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1715 | + ) -> operations_pb2.ListOperationsResponse: |
| 1716 | + r"""Lists operations that match the specified filter in the request. |
| 1717 | +
|
| 1718 | + Args: |
| 1719 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 1720 | + The request object. Request message for |
| 1721 | + `ListOperations` method. |
| 1722 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1723 | + if any, should be retried. |
| 1724 | + timeout (float): The timeout for this request. |
| 1725 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1726 | + sent along with the request as metadata. |
| 1727 | + Returns: |
| 1728 | + ~.operations_pb2.ListOperationsResponse: |
| 1729 | + Response message for ``ListOperations`` method. |
| 1730 | + """ |
| 1731 | + # Create or coerce a protobuf request object. |
| 1732 | + # The request isn't a proto-plus wrapped type, |
| 1733 | + # so it must be constructed via keyword expansion. |
| 1734 | + if isinstance(request, dict): |
| 1735 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1736 | + |
| 1737 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1738 | + # and friendly error handling. |
| 1739 | + rpc = gapic_v1.method.wrap_method( |
| 1740 | + self._client._transport.list_operations, |
| 1741 | + default_timeout=None, |
| 1742 | + client_info=DEFAULT_CLIENT_INFO, |
| 1743 | + ) |
| 1744 | + |
| 1745 | + # Certain fields should be provided within the metadata header; |
| 1746 | + # add these here. |
| 1747 | + metadata = tuple(metadata) + ( |
| 1748 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1749 | + ) |
| 1750 | + |
| 1751 | + # Send the request. |
| 1752 | + response = await rpc( |
| 1753 | + request, |
| 1754 | + retry=retry, |
| 1755 | + timeout=timeout, |
| 1756 | + metadata=metadata, |
| 1757 | + ) |
| 1758 | + |
| 1759 | + # Done; return the response. |
| 1760 | + return response |
| 1761 | + |
| 1762 | + async def get_operation( |
| 1763 | + self, |
| 1764 | + request: operations_pb2.GetOperationRequest = None, |
| 1765 | + *, |
| 1766 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1767 | + timeout: float = None, |
| 1768 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1769 | + ) -> operations_pb2.Operation: |
| 1770 | + r"""Gets the latest state of a long-running operation. |
| 1771 | +
|
| 1772 | + Args: |
| 1773 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1774 | + The request object. Request message for |
| 1775 | + `GetOperation` method. |
| 1776 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1777 | + if any, should be retried. |
| 1778 | + timeout (float): The timeout for this request. |
| 1779 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1780 | + sent along with the request as metadata. |
| 1781 | + Returns: |
| 1782 | + ~.operations_pb2.Operation: |
| 1783 | + An ``Operation`` object. |
| 1784 | + """ |
| 1785 | + # Create or coerce a protobuf request object. |
| 1786 | + # The request isn't a proto-plus wrapped type, |
| 1787 | + # so it must be constructed via keyword expansion. |
| 1788 | + if isinstance(request, dict): |
| 1789 | + request = operations_pb2.GetOperationRequest(**request) |
| 1790 | + |
| 1791 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1792 | + # and friendly error handling. |
| 1793 | + rpc = gapic_v1.method.wrap_method( |
| 1794 | + self._client._transport.get_operation, |
| 1795 | + default_timeout=None, |
| 1796 | + client_info=DEFAULT_CLIENT_INFO, |
| 1797 | + ) |
| 1798 | + |
| 1799 | + # Certain fields should be provided within the metadata header; |
| 1800 | + # add these here. |
| 1801 | + metadata = tuple(metadata) + ( |
| 1802 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1803 | + ) |
| 1804 | + |
| 1805 | + # Send the request. |
| 1806 | + response = await rpc( |
| 1807 | + request, |
| 1808 | + retry=retry, |
| 1809 | + timeout=timeout, |
| 1810 | + metadata=metadata, |
| 1811 | + ) |
| 1812 | + |
| 1813 | + # Done; return the response. |
| 1814 | + return response |
| 1815 | + |
| 1816 | + async def delete_operation( |
| 1817 | + self, |
| 1818 | + request: operations_pb2.DeleteOperationRequest = None, |
| 1819 | + *, |
| 1820 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1821 | + timeout: float = None, |
| 1822 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1823 | + ) -> None: |
| 1824 | + r"""Deletes a long-running operation. |
| 1825 | +
|
| 1826 | + This method indicates that the client is no longer interested |
| 1827 | + in the operation result. It does not cancel the operation. |
| 1828 | + If the server doesn't support this method, it returns |
| 1829 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1830 | +
|
| 1831 | + Args: |
| 1832 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 1833 | + The request object. Request message for |
| 1834 | + `DeleteOperation` method. |
| 1835 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1836 | + if any, should be retried. |
| 1837 | + timeout (float): The timeout for this request. |
| 1838 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1839 | + sent along with the request as metadata. |
| 1840 | + Returns: |
| 1841 | + None |
| 1842 | + """ |
| 1843 | + # Create or coerce a protobuf request object. |
| 1844 | + # The request isn't a proto-plus wrapped type, |
| 1845 | + # so it must be constructed via keyword expansion. |
| 1846 | + if isinstance(request, dict): |
| 1847 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 1848 | + |
| 1849 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1850 | + # and friendly error handling. |
| 1851 | + rpc = gapic_v1.method.wrap_method( |
| 1852 | + self._client._transport.delete_operation, |
| 1853 | + default_timeout=None, |
| 1854 | + client_info=DEFAULT_CLIENT_INFO, |
| 1855 | + ) |
| 1856 | + |
| 1857 | + # Certain fields should be provided within the metadata header; |
| 1858 | + # add these here. |
| 1859 | + metadata = tuple(metadata) + ( |
| 1860 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1861 | + ) |
| 1862 | + |
| 1863 | + # Send the request. |
| 1864 | + await rpc( |
| 1865 | + request, |
| 1866 | + retry=retry, |
| 1867 | + timeout=timeout, |
| 1868 | + metadata=metadata, |
| 1869 | + ) |
| 1870 | + |
| 1871 | + async def cancel_operation( |
| 1872 | + self, |
| 1873 | + request: operations_pb2.CancelOperationRequest = None, |
| 1874 | + *, |
| 1875 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1876 | + timeout: float = None, |
| 1877 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1878 | + ) -> None: |
| 1879 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 1880 | +
|
| 1881 | + The server makes a best effort to cancel the operation, but success |
| 1882 | + is not guaranteed. If the server doesn't support this method, it returns |
| 1883 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1884 | +
|
| 1885 | + Args: |
| 1886 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 1887 | + The request object. Request message for |
| 1888 | + `CancelOperation` method. |
| 1889 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1890 | + if any, should be retried. |
| 1891 | + timeout (float): The timeout for this request. |
| 1892 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1893 | + sent along with the request as metadata. |
| 1894 | + Returns: |
| 1895 | + None |
| 1896 | + """ |
| 1897 | + # Create or coerce a protobuf request object. |
| 1898 | + # The request isn't a proto-plus wrapped type, |
| 1899 | + # so it must be constructed via keyword expansion. |
| 1900 | + if isinstance(request, dict): |
| 1901 | + request = operations_pb2.CancelOperationRequest(**request) |
| 1902 | + |
| 1903 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1904 | + # and friendly error handling. |
| 1905 | + rpc = gapic_v1.method.wrap_method( |
| 1906 | + self._client._transport.cancel_operation, |
| 1907 | + default_timeout=None, |
| 1908 | + client_info=DEFAULT_CLIENT_INFO, |
| 1909 | + ) |
| 1910 | + |
| 1911 | + # Certain fields should be provided within the metadata header; |
| 1912 | + # add these here. |
| 1913 | + metadata = tuple(metadata) + ( |
| 1914 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1915 | + ) |
| 1916 | + |
| 1917 | + # Send the request. |
| 1918 | + await rpc( |
| 1919 | + request, |
| 1920 | + retry=retry, |
| 1921 | + timeout=timeout, |
| 1922 | + metadata=metadata, |
| 1923 | + ) |
| 1924 | + |
1706 | 1925 | async def __aenter__(self):
|
1707 | 1926 | return self
|
1708 | 1927 |
|
|
0 commit comments