volcengine_sdk_protobuf/protobuf/
rds_database.rs

1#[derive(serde::Serialize, serde::Deserialize)]
2#[serde(rename_all = "PascalCase")]
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct DescribeDatabasesReq {
6    #[prost(string, optional, tag = "1")]
7    pub instance_id: ::core::option::Option<::prost::alloc::string::String>,
8    #[prost(string, optional, tag = "2")]
9    pub db_name: ::core::option::Option<::prost::alloc::string::String>,
10    #[prost(int64, optional, tag = "3")]
11    pub page_size: ::core::option::Option<i64>,
12    #[prost(int64, optional, tag = "4")]
13    pub page_number: ::core::option::Option<i64>,
14}
15#[derive(serde::Serialize, serde::Deserialize)]
16#[serde(rename_all = "PascalCase")]
17#[allow(clippy::derive_partial_eq_without_eq)]
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct DescribeDatabasesResp {
20    #[prost(message, optional, tag = "1")]
21    pub response_metadata: ::core::option::Option<ResponseMetadata>,
22    #[prost(message, optional, tag = "2")]
23    pub result: ::core::option::Option<DescribeDatabasesResultResp>,
24}
25#[derive(serde::Serialize, serde::Deserialize)]
26#[serde(rename_all = "PascalCase")]
27#[allow(clippy::derive_partial_eq_without_eq)]
28#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct DescribeDatabasesResultResp {
30    #[prost(int64, optional, tag = "1")]
31    pub total: ::core::option::Option<i64>,
32    #[prost(message, repeated, tag = "2")]
33    pub databases: ::prost::alloc::vec::Vec<DescribeDatabasesResultDatabaseResp>,
34}
35#[derive(serde::Serialize, serde::Deserialize)]
36#[serde(rename_all = "PascalCase")]
37#[allow(clippy::derive_partial_eq_without_eq)]
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct DescribeDatabasesResultDatabaseResp {
40    #[prost(string, optional, tag = "1")]
41    #[serde(rename = "DBName")]
42    pub db_name: ::core::option::Option<::prost::alloc::string::String>,
43    #[prost(string, optional, tag = "2")]
44    pub character_set_name: ::core::option::Option<::prost::alloc::string::String>,
45    #[prost(string, optional, tag = "3")]
46    #[serde(rename = "DBDesc")]
47    pub db_desc: ::core::option::Option<::prost::alloc::string::String>,
48    #[prost(string, optional, tag = "4")]
49    #[serde(rename = "DBStatus")]
50    pub db_status: ::core::option::Option<::prost::alloc::string::String>,
51    #[prost(message, repeated, tag = "5")]
52    pub database_privileges: ::prost::alloc::vec::Vec<
53        DescribeDatabasesResultDatabasePrivilegeResp,
54    >,
55}
56#[derive(serde::Serialize, serde::Deserialize)]
57#[serde(rename_all = "PascalCase")]
58#[allow(clippy::derive_partial_eq_without_eq)]
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct DescribeDatabasesResultDatabasePrivilegeResp {
61    #[prost(string, optional, tag = "1")]
62    pub account_name: ::core::option::Option<::prost::alloc::string::String>,
63    #[prost(string, optional, tag = "2")]
64    pub host: ::core::option::Option<::prost::alloc::string::String>,
65    #[prost(string, optional, tag = "3")]
66    pub account_privilege: ::core::option::Option<::prost::alloc::string::String>,
67    #[prost(string, optional, tag = "4")]
68    pub account_privilege_detail: ::core::option::Option<::prost::alloc::string::String>,
69}
70#[derive(serde::Serialize, serde::Deserialize)]
71#[serde(rename_all = "PascalCase")]
72#[allow(clippy::derive_partial_eq_without_eq)]
73#[derive(Clone, PartialEq, ::prost::Message)]
74pub struct CreateDatabaseReq {
75    #[prost(string, optional, tag = "1")]
76    pub instance_id: ::core::option::Option<::prost::alloc::string::String>,
77    #[prost(string, optional, tag = "2")]
78    pub db_name: ::core::option::Option<::prost::alloc::string::String>,
79    #[prost(string, optional, tag = "3")]
80    pub character_set_name: ::core::option::Option<::prost::alloc::string::String>,
81    #[prost(string, optional, tag = "4")]
82    pub db_desc: ::core::option::Option<::prost::alloc::string::String>,
83    #[prost(message, repeated, tag = "5")]
84    pub database_privileges: ::prost::alloc::vec::Vec<CreateDatabasePrivilegesReq>,
85}
86#[derive(serde::Serialize, serde::Deserialize)]
87#[serde(rename_all = "PascalCase")]
88#[allow(clippy::derive_partial_eq_without_eq)]
89#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct CreateDatabasePrivilegesReq {
91    #[prost(string, optional, tag = "1")]
92    pub db_name: ::core::option::Option<::prost::alloc::string::String>,
93    #[prost(string, optional, tag = "2")]
94    pub account_privilege: ::core::option::Option<::prost::alloc::string::String>,
95    #[prost(string, optional, tag = "3")]
96    pub account_privilege_detail: ::core::option::Option<::prost::alloc::string::String>,
97}
98#[derive(serde::Serialize, serde::Deserialize)]
99#[serde(rename_all = "PascalCase")]
100#[allow(clippy::derive_partial_eq_without_eq)]
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct CreateDatabaseResp {
103    #[prost(message, optional, tag = "1")]
104    pub response_metadata: ::core::option::Option<ResponseMetadata>,
105}
106#[derive(serde::Serialize, serde::Deserialize)]
107#[serde(rename_all = "PascalCase")]
108#[allow(clippy::derive_partial_eq_without_eq)]
109#[derive(Clone, PartialEq, ::prost::Message)]
110pub struct ResponseMetadata {
111    #[prost(string, tag = "1")]
112    pub request_id: ::prost::alloc::string::String,
113    #[prost(string, tag = "2")]
114    pub action: ::prost::alloc::string::String,
115    #[prost(string, tag = "3")]
116    pub version: ::prost::alloc::string::String,
117    #[prost(string, tag = "4")]
118    pub service: ::prost::alloc::string::String,
119    #[prost(string, tag = "5")]
120    pub region: ::prost::alloc::string::String,
121    #[prost(message, optional, tag = "6")]
122    pub error: ::core::option::Option<ResponseMetadataErr>,
123}
124#[derive(serde::Serialize, serde::Deserialize)]
125#[serde(rename_all = "PascalCase")]
126#[allow(clippy::derive_partial_eq_without_eq)]
127#[derive(Clone, PartialEq, ::prost::Message)]
128pub struct ResponseMetadataErr {
129    #[prost(int64, optional, tag = "1")]
130    pub code_n: ::core::option::Option<i64>,
131    #[prost(string, tag = "2")]
132    pub code: ::prost::alloc::string::String,
133    #[prost(string, tag = "3")]
134    pub message: ::prost::alloc::string::String,
135}
136/// Generated client implementations.
137pub mod rds_data_base_client {
138    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
139    use tonic::codegen::*;
140    use tonic::codegen::http::Uri;
141    #[derive(Debug, Clone)]
142    pub struct RdsDataBaseClient<T> {
143        inner: tonic::client::Grpc<T>,
144    }
145    impl RdsDataBaseClient<tonic::transport::Channel> {
146        /// Attempt to create a new client by connecting to a given endpoint.
147        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
148        where
149            D: TryInto<tonic::transport::Endpoint>,
150            D::Error: Into<StdError>,
151        {
152            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
153            Ok(Self::new(conn))
154        }
155    }
156    impl<T> RdsDataBaseClient<T>
157    where
158        T: tonic::client::GrpcService<tonic::body::BoxBody>,
159        T::Error: Into<StdError>,
160        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
161        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
162    {
163        pub fn new(inner: T) -> Self {
164            let inner = tonic::client::Grpc::new(inner);
165            Self { inner }
166        }
167        pub fn with_origin(inner: T, origin: Uri) -> Self {
168            let inner = tonic::client::Grpc::with_origin(inner, origin);
169            Self { inner }
170        }
171        pub fn with_interceptor<F>(
172            inner: T,
173            interceptor: F,
174        ) -> RdsDataBaseClient<InterceptedService<T, F>>
175        where
176            F: tonic::service::Interceptor,
177            T::ResponseBody: Default,
178            T: tonic::codegen::Service<
179                http::Request<tonic::body::BoxBody>,
180                Response = http::Response<
181                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
182                >,
183            >,
184            <T as tonic::codegen::Service<
185                http::Request<tonic::body::BoxBody>,
186            >>::Error: Into<StdError> + Send + Sync,
187        {
188            RdsDataBaseClient::new(InterceptedService::new(inner, interceptor))
189        }
190        /// Compress requests with the given encoding.
191        ///
192        /// This requires the server to support it otherwise it might respond with an
193        /// error.
194        #[must_use]
195        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
196            self.inner = self.inner.send_compressed(encoding);
197            self
198        }
199        /// Enable decompressing responses.
200        #[must_use]
201        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
202            self.inner = self.inner.accept_compressed(encoding);
203            self
204        }
205        /// Limits the maximum size of a decoded message.
206        ///
207        /// Default: `4MB`
208        #[must_use]
209        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
210            self.inner = self.inner.max_decoding_message_size(limit);
211            self
212        }
213        /// Limits the maximum size of an encoded message.
214        ///
215        /// Default: `usize::MAX`
216        #[must_use]
217        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
218            self.inner = self.inner.max_encoding_message_size(limit);
219            self
220        }
221        /// CreateDatabase
222        pub async fn create_database(
223            &mut self,
224            request: impl tonic::IntoRequest<super::CreateDatabaseReq>,
225        ) -> std::result::Result<
226            tonic::Response<super::CreateDatabaseResp>,
227            tonic::Status,
228        > {
229            self.inner
230                .ready()
231                .await
232                .map_err(|e| {
233                    tonic::Status::new(
234                        tonic::Code::Unknown,
235                        format!("Service was not ready: {}", e.into()),
236                    )
237                })?;
238            let codec = tonic::codec::ProstCodec::default();
239            let path = http::uri::PathAndQuery::from_static(
240                "/rds_database.RdsDataBase/CreateDatabase",
241            );
242            let mut req = request.into_request();
243            req.extensions_mut()
244                .insert(GrpcMethod::new("rds_database.RdsDataBase", "CreateDatabase"));
245            self.inner.unary(req, path, codec).await
246        }
247        /// DescribeDatabases
248        pub async fn describe_databases(
249            &mut self,
250            request: impl tonic::IntoRequest<super::DescribeDatabasesReq>,
251        ) -> std::result::Result<
252            tonic::Response<super::DescribeDatabasesResp>,
253            tonic::Status,
254        > {
255            self.inner
256                .ready()
257                .await
258                .map_err(|e| {
259                    tonic::Status::new(
260                        tonic::Code::Unknown,
261                        format!("Service was not ready: {}", e.into()),
262                    )
263                })?;
264            let codec = tonic::codec::ProstCodec::default();
265            let path = http::uri::PathAndQuery::from_static(
266                "/rds_database.RdsDataBase/DescribeDatabases",
267            );
268            let mut req = request.into_request();
269            req.extensions_mut()
270                .insert(
271                    GrpcMethod::new("rds_database.RdsDataBase", "DescribeDatabases"),
272                );
273            self.inner.unary(req, path, codec).await
274        }
275    }
276}
277/// Generated server implementations.
278pub mod rds_data_base_server {
279    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
280    use tonic::codegen::*;
281    /// Generated trait containing gRPC methods that should be implemented for use with RdsDataBaseServer.
282    #[async_trait]
283    pub trait RdsDataBase: Send + Sync + 'static {
284        /// CreateDatabase
285        async fn create_database(
286            &self,
287            request: tonic::Request<super::CreateDatabaseReq>,
288        ) -> std::result::Result<
289            tonic::Response<super::CreateDatabaseResp>,
290            tonic::Status,
291        >;
292        /// DescribeDatabases
293        async fn describe_databases(
294            &self,
295            request: tonic::Request<super::DescribeDatabasesReq>,
296        ) -> std::result::Result<
297            tonic::Response<super::DescribeDatabasesResp>,
298            tonic::Status,
299        >;
300    }
301    #[derive(Debug)]
302    pub struct RdsDataBaseServer<T: RdsDataBase> {
303        inner: _Inner<T>,
304        accept_compression_encodings: EnabledCompressionEncodings,
305        send_compression_encodings: EnabledCompressionEncodings,
306        max_decoding_message_size: Option<usize>,
307        max_encoding_message_size: Option<usize>,
308    }
309    struct _Inner<T>(Arc<T>);
310    impl<T: RdsDataBase> RdsDataBaseServer<T> {
311        pub fn new(inner: T) -> Self {
312            Self::from_arc(Arc::new(inner))
313        }
314        pub fn from_arc(inner: Arc<T>) -> Self {
315            let inner = _Inner(inner);
316            Self {
317                inner,
318                accept_compression_encodings: Default::default(),
319                send_compression_encodings: Default::default(),
320                max_decoding_message_size: None,
321                max_encoding_message_size: None,
322            }
323        }
324        pub fn with_interceptor<F>(
325            inner: T,
326            interceptor: F,
327        ) -> InterceptedService<Self, F>
328        where
329            F: tonic::service::Interceptor,
330        {
331            InterceptedService::new(Self::new(inner), interceptor)
332        }
333        /// Enable decompressing requests with the given encoding.
334        #[must_use]
335        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
336            self.accept_compression_encodings.enable(encoding);
337            self
338        }
339        /// Compress responses with the given encoding, if the client supports it.
340        #[must_use]
341        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
342            self.send_compression_encodings.enable(encoding);
343            self
344        }
345        /// Limits the maximum size of a decoded message.
346        ///
347        /// Default: `4MB`
348        #[must_use]
349        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
350            self.max_decoding_message_size = Some(limit);
351            self
352        }
353        /// Limits the maximum size of an encoded message.
354        ///
355        /// Default: `usize::MAX`
356        #[must_use]
357        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
358            self.max_encoding_message_size = Some(limit);
359            self
360        }
361    }
362    impl<T, B> tonic::codegen::Service<http::Request<B>> for RdsDataBaseServer<T>
363    where
364        T: RdsDataBase,
365        B: Body + Send + 'static,
366        B::Error: Into<StdError> + Send + 'static,
367    {
368        type Response = http::Response<tonic::body::BoxBody>;
369        type Error = std::convert::Infallible;
370        type Future = BoxFuture<Self::Response, Self::Error>;
371        fn poll_ready(
372            &mut self,
373            _cx: &mut Context<'_>,
374        ) -> Poll<std::result::Result<(), Self::Error>> {
375            Poll::Ready(Ok(()))
376        }
377        fn call(&mut self, req: http::Request<B>) -> Self::Future {
378            let inner = self.inner.clone();
379            match req.uri().path() {
380                "/rds_database.RdsDataBase/CreateDatabase" => {
381                    #[allow(non_camel_case_types)]
382                    struct CreateDatabaseSvc<T: RdsDataBase>(pub Arc<T>);
383                    impl<
384                        T: RdsDataBase,
385                    > tonic::server::UnaryService<super::CreateDatabaseReq>
386                    for CreateDatabaseSvc<T> {
387                        type Response = super::CreateDatabaseResp;
388                        type Future = BoxFuture<
389                            tonic::Response<Self::Response>,
390                            tonic::Status,
391                        >;
392                        fn call(
393                            &mut self,
394                            request: tonic::Request<super::CreateDatabaseReq>,
395                        ) -> Self::Future {
396                            let inner = Arc::clone(&self.0);
397                            let fut = async move {
398                                (*inner).create_database(request).await
399                            };
400                            Box::pin(fut)
401                        }
402                    }
403                    let accept_compression_encodings = self.accept_compression_encodings;
404                    let send_compression_encodings = self.send_compression_encodings;
405                    let max_decoding_message_size = self.max_decoding_message_size;
406                    let max_encoding_message_size = self.max_encoding_message_size;
407                    let inner = self.inner.clone();
408                    let fut = async move {
409                        let inner = inner.0;
410                        let method = CreateDatabaseSvc(inner);
411                        let codec = tonic::codec::ProstCodec::default();
412                        let mut grpc = tonic::server::Grpc::new(codec)
413                            .apply_compression_config(
414                                accept_compression_encodings,
415                                send_compression_encodings,
416                            )
417                            .apply_max_message_size_config(
418                                max_decoding_message_size,
419                                max_encoding_message_size,
420                            );
421                        let res = grpc.unary(method, req).await;
422                        Ok(res)
423                    };
424                    Box::pin(fut)
425                }
426                "/rds_database.RdsDataBase/DescribeDatabases" => {
427                    #[allow(non_camel_case_types)]
428                    struct DescribeDatabasesSvc<T: RdsDataBase>(pub Arc<T>);
429                    impl<
430                        T: RdsDataBase,
431                    > tonic::server::UnaryService<super::DescribeDatabasesReq>
432                    for DescribeDatabasesSvc<T> {
433                        type Response = super::DescribeDatabasesResp;
434                        type Future = BoxFuture<
435                            tonic::Response<Self::Response>,
436                            tonic::Status,
437                        >;
438                        fn call(
439                            &mut self,
440                            request: tonic::Request<super::DescribeDatabasesReq>,
441                        ) -> Self::Future {
442                            let inner = Arc::clone(&self.0);
443                            let fut = async move {
444                                (*inner).describe_databases(request).await
445                            };
446                            Box::pin(fut)
447                        }
448                    }
449                    let accept_compression_encodings = self.accept_compression_encodings;
450                    let send_compression_encodings = self.send_compression_encodings;
451                    let max_decoding_message_size = self.max_decoding_message_size;
452                    let max_encoding_message_size = self.max_encoding_message_size;
453                    let inner = self.inner.clone();
454                    let fut = async move {
455                        let inner = inner.0;
456                        let method = DescribeDatabasesSvc(inner);
457                        let codec = tonic::codec::ProstCodec::default();
458                        let mut grpc = tonic::server::Grpc::new(codec)
459                            .apply_compression_config(
460                                accept_compression_encodings,
461                                send_compression_encodings,
462                            )
463                            .apply_max_message_size_config(
464                                max_decoding_message_size,
465                                max_encoding_message_size,
466                            );
467                        let res = grpc.unary(method, req).await;
468                        Ok(res)
469                    };
470                    Box::pin(fut)
471                }
472                _ => {
473                    Box::pin(async move {
474                        Ok(
475                            http::Response::builder()
476                                .status(200)
477                                .header("grpc-status", "12")
478                                .header("content-type", "application/grpc")
479                                .body(empty_body())
480                                .unwrap(),
481                        )
482                    })
483                }
484            }
485        }
486    }
487    impl<T: RdsDataBase> Clone for RdsDataBaseServer<T> {
488        fn clone(&self) -> Self {
489            let inner = self.inner.clone();
490            Self {
491                inner,
492                accept_compression_encodings: self.accept_compression_encodings,
493                send_compression_encodings: self.send_compression_encodings,
494                max_decoding_message_size: self.max_decoding_message_size,
495                max_encoding_message_size: self.max_encoding_message_size,
496            }
497        }
498    }
499    impl<T: RdsDataBase> Clone for _Inner<T> {
500        fn clone(&self) -> Self {
501            Self(Arc::clone(&self.0))
502        }
503    }
504    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
505        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
506            write!(f, "{:?}", self.0)
507        }
508    }
509    impl<T: RdsDataBase> tonic::server::NamedService for RdsDataBaseServer<T> {
510        const NAME: &'static str = "rds_database.RdsDataBase";
511    }
512}