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