|
40 | 40 | from google.cloud.spanner_admin_database_v1.types import spanner_database_admin
|
41 | 41 | from google.iam.v1 import iam_policy_pb2 # type: ignore
|
42 | 42 | from google.iam.v1 import policy_pb2 # type: ignore
|
| 43 | +from google.longrunning import operations_pb2 |
43 | 44 | from google.longrunning import operations_pb2 # type: ignore
|
44 | 45 | from google.protobuf import empty_pb2 # type: ignore
|
45 | 46 | from google.protobuf import field_mask_pb2 # type: ignore
|
@@ -692,9 +693,6 @@ async def sample_update_database_ddl():
|
692 | 693 |
|
693 | 694 | }
|
694 | 695 |
|
695 |
| - The JSON representation for Empty is empty JSON |
696 |
| - object {}. |
697 |
| -
|
698 | 696 | """
|
699 | 697 | # Create or coerce a protobuf request object.
|
700 | 698 | # Quick check: If we got a request object, we should *not* have
|
@@ -2718,6 +2716,223 @@ async def sample_list_database_roles():
|
2718 | 2716 | # Done; return the response.
|
2719 | 2717 | return response
|
2720 | 2718 |
|
| 2719 | + async def list_operations( |
| 2720 | + self, |
| 2721 | + request: operations_pb2.ListOperationsRequest = None, |
| 2722 | + *, |
| 2723 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2724 | + timeout: float = None, |
| 2725 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2726 | + ) -> operations_pb2.ListOperationsResponse: |
| 2727 | + r"""Lists operations that match the specified filter in the request. |
| 2728 | +
|
| 2729 | + Args: |
| 2730 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 2731 | + The request object. Request message for |
| 2732 | + `ListOperations` method. |
| 2733 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2734 | + if any, should be retried. |
| 2735 | + timeout (float): The timeout for this request. |
| 2736 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2737 | + sent along with the request as metadata. |
| 2738 | + Returns: |
| 2739 | + ~.operations_pb2.ListOperationsResponse: |
| 2740 | + Response message for ``ListOperations`` method. |
| 2741 | + """ |
| 2742 | + # Create or coerce a protobuf request object. |
| 2743 | + # The request isn't a proto-plus wrapped type, |
| 2744 | + # so it must be constructed via keyword expansion. |
| 2745 | + if isinstance(request, dict): |
| 2746 | + request = operations_pb2.ListOperationsRequest(**request) |
| 2747 | + |
| 2748 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2749 | + # and friendly error handling. |
| 2750 | + rpc = gapic_v1.method.wrap_method( |
| 2751 | + self._client._transport.list_operations, |
| 2752 | + default_timeout=None, |
| 2753 | + client_info=DEFAULT_CLIENT_INFO, |
| 2754 | + ) |
| 2755 | + |
| 2756 | + # Certain fields should be provided within the metadata header; |
| 2757 | + # add these here. |
| 2758 | + metadata = tuple(metadata) + ( |
| 2759 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2760 | + ) |
| 2761 | + |
| 2762 | + # Send the request. |
| 2763 | + response = await rpc( |
| 2764 | + request, |
| 2765 | + retry=retry, |
| 2766 | + timeout=timeout, |
| 2767 | + metadata=metadata, |
| 2768 | + ) |
| 2769 | + |
| 2770 | + # Done; return the response. |
| 2771 | + return response |
| 2772 | + |
| 2773 | + async def get_operation( |
| 2774 | + self, |
| 2775 | + request: operations_pb2.GetOperationRequest = None, |
| 2776 | + *, |
| 2777 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2778 | + timeout: float = None, |
| 2779 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2780 | + ) -> operations_pb2.Operation: |
| 2781 | + r"""Gets the latest state of a long-running operation. |
| 2782 | +
|
| 2783 | + Args: |
| 2784 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 2785 | + The request object. Request message for |
| 2786 | + `GetOperation` method. |
| 2787 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2788 | + if any, should be retried. |
| 2789 | + timeout (float): The timeout for this request. |
| 2790 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2791 | + sent along with the request as metadata. |
| 2792 | + Returns: |
| 2793 | + ~.operations_pb2.Operation: |
| 2794 | + An ``Operation`` object. |
| 2795 | + """ |
| 2796 | + # Create or coerce a protobuf request object. |
| 2797 | + # The request isn't a proto-plus wrapped type, |
| 2798 | + # so it must be constructed via keyword expansion. |
| 2799 | + if isinstance(request, dict): |
| 2800 | + request = operations_pb2.GetOperationRequest(**request) |
| 2801 | + |
| 2802 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2803 | + # and friendly error handling. |
| 2804 | + rpc = gapic_v1.method.wrap_method( |
| 2805 | + self._client._transport.get_operation, |
| 2806 | + default_timeout=None, |
| 2807 | + client_info=DEFAULT_CLIENT_INFO, |
| 2808 | + ) |
| 2809 | + |
| 2810 | + # Certain fields should be provided within the metadata header; |
| 2811 | + # add these here. |
| 2812 | + metadata = tuple(metadata) + ( |
| 2813 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2814 | + ) |
| 2815 | + |
| 2816 | + # Send the request. |
| 2817 | + response = await rpc( |
| 2818 | + request, |
| 2819 | + retry=retry, |
| 2820 | + timeout=timeout, |
| 2821 | + metadata=metadata, |
| 2822 | + ) |
| 2823 | + |
| 2824 | + # Done; return the response. |
| 2825 | + return response |
| 2826 | + |
| 2827 | + async def delete_operation( |
| 2828 | + self, |
| 2829 | + request: operations_pb2.DeleteOperationRequest = None, |
| 2830 | + *, |
| 2831 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2832 | + timeout: float = None, |
| 2833 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2834 | + ) -> None: |
| 2835 | + r"""Deletes a long-running operation. |
| 2836 | +
|
| 2837 | + This method indicates that the client is no longer interested |
| 2838 | + in the operation result. It does not cancel the operation. |
| 2839 | + If the server doesn't support this method, it returns |
| 2840 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 2841 | +
|
| 2842 | + Args: |
| 2843 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 2844 | + The request object. Request message for |
| 2845 | + `DeleteOperation` method. |
| 2846 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2847 | + if any, should be retried. |
| 2848 | + timeout (float): The timeout for this request. |
| 2849 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2850 | + sent along with the request as metadata. |
| 2851 | + Returns: |
| 2852 | + None |
| 2853 | + """ |
| 2854 | + # Create or coerce a protobuf request object. |
| 2855 | + # The request isn't a proto-plus wrapped type, |
| 2856 | + # so it must be constructed via keyword expansion. |
| 2857 | + if isinstance(request, dict): |
| 2858 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 2859 | + |
| 2860 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2861 | + # and friendly error handling. |
| 2862 | + rpc = gapic_v1.method.wrap_method( |
| 2863 | + self._client._transport.delete_operation, |
| 2864 | + default_timeout=None, |
| 2865 | + client_info=DEFAULT_CLIENT_INFO, |
| 2866 | + ) |
| 2867 | + |
| 2868 | + # Certain fields should be provided within the metadata header; |
| 2869 | + # add these here. |
| 2870 | + metadata = tuple(metadata) + ( |
| 2871 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2872 | + ) |
| 2873 | + |
| 2874 | + # Send the request. |
| 2875 | + await rpc( |
| 2876 | + request, |
| 2877 | + retry=retry, |
| 2878 | + timeout=timeout, |
| 2879 | + metadata=metadata, |
| 2880 | + ) |
| 2881 | + |
| 2882 | + async def cancel_operation( |
| 2883 | + self, |
| 2884 | + request: operations_pb2.CancelOperationRequest = None, |
| 2885 | + *, |
| 2886 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2887 | + timeout: float = None, |
| 2888 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2889 | + ) -> None: |
| 2890 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 2891 | +
|
| 2892 | + The server makes a best effort to cancel the operation, but success |
| 2893 | + is not guaranteed. If the server doesn't support this method, it returns |
| 2894 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 2895 | +
|
| 2896 | + Args: |
| 2897 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 2898 | + The request object. Request message for |
| 2899 | + `CancelOperation` method. |
| 2900 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2901 | + if any, should be retried. |
| 2902 | + timeout (float): The timeout for this request. |
| 2903 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2904 | + sent along with the request as metadata. |
| 2905 | + Returns: |
| 2906 | + None |
| 2907 | + """ |
| 2908 | + # Create or coerce a protobuf request object. |
| 2909 | + # The request isn't a proto-plus wrapped type, |
| 2910 | + # so it must be constructed via keyword expansion. |
| 2911 | + if isinstance(request, dict): |
| 2912 | + request = operations_pb2.CancelOperationRequest(**request) |
| 2913 | + |
| 2914 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2915 | + # and friendly error handling. |
| 2916 | + rpc = gapic_v1.method.wrap_method( |
| 2917 | + self._client._transport.cancel_operation, |
| 2918 | + default_timeout=None, |
| 2919 | + client_info=DEFAULT_CLIENT_INFO, |
| 2920 | + ) |
| 2921 | + |
| 2922 | + # Certain fields should be provided within the metadata header; |
| 2923 | + # add these here. |
| 2924 | + metadata = tuple(metadata) + ( |
| 2925 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2926 | + ) |
| 2927 | + |
| 2928 | + # Send the request. |
| 2929 | + await rpc( |
| 2930 | + request, |
| 2931 | + retry=retry, |
| 2932 | + timeout=timeout, |
| 2933 | + metadata=metadata, |
| 2934 | + ) |
| 2935 | + |
2721 | 2936 | async def __aenter__(self):
|
2722 | 2937 | return self
|
2723 | 2938 |
|
|
0 commit comments