talos_rust_client/generated/
securityapi.rs

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