|
44 | 44 |
|
45 | 45 | from google.api_core import operation # type: ignore |
46 | 46 | from google.api_core import operation_async # type: ignore |
| 47 | +from google.cloud.location import locations_pb2 # type: ignore |
| 48 | +from google.longrunning import operations_pb2 |
47 | 49 | from google.protobuf import empty_pb2 # type: ignore |
48 | 50 | from google.protobuf import field_mask_pb2 # type: ignore |
49 | 51 | from google.protobuf import timestamp_pb2 # type: ignore |
@@ -1685,6 +1687,331 @@ async def sample_reschedule_maintenance(): |
1685 | 1687 | # Done; return the response. |
1686 | 1688 | return response |
1687 | 1689 |
|
| 1690 | + async def list_operations( |
| 1691 | + self, |
| 1692 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 1693 | + *, |
| 1694 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1695 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1696 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1697 | + ) -> operations_pb2.ListOperationsResponse: |
| 1698 | + r"""Lists operations that match the specified filter in the request. |
| 1699 | +
|
| 1700 | + Args: |
| 1701 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 1702 | + The request object. Request message for |
| 1703 | + `ListOperations` method. |
| 1704 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1705 | + if any, should be retried. |
| 1706 | + timeout (float): The timeout for this request. |
| 1707 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1708 | + sent along with the request as metadata. |
| 1709 | + Returns: |
| 1710 | + ~.operations_pb2.ListOperationsResponse: |
| 1711 | + Response message for ``ListOperations`` method. |
| 1712 | + """ |
| 1713 | + # Create or coerce a protobuf request object. |
| 1714 | + # The request isn't a proto-plus wrapped type, |
| 1715 | + # so it must be constructed via keyword expansion. |
| 1716 | + if isinstance(request, dict): |
| 1717 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1718 | + |
| 1719 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1720 | + # and friendly error handling. |
| 1721 | + rpc = gapic_v1.method.wrap_method( |
| 1722 | + self._client._transport.list_operations, |
| 1723 | + default_timeout=None, |
| 1724 | + client_info=DEFAULT_CLIENT_INFO, |
| 1725 | + ) |
| 1726 | + |
| 1727 | + # Certain fields should be provided within the metadata header; |
| 1728 | + # add these here. |
| 1729 | + metadata = tuple(metadata) + ( |
| 1730 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1731 | + ) |
| 1732 | + |
| 1733 | + # Send the request. |
| 1734 | + response = await rpc( |
| 1735 | + request, |
| 1736 | + retry=retry, |
| 1737 | + timeout=timeout, |
| 1738 | + metadata=metadata, |
| 1739 | + ) |
| 1740 | + |
| 1741 | + # Done; return the response. |
| 1742 | + return response |
| 1743 | + |
| 1744 | + async def get_operation( |
| 1745 | + self, |
| 1746 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 1747 | + *, |
| 1748 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1749 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1750 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1751 | + ) -> operations_pb2.Operation: |
| 1752 | + r"""Gets the latest state of a long-running operation. |
| 1753 | +
|
| 1754 | + Args: |
| 1755 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1756 | + The request object. Request message for |
| 1757 | + `GetOperation` method. |
| 1758 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1759 | + if any, should be retried. |
| 1760 | + timeout (float): The timeout for this request. |
| 1761 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1762 | + sent along with the request as metadata. |
| 1763 | + Returns: |
| 1764 | + ~.operations_pb2.Operation: |
| 1765 | + An ``Operation`` object. |
| 1766 | + """ |
| 1767 | + # Create or coerce a protobuf request object. |
| 1768 | + # The request isn't a proto-plus wrapped type, |
| 1769 | + # so it must be constructed via keyword expansion. |
| 1770 | + if isinstance(request, dict): |
| 1771 | + request = operations_pb2.GetOperationRequest(**request) |
| 1772 | + |
| 1773 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1774 | + # and friendly error handling. |
| 1775 | + rpc = gapic_v1.method.wrap_method( |
| 1776 | + self._client._transport.get_operation, |
| 1777 | + default_timeout=None, |
| 1778 | + client_info=DEFAULT_CLIENT_INFO, |
| 1779 | + ) |
| 1780 | + |
| 1781 | + # Certain fields should be provided within the metadata header; |
| 1782 | + # add these here. |
| 1783 | + metadata = tuple(metadata) + ( |
| 1784 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1785 | + ) |
| 1786 | + |
| 1787 | + # Send the request. |
| 1788 | + response = await rpc( |
| 1789 | + request, |
| 1790 | + retry=retry, |
| 1791 | + timeout=timeout, |
| 1792 | + metadata=metadata, |
| 1793 | + ) |
| 1794 | + |
| 1795 | + # Done; return the response. |
| 1796 | + return response |
| 1797 | + |
| 1798 | + async def delete_operation( |
| 1799 | + self, |
| 1800 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 1801 | + *, |
| 1802 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1803 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1804 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1805 | + ) -> None: |
| 1806 | + r"""Deletes a long-running operation. |
| 1807 | +
|
| 1808 | + This method indicates that the client is no longer interested |
| 1809 | + in the operation result. It does not cancel the operation. |
| 1810 | + If the server doesn't support this method, it returns |
| 1811 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1812 | +
|
| 1813 | + Args: |
| 1814 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 1815 | + The request object. Request message for |
| 1816 | + `DeleteOperation` method. |
| 1817 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1818 | + if any, should be retried. |
| 1819 | + timeout (float): The timeout for this request. |
| 1820 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1821 | + sent along with the request as metadata. |
| 1822 | + Returns: |
| 1823 | + None |
| 1824 | + """ |
| 1825 | + # Create or coerce a protobuf request object. |
| 1826 | + # The request isn't a proto-plus wrapped type, |
| 1827 | + # so it must be constructed via keyword expansion. |
| 1828 | + if isinstance(request, dict): |
| 1829 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 1830 | + |
| 1831 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1832 | + # and friendly error handling. |
| 1833 | + rpc = gapic_v1.method.wrap_method( |
| 1834 | + self._client._transport.delete_operation, |
| 1835 | + default_timeout=None, |
| 1836 | + client_info=DEFAULT_CLIENT_INFO, |
| 1837 | + ) |
| 1838 | + |
| 1839 | + # Certain fields should be provided within the metadata header; |
| 1840 | + # add these here. |
| 1841 | + metadata = tuple(metadata) + ( |
| 1842 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1843 | + ) |
| 1844 | + |
| 1845 | + # Send the request. |
| 1846 | + await rpc( |
| 1847 | + request, |
| 1848 | + retry=retry, |
| 1849 | + timeout=timeout, |
| 1850 | + metadata=metadata, |
| 1851 | + ) |
| 1852 | + |
| 1853 | + async def cancel_operation( |
| 1854 | + self, |
| 1855 | + request: Optional[operations_pb2.CancelOperationRequest] = None, |
| 1856 | + *, |
| 1857 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1858 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1859 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1860 | + ) -> None: |
| 1861 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 1862 | +
|
| 1863 | + The server makes a best effort to cancel the operation, but success |
| 1864 | + is not guaranteed. If the server doesn't support this method, it returns |
| 1865 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1866 | +
|
| 1867 | + Args: |
| 1868 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 1869 | + The request object. Request message for |
| 1870 | + `CancelOperation` method. |
| 1871 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1872 | + if any, should be retried. |
| 1873 | + timeout (float): The timeout for this request. |
| 1874 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1875 | + sent along with the request as metadata. |
| 1876 | + Returns: |
| 1877 | + None |
| 1878 | + """ |
| 1879 | + # Create or coerce a protobuf request object. |
| 1880 | + # The request isn't a proto-plus wrapped type, |
| 1881 | + # so it must be constructed via keyword expansion. |
| 1882 | + if isinstance(request, dict): |
| 1883 | + request = operations_pb2.CancelOperationRequest(**request) |
| 1884 | + |
| 1885 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1886 | + # and friendly error handling. |
| 1887 | + rpc = gapic_v1.method.wrap_method( |
| 1888 | + self._client._transport.cancel_operation, |
| 1889 | + default_timeout=None, |
| 1890 | + client_info=DEFAULT_CLIENT_INFO, |
| 1891 | + ) |
| 1892 | + |
| 1893 | + # Certain fields should be provided within the metadata header; |
| 1894 | + # add these here. |
| 1895 | + metadata = tuple(metadata) + ( |
| 1896 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1897 | + ) |
| 1898 | + |
| 1899 | + # Send the request. |
| 1900 | + await rpc( |
| 1901 | + request, |
| 1902 | + retry=retry, |
| 1903 | + timeout=timeout, |
| 1904 | + metadata=metadata, |
| 1905 | + ) |
| 1906 | + |
| 1907 | + async def get_location( |
| 1908 | + self, |
| 1909 | + request: Optional[locations_pb2.GetLocationRequest] = None, |
| 1910 | + *, |
| 1911 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1912 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1913 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1914 | + ) -> locations_pb2.Location: |
| 1915 | + r"""Gets information about a location. |
| 1916 | +
|
| 1917 | + Args: |
| 1918 | + request (:class:`~.location_pb2.GetLocationRequest`): |
| 1919 | + The request object. Request message for |
| 1920 | + `GetLocation` method. |
| 1921 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1922 | + if any, should be retried. |
| 1923 | + timeout (float): The timeout for this request. |
| 1924 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1925 | + sent along with the request as metadata. |
| 1926 | + Returns: |
| 1927 | + ~.location_pb2.Location: |
| 1928 | + Location object. |
| 1929 | + """ |
| 1930 | + # Create or coerce a protobuf request object. |
| 1931 | + # The request isn't a proto-plus wrapped type, |
| 1932 | + # so it must be constructed via keyword expansion. |
| 1933 | + if isinstance(request, dict): |
| 1934 | + request = locations_pb2.GetLocationRequest(**request) |
| 1935 | + |
| 1936 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1937 | + # and friendly error handling. |
| 1938 | + rpc = gapic_v1.method.wrap_method( |
| 1939 | + self._client._transport.get_location, |
| 1940 | + default_timeout=None, |
| 1941 | + client_info=DEFAULT_CLIENT_INFO, |
| 1942 | + ) |
| 1943 | + |
| 1944 | + # Certain fields should be provided within the metadata header; |
| 1945 | + # add these here. |
| 1946 | + metadata = tuple(metadata) + ( |
| 1947 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1948 | + ) |
| 1949 | + |
| 1950 | + # Send the request. |
| 1951 | + response = await rpc( |
| 1952 | + request, |
| 1953 | + retry=retry, |
| 1954 | + timeout=timeout, |
| 1955 | + metadata=metadata, |
| 1956 | + ) |
| 1957 | + |
| 1958 | + # Done; return the response. |
| 1959 | + return response |
| 1960 | + |
| 1961 | + async def list_locations( |
| 1962 | + self, |
| 1963 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 1964 | + *, |
| 1965 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1966 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1967 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1968 | + ) -> locations_pb2.ListLocationsResponse: |
| 1969 | + r"""Lists information about the supported locations for this service. |
| 1970 | +
|
| 1971 | + Args: |
| 1972 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 1973 | + The request object. Request message for |
| 1974 | + `ListLocations` method. |
| 1975 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1976 | + if any, should be retried. |
| 1977 | + timeout (float): The timeout for this request. |
| 1978 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1979 | + sent along with the request as metadata. |
| 1980 | + Returns: |
| 1981 | + ~.location_pb2.ListLocationsResponse: |
| 1982 | + Response message for ``ListLocations`` method. |
| 1983 | + """ |
| 1984 | + # Create or coerce a protobuf request object. |
| 1985 | + # The request isn't a proto-plus wrapped type, |
| 1986 | + # so it must be constructed via keyword expansion. |
| 1987 | + if isinstance(request, dict): |
| 1988 | + request = locations_pb2.ListLocationsRequest(**request) |
| 1989 | + |
| 1990 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1991 | + # and friendly error handling. |
| 1992 | + rpc = gapic_v1.method.wrap_method( |
| 1993 | + self._client._transport.list_locations, |
| 1994 | + default_timeout=None, |
| 1995 | + client_info=DEFAULT_CLIENT_INFO, |
| 1996 | + ) |
| 1997 | + |
| 1998 | + # Certain fields should be provided within the metadata header; |
| 1999 | + # add these here. |
| 2000 | + metadata = tuple(metadata) + ( |
| 2001 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2002 | + ) |
| 2003 | + |
| 2004 | + # Send the request. |
| 2005 | + response = await rpc( |
| 2006 | + request, |
| 2007 | + retry=retry, |
| 2008 | + timeout=timeout, |
| 2009 | + metadata=metadata, |
| 2010 | + ) |
| 2011 | + |
| 2012 | + # Done; return the response. |
| 2013 | + return response |
| 2014 | + |
1688 | 2015 | async def __aenter__(self): |
1689 | 2016 | return self |
1690 | 2017 |
|
|
0 commit comments