cx_api/generated/
com.coralogixapis.metrics_rule_manager.v1.rs

1// This file is @generated by prost-build.
2/// *
3/// A group of recording rules. Rules within a group are run sequentially at a regular interval,
4/// with the same evaluation time.
5#[derive(serde::Serialize, serde::Deserialize)]
6#[serde(rename_all = "snake_case")]
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct InRuleGroup {
9    /// Name of the group.
10    #[prost(string, tag = "1")]
11    pub name: ::prost::alloc::string::String,
12    /// How often rules in the group are evaluated.
13    ///
14    /// optional, default = 60 secs
15    #[prost(uint32, optional, tag = "2")]
16    pub interval: ::core::option::Option<u32>,
17    /// Limits the number of series a rule can produce.
18    ///
19    /// optional, 0 is no limit, default = 0
20    #[prost(uint64, optional, tag = "3")]
21    pub limit: ::core::option::Option<u64>,
22    /// Rules of the group.
23    #[prost(message, repeated, tag = "4")]
24    pub rules: ::prost::alloc::vec::Vec<InRule>,
25    #[prost(uint32, optional, tag = "5")]
26    pub version: ::core::option::Option<u32>,
27    #[prost(string, optional, tag = "6")]
28    pub id: ::core::option::Option<::prost::alloc::string::String>,
29}
30#[derive(serde::Serialize, serde::Deserialize)]
31#[serde(rename_all = "snake_case")]
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct InRule {
34    /// The name of the time series to output to. Must be a valid metric name.
35    #[prost(string, tag = "1")]
36    pub record: ::prost::alloc::string::String,
37    /// *
38    /// The PromQL expression to evaluate. Every evaluation cycle this is
39    /// evaluated at the current time, and the result recorded as a new set of
40    /// time series with the metric name as given by 'record'.
41    #[prost(string, tag = "2")]
42    pub expr: ::prost::alloc::string::String,
43    /// Labels to add or overwrite before storing the result.
44    #[prost(map = "string, string", tag = "3")]
45    pub labels: ::std::collections::HashMap<
46        ::prost::alloc::string::String,
47        ::prost::alloc::string::String,
48    >,
49}
50#[derive(serde::Serialize, serde::Deserialize)]
51#[serde(rename_all = "snake_case")]
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct OutRuleGroup {
54    #[prost(string, tag = "1")]
55    pub name: ::prost::alloc::string::String,
56    #[prost(uint32, optional, tag = "2")]
57    pub interval: ::core::option::Option<u32>,
58    #[prost(uint64, optional, tag = "3")]
59    pub limit: ::core::option::Option<u64>,
60    #[prost(message, repeated, tag = "4")]
61    pub rules: ::prost::alloc::vec::Vec<OutRule>,
62    #[prost(uint64, optional, tag = "5")]
63    pub last_eval_at: ::core::option::Option<u64>,
64    #[prost(uint32, tag = "6")]
65    pub version: u32,
66    #[prost(string, tag = "7")]
67    pub id: ::prost::alloc::string::String,
68}
69#[derive(serde::Serialize, serde::Deserialize)]
70#[serde(rename_all = "snake_case")]
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct OutRule {
73    #[prost(string, tag = "1")]
74    pub record: ::prost::alloc::string::String,
75    #[prost(string, tag = "2")]
76    pub expr: ::prost::alloc::string::String,
77    #[prost(map = "string, string", tag = "3")]
78    pub labels: ::std::collections::HashMap<
79        ::prost::alloc::string::String,
80        ::prost::alloc::string::String,
81    >,
82    #[prost(uint64, optional, tag = "4")]
83    pub last_eval_duration_ms: ::core::option::Option<u64>,
84}
85/// * A matcher specifying a group to delete.
86#[derive(serde::Serialize, serde::Deserialize)]
87#[serde(rename_all = "snake_case")]
88#[derive(Clone, PartialEq, ::prost::Message)]
89pub struct DeleteRuleGroup {
90    /// Name of the group.
91    #[prost(string, tag = "1")]
92    pub name: ::prost::alloc::string::String,
93}
94/// * A listing of rule groups.
95#[derive(serde::Serialize, serde::Deserialize)]
96#[serde(rename_all = "snake_case")]
97#[derive(Clone, PartialEq, ::prost::Message)]
98pub struct RuleGroupListing {
99    #[prost(message, repeated, tag = "1")]
100    pub rule_groups: ::prost::alloc::vec::Vec<OutRuleGroup>,
101}
102/// * A matcher specifying a group to fetch.
103#[derive(serde::Serialize, serde::Deserialize)]
104#[serde(rename_all = "snake_case")]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct FetchRuleGroup {
107    #[prost(string, tag = "1")]
108    pub name: ::prost::alloc::string::String,
109}
110/// * Result of a rule group fetch operation.
111#[derive(serde::Serialize, serde::Deserialize)]
112#[serde(rename_all = "snake_case")]
113#[derive(Clone, PartialEq, ::prost::Message)]
114pub struct FetchRuleGroupResult {
115    /// optional, empty if not found
116    #[prost(message, optional, tag = "1")]
117    pub rule_group: ::core::option::Option<OutRuleGroup>,
118}
119#[derive(serde::Serialize, serde::Deserialize)]
120#[serde(rename_all = "snake_case")]
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct CreateRuleGroupSet {
123    #[prost(message, repeated, tag = "1")]
124    pub groups: ::prost::alloc::vec::Vec<InRuleGroup>,
125    #[prost(string, optional, tag = "2")]
126    pub name: ::core::option::Option<::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 CreateRuleGroupSetResult {
132    #[prost(string, tag = "1")]
133    pub id: ::prost::alloc::string::String,
134}
135#[derive(serde::Serialize, serde::Deserialize)]
136#[serde(rename_all = "snake_case")]
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct UpdateRuleGroupSet {
139    #[prost(string, tag = "1")]
140    pub id: ::prost::alloc::string::String,
141    #[prost(message, repeated, tag = "2")]
142    pub groups: ::prost::alloc::vec::Vec<InRuleGroup>,
143    #[prost(string, optional, tag = "3")]
144    pub name: ::core::option::Option<::prost::alloc::string::String>,
145}
146#[derive(serde::Serialize, serde::Deserialize)]
147#[serde(rename_all = "snake_case")]
148#[derive(Clone, PartialEq, ::prost::Message)]
149pub struct RuleGroupSetListing {
150    #[prost(message, repeated, tag = "1")]
151    pub sets: ::prost::alloc::vec::Vec<OutRuleGroupSet>,
152}
153#[derive(serde::Serialize, serde::Deserialize)]
154#[serde(rename_all = "snake_case")]
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct FetchRuleGroupSet {
157    #[prost(string, tag = "1")]
158    pub id: ::prost::alloc::string::String,
159}
160#[derive(serde::Serialize, serde::Deserialize)]
161#[serde(rename_all = "snake_case")]
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct DeleteRuleGroupSet {
164    #[prost(string, tag = "1")]
165    pub id: ::prost::alloc::string::String,
166}
167#[derive(serde::Serialize, serde::Deserialize)]
168#[serde(rename_all = "snake_case")]
169#[derive(Clone, PartialEq, ::prost::Message)]
170pub struct OutRuleGroupSet {
171    #[prost(string, tag = "1")]
172    pub id: ::prost::alloc::string::String,
173    #[prost(message, repeated, tag = "2")]
174    pub groups: ::prost::alloc::vec::Vec<OutRuleGroup>,
175    #[prost(string, tag = "3")]
176    pub name: ::prost::alloc::string::String,
177}
178/// Generated client implementations.
179pub mod rule_groups_client {
180    #![allow(
181        unused_variables,
182        dead_code,
183        missing_docs,
184        clippy::wildcard_imports,
185        clippy::let_unit_value,
186    )]
187    use tonic::codegen::*;
188    use tonic::codegen::http::Uri;
189    /// *
190    /// CRUD operations on recording rule groups.
191    #[derive(Debug, Clone)]
192    pub struct RuleGroupsClient<T> {
193        inner: tonic::client::Grpc<T>,
194    }
195    impl RuleGroupsClient<tonic::transport::Channel> {
196        /// Attempt to create a new client by connecting to a given endpoint.
197        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
198        where
199            D: TryInto<tonic::transport::Endpoint>,
200            D::Error: Into<StdError>,
201        {
202            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
203            Ok(Self::new(conn))
204        }
205    }
206    impl<T> RuleGroupsClient<T>
207    where
208        T: tonic::client::GrpcService<tonic::body::BoxBody>,
209        T::Error: Into<StdError>,
210        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
211        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
212    {
213        pub fn new(inner: T) -> Self {
214            let inner = tonic::client::Grpc::new(inner);
215            Self { inner }
216        }
217        pub fn with_origin(inner: T, origin: Uri) -> Self {
218            let inner = tonic::client::Grpc::with_origin(inner, origin);
219            Self { inner }
220        }
221        pub fn with_interceptor<F>(
222            inner: T,
223            interceptor: F,
224        ) -> RuleGroupsClient<InterceptedService<T, F>>
225        where
226            F: tonic::service::Interceptor,
227            T::ResponseBody: Default,
228            T: tonic::codegen::Service<
229                http::Request<tonic::body::BoxBody>,
230                Response = http::Response<
231                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
232                >,
233            >,
234            <T as tonic::codegen::Service<
235                http::Request<tonic::body::BoxBody>,
236            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
237        {
238            RuleGroupsClient::new(InterceptedService::new(inner, interceptor))
239        }
240        /// Compress requests with the given encoding.
241        ///
242        /// This requires the server to support it otherwise it might respond with an
243        /// error.
244        #[must_use]
245        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
246            self.inner = self.inner.send_compressed(encoding);
247            self
248        }
249        /// Enable decompressing responses.
250        #[must_use]
251        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
252            self.inner = self.inner.accept_compressed(encoding);
253            self
254        }
255        /// Limits the maximum size of a decoded message.
256        ///
257        /// Default: `4MB`
258        #[must_use]
259        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
260            self.inner = self.inner.max_decoding_message_size(limit);
261            self
262        }
263        /// Limits the maximum size of an encoded message.
264        ///
265        /// Default: `usize::MAX`
266        #[must_use]
267        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
268            self.inner = self.inner.max_encoding_message_size(limit);
269            self
270        }
271        /// Creates or updates a rule group.
272        pub async fn save(
273            &mut self,
274            request: impl tonic::IntoRequest<super::InRuleGroup>,
275        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
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.metrics_rule_manager.v1.RuleGroups/Save",
287            );
288            let mut req = request.into_request();
289            req.extensions_mut()
290                .insert(
291                    GrpcMethod::new(
292                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroups",
293                        "Save",
294                    ),
295                );
296            self.inner.unary(req, path, codec).await
297        }
298        /// Deletes a rule group matching the given input.
299        pub async fn delete(
300            &mut self,
301            request: impl tonic::IntoRequest<super::DeleteRuleGroup>,
302        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
303            self.inner
304                .ready()
305                .await
306                .map_err(|e| {
307                    tonic::Status::unknown(
308                        format!("Service was not ready: {}", e.into()),
309                    )
310                })?;
311            let codec = tonic::codec::ProstCodec::default();
312            let path = http::uri::PathAndQuery::from_static(
313                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroups/Delete",
314            );
315            let mut req = request.into_request();
316            req.extensions_mut()
317                .insert(
318                    GrpcMethod::new(
319                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroups",
320                        "Delete",
321                    ),
322                );
323            self.inner.unary(req, path, codec).await
324        }
325        /// Lists all the rule groups.
326        pub async fn list(
327            &mut self,
328            request: impl tonic::IntoRequest<()>,
329        ) -> std::result::Result<
330            tonic::Response<super::RuleGroupListing>,
331            tonic::Status,
332        > {
333            self.inner
334                .ready()
335                .await
336                .map_err(|e| {
337                    tonic::Status::unknown(
338                        format!("Service was not ready: {}", e.into()),
339                    )
340                })?;
341            let codec = tonic::codec::ProstCodec::default();
342            let path = http::uri::PathAndQuery::from_static(
343                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroups/List",
344            );
345            let mut req = request.into_request();
346            req.extensions_mut()
347                .insert(
348                    GrpcMethod::new(
349                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroups",
350                        "List",
351                    ),
352                );
353            self.inner.unary(req, path, codec).await
354        }
355        /// Fetches a rule group matching a given input.
356        pub async fn fetch(
357            &mut self,
358            request: impl tonic::IntoRequest<super::FetchRuleGroup>,
359        ) -> std::result::Result<
360            tonic::Response<super::FetchRuleGroupResult>,
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.metrics_rule_manager.v1.RuleGroups/Fetch",
374            );
375            let mut req = request.into_request();
376            req.extensions_mut()
377                .insert(
378                    GrpcMethod::new(
379                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroups",
380                        "Fetch",
381                    ),
382                );
383            self.inner.unary(req, path, codec).await
384        }
385    }
386}
387/// Generated client implementations.
388pub mod rule_group_sets_client {
389    #![allow(
390        unused_variables,
391        dead_code,
392        missing_docs,
393        clippy::wildcard_imports,
394        clippy::let_unit_value,
395    )]
396    use tonic::codegen::*;
397    use tonic::codegen::http::Uri;
398    #[derive(Debug, Clone)]
399    pub struct RuleGroupSetsClient<T> {
400        inner: tonic::client::Grpc<T>,
401    }
402    impl RuleGroupSetsClient<tonic::transport::Channel> {
403        /// Attempt to create a new client by connecting to a given endpoint.
404        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
405        where
406            D: TryInto<tonic::transport::Endpoint>,
407            D::Error: Into<StdError>,
408        {
409            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
410            Ok(Self::new(conn))
411        }
412    }
413    impl<T> RuleGroupSetsClient<T>
414    where
415        T: tonic::client::GrpcService<tonic::body::BoxBody>,
416        T::Error: Into<StdError>,
417        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
418        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
419    {
420        pub fn new(inner: T) -> Self {
421            let inner = tonic::client::Grpc::new(inner);
422            Self { inner }
423        }
424        pub fn with_origin(inner: T, origin: Uri) -> Self {
425            let inner = tonic::client::Grpc::with_origin(inner, origin);
426            Self { inner }
427        }
428        pub fn with_interceptor<F>(
429            inner: T,
430            interceptor: F,
431        ) -> RuleGroupSetsClient<InterceptedService<T, F>>
432        where
433            F: tonic::service::Interceptor,
434            T::ResponseBody: Default,
435            T: tonic::codegen::Service<
436                http::Request<tonic::body::BoxBody>,
437                Response = http::Response<
438                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
439                >,
440            >,
441            <T as tonic::codegen::Service<
442                http::Request<tonic::body::BoxBody>,
443            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
444        {
445            RuleGroupSetsClient::new(InterceptedService::new(inner, interceptor))
446        }
447        /// Compress requests with the given encoding.
448        ///
449        /// This requires the server to support it otherwise it might respond with an
450        /// error.
451        #[must_use]
452        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
453            self.inner = self.inner.send_compressed(encoding);
454            self
455        }
456        /// Enable decompressing responses.
457        #[must_use]
458        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
459            self.inner = self.inner.accept_compressed(encoding);
460            self
461        }
462        /// Limits the maximum size of a decoded message.
463        ///
464        /// Default: `4MB`
465        #[must_use]
466        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
467            self.inner = self.inner.max_decoding_message_size(limit);
468            self
469        }
470        /// Limits the maximum size of an encoded message.
471        ///
472        /// Default: `usize::MAX`
473        #[must_use]
474        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
475            self.inner = self.inner.max_encoding_message_size(limit);
476            self
477        }
478        pub async fn create(
479            &mut self,
480            request: impl tonic::IntoRequest<super::CreateRuleGroupSet>,
481        ) -> std::result::Result<
482            tonic::Response<super::CreateRuleGroupSetResult>,
483            tonic::Status,
484        > {
485            self.inner
486                .ready()
487                .await
488                .map_err(|e| {
489                    tonic::Status::unknown(
490                        format!("Service was not ready: {}", e.into()),
491                    )
492                })?;
493            let codec = tonic::codec::ProstCodec::default();
494            let path = http::uri::PathAndQuery::from_static(
495                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets/Create",
496            );
497            let mut req = request.into_request();
498            req.extensions_mut()
499                .insert(
500                    GrpcMethod::new(
501                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets",
502                        "Create",
503                    ),
504                );
505            self.inner.unary(req, path, codec).await
506        }
507        pub async fn update(
508            &mut self,
509            request: impl tonic::IntoRequest<super::UpdateRuleGroupSet>,
510        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
511            self.inner
512                .ready()
513                .await
514                .map_err(|e| {
515                    tonic::Status::unknown(
516                        format!("Service was not ready: {}", e.into()),
517                    )
518                })?;
519            let codec = tonic::codec::ProstCodec::default();
520            let path = http::uri::PathAndQuery::from_static(
521                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets/Update",
522            );
523            let mut req = request.into_request();
524            req.extensions_mut()
525                .insert(
526                    GrpcMethod::new(
527                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets",
528                        "Update",
529                    ),
530                );
531            self.inner.unary(req, path, codec).await
532        }
533        pub async fn list(
534            &mut self,
535            request: impl tonic::IntoRequest<()>,
536        ) -> std::result::Result<
537            tonic::Response<super::RuleGroupSetListing>,
538            tonic::Status,
539        > {
540            self.inner
541                .ready()
542                .await
543                .map_err(|e| {
544                    tonic::Status::unknown(
545                        format!("Service was not ready: {}", e.into()),
546                    )
547                })?;
548            let codec = tonic::codec::ProstCodec::default();
549            let path = http::uri::PathAndQuery::from_static(
550                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets/List",
551            );
552            let mut req = request.into_request();
553            req.extensions_mut()
554                .insert(
555                    GrpcMethod::new(
556                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets",
557                        "List",
558                    ),
559                );
560            self.inner.unary(req, path, codec).await
561        }
562        pub async fn fetch(
563            &mut self,
564            request: impl tonic::IntoRequest<super::FetchRuleGroupSet>,
565        ) -> std::result::Result<
566            tonic::Response<super::OutRuleGroupSet>,
567            tonic::Status,
568        > {
569            self.inner
570                .ready()
571                .await
572                .map_err(|e| {
573                    tonic::Status::unknown(
574                        format!("Service was not ready: {}", e.into()),
575                    )
576                })?;
577            let codec = tonic::codec::ProstCodec::default();
578            let path = http::uri::PathAndQuery::from_static(
579                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets/Fetch",
580            );
581            let mut req = request.into_request();
582            req.extensions_mut()
583                .insert(
584                    GrpcMethod::new(
585                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets",
586                        "Fetch",
587                    ),
588                );
589            self.inner.unary(req, path, codec).await
590        }
591        pub async fn delete(
592            &mut self,
593            request: impl tonic::IntoRequest<super::DeleteRuleGroupSet>,
594        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
595            self.inner
596                .ready()
597                .await
598                .map_err(|e| {
599                    tonic::Status::unknown(
600                        format!("Service was not ready: {}", e.into()),
601                    )
602                })?;
603            let codec = tonic::codec::ProstCodec::default();
604            let path = http::uri::PathAndQuery::from_static(
605                "/com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets/Delete",
606            );
607            let mut req = request.into_request();
608            req.extensions_mut()
609                .insert(
610                    GrpcMethod::new(
611                        "com.coralogixapis.metrics_rule_manager.v1.RuleGroupSets",
612                        "Delete",
613                    ),
614                );
615            self.inner.unary(req, path, codec).await
616        }
617    }
618}