cx_api/generated/
com.coralogixapis.notification_center.routers.v1.rs

1// This file is @generated by prost-build.
2/// The global router contains a pre-configured list of routing rules
3/// and can be specified as a part of the notification request.
4#[derive(serde::Serialize, serde::Deserialize)]
5#[serde(rename_all = "snake_case")]
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct GlobalRouter {
8    /// A unique identifier - automatically generated unless provided by the user
9    #[prost(string, optional, tag = "1")]
10    pub id: ::core::option::Option<::prost::alloc::string::String>,
11    #[prost(string, tag = "4")]
12    pub name: ::prost::alloc::string::String,
13    #[prost(string, tag = "5")]
14    pub description: ::prost::alloc::string::String,
15    /// The routing rules to be applied in order to determine the destinations of the notification, the first rule that matches will be used
16    #[prost(message, repeated, tag = "6")]
17    pub rules: ::prost::alloc::vec::Vec<super::super::routing::RoutingRule>,
18    /// The fallback destinations to be used if no rule matches
19    #[prost(message, repeated, tag = "7")]
20    pub fallback: ::prost::alloc::vec::Vec<super::super::routing::RoutingTarget>,
21    /// System-generated timestamp for when the router was last updated
22    #[prost(message, optional, tag = "8")]
23    pub create_time: ::core::option::Option<::prost_wkt_types::Timestamp>,
24    /// System-generated timestamp for when the router was last updated
25    #[prost(message, optional, tag = "9")]
26    pub update_time: ::core::option::Option<::prost_wkt_types::Timestamp>,
27    #[prost(map = "string, string", tag = "10")]
28    pub entity_labels: ::std::collections::HashMap<
29        ::prost::alloc::string::String,
30        ::prost::alloc::string::String,
31    >,
32    #[deprecated]
33    #[prost(enumeration = "super::super::EntityType", optional, tag = "11")]
34    pub entity_type: ::core::option::Option<i32>,
35    #[prost(map = "string, string", tag = "13")]
36    pub entity_label_matcher: ::std::collections::HashMap<
37        ::prost::alloc::string::String,
38        ::prost::alloc::string::String,
39    >,
40}
41#[derive(serde::Serialize, serde::Deserialize)]
42#[serde(rename_all = "snake_case")]
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct CreateGlobalRouterRequest {
45    #[prost(message, optional, tag = "1")]
46    pub router: ::core::option::Option<GlobalRouter>,
47}
48#[derive(serde::Serialize, serde::Deserialize)]
49#[serde(rename_all = "snake_case")]
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct CreateGlobalRouterResponse {
52    #[prost(message, optional, tag = "1")]
53    pub router: ::core::option::Option<GlobalRouter>,
54}
55#[derive(serde::Serialize, serde::Deserialize)]
56#[serde(rename_all = "snake_case")]
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct ReplaceGlobalRouterRequest {
59    #[prost(message, optional, tag = "1")]
60    pub router: ::core::option::Option<GlobalRouter>,
61}
62#[derive(serde::Serialize, serde::Deserialize)]
63#[serde(rename_all = "snake_case")]
64#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct ReplaceGlobalRouterResponse {
66    #[prost(message, optional, tag = "1")]
67    pub router: ::core::option::Option<GlobalRouter>,
68}
69#[derive(serde::Serialize, serde::Deserialize)]
70#[serde(rename_all = "snake_case")]
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct CreateOrReplaceGlobalRouterRequest {
73    #[prost(message, optional, tag = "1")]
74    pub router: ::core::option::Option<GlobalRouter>,
75}
76#[derive(serde::Serialize, serde::Deserialize)]
77#[serde(rename_all = "snake_case")]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct CreateOrReplaceGlobalRouterResponse {
80    #[prost(message, optional, tag = "1")]
81    pub router: ::core::option::Option<GlobalRouter>,
82}
83#[derive(serde::Serialize, serde::Deserialize)]
84#[serde(rename_all = "snake_case")]
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct DeleteGlobalRouterRequest {
87    #[prost(string, tag = "3")]
88    pub id: ::prost::alloc::string::String,
89}
90#[derive(serde::Serialize, serde::Deserialize)]
91#[serde(rename_all = "snake_case")]
92#[derive(Clone, Copy, PartialEq, ::prost::Message)]
93pub struct DeleteGlobalRouterResponse {}
94#[derive(serde::Serialize, serde::Deserialize)]
95#[serde(rename_all = "snake_case")]
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct GetGlobalRouterRequest {
98    #[prost(string, tag = "3")]
99    pub id: ::prost::alloc::string::String,
100}
101#[derive(serde::Serialize, serde::Deserialize)]
102#[serde(rename_all = "snake_case")]
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct GetGlobalRouterResponse {
105    #[prost(message, optional, tag = "1")]
106    pub router: ::core::option::Option<GlobalRouter>,
107}
108#[derive(serde::Serialize, serde::Deserialize)]
109#[serde(rename_all = "snake_case")]
110#[derive(Clone, PartialEq, ::prost::Message)]
111pub struct ListGlobalRoutersRequest {
112    #[deprecated]
113    #[prost(enumeration = "super::super::EntityType", optional, tag = "2")]
114    pub entity_type: ::core::option::Option<i32>,
115    /// If empty, all routers are returned.
116    #[prost(map = "string, message", tag = "3")]
117    pub source_entity_labels: ::std::collections::HashMap<
118        ::prost::alloc::string::String,
119        super::super::EntityLabelValues,
120    >,
121}
122#[derive(serde::Serialize, serde::Deserialize)]
123#[serde(rename_all = "snake_case")]
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct ListGlobalRoutersResponse {
126    #[prost(message, repeated, tag = "1")]
127    pub routers: ::prost::alloc::vec::Vec<GlobalRouter>,
128}
129#[derive(serde::Serialize, serde::Deserialize)]
130#[serde(rename_all = "snake_case")]
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct BatchGetGlobalRoutersRequest {
133    #[prost(string, repeated, tag = "3")]
134    pub global_router_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
135}
136#[derive(serde::Serialize, serde::Deserialize)]
137#[serde(rename_all = "snake_case")]
138#[derive(Clone, PartialEq, ::prost::Message)]
139pub struct BatchGetGlobalRoutersResponse {
140    #[prost(map = "string, message", tag = "1")]
141    pub routers: ::std::collections::HashMap<
142        ::prost::alloc::string::String,
143        GlobalRouter,
144    >,
145    #[prost(string, repeated, tag = "2")]
146    pub not_found_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
147}
148/// Generated client implementations.
149pub mod global_routers_service_client {
150    #![allow(
151        unused_variables,
152        dead_code,
153        missing_docs,
154        clippy::wildcard_imports,
155        clippy::let_unit_value,
156    )]
157    use tonic::codegen::*;
158    use tonic::codegen::http::Uri;
159    /// Public API that allows managing global routers
160    #[derive(Debug, Clone)]
161    pub struct GlobalRoutersServiceClient<T> {
162        inner: tonic::client::Grpc<T>,
163    }
164    impl GlobalRoutersServiceClient<tonic::transport::Channel> {
165        /// Attempt to create a new client by connecting to a given endpoint.
166        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
167        where
168            D: TryInto<tonic::transport::Endpoint>,
169            D::Error: Into<StdError>,
170        {
171            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
172            Ok(Self::new(conn))
173        }
174    }
175    impl<T> GlobalRoutersServiceClient<T>
176    where
177        T: tonic::client::GrpcService<tonic::body::BoxBody>,
178        T::Error: Into<StdError>,
179        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
180        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
181    {
182        pub fn new(inner: T) -> Self {
183            let inner = tonic::client::Grpc::new(inner);
184            Self { inner }
185        }
186        pub fn with_origin(inner: T, origin: Uri) -> Self {
187            let inner = tonic::client::Grpc::with_origin(inner, origin);
188            Self { inner }
189        }
190        pub fn with_interceptor<F>(
191            inner: T,
192            interceptor: F,
193        ) -> GlobalRoutersServiceClient<InterceptedService<T, F>>
194        where
195            F: tonic::service::Interceptor,
196            T::ResponseBody: Default,
197            T: tonic::codegen::Service<
198                http::Request<tonic::body::BoxBody>,
199                Response = http::Response<
200                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
201                >,
202            >,
203            <T as tonic::codegen::Service<
204                http::Request<tonic::body::BoxBody>,
205            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
206        {
207            GlobalRoutersServiceClient::new(InterceptedService::new(inner, interceptor))
208        }
209        /// Compress requests with the given encoding.
210        ///
211        /// This requires the server to support it otherwise it might respond with an
212        /// error.
213        #[must_use]
214        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
215            self.inner = self.inner.send_compressed(encoding);
216            self
217        }
218        /// Enable decompressing responses.
219        #[must_use]
220        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
221            self.inner = self.inner.accept_compressed(encoding);
222            self
223        }
224        /// Limits the maximum size of a decoded message.
225        ///
226        /// Default: `4MB`
227        #[must_use]
228        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
229            self.inner = self.inner.max_decoding_message_size(limit);
230            self
231        }
232        /// Limits the maximum size of an encoded message.
233        ///
234        /// Default: `usize::MAX`
235        #[must_use]
236        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
237            self.inner = self.inner.max_encoding_message_size(limit);
238            self
239        }
240        pub async fn create_global_router(
241            &mut self,
242            request: impl tonic::IntoRequest<super::CreateGlobalRouterRequest>,
243        ) -> std::result::Result<
244            tonic::Response<super::CreateGlobalRouterResponse>,
245            tonic::Status,
246        > {
247            self.inner
248                .ready()
249                .await
250                .map_err(|e| {
251                    tonic::Status::unknown(
252                        format!("Service was not ready: {}", e.into()),
253                    )
254                })?;
255            let codec = tonic::codec::ProstCodec::default();
256            let path = http::uri::PathAndQuery::from_static(
257                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/CreateGlobalRouter",
258            );
259            let mut req = request.into_request();
260            req.extensions_mut()
261                .insert(
262                    GrpcMethod::new(
263                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
264                        "CreateGlobalRouter",
265                    ),
266                );
267            self.inner.unary(req, path, codec).await
268        }
269        pub async fn replace_global_router(
270            &mut self,
271            request: impl tonic::IntoRequest<super::ReplaceGlobalRouterRequest>,
272        ) -> std::result::Result<
273            tonic::Response<super::ReplaceGlobalRouterResponse>,
274            tonic::Status,
275        > {
276            self.inner
277                .ready()
278                .await
279                .map_err(|e| {
280                    tonic::Status::unknown(
281                        format!("Service was not ready: {}", e.into()),
282                    )
283                })?;
284            let codec = tonic::codec::ProstCodec::default();
285            let path = http::uri::PathAndQuery::from_static(
286                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/ReplaceGlobalRouter",
287            );
288            let mut req = request.into_request();
289            req.extensions_mut()
290                .insert(
291                    GrpcMethod::new(
292                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
293                        "ReplaceGlobalRouter",
294                    ),
295                );
296            self.inner.unary(req, path, codec).await
297        }
298        pub async fn create_or_replace_global_router(
299            &mut self,
300            request: impl tonic::IntoRequest<super::CreateOrReplaceGlobalRouterRequest>,
301        ) -> std::result::Result<
302            tonic::Response<super::CreateOrReplaceGlobalRouterResponse>,
303            tonic::Status,
304        > {
305            self.inner
306                .ready()
307                .await
308                .map_err(|e| {
309                    tonic::Status::unknown(
310                        format!("Service was not ready: {}", e.into()),
311                    )
312                })?;
313            let codec = tonic::codec::ProstCodec::default();
314            let path = http::uri::PathAndQuery::from_static(
315                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/CreateOrReplaceGlobalRouter",
316            );
317            let mut req = request.into_request();
318            req.extensions_mut()
319                .insert(
320                    GrpcMethod::new(
321                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
322                        "CreateOrReplaceGlobalRouter",
323                    ),
324                );
325            self.inner.unary(req, path, codec).await
326        }
327        pub async fn delete_global_router(
328            &mut self,
329            request: impl tonic::IntoRequest<super::DeleteGlobalRouterRequest>,
330        ) -> std::result::Result<
331            tonic::Response<super::DeleteGlobalRouterResponse>,
332            tonic::Status,
333        > {
334            self.inner
335                .ready()
336                .await
337                .map_err(|e| {
338                    tonic::Status::unknown(
339                        format!("Service was not ready: {}", e.into()),
340                    )
341                })?;
342            let codec = tonic::codec::ProstCodec::default();
343            let path = http::uri::PathAndQuery::from_static(
344                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/DeleteGlobalRouter",
345            );
346            let mut req = request.into_request();
347            req.extensions_mut()
348                .insert(
349                    GrpcMethod::new(
350                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
351                        "DeleteGlobalRouter",
352                    ),
353                );
354            self.inner.unary(req, path, codec).await
355        }
356        pub async fn get_global_router(
357            &mut self,
358            request: impl tonic::IntoRequest<super::GetGlobalRouterRequest>,
359        ) -> std::result::Result<
360            tonic::Response<super::GetGlobalRouterResponse>,
361            tonic::Status,
362        > {
363            self.inner
364                .ready()
365                .await
366                .map_err(|e| {
367                    tonic::Status::unknown(
368                        format!("Service was not ready: {}", e.into()),
369                    )
370                })?;
371            let codec = tonic::codec::ProstCodec::default();
372            let path = http::uri::PathAndQuery::from_static(
373                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/GetGlobalRouter",
374            );
375            let mut req = request.into_request();
376            req.extensions_mut()
377                .insert(
378                    GrpcMethod::new(
379                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
380                        "GetGlobalRouter",
381                    ),
382                );
383            self.inner.unary(req, path, codec).await
384        }
385        pub async fn list_global_routers(
386            &mut self,
387            request: impl tonic::IntoRequest<super::ListGlobalRoutersRequest>,
388        ) -> std::result::Result<
389            tonic::Response<super::ListGlobalRoutersResponse>,
390            tonic::Status,
391        > {
392            self.inner
393                .ready()
394                .await
395                .map_err(|e| {
396                    tonic::Status::unknown(
397                        format!("Service was not ready: {}", e.into()),
398                    )
399                })?;
400            let codec = tonic::codec::ProstCodec::default();
401            let path = http::uri::PathAndQuery::from_static(
402                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/ListGlobalRouters",
403            );
404            let mut req = request.into_request();
405            req.extensions_mut()
406                .insert(
407                    GrpcMethod::new(
408                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
409                        "ListGlobalRouters",
410                    ),
411                );
412            self.inner.unary(req, path, codec).await
413        }
414        pub async fn batch_get_global_routers(
415            &mut self,
416            request: impl tonic::IntoRequest<super::BatchGetGlobalRoutersRequest>,
417        ) -> std::result::Result<
418            tonic::Response<super::BatchGetGlobalRoutersResponse>,
419            tonic::Status,
420        > {
421            self.inner
422                .ready()
423                .await
424                .map_err(|e| {
425                    tonic::Status::unknown(
426                        format!("Service was not ready: {}", e.into()),
427                    )
428                })?;
429            let codec = tonic::codec::ProstCodec::default();
430            let path = http::uri::PathAndQuery::from_static(
431                "/com.coralogixapis.notification_center.routers.v1.GlobalRoutersService/BatchGetGlobalRouters",
432            );
433            let mut req = request.into_request();
434            req.extensions_mut()
435                .insert(
436                    GrpcMethod::new(
437                        "com.coralogixapis.notification_center.routers.v1.GlobalRoutersService",
438                        "BatchGetGlobalRouters",
439                    ),
440                );
441            self.inner.unary(req, path, codec).await
442        }
443    }
444}