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

1// This file is @generated by prost-build.
2#[derive(serde::Serialize, serde::Deserialize)]
3#[serde(rename_all = "snake_case")]
4#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
5#[repr(i32)]
6pub enum EntityType {
7    Unspecified = 0,
8    Logs = 1,
9    Spans = 2,
10}
11impl EntityType {
12    /// String value of the enum field names used in the ProtoBuf definition.
13    ///
14    /// The values are not transformed in any way and thus are considered stable
15    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
16    pub fn as_str_name(&self) -> &'static str {
17        match self {
18            Self::Unspecified => "ENTITY_TYPE_UNSPECIFIED",
19            Self::Logs => "ENTITY_TYPE_LOGS",
20            Self::Spans => "ENTITY_TYPE_SPANS",
21        }
22    }
23    /// Creates an enum from field names used in the ProtoBuf definition.
24    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
25        match value {
26            "ENTITY_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
27            "ENTITY_TYPE_LOGS" => Some(Self::Logs),
28            "ENTITY_TYPE_SPANS" => Some(Self::Spans),
29            _ => None,
30        }
31    }
32}
33#[derive(serde::Serialize, serde::Deserialize)]
34#[serde(rename_all = "snake_case")]
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct Scope {
37    #[prost(string, tag = "1")]
38    pub id: ::prost::alloc::string::String,
39    #[prost(string, tag = "2")]
40    pub display_name: ::prost::alloc::string::String,
41    #[prost(string, optional, tag = "3")]
42    pub description: ::core::option::Option<::prost::alloc::string::String>,
43    #[prost(int32, tag = "4")]
44    pub team_id: i32,
45    #[prost(message, repeated, tag = "5")]
46    pub filters: ::prost::alloc::vec::Vec<Filter>,
47    #[prost(string, tag = "6")]
48    pub default_expression: ::prost::alloc::string::String,
49}
50#[derive(serde::Serialize, serde::Deserialize)]
51#[serde(rename_all = "snake_case")]
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct Filter {
54    #[prost(enumeration = "EntityType", tag = "1")]
55    pub entity_type: i32,
56    #[prost(string, tag = "2")]
57    pub expression: ::prost::alloc::string::String,
58}
59/// We get user information from context
60/// Source: <https://www.notion.so/coralogix/Generic-Scopes-7ba56b0ba8f846228ca34fa6257f7258?pvs=4#3d61c9746d0c407b9b40e35deca9e60c>
61#[derive(serde::Serialize, serde::Deserialize)]
62#[serde(rename_all = "snake_case")]
63#[derive(Clone, Copy, PartialEq, ::prost::Message)]
64pub struct GetTeamScopesRequest {}
65#[derive(serde::Serialize, serde::Deserialize)]
66#[serde(rename_all = "snake_case")]
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct GetTeamScopesByIdsRequest {
69    #[prost(string, repeated, tag = "1")]
70    pub ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
71}
72#[derive(serde::Serialize, serde::Deserialize)]
73#[serde(rename_all = "snake_case")]
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct GetScopesResponse {
76    #[prost(message, repeated, tag = "1")]
77    pub scopes: ::prost::alloc::vec::Vec<Scope>,
78}
79#[derive(serde::Serialize, serde::Deserialize)]
80#[serde(rename_all = "snake_case")]
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct CreateScopeRequest {
83    #[prost(string, tag = "1")]
84    pub display_name: ::prost::alloc::string::String,
85    #[prost(string, optional, tag = "2")]
86    pub description: ::core::option::Option<::prost::alloc::string::String>,
87    #[prost(message, repeated, tag = "3")]
88    pub filters: ::prost::alloc::vec::Vec<Filter>,
89    #[prost(string, tag = "4")]
90    pub default_expression: ::prost::alloc::string::String,
91}
92#[derive(serde::Serialize, serde::Deserialize)]
93#[serde(rename_all = "snake_case")]
94#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct CreateScopeResponse {
96    #[prost(message, optional, tag = "1")]
97    pub scope: ::core::option::Option<Scope>,
98}
99#[derive(serde::Serialize, serde::Deserialize)]
100#[serde(rename_all = "snake_case")]
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct UpdateScopeRequest {
103    #[prost(string, tag = "1")]
104    pub id: ::prost::alloc::string::String,
105    #[prost(string, tag = "2")]
106    pub display_name: ::prost::alloc::string::String,
107    #[prost(string, optional, tag = "3")]
108    pub description: ::core::option::Option<::prost::alloc::string::String>,
109    #[prost(message, repeated, tag = "4")]
110    pub filters: ::prost::alloc::vec::Vec<Filter>,
111    #[prost(string, tag = "5")]
112    pub default_expression: ::prost::alloc::string::String,
113}
114#[derive(serde::Serialize, serde::Deserialize)]
115#[serde(rename_all = "snake_case")]
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct UpdateScopeResponse {
118    #[prost(message, optional, tag = "1")]
119    pub scope: ::core::option::Option<Scope>,
120}
121#[derive(serde::Serialize, serde::Deserialize)]
122#[serde(rename_all = "snake_case")]
123#[derive(Clone, PartialEq, ::prost::Message)]
124pub struct DeleteScopeRequest {
125    #[prost(string, tag = "1")]
126    pub id: ::prost::alloc::string::String,
127}
128#[derive(serde::Serialize, serde::Deserialize)]
129#[serde(rename_all = "snake_case")]
130#[derive(Clone, Copy, PartialEq, ::prost::Message)]
131pub struct DeleteScopeResponse {}
132/// Generated client implementations.
133pub mod scopes_service_client {
134    #![allow(
135        unused_variables,
136        dead_code,
137        missing_docs,
138        clippy::wildcard_imports,
139        clippy::let_unit_value,
140    )]
141    use tonic::codegen::*;
142    use tonic::codegen::http::Uri;
143    #[derive(Debug, Clone)]
144    pub struct ScopesServiceClient<T> {
145        inner: tonic::client::Grpc<T>,
146    }
147    impl ScopesServiceClient<tonic::transport::Channel> {
148        /// Attempt to create a new client by connecting to a given endpoint.
149        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
150        where
151            D: TryInto<tonic::transport::Endpoint>,
152            D::Error: Into<StdError>,
153        {
154            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
155            Ok(Self::new(conn))
156        }
157    }
158    impl<T> ScopesServiceClient<T>
159    where
160        T: tonic::client::GrpcService<tonic::body::BoxBody>,
161        T::Error: Into<StdError>,
162        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
163        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
164    {
165        pub fn new(inner: T) -> Self {
166            let inner = tonic::client::Grpc::new(inner);
167            Self { inner }
168        }
169        pub fn with_origin(inner: T, origin: Uri) -> Self {
170            let inner = tonic::client::Grpc::with_origin(inner, origin);
171            Self { inner }
172        }
173        pub fn with_interceptor<F>(
174            inner: T,
175            interceptor: F,
176        ) -> ScopesServiceClient<InterceptedService<T, F>>
177        where
178            F: tonic::service::Interceptor,
179            T::ResponseBody: Default,
180            T: tonic::codegen::Service<
181                http::Request<tonic::body::BoxBody>,
182                Response = http::Response<
183                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
184                >,
185            >,
186            <T as tonic::codegen::Service<
187                http::Request<tonic::body::BoxBody>,
188            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
189        {
190            ScopesServiceClient::new(InterceptedService::new(inner, interceptor))
191        }
192        /// Compress requests with the given encoding.
193        ///
194        /// This requires the server to support it otherwise it might respond with an
195        /// error.
196        #[must_use]
197        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
198            self.inner = self.inner.send_compressed(encoding);
199            self
200        }
201        /// Enable decompressing responses.
202        #[must_use]
203        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
204            self.inner = self.inner.accept_compressed(encoding);
205            self
206        }
207        /// Limits the maximum size of a decoded message.
208        ///
209        /// Default: `4MB`
210        #[must_use]
211        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
212            self.inner = self.inner.max_decoding_message_size(limit);
213            self
214        }
215        /// Limits the maximum size of an encoded message.
216        ///
217        /// Default: `usize::MAX`
218        #[must_use]
219        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
220            self.inner = self.inner.max_encoding_message_size(limit);
221            self
222        }
223        pub async fn get_team_scopes_by_ids(
224            &mut self,
225            request: impl tonic::IntoRequest<super::GetTeamScopesByIdsRequest>,
226        ) -> std::result::Result<
227            tonic::Response<super::GetScopesResponse>,
228            tonic::Status,
229        > {
230            self.inner
231                .ready()
232                .await
233                .map_err(|e| {
234                    tonic::Status::unknown(
235                        format!("Service was not ready: {}", e.into()),
236                    )
237                })?;
238            let codec = tonic::codec::ProstCodec::default();
239            let path = http::uri::PathAndQuery::from_static(
240                "/com.coralogixapis.scopes.v1.ScopesService/GetTeamScopesByIds",
241            );
242            let mut req = request.into_request();
243            req.extensions_mut()
244                .insert(
245                    GrpcMethod::new(
246                        "com.coralogixapis.scopes.v1.ScopesService",
247                        "GetTeamScopesByIds",
248                    ),
249                );
250            self.inner.unary(req, path, codec).await
251        }
252        pub async fn get_team_scopes(
253            &mut self,
254            request: impl tonic::IntoRequest<super::GetTeamScopesRequest>,
255        ) -> std::result::Result<
256            tonic::Response<super::GetScopesResponse>,
257            tonic::Status,
258        > {
259            self.inner
260                .ready()
261                .await
262                .map_err(|e| {
263                    tonic::Status::unknown(
264                        format!("Service was not ready: {}", e.into()),
265                    )
266                })?;
267            let codec = tonic::codec::ProstCodec::default();
268            let path = http::uri::PathAndQuery::from_static(
269                "/com.coralogixapis.scopes.v1.ScopesService/GetTeamScopes",
270            );
271            let mut req = request.into_request();
272            req.extensions_mut()
273                .insert(
274                    GrpcMethod::new(
275                        "com.coralogixapis.scopes.v1.ScopesService",
276                        "GetTeamScopes",
277                    ),
278                );
279            self.inner.unary(req, path, codec).await
280        }
281        pub async fn create_scope(
282            &mut self,
283            request: impl tonic::IntoRequest<super::CreateScopeRequest>,
284        ) -> std::result::Result<
285            tonic::Response<super::CreateScopeResponse>,
286            tonic::Status,
287        > {
288            self.inner
289                .ready()
290                .await
291                .map_err(|e| {
292                    tonic::Status::unknown(
293                        format!("Service was not ready: {}", e.into()),
294                    )
295                })?;
296            let codec = tonic::codec::ProstCodec::default();
297            let path = http::uri::PathAndQuery::from_static(
298                "/com.coralogixapis.scopes.v1.ScopesService/CreateScope",
299            );
300            let mut req = request.into_request();
301            req.extensions_mut()
302                .insert(
303                    GrpcMethod::new(
304                        "com.coralogixapis.scopes.v1.ScopesService",
305                        "CreateScope",
306                    ),
307                );
308            self.inner.unary(req, path, codec).await
309        }
310        pub async fn update_scope(
311            &mut self,
312            request: impl tonic::IntoRequest<super::UpdateScopeRequest>,
313        ) -> std::result::Result<
314            tonic::Response<super::UpdateScopeResponse>,
315            tonic::Status,
316        > {
317            self.inner
318                .ready()
319                .await
320                .map_err(|e| {
321                    tonic::Status::unknown(
322                        format!("Service was not ready: {}", e.into()),
323                    )
324                })?;
325            let codec = tonic::codec::ProstCodec::default();
326            let path = http::uri::PathAndQuery::from_static(
327                "/com.coralogixapis.scopes.v1.ScopesService/UpdateScope",
328            );
329            let mut req = request.into_request();
330            req.extensions_mut()
331                .insert(
332                    GrpcMethod::new(
333                        "com.coralogixapis.scopes.v1.ScopesService",
334                        "UpdateScope",
335                    ),
336                );
337            self.inner.unary(req, path, codec).await
338        }
339        pub async fn delete_scope(
340            &mut self,
341            request: impl tonic::IntoRequest<super::DeleteScopeRequest>,
342        ) -> std::result::Result<
343            tonic::Response<super::DeleteScopeResponse>,
344            tonic::Status,
345        > {
346            self.inner
347                .ready()
348                .await
349                .map_err(|e| {
350                    tonic::Status::unknown(
351                        format!("Service was not ready: {}", e.into()),
352                    )
353                })?;
354            let codec = tonic::codec::ProstCodec::default();
355            let path = http::uri::PathAndQuery::from_static(
356                "/com.coralogixapis.scopes.v1.ScopesService/DeleteScope",
357            );
358            let mut req = request.into_request();
359            req.extensions_mut()
360                .insert(
361                    GrpcMethod::new(
362                        "com.coralogixapis.scopes.v1.ScopesService",
363                        "DeleteScope",
364                    ),
365                );
366            self.inner.unary(req, path, codec).await
367        }
368    }
369}