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