risingwave_pb/
cloud_service.rs

1// This file is @generated by prost-build.
2#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct RwCloudValidateSourceRequest {
5    #[prost(enumeration = "SourceType", tag = "1")]
6    pub source_type: i32,
7    #[prost(map = "string, string", tag = "2")]
8    pub source_config: ::std::collections::HashMap<
9        ::prost::alloc::string::String,
10        ::prost::alloc::string::String,
11    >,
12}
13#[derive(prost_helpers::AnyPB)]
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct RwCloudValidateSourceResponse {
16    #[prost(bool, tag = "1")]
17    pub ok: bool,
18    /// On validation failure, we return the error.
19    #[prost(message, optional, tag = "2")]
20    pub error: ::core::option::Option<rw_cloud_validate_source_response::Error>,
21}
22/// Nested message and enum types in `RwCloudValidateSourceResponse`.
23pub mod rw_cloud_validate_source_response {
24    #[derive(prost_helpers::AnyPB)]
25    #[derive(Clone, PartialEq, ::prost::Message)]
26    pub struct Error {
27        #[prost(enumeration = "ErrorType", tag = "1")]
28        pub error_type: i32,
29        #[prost(string, tag = "2")]
30        pub error_message: ::prost::alloc::string::String,
31    }
32    #[derive(prost_helpers::AnyPB)]
33    #[derive(
34        Clone,
35        Copy,
36        Debug,
37        PartialEq,
38        Eq,
39        Hash,
40        PartialOrd,
41        Ord,
42        ::prost::Enumeration
43    )]
44    #[repr(i32)]
45    pub enum ErrorType {
46        Unspecified = 0,
47        PrivatelinkConnectionNotFound = 1,
48        PrivatelinkUnavailable = 2,
49        PrivatelinkResolveErr = 3,
50        KafkaInvalidProperties = 4,
51        KafkaTopicNotFound = 5,
52        KafkaBrokerUnreachable = 6,
53        KafkaOther = 7,
54        AwsClientNotConfigured = 8,
55    }
56    impl ErrorType {
57        /// String value of the enum field names used in the ProtoBuf definition.
58        ///
59        /// The values are not transformed in any way and thus are considered stable
60        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
61        pub fn as_str_name(&self) -> &'static str {
62            match self {
63                Self::Unspecified => "UNSPECIFIED",
64                Self::PrivatelinkConnectionNotFound => "PRIVATELINK_CONNECTION_NOT_FOUND",
65                Self::PrivatelinkUnavailable => "PRIVATELINK_UNAVAILABLE",
66                Self::PrivatelinkResolveErr => "PRIVATELINK_RESOLVE_ERR",
67                Self::KafkaInvalidProperties => "KAFKA_INVALID_PROPERTIES",
68                Self::KafkaTopicNotFound => "KAFKA_TOPIC_NOT_FOUND",
69                Self::KafkaBrokerUnreachable => "KAFKA_BROKER_UNREACHABLE",
70                Self::KafkaOther => "KAFKA_OTHER",
71                Self::AwsClientNotConfigured => "AWS_CLIENT_NOT_CONFIGURED",
72            }
73        }
74        /// Creates an enum from field names used in the ProtoBuf definition.
75        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
76            match value {
77                "UNSPECIFIED" => Some(Self::Unspecified),
78                "PRIVATELINK_CONNECTION_NOT_FOUND" => {
79                    Some(Self::PrivatelinkConnectionNotFound)
80                }
81                "PRIVATELINK_UNAVAILABLE" => Some(Self::PrivatelinkUnavailable),
82                "PRIVATELINK_RESOLVE_ERR" => Some(Self::PrivatelinkResolveErr),
83                "KAFKA_INVALID_PROPERTIES" => Some(Self::KafkaInvalidProperties),
84                "KAFKA_TOPIC_NOT_FOUND" => Some(Self::KafkaTopicNotFound),
85                "KAFKA_BROKER_UNREACHABLE" => Some(Self::KafkaBrokerUnreachable),
86                "KAFKA_OTHER" => Some(Self::KafkaOther),
87                "AWS_CLIENT_NOT_CONFIGURED" => Some(Self::AwsClientNotConfigured),
88                _ => None,
89            }
90        }
91    }
92}
93#[derive(prost_helpers::AnyPB)]
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
95#[repr(i32)]
96pub enum SourceType {
97    Unspecified = 0,
98    Kafka = 1,
99}
100impl SourceType {
101    /// String value of the enum field names used in the ProtoBuf definition.
102    ///
103    /// The values are not transformed in any way and thus are considered stable
104    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
105    pub fn as_str_name(&self) -> &'static str {
106        match self {
107            Self::Unspecified => "UNSPECIFIED",
108            Self::Kafka => "KAFKA",
109        }
110    }
111    /// Creates an enum from field names used in the ProtoBuf definition.
112    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
113        match value {
114            "UNSPECIFIED" => Some(Self::Unspecified),
115            "KAFKA" => Some(Self::Kafka),
116            _ => None,
117        }
118    }
119}
120/// Generated client implementations.
121pub mod cloud_service_client {
122    #![allow(
123        unused_variables,
124        dead_code,
125        missing_docs,
126        clippy::wildcard_imports,
127        clippy::let_unit_value,
128    )]
129    use tonic::codegen::*;
130    use tonic::codegen::http::Uri;
131    #[derive(Debug, Clone)]
132    pub struct CloudServiceClient<T> {
133        inner: tonic::client::Grpc<T>,
134    }
135    impl CloudServiceClient<tonic::transport::Channel> {
136        /// Attempt to create a new client by connecting to a given endpoint.
137        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
138        where
139            D: TryInto<tonic::transport::Endpoint>,
140            D::Error: Into<StdError>,
141        {
142            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
143            Ok(Self::new(conn))
144        }
145    }
146    impl<T> CloudServiceClient<T>
147    where
148        T: tonic::client::GrpcService<tonic::body::BoxBody>,
149        T::Error: Into<StdError>,
150        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
151        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
152    {
153        pub fn new(inner: T) -> Self {
154            let inner = tonic::client::Grpc::new(inner);
155            Self { inner }
156        }
157        pub fn with_origin(inner: T, origin: Uri) -> Self {
158            let inner = tonic::client::Grpc::with_origin(inner, origin);
159            Self { inner }
160        }
161        pub fn with_interceptor<F>(
162            inner: T,
163            interceptor: F,
164        ) -> CloudServiceClient<InterceptedService<T, F>>
165        where
166            F: tonic::service::Interceptor,
167            T::ResponseBody: Default,
168            T: tonic::codegen::Service<
169                http::Request<tonic::body::BoxBody>,
170                Response = http::Response<
171                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
172                >,
173            >,
174            <T as tonic::codegen::Service<
175                http::Request<tonic::body::BoxBody>,
176            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
177        {
178            CloudServiceClient::new(InterceptedService::new(inner, interceptor))
179        }
180        /// Compress requests with the given encoding.
181        ///
182        /// This requires the server to support it otherwise it might respond with an
183        /// error.
184        #[must_use]
185        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
186            self.inner = self.inner.send_compressed(encoding);
187            self
188        }
189        /// Enable decompressing responses.
190        #[must_use]
191        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
192            self.inner = self.inner.accept_compressed(encoding);
193            self
194        }
195        /// Limits the maximum size of a decoded message.
196        ///
197        /// Default: `4MB`
198        #[must_use]
199        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
200            self.inner = self.inner.max_decoding_message_size(limit);
201            self
202        }
203        /// Limits the maximum size of an encoded message.
204        ///
205        /// Default: `usize::MAX`
206        #[must_use]
207        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
208            self.inner = self.inner.max_encoding_message_size(limit);
209            self
210        }
211        pub async fn rw_cloud_validate_source(
212            &mut self,
213            request: impl tonic::IntoRequest<super::RwCloudValidateSourceRequest>,
214        ) -> std::result::Result<
215            tonic::Response<super::RwCloudValidateSourceResponse>,
216            tonic::Status,
217        > {
218            self.inner
219                .ready()
220                .await
221                .map_err(|e| {
222                    tonic::Status::unknown(
223                        format!("Service was not ready: {}", e.into()),
224                    )
225                })?;
226            let codec = tonic::codec::ProstCodec::default();
227            let path = http::uri::PathAndQuery::from_static(
228                "/cloud_service.CloudService/RwCloudValidateSource",
229            );
230            let mut req = request.into_request();
231            req.extensions_mut()
232                .insert(
233                    GrpcMethod::new(
234                        "cloud_service.CloudService",
235                        "RwCloudValidateSource",
236                    ),
237                );
238            self.inner.unary(req, path, codec).await
239        }
240    }
241}
242/// Generated server implementations.
243pub mod cloud_service_server {
244    #![allow(
245        unused_variables,
246        dead_code,
247        missing_docs,
248        clippy::wildcard_imports,
249        clippy::let_unit_value,
250    )]
251    use tonic::codegen::*;
252    /// Generated trait containing gRPC methods that should be implemented for use with CloudServiceServer.
253    #[async_trait]
254    pub trait CloudService: std::marker::Send + std::marker::Sync + 'static {
255        async fn rw_cloud_validate_source(
256            &self,
257            request: tonic::Request<super::RwCloudValidateSourceRequest>,
258        ) -> std::result::Result<
259            tonic::Response<super::RwCloudValidateSourceResponse>,
260            tonic::Status,
261        >;
262    }
263    #[derive(Debug)]
264    pub struct CloudServiceServer<T> {
265        inner: Arc<T>,
266        accept_compression_encodings: EnabledCompressionEncodings,
267        send_compression_encodings: EnabledCompressionEncodings,
268        max_decoding_message_size: Option<usize>,
269        max_encoding_message_size: Option<usize>,
270    }
271    impl<T> CloudServiceServer<T> {
272        pub fn new(inner: T) -> Self {
273            Self::from_arc(Arc::new(inner))
274        }
275        pub fn from_arc(inner: Arc<T>) -> Self {
276            Self {
277                inner,
278                accept_compression_encodings: Default::default(),
279                send_compression_encodings: Default::default(),
280                max_decoding_message_size: None,
281                max_encoding_message_size: None,
282            }
283        }
284        pub fn with_interceptor<F>(
285            inner: T,
286            interceptor: F,
287        ) -> InterceptedService<Self, F>
288        where
289            F: tonic::service::Interceptor,
290        {
291            InterceptedService::new(Self::new(inner), interceptor)
292        }
293        /// Enable decompressing requests with the given encoding.
294        #[must_use]
295        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
296            self.accept_compression_encodings.enable(encoding);
297            self
298        }
299        /// Compress responses with the given encoding, if the client supports it.
300        #[must_use]
301        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
302            self.send_compression_encodings.enable(encoding);
303            self
304        }
305        /// Limits the maximum size of a decoded message.
306        ///
307        /// Default: `4MB`
308        #[must_use]
309        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
310            self.max_decoding_message_size = Some(limit);
311            self
312        }
313        /// Limits the maximum size of an encoded message.
314        ///
315        /// Default: `usize::MAX`
316        #[must_use]
317        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
318            self.max_encoding_message_size = Some(limit);
319            self
320        }
321    }
322    impl<T, B> tonic::codegen::Service<http::Request<B>> for CloudServiceServer<T>
323    where
324        T: CloudService,
325        B: Body + std::marker::Send + 'static,
326        B::Error: Into<StdError> + std::marker::Send + 'static,
327    {
328        type Response = http::Response<tonic::body::BoxBody>;
329        type Error = std::convert::Infallible;
330        type Future = BoxFuture<Self::Response, Self::Error>;
331        fn poll_ready(
332            &mut self,
333            _cx: &mut Context<'_>,
334        ) -> Poll<std::result::Result<(), Self::Error>> {
335            Poll::Ready(Ok(()))
336        }
337        fn call(&mut self, req: http::Request<B>) -> Self::Future {
338            match req.uri().path() {
339                "/cloud_service.CloudService/RwCloudValidateSource" => {
340                    #[allow(non_camel_case_types)]
341                    struct RwCloudValidateSourceSvc<T: CloudService>(pub Arc<T>);
342                    impl<
343                        T: CloudService,
344                    > tonic::server::UnaryService<super::RwCloudValidateSourceRequest>
345                    for RwCloudValidateSourceSvc<T> {
346                        type Response = super::RwCloudValidateSourceResponse;
347                        type Future = BoxFuture<
348                            tonic::Response<Self::Response>,
349                            tonic::Status,
350                        >;
351                        fn call(
352                            &mut self,
353                            request: tonic::Request<super::RwCloudValidateSourceRequest>,
354                        ) -> Self::Future {
355                            let inner = Arc::clone(&self.0);
356                            let fut = async move {
357                                <T as CloudService>::rw_cloud_validate_source(
358                                        &inner,
359                                        request,
360                                    )
361                                    .await
362                            };
363                            Box::pin(fut)
364                        }
365                    }
366                    let accept_compression_encodings = self.accept_compression_encodings;
367                    let send_compression_encodings = self.send_compression_encodings;
368                    let max_decoding_message_size = self.max_decoding_message_size;
369                    let max_encoding_message_size = self.max_encoding_message_size;
370                    let inner = self.inner.clone();
371                    let fut = async move {
372                        let method = RwCloudValidateSourceSvc(inner);
373                        let codec = tonic::codec::ProstCodec::default();
374                        let mut grpc = tonic::server::Grpc::new(codec)
375                            .apply_compression_config(
376                                accept_compression_encodings,
377                                send_compression_encodings,
378                            )
379                            .apply_max_message_size_config(
380                                max_decoding_message_size,
381                                max_encoding_message_size,
382                            );
383                        let res = grpc.unary(method, req).await;
384                        Ok(res)
385                    };
386                    Box::pin(fut)
387                }
388                _ => {
389                    Box::pin(async move {
390                        let mut response = http::Response::new(empty_body());
391                        let headers = response.headers_mut();
392                        headers
393                            .insert(
394                                tonic::Status::GRPC_STATUS,
395                                (tonic::Code::Unimplemented as i32).into(),
396                            );
397                        headers
398                            .insert(
399                                http::header::CONTENT_TYPE,
400                                tonic::metadata::GRPC_CONTENT_TYPE,
401                            );
402                        Ok(response)
403                    })
404                }
405            }
406        }
407    }
408    impl<T> Clone for CloudServiceServer<T> {
409        fn clone(&self) -> Self {
410            let inner = self.inner.clone();
411            Self {
412                inner,
413                accept_compression_encodings: self.accept_compression_encodings,
414                send_compression_encodings: self.send_compression_encodings,
415                max_decoding_message_size: self.max_decoding_message_size,
416                max_encoding_message_size: self.max_encoding_message_size,
417            }
418        }
419    }
420    /// Generated gRPC service name
421    pub const SERVICE_NAME: &str = "cloud_service.CloudService";
422    impl<T> tonic::server::NamedService for CloudServiceServer<T> {
423        const NAME: &'static str = SERVICE_NAME;
424    }
425}