talos_rust_client/generated/
time.rs

1// This file is @generated by prost-build.
2/// The response message containing the ntp server
3#[derive(serde::Serialize, serde::Deserialize)]
4#[serde(rename_all = "camelCase")]
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct TimeRequest {
7    #[prost(string, tag = "1")]
8    pub server: ::prost::alloc::string::String,
9}
10#[derive(serde::Serialize, serde::Deserialize)]
11#[serde(rename_all = "camelCase")]
12#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct Time {
14    #[prost(message, optional, tag = "1")]
15    pub metadata: ::core::option::Option<super::common::Metadata>,
16    #[prost(string, tag = "2")]
17    pub server: ::prost::alloc::string::String,
18    #[prost(message, optional, tag = "3")]
19    pub localtime: ::core::option::Option<super::google::protobuf::Timestamp>,
20    #[prost(message, optional, tag = "4")]
21    pub remotetime: ::core::option::Option<super::google::protobuf::Timestamp>,
22}
23/// The response message containing the ntp server, time, and offset
24#[derive(serde::Serialize, serde::Deserialize)]
25#[serde(rename_all = "camelCase")]
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct TimeResponse {
28    #[prost(message, repeated, tag = "1")]
29    pub messages: ::prost::alloc::vec::Vec<Time>,
30}
31/// Generated client implementations.
32pub mod time_service_client {
33    #![allow(
34        unused_variables,
35        dead_code,
36        missing_docs,
37        clippy::wildcard_imports,
38        clippy::let_unit_value,
39    )]
40    use tonic::codegen::*;
41    use tonic::codegen::http::Uri;
42    /// The time service definition.
43    #[derive(Debug, Clone)]
44    pub struct TimeServiceClient<T> {
45        inner: tonic::client::Grpc<T>,
46    }
47    impl TimeServiceClient<tonic::transport::Channel> {
48        /// Attempt to create a new client by connecting to a given endpoint.
49        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
50        where
51            D: TryInto<tonic::transport::Endpoint>,
52            D::Error: Into<StdError>,
53        {
54            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
55            Ok(Self::new(conn))
56        }
57    }
58    impl<T> TimeServiceClient<T>
59    where
60        T: tonic::client::GrpcService<tonic::body::BoxBody>,
61        T::Error: Into<StdError>,
62        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
63        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
64    {
65        pub fn new(inner: T) -> Self {
66            let inner = tonic::client::Grpc::new(inner);
67            Self { inner }
68        }
69        pub fn with_origin(inner: T, origin: Uri) -> Self {
70            let inner = tonic::client::Grpc::with_origin(inner, origin);
71            Self { inner }
72        }
73        pub fn with_interceptor<F>(
74            inner: T,
75            interceptor: F,
76        ) -> TimeServiceClient<InterceptedService<T, F>>
77        where
78            F: tonic::service::Interceptor,
79            T::ResponseBody: Default,
80            T: tonic::codegen::Service<
81                http::Request<tonic::body::BoxBody>,
82                Response = http::Response<
83                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
84                >,
85            >,
86            <T as tonic::codegen::Service<
87                http::Request<tonic::body::BoxBody>,
88            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
89        {
90            TimeServiceClient::new(InterceptedService::new(inner, interceptor))
91        }
92        /// Compress requests with the given encoding.
93        ///
94        /// This requires the server to support it otherwise it might respond with an
95        /// error.
96        #[must_use]
97        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
98            self.inner = self.inner.send_compressed(encoding);
99            self
100        }
101        /// Enable decompressing responses.
102        #[must_use]
103        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
104            self.inner = self.inner.accept_compressed(encoding);
105            self
106        }
107        /// Limits the maximum size of a decoded message.
108        ///
109        /// Default: `4MB`
110        #[must_use]
111        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
112            self.inner = self.inner.max_decoding_message_size(limit);
113            self
114        }
115        /// Limits the maximum size of an encoded message.
116        ///
117        /// Default: `usize::MAX`
118        #[must_use]
119        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
120            self.inner = self.inner.max_encoding_message_size(limit);
121            self
122        }
123        pub async fn time(
124            &mut self,
125            request: impl tonic::IntoRequest<super::super::google::protobuf::Empty>,
126        ) -> std::result::Result<tonic::Response<super::TimeResponse>, tonic::Status> {
127            self.inner
128                .ready()
129                .await
130                .map_err(|e| {
131                    tonic::Status::unknown(
132                        format!("Service was not ready: {}", e.into()),
133                    )
134                })?;
135            let codec = tonic::codec::ProstCodec::default();
136            let path = http::uri::PathAndQuery::from_static("/time.TimeService/Time");
137            let mut req = request.into_request();
138            req.extensions_mut().insert(GrpcMethod::new("time.TimeService", "Time"));
139            self.inner.unary(req, path, codec).await
140        }
141        pub async fn time_check(
142            &mut self,
143            request: impl tonic::IntoRequest<super::TimeRequest>,
144        ) -> std::result::Result<tonic::Response<super::TimeResponse>, tonic::Status> {
145            self.inner
146                .ready()
147                .await
148                .map_err(|e| {
149                    tonic::Status::unknown(
150                        format!("Service was not ready: {}", e.into()),
151                    )
152                })?;
153            let codec = tonic::codec::ProstCodec::default();
154            let path = http::uri::PathAndQuery::from_static(
155                "/time.TimeService/TimeCheck",
156            );
157            let mut req = request.into_request();
158            req.extensions_mut()
159                .insert(GrpcMethod::new("time.TimeService", "TimeCheck"));
160            self.inner.unary(req, path, codec).await
161        }
162    }
163}