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