Skip to main content

talos_api_rs/api/generated/
version.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// DO NOT EDIT
3// This file is @generated by prost-build.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct VersionRequest {
6    #[prost(bool, tag = "1")]
7    pub client: bool,
8}
9#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
10pub struct VersionResponse {
11    #[prost(string, tag = "1")]
12    pub tag: ::prost::alloc::string::String,
13    #[prost(string, tag = "2")]
14    pub sha: ::prost::alloc::string::String,
15}
16/// Generated client implementations.
17pub mod version_service_client {
18    #![allow(
19        unused_variables,
20        dead_code,
21        missing_docs,
22        clippy::wildcard_imports,
23        clippy::let_unit_value
24    )]
25    use tonic::codegen::http::Uri;
26    use tonic::codegen::*;
27    #[derive(Debug, Clone)]
28    pub struct VersionServiceClient<T> {
29        inner: tonic::client::Grpc<T>,
30    }
31    impl VersionServiceClient<tonic::transport::Channel> {
32        /// Attempt to create a new client by connecting to a given endpoint.
33        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
34        where
35            D: TryInto<tonic::transport::Endpoint>,
36            D::Error: Into<StdError>,
37        {
38            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
39            Ok(Self::new(conn))
40        }
41    }
42    impl<T> VersionServiceClient<T>
43    where
44        T: tonic::client::GrpcService<tonic::body::Body>,
45        T::Error: Into<StdError>,
46        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
47        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
48    {
49        pub fn new(inner: T) -> Self {
50            let inner = tonic::client::Grpc::new(inner);
51            Self { inner }
52        }
53        pub fn with_origin(inner: T, origin: Uri) -> Self {
54            let inner = tonic::client::Grpc::with_origin(inner, origin);
55            Self { inner }
56        }
57        pub fn with_interceptor<F>(
58            inner: T,
59            interceptor: F,
60        ) -> VersionServiceClient<InterceptedService<T, F>>
61        where
62            F: tonic::service::Interceptor,
63            T::ResponseBody: Default,
64            T: tonic::codegen::Service<
65                http::Request<tonic::body::Body>,
66                Response = http::Response<
67                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
68                >,
69            >,
70            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
71                Into<StdError> + std::marker::Send + std::marker::Sync,
72        {
73            VersionServiceClient::new(InterceptedService::new(inner, interceptor))
74        }
75        /// Compress requests with the given encoding.
76        ///
77        /// This requires the server to support it otherwise it might respond with an
78        /// error.
79        #[must_use]
80        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
81            self.inner = self.inner.send_compressed(encoding);
82            self
83        }
84        /// Enable decompressing responses.
85        #[must_use]
86        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
87            self.inner = self.inner.accept_compressed(encoding);
88            self
89        }
90        /// Limits the maximum size of a decoded message.
91        ///
92        /// Default: `4MB`
93        #[must_use]
94        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
95            self.inner = self.inner.max_decoding_message_size(limit);
96            self
97        }
98        /// Limits the maximum size of an encoded message.
99        ///
100        /// Default: `usize::MAX`
101        #[must_use]
102        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
103            self.inner = self.inner.max_encoding_message_size(limit);
104            self
105        }
106        pub async fn version(
107            &mut self,
108            request: impl tonic::IntoRequest<super::VersionRequest>,
109        ) -> std::result::Result<tonic::Response<super::VersionResponse>, tonic::Status> {
110            self.inner.ready().await.map_err(|e| {
111                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
112            })?;
113            let codec = tonic_prost::ProstCodec::default();
114            let path = http::uri::PathAndQuery::from_static("/version.VersionService/Version");
115            let mut req = request.into_request();
116            req.extensions_mut()
117                .insert(GrpcMethod::new("version.VersionService", "Version"));
118            self.inner.unary(req, path, codec).await
119        }
120    }
121}
122/// Generated server implementations.
123pub mod version_service_server {
124    #![allow(
125        unused_variables,
126        dead_code,
127        missing_docs,
128        clippy::wildcard_imports,
129        clippy::let_unit_value
130    )]
131    use tonic::codegen::*;
132    /// Generated trait containing gRPC methods that should be implemented for use with VersionServiceServer.
133    #[async_trait]
134    pub trait VersionService: std::marker::Send + std::marker::Sync + 'static {
135        async fn version(
136            &self,
137            request: tonic::Request<super::VersionRequest>,
138        ) -> std::result::Result<tonic::Response<super::VersionResponse>, tonic::Status>;
139    }
140    #[derive(Debug)]
141    pub struct VersionServiceServer<T> {
142        inner: Arc<T>,
143        accept_compression_encodings: EnabledCompressionEncodings,
144        send_compression_encodings: EnabledCompressionEncodings,
145        max_decoding_message_size: Option<usize>,
146        max_encoding_message_size: Option<usize>,
147    }
148    impl<T> VersionServiceServer<T> {
149        pub fn new(inner: T) -> Self {
150            Self::from_arc(Arc::new(inner))
151        }
152        pub fn from_arc(inner: Arc<T>) -> Self {
153            Self {
154                inner,
155                accept_compression_encodings: Default::default(),
156                send_compression_encodings: Default::default(),
157                max_decoding_message_size: None,
158                max_encoding_message_size: None,
159            }
160        }
161        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
162        where
163            F: tonic::service::Interceptor,
164        {
165            InterceptedService::new(Self::new(inner), interceptor)
166        }
167        /// Enable decompressing requests with the given encoding.
168        #[must_use]
169        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
170            self.accept_compression_encodings.enable(encoding);
171            self
172        }
173        /// Compress responses with the given encoding, if the client supports it.
174        #[must_use]
175        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
176            self.send_compression_encodings.enable(encoding);
177            self
178        }
179        /// Limits the maximum size of a decoded message.
180        ///
181        /// Default: `4MB`
182        #[must_use]
183        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
184            self.max_decoding_message_size = Some(limit);
185            self
186        }
187        /// Limits the maximum size of an encoded message.
188        ///
189        /// Default: `usize::MAX`
190        #[must_use]
191        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
192            self.max_encoding_message_size = Some(limit);
193            self
194        }
195    }
196    impl<T, B> tonic::codegen::Service<http::Request<B>> for VersionServiceServer<T>
197    where
198        T: VersionService,
199        B: Body + std::marker::Send + 'static,
200        B::Error: Into<StdError> + std::marker::Send + 'static,
201    {
202        type Response = http::Response<tonic::body::Body>;
203        type Error = std::convert::Infallible;
204        type Future = BoxFuture<Self::Response, Self::Error>;
205        fn poll_ready(
206            &mut self,
207            _cx: &mut Context<'_>,
208        ) -> Poll<std::result::Result<(), Self::Error>> {
209            Poll::Ready(Ok(()))
210        }
211        fn call(&mut self, req: http::Request<B>) -> Self::Future {
212            match req.uri().path() {
213                "/version.VersionService/Version" => {
214                    #[allow(non_camel_case_types)]
215                    struct VersionSvc<T: VersionService>(pub Arc<T>);
216                    impl<T: VersionService> tonic::server::UnaryService<super::VersionRequest> for VersionSvc<T> {
217                        type Response = super::VersionResponse;
218                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
219                        fn call(
220                            &mut self,
221                            request: tonic::Request<super::VersionRequest>,
222                        ) -> Self::Future {
223                            let inner = Arc::clone(&self.0);
224                            let fut = async move {
225                                <T as VersionService>::version(&inner, request).await
226                            };
227                            Box::pin(fut)
228                        }
229                    }
230                    let accept_compression_encodings = self.accept_compression_encodings;
231                    let send_compression_encodings = self.send_compression_encodings;
232                    let max_decoding_message_size = self.max_decoding_message_size;
233                    let max_encoding_message_size = self.max_encoding_message_size;
234                    let inner = self.inner.clone();
235                    let fut = async move {
236                        let method = VersionSvc(inner);
237                        let codec = tonic_prost::ProstCodec::default();
238                        let mut grpc = tonic::server::Grpc::new(codec)
239                            .apply_compression_config(
240                                accept_compression_encodings,
241                                send_compression_encodings,
242                            )
243                            .apply_max_message_size_config(
244                                max_decoding_message_size,
245                                max_encoding_message_size,
246                            );
247                        let res = grpc.unary(method, req).await;
248                        Ok(res)
249                    };
250                    Box::pin(fut)
251                }
252                _ => Box::pin(async move {
253                    let mut response = http::Response::new(tonic::body::Body::default());
254                    let headers = response.headers_mut();
255                    headers.insert(
256                        tonic::Status::GRPC_STATUS,
257                        (tonic::Code::Unimplemented as i32).into(),
258                    );
259                    headers.insert(
260                        http::header::CONTENT_TYPE,
261                        tonic::metadata::GRPC_CONTENT_TYPE,
262                    );
263                    Ok(response)
264                }),
265            }
266        }
267    }
268    impl<T> Clone for VersionServiceServer<T> {
269        fn clone(&self) -> Self {
270            let inner = self.inner.clone();
271            Self {
272                inner,
273                accept_compression_encodings: self.accept_compression_encodings,
274                send_compression_encodings: self.send_compression_encodings,
275                max_decoding_message_size: self.max_decoding_message_size,
276                max_encoding_message_size: self.max_encoding_message_size,
277            }
278        }
279    }
280    /// Generated gRPC service name
281    pub const SERVICE_NAME: &str = "version.VersionService";
282    impl<T> tonic::server::NamedService for VersionServiceServer<T> {
283        const NAME: &'static str = SERVICE_NAME;
284    }
285}