nominal_api/proto/
nominal.authentication.groups.v1.rs

1// This file is @generated by prost-build.
2/// A group represents a collection of users within an organization
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Group {
5    #[prost(string, tag = "1")]
6    pub rid: ::prost::alloc::string::String,
7    #[prost(string, tag = "2")]
8    pub org_rid: ::prost::alloc::string::String,
9    /// Group ID must be unique per org.
10    /// If sourced from the customer's IdP, will match IdP group name.
11    #[prost(string, tag = "3")]
12    pub group_id: ::prost::alloc::string::String,
13    #[prost(string, tag = "4")]
14    pub display_name: ::prost::alloc::string::String,
15    #[prost(string, tag = "5")]
16    pub description: ::prost::alloc::string::String,
17    /// The list of users in this group
18    #[prost(string, repeated, tag = "6")]
19    pub user_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
20    #[prost(message, optional, tag = "7")]
21    pub created_at: ::core::option::Option<
22        super::super::super::super::google::protobuf::Timestamp,
23    >,
24    #[prost(message, optional, tag = "8")]
25    pub updated_at: ::core::option::Option<
26        super::super::super::super::google::protobuf::Timestamp,
27    >,
28    /// Symbol to identify groups
29    #[prost(message, optional, tag = "9")]
30    pub symbol: ::core::option::Option<super::super::super::scout::elements::v1::Symbol>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct SearchGroupsQuery {
34    #[prost(oneof = "search_groups_query::Query", tags = "1, 2, 3")]
35    pub query: ::core::option::Option<search_groups_query::Query>,
36}
37/// Nested message and enum types in `SearchGroupsQuery`.
38pub mod search_groups_query {
39    #[derive(Clone, PartialEq, ::prost::Oneof)]
40    pub enum Query {
41        #[prost(string, tag = "1")]
42        ExactSubstringText(::prost::alloc::string::String),
43        /// and is implemented to allow for list (use SearchQueryAnd(\[\]))
44        #[prost(message, tag = "2")]
45        And(super::SearchQueryAnd),
46        #[prost(message, tag = "3")]
47        Or(super::SearchQueryOr),
48    }
49}
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct SearchQueryAnd {
52    #[prost(message, repeated, tag = "1")]
53    pub queries: ::prost::alloc::vec::Vec<SearchGroupsQuery>,
54}
55#[derive(Clone, PartialEq, ::prost::Message)]
56pub struct SearchQueryOr {
57    #[prost(message, repeated, tag = "1")]
58    pub queries: ::prost::alloc::vec::Vec<SearchGroupsQuery>,
59}
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct SearchGroupsRequest {
62    /// Page sizes greater than 1_000 will be rejected. Default pageSize is 100.
63    #[prost(int32, optional, tag = "1")]
64    pub page_size: ::core::option::Option<i32>,
65    #[prost(string, optional, tag = "2")]
66    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
67    /// omitting archivedStatus because currently groups are IDP sync-only
68    #[prost(message, optional, tag = "3")]
69    pub query: ::core::option::Option<SearchGroupsQuery>,
70}
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct SearchGroupsResponse {
73    #[prost(message, repeated, tag = "1")]
74    pub results: ::prost::alloc::vec::Vec<Group>,
75    #[prost(string, optional, tag = "2")]
76    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
77}
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct GetGroupRequest {
80    #[prost(string, tag = "1")]
81    pub group_rid: ::prost::alloc::string::String,
82}
83#[derive(Clone, PartialEq, ::prost::Message)]
84pub struct GetGroupResponse {
85    #[prost(message, optional, tag = "1")]
86    pub group: ::core::option::Option<Group>,
87}
88#[derive(Clone, PartialEq, ::prost::Message)]
89pub struct GetGroupByIdRequest {
90    #[prost(string, tag = "1")]
91    pub group_id: ::prost::alloc::string::String,
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct GetGroupByIdResponse {
95    #[prost(message, optional, tag = "1")]
96    pub group: ::core::option::Option<Group>,
97}
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct GetGroupsRequest {
100    #[prost(string, repeated, tag = "1")]
101    pub group_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
102}
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct GetGroupsResponse {
105    #[prost(map = "string, message", tag = "1")]
106    pub groups: ::std::collections::HashMap<::prost::alloc::string::String, Group>,
107}
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct UpdateGroupMetadataRequest {
110    #[prost(string, optional, tag = "1")]
111    pub display_name: ::core::option::Option<::prost::alloc::string::String>,
112    #[prost(string, optional, tag = "2")]
113    pub description: ::core::option::Option<::prost::alloc::string::String>,
114    #[prost(message, optional, tag = "3")]
115    pub symbol: ::core::option::Option<
116        update_group_metadata_request::UpdateGroupSymbolWrapper,
117    >,
118}
119/// Nested message and enum types in `UpdateGroupMetadataRequest`.
120pub mod update_group_metadata_request {
121    #[derive(Clone, PartialEq, ::prost::Message)]
122    pub struct UpdateGroupSymbolWrapper {
123        #[prost(message, optional, tag = "1")]
124        pub value: ::core::option::Option<
125            super::super::super::super::scout::elements::v1::Symbol,
126        >,
127    }
128}
129#[derive(Clone, PartialEq, ::prost::Message)]
130pub struct UpdateGroupMetadataRequestWrapper {
131    #[prost(string, tag = "1")]
132    pub group_rid: ::prost::alloc::string::String,
133    #[prost(message, optional, tag = "2")]
134    pub request: ::core::option::Option<UpdateGroupMetadataRequest>,
135}
136#[derive(Clone, PartialEq, ::prost::Message)]
137pub struct UpdateGroupMetadataResponse {
138    #[prost(message, optional, tag = "1")]
139    pub group: ::core::option::Option<Group>,
140}
141#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
142#[repr(i32)]
143pub enum GroupErrors {
144    /// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
145    Unauthorized = 0,
146    NotFound = 1,
147    RequestedPageSizeTooLarge = 2,
148}
149impl GroupErrors {
150    /// String value of the enum field names used in the ProtoBuf definition.
151    ///
152    /// The values are not transformed in any way and thus are considered stable
153    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
154    pub fn as_str_name(&self) -> &'static str {
155        match self {
156            Self::Unauthorized => "GROUP_ERRORS_UNAUTHORIZED",
157            Self::NotFound => "GROUP_ERRORS_NOT_FOUND",
158            Self::RequestedPageSizeTooLarge => {
159                "GROUP_ERRORS_REQUESTED_PAGE_SIZE_TOO_LARGE"
160            }
161        }
162    }
163    /// Creates an enum from field names used in the ProtoBuf definition.
164    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
165        match value {
166            "GROUP_ERRORS_UNAUTHORIZED" => Some(Self::Unauthorized),
167            "GROUP_ERRORS_NOT_FOUND" => Some(Self::NotFound),
168            "GROUP_ERRORS_REQUESTED_PAGE_SIZE_TOO_LARGE" => {
169                Some(Self::RequestedPageSizeTooLarge)
170            }
171            _ => None,
172        }
173    }
174}
175/// Generated client implementations.
176pub mod group_service_client {
177    #![allow(
178        unused_variables,
179        dead_code,
180        missing_docs,
181        clippy::wildcard_imports,
182        clippy::let_unit_value,
183    )]
184    use tonic::codegen::*;
185    use tonic::codegen::http::Uri;
186    /// Service for managing groups within an organization
187    #[derive(Debug, Clone)]
188    pub struct GroupServiceClient<T> {
189        inner: tonic::client::Grpc<T>,
190    }
191    impl GroupServiceClient<tonic::transport::Channel> {
192        /// Attempt to create a new client by connecting to a given endpoint.
193        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
194        where
195            D: TryInto<tonic::transport::Endpoint>,
196            D::Error: Into<StdError>,
197        {
198            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
199            Ok(Self::new(conn))
200        }
201    }
202    impl<T> GroupServiceClient<T>
203    where
204        T: tonic::client::GrpcService<tonic::body::Body>,
205        T::Error: Into<StdError>,
206        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
207        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
208    {
209        pub fn new(inner: T) -> Self {
210            let inner = tonic::client::Grpc::new(inner);
211            Self { inner }
212        }
213        pub fn with_origin(inner: T, origin: Uri) -> Self {
214            let inner = tonic::client::Grpc::with_origin(inner, origin);
215            Self { inner }
216        }
217        pub fn with_interceptor<F>(
218            inner: T,
219            interceptor: F,
220        ) -> GroupServiceClient<InterceptedService<T, F>>
221        where
222            F: tonic::service::Interceptor,
223            T::ResponseBody: Default,
224            T: tonic::codegen::Service<
225                http::Request<tonic::body::Body>,
226                Response = http::Response<
227                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
228                >,
229            >,
230            <T as tonic::codegen::Service<
231                http::Request<tonic::body::Body>,
232            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
233        {
234            GroupServiceClient::new(InterceptedService::new(inner, interceptor))
235        }
236        /// Compress requests with the given encoding.
237        ///
238        /// This requires the server to support it otherwise it might respond with an
239        /// error.
240        #[must_use]
241        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
242            self.inner = self.inner.send_compressed(encoding);
243            self
244        }
245        /// Enable decompressing responses.
246        #[must_use]
247        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
248            self.inner = self.inner.accept_compressed(encoding);
249            self
250        }
251        /// Limits the maximum size of a decoded message.
252        ///
253        /// Default: `4MB`
254        #[must_use]
255        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
256            self.inner = self.inner.max_decoding_message_size(limit);
257            self
258        }
259        /// Limits the maximum size of an encoded message.
260        ///
261        /// Default: `usize::MAX`
262        #[must_use]
263        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
264            self.inner = self.inner.max_encoding_message_size(limit);
265            self
266        }
267        /// Get group within the user's organization
268        pub async fn get_group(
269            &mut self,
270            request: impl tonic::IntoRequest<super::GetGroupRequest>,
271        ) -> std::result::Result<
272            tonic::Response<super::GetGroupResponse>,
273            tonic::Status,
274        > {
275            self.inner
276                .ready()
277                .await
278                .map_err(|e| {
279                    tonic::Status::unknown(
280                        format!("Service was not ready: {}", e.into()),
281                    )
282                })?;
283            let codec = tonic::codec::ProstCodec::default();
284            let path = http::uri::PathAndQuery::from_static(
285                "/nominal.authentication.groups.v1.GroupService/GetGroup",
286            );
287            let mut req = request.into_request();
288            req.extensions_mut()
289                .insert(
290                    GrpcMethod::new(
291                        "nominal.authentication.groups.v1.GroupService",
292                        "GetGroup",
293                    ),
294                );
295            self.inner.unary(req, path, codec).await
296        }
297        /// Get batch of groups within the user's organization
298        pub async fn get_groups(
299            &mut self,
300            request: impl tonic::IntoRequest<super::GetGroupsRequest>,
301        ) -> std::result::Result<
302            tonic::Response<super::GetGroupsResponse>,
303            tonic::Status,
304        > {
305            self.inner
306                .ready()
307                .await
308                .map_err(|e| {
309                    tonic::Status::unknown(
310                        format!("Service was not ready: {}", e.into()),
311                    )
312                })?;
313            let codec = tonic::codec::ProstCodec::default();
314            let path = http::uri::PathAndQuery::from_static(
315                "/nominal.authentication.groups.v1.GroupService/GetGroups",
316            );
317            let mut req = request.into_request();
318            req.extensions_mut()
319                .insert(
320                    GrpcMethod::new(
321                        "nominal.authentication.groups.v1.GroupService",
322                        "GetGroups",
323                    ),
324                );
325            self.inner.unary(req, path, codec).await
326        }
327        /// Gets a group by its ID within the user's organization
328        pub async fn get_group_by_id(
329            &mut self,
330            request: impl tonic::IntoRequest<super::GetGroupByIdRequest>,
331        ) -> std::result::Result<
332            tonic::Response<super::GetGroupByIdResponse>,
333            tonic::Status,
334        > {
335            self.inner
336                .ready()
337                .await
338                .map_err(|e| {
339                    tonic::Status::unknown(
340                        format!("Service was not ready: {}", e.into()),
341                    )
342                })?;
343            let codec = tonic::codec::ProstCodec::default();
344            let path = http::uri::PathAndQuery::from_static(
345                "/nominal.authentication.groups.v1.GroupService/GetGroupById",
346            );
347            let mut req = request.into_request();
348            req.extensions_mut()
349                .insert(
350                    GrpcMethod::new(
351                        "nominal.authentication.groups.v1.GroupService",
352                        "GetGroupById",
353                    ),
354                );
355            self.inner.unary(req, path, codec).await
356        }
357        /// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
358        /// Updates the metadata of a group
359        pub async fn update_group_metadata(
360            &mut self,
361            request: impl tonic::IntoRequest<super::UpdateGroupMetadataRequestWrapper>,
362        ) -> std::result::Result<
363            tonic::Response<super::UpdateGroupMetadataResponse>,
364            tonic::Status,
365        > {
366            self.inner
367                .ready()
368                .await
369                .map_err(|e| {
370                    tonic::Status::unknown(
371                        format!("Service was not ready: {}", e.into()),
372                    )
373                })?;
374            let codec = tonic::codec::ProstCodec::default();
375            let path = http::uri::PathAndQuery::from_static(
376                "/nominal.authentication.groups.v1.GroupService/UpdateGroupMetadata",
377            );
378            let mut req = request.into_request();
379            req.extensions_mut()
380                .insert(
381                    GrpcMethod::new(
382                        "nominal.authentication.groups.v1.GroupService",
383                        "UpdateGroupMetadata",
384                    ),
385                );
386            self.inner.unary(req, path, codec).await
387        }
388        /// Searches all groups in the user's organization using given query
389        pub async fn search_groups(
390            &mut self,
391            request: impl tonic::IntoRequest<super::SearchGroupsRequest>,
392        ) -> std::result::Result<
393            tonic::Response<super::SearchGroupsResponse>,
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                "/nominal.authentication.groups.v1.GroupService/SearchGroups",
407            );
408            let mut req = request.into_request();
409            req.extensions_mut()
410                .insert(
411                    GrpcMethod::new(
412                        "nominal.authentication.groups.v1.GroupService",
413                        "SearchGroups",
414                    ),
415                );
416            self.inner.unary(req, path, codec).await
417        }
418    }
419}