ydb_grpc_bindings/generated/
ydb.operation.v1.rs

1/// Generated client implementations.
2pub mod operation_service_client {
3    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4    use tonic::codegen::*;
5    use tonic::codegen::http::Uri;
6    #[derive(Debug, Clone)]
7    pub struct OperationServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl OperationServiceClient<tonic::transport::Channel> {
11        /// Attempt to create a new client by connecting to a given endpoint.
12        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
13        where
14            D: TryInto<tonic::transport::Endpoint>,
15            D::Error: Into<StdError>,
16        {
17            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
18            Ok(Self::new(conn))
19        }
20    }
21    impl<T> OperationServiceClient<T>
22    where
23        T: tonic::client::GrpcService<tonic::body::BoxBody>,
24        T::Error: Into<StdError>,
25        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
26        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
27    {
28        pub fn new(inner: T) -> Self {
29            let inner = tonic::client::Grpc::new(inner);
30            Self { inner }
31        }
32        pub fn with_origin(inner: T, origin: Uri) -> Self {
33            let inner = tonic::client::Grpc::with_origin(inner, origin);
34            Self { inner }
35        }
36        pub fn with_interceptor<F>(
37            inner: T,
38            interceptor: F,
39        ) -> OperationServiceClient<InterceptedService<T, F>>
40        where
41            F: tonic::service::Interceptor,
42            T::ResponseBody: Default,
43            T: tonic::codegen::Service<
44                http::Request<tonic::body::BoxBody>,
45                Response = http::Response<
46                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
47                >,
48            >,
49            <T as tonic::codegen::Service<
50                http::Request<tonic::body::BoxBody>,
51            >>::Error: Into<StdError> + Send + Sync,
52        {
53            OperationServiceClient::new(InterceptedService::new(inner, interceptor))
54        }
55        /// Compress requests with the given encoding.
56        ///
57        /// This requires the server to support it otherwise it might respond with an
58        /// error.
59        #[must_use]
60        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
61            self.inner = self.inner.send_compressed(encoding);
62            self
63        }
64        /// Enable decompressing responses.
65        #[must_use]
66        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
67            self.inner = self.inner.accept_compressed(encoding);
68            self
69        }
70        /// Limits the maximum size of a decoded message.
71        ///
72        /// Default: `4MB`
73        #[must_use]
74        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
75            self.inner = self.inner.max_decoding_message_size(limit);
76            self
77        }
78        /// Limits the maximum size of an encoded message.
79        ///
80        /// Default: `usize::MAX`
81        #[must_use]
82        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
83            self.inner = self.inner.max_encoding_message_size(limit);
84            self
85        }
86        /// Check status for a given operation.
87        pub async fn get_operation(
88            &mut self,
89            request: impl tonic::IntoRequest<
90                super::super::super::operations::GetOperationRequest,
91            >,
92        ) -> std::result::Result<
93            tonic::Response<super::super::super::operations::GetOperationResponse>,
94            tonic::Status,
95        > {
96            self.inner
97                .ready()
98                .await
99                .map_err(|e| {
100                    tonic::Status::new(
101                        tonic::Code::Unknown,
102                        format!("Service was not ready: {}", e.into()),
103                    )
104                })?;
105            let codec = tonic::codec::ProstCodec::default();
106            let path = http::uri::PathAndQuery::from_static(
107                "/Ydb.Operation.V1.OperationService/GetOperation",
108            );
109            let mut req = request.into_request();
110            req.extensions_mut()
111                .insert(
112                    GrpcMethod::new("Ydb.Operation.V1.OperationService", "GetOperation"),
113                );
114            self.inner.unary(req, path, codec).await
115        }
116        /// Starts cancellation of a long-running operation,
117        /// Clients can use GetOperation to check whether the cancellation succeeded
118        /// or whether the operation completed despite cancellation.
119        pub async fn cancel_operation(
120            &mut self,
121            request: impl tonic::IntoRequest<
122                super::super::super::operations::CancelOperationRequest,
123            >,
124        ) -> std::result::Result<
125            tonic::Response<super::super::super::operations::CancelOperationResponse>,
126            tonic::Status,
127        > {
128            self.inner
129                .ready()
130                .await
131                .map_err(|e| {
132                    tonic::Status::new(
133                        tonic::Code::Unknown,
134                        format!("Service was not ready: {}", e.into()),
135                    )
136                })?;
137            let codec = tonic::codec::ProstCodec::default();
138            let path = http::uri::PathAndQuery::from_static(
139                "/Ydb.Operation.V1.OperationService/CancelOperation",
140            );
141            let mut req = request.into_request();
142            req.extensions_mut()
143                .insert(
144                    GrpcMethod::new(
145                        "Ydb.Operation.V1.OperationService",
146                        "CancelOperation",
147                    ),
148                );
149            self.inner.unary(req, path, codec).await
150        }
151        /// Forgets long-running operation. It does not cancel the operation and returns
152        /// an error if operation was not completed.
153        pub async fn forget_operation(
154            &mut self,
155            request: impl tonic::IntoRequest<
156                super::super::super::operations::ForgetOperationRequest,
157            >,
158        ) -> std::result::Result<
159            tonic::Response<super::super::super::operations::ForgetOperationResponse>,
160            tonic::Status,
161        > {
162            self.inner
163                .ready()
164                .await
165                .map_err(|e| {
166                    tonic::Status::new(
167                        tonic::Code::Unknown,
168                        format!("Service was not ready: {}", e.into()),
169                    )
170                })?;
171            let codec = tonic::codec::ProstCodec::default();
172            let path = http::uri::PathAndQuery::from_static(
173                "/Ydb.Operation.V1.OperationService/ForgetOperation",
174            );
175            let mut req = request.into_request();
176            req.extensions_mut()
177                .insert(
178                    GrpcMethod::new(
179                        "Ydb.Operation.V1.OperationService",
180                        "ForgetOperation",
181                    ),
182                );
183            self.inner.unary(req, path, codec).await
184        }
185        /// Lists operations that match the specified filter in the request.
186        pub async fn list_operations(
187            &mut self,
188            request: impl tonic::IntoRequest<
189                super::super::super::operations::ListOperationsRequest,
190            >,
191        ) -> std::result::Result<
192            tonic::Response<super::super::super::operations::ListOperationsResponse>,
193            tonic::Status,
194        > {
195            self.inner
196                .ready()
197                .await
198                .map_err(|e| {
199                    tonic::Status::new(
200                        tonic::Code::Unknown,
201                        format!("Service was not ready: {}", e.into()),
202                    )
203                })?;
204            let codec = tonic::codec::ProstCodec::default();
205            let path = http::uri::PathAndQuery::from_static(
206                "/Ydb.Operation.V1.OperationService/ListOperations",
207            );
208            let mut req = request.into_request();
209            req.extensions_mut()
210                .insert(
211                    GrpcMethod::new(
212                        "Ydb.Operation.V1.OperationService",
213                        "ListOperations",
214                    ),
215                );
216            self.inner.unary(req, path, codec).await
217        }
218    }
219}