Skip to main content

nominal_api_proto/proto/
nominal.authorization.roles.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct RoleAssignmentRequest {
4    #[prost(enumeration = "Role", tag = "1")]
5    pub role: i32,
6    #[prost(oneof = "role_assignment_request::Assignee", tags = "2")]
7    pub assignee: ::core::option::Option<role_assignment_request::Assignee>,
8}
9/// Nested message and enum types in `RoleAssignmentRequest`.
10pub mod role_assignment_request {
11    #[derive(Clone, PartialEq, ::prost::Oneof)]
12    pub enum Assignee {
13        #[prost(string, tag = "2")]
14        UserRid(::prost::alloc::string::String),
15    }
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct RoleAssignmentResponse {
19    #[prost(enumeration = "Role", tag = "1")]
20    pub role: i32,
21    #[prost(oneof = "role_assignment_response::Assignee", tags = "2")]
22    pub assignee: ::core::option::Option<role_assignment_response::Assignee>,
23}
24/// Nested message and enum types in `RoleAssignmentResponse`.
25pub mod role_assignment_response {
26    #[derive(Clone, PartialEq, ::prost::Oneof)]
27    pub enum Assignee {
28        #[prost(string, tag = "2")]
29        UserRid(::prost::alloc::string::String),
30    }
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct UpdateResourceRolesRequest {
34    #[prost(string, tag = "1")]
35    pub resource: ::prost::alloc::string::String,
36    #[prost(message, repeated, tag = "2")]
37    pub assignments_to_add: ::prost::alloc::vec::Vec<RoleAssignmentRequest>,
38    #[prost(message, repeated, tag = "3")]
39    pub assignments_to_remove: ::prost::alloc::vec::Vec<RoleAssignmentRequest>,
40}
41#[derive(Clone, Copy, PartialEq, ::prost::Message)]
42pub struct UpdateResourceRolesResponse {}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct GetResourceRolesRequest {
45    #[prost(string, tag = "1")]
46    pub resource: ::prost::alloc::string::String,
47}
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct GetResourceRolesResponse {
50    #[prost(message, repeated, tag = "1")]
51    pub role_assignments: ::prost::alloc::vec::Vec<RoleAssignmentResponse>,
52}
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct BatchGetResourceRolesRequest {
55    #[prost(string, repeated, tag = "1")]
56    pub resources: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
57}
58#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct BatchGetResourceRolesResponse {
60    #[prost(map = "string, message", tag = "1")]
61    pub role_assignments_by_resource: ::std::collections::HashMap<
62        ::prost::alloc::string::String,
63        batch_get_resource_roles_response::RoleAssignmentWrapper,
64    >,
65}
66/// Nested message and enum types in `BatchGetResourceRolesResponse`.
67pub mod batch_get_resource_roles_response {
68    #[derive(Clone, PartialEq, ::prost::Message)]
69    pub struct RoleAssignmentWrapper {
70        #[prost(message, repeated, tag = "1")]
71        pub role_assignments: ::prost::alloc::vec::Vec<super::RoleAssignmentResponse>,
72    }
73}
74#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
75#[repr(i32)]
76pub enum Role {
77    Unspecified = 0,
78    Owner = 1,
79}
80impl Role {
81    /// String value of the enum field names used in the ProtoBuf definition.
82    ///
83    /// The values are not transformed in any way and thus are considered stable
84    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
85    pub fn as_str_name(&self) -> &'static str {
86        match self {
87            Self::Unspecified => "ROLE_UNSPECIFIED",
88            Self::Owner => "ROLE_OWNER",
89        }
90    }
91    /// Creates an enum from field names used in the ProtoBuf definition.
92    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
93        match value {
94            "ROLE_UNSPECIFIED" => Some(Self::Unspecified),
95            "ROLE_OWNER" => Some(Self::Owner),
96            _ => None,
97        }
98    }
99}
100/// Generated client implementations.
101pub mod role_service_client {
102    #![allow(
103        unused_variables,
104        dead_code,
105        missing_docs,
106        clippy::wildcard_imports,
107        clippy::let_unit_value,
108    )]
109    use tonic::codegen::*;
110    use tonic::codegen::http::Uri;
111    #[derive(Debug, Clone)]
112    pub struct RoleServiceClient<T> {
113        inner: tonic::client::Grpc<T>,
114    }
115    impl RoleServiceClient<tonic::transport::Channel> {
116        /// Attempt to create a new client by connecting to a given endpoint.
117        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
118        where
119            D: TryInto<tonic::transport::Endpoint>,
120            D::Error: Into<StdError>,
121        {
122            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
123            Ok(Self::new(conn))
124        }
125    }
126    impl<T> RoleServiceClient<T>
127    where
128        T: tonic::client::GrpcService<tonic::body::Body>,
129        T::Error: Into<StdError>,
130        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
131        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
132    {
133        pub fn new(inner: T) -> Self {
134            let inner = tonic::client::Grpc::new(inner);
135            Self { inner }
136        }
137        pub fn with_origin(inner: T, origin: Uri) -> Self {
138            let inner = tonic::client::Grpc::with_origin(inner, origin);
139            Self { inner }
140        }
141        pub fn with_interceptor<F>(
142            inner: T,
143            interceptor: F,
144        ) -> RoleServiceClient<InterceptedService<T, F>>
145        where
146            F: tonic::service::Interceptor,
147            T::ResponseBody: Default,
148            T: tonic::codegen::Service<
149                http::Request<tonic::body::Body>,
150                Response = http::Response<
151                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
152                >,
153            >,
154            <T as tonic::codegen::Service<
155                http::Request<tonic::body::Body>,
156            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
157        {
158            RoleServiceClient::new(InterceptedService::new(inner, interceptor))
159        }
160        /// Compress requests with the given encoding.
161        ///
162        /// This requires the server to support it otherwise it might respond with an
163        /// error.
164        #[must_use]
165        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
166            self.inner = self.inner.send_compressed(encoding);
167            self
168        }
169        /// Enable decompressing responses.
170        #[must_use]
171        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
172            self.inner = self.inner.accept_compressed(encoding);
173            self
174        }
175        /// Limits the maximum size of a decoded message.
176        ///
177        /// Default: `4MB`
178        #[must_use]
179        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
180            self.inner = self.inner.max_decoding_message_size(limit);
181            self
182        }
183        /// Limits the maximum size of an encoded message.
184        ///
185        /// Default: `usize::MAX`
186        #[must_use]
187        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
188            self.inner = self.inner.max_encoding_message_size(limit);
189            self
190        }
191        pub async fn update_resource_roles(
192            &mut self,
193            request: impl tonic::IntoRequest<super::UpdateResourceRolesRequest>,
194        ) -> std::result::Result<
195            tonic::Response<super::UpdateResourceRolesResponse>,
196            tonic::Status,
197        > {
198            self.inner
199                .ready()
200                .await
201                .map_err(|e| {
202                    tonic::Status::unknown(
203                        format!("Service was not ready: {}", e.into()),
204                    )
205                })?;
206            let codec = tonic::codec::ProstCodec::default();
207            let path = http::uri::PathAndQuery::from_static(
208                "/nominal.authorization.roles.v1.RoleService/UpdateResourceRoles",
209            );
210            let mut req = request.into_request();
211            req.extensions_mut()
212                .insert(
213                    GrpcMethod::new(
214                        "nominal.authorization.roles.v1.RoleService",
215                        "UpdateResourceRoles",
216                    ),
217                );
218            self.inner.unary(req, path, codec).await
219        }
220        pub async fn get_resource_roles(
221            &mut self,
222            request: impl tonic::IntoRequest<super::GetResourceRolesRequest>,
223        ) -> std::result::Result<
224            tonic::Response<super::GetResourceRolesResponse>,
225            tonic::Status,
226        > {
227            self.inner
228                .ready()
229                .await
230                .map_err(|e| {
231                    tonic::Status::unknown(
232                        format!("Service was not ready: {}", e.into()),
233                    )
234                })?;
235            let codec = tonic::codec::ProstCodec::default();
236            let path = http::uri::PathAndQuery::from_static(
237                "/nominal.authorization.roles.v1.RoleService/GetResourceRoles",
238            );
239            let mut req = request.into_request();
240            req.extensions_mut()
241                .insert(
242                    GrpcMethod::new(
243                        "nominal.authorization.roles.v1.RoleService",
244                        "GetResourceRoles",
245                    ),
246                );
247            self.inner.unary(req, path, codec).await
248        }
249        pub async fn batch_get_resource_roles(
250            &mut self,
251            request: impl tonic::IntoRequest<super::BatchGetResourceRolesRequest>,
252        ) -> std::result::Result<
253            tonic::Response<super::BatchGetResourceRolesResponse>,
254            tonic::Status,
255        > {
256            self.inner
257                .ready()
258                .await
259                .map_err(|e| {
260                    tonic::Status::unknown(
261                        format!("Service was not ready: {}", e.into()),
262                    )
263                })?;
264            let codec = tonic::codec::ProstCodec::default();
265            let path = http::uri::PathAndQuery::from_static(
266                "/nominal.authorization.roles.v1.RoleService/BatchGetResourceRoles",
267            );
268            let mut req = request.into_request();
269            req.extensions_mut()
270                .insert(
271                    GrpcMethod::new(
272                        "nominal.authorization.roles.v1.RoleService",
273                        "BatchGetResourceRoles",
274                    ),
275                );
276            self.inner.unary(req, path, codec).await
277        }
278    }
279}