nominal_api/proto/
nominal.authorization.permissions.v1.rs1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct CheckPermissionRequest {
5 #[prost(string, tag = "1")]
6 pub action: ::prost::alloc::string::String,
7 #[prost(string, tag = "2")]
8 pub resource: ::prost::alloc::string::String,
9}
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct CheckPermissionsRequest {
12 #[prost(message, repeated, tag = "1")]
13 pub requests: ::prost::alloc::vec::Vec<CheckPermissionRequest>,
14}
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct CheckPermissionResponse {
17 #[prost(bool, tag = "1")]
18 pub is_authorized: bool,
19 #[prost(message, optional, tag = "2")]
20 pub requested_permission: ::core::option::Option<CheckPermissionRequest>,
21}
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct CheckPermissionsResponse {
24 #[prost(message, repeated, tag = "1")]
25 pub responses: ::prost::alloc::vec::Vec<CheckPermissionResponse>,
26}
27pub mod permission_service_client {
29 #![allow(
30 unused_variables,
31 dead_code,
32 missing_docs,
33 clippy::wildcard_imports,
34 clippy::let_unit_value,
35 )]
36 use tonic::codegen::*;
37 use tonic::codegen::http::Uri;
38 #[derive(Debug, Clone)]
41 pub struct PermissionServiceClient<T> {
42 inner: tonic::client::Grpc<T>,
43 }
44 impl PermissionServiceClient<tonic::transport::Channel> {
45 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
47 where
48 D: TryInto<tonic::transport::Endpoint>,
49 D::Error: Into<StdError>,
50 {
51 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
52 Ok(Self::new(conn))
53 }
54 }
55 impl<T> PermissionServiceClient<T>
56 where
57 T: tonic::client::GrpcService<tonic::body::Body>,
58 T::Error: Into<StdError>,
59 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
60 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
61 {
62 pub fn new(inner: T) -> Self {
63 let inner = tonic::client::Grpc::new(inner);
64 Self { inner }
65 }
66 pub fn with_origin(inner: T, origin: Uri) -> Self {
67 let inner = tonic::client::Grpc::with_origin(inner, origin);
68 Self { inner }
69 }
70 pub fn with_interceptor<F>(
71 inner: T,
72 interceptor: F,
73 ) -> PermissionServiceClient<InterceptedService<T, F>>
74 where
75 F: tonic::service::Interceptor,
76 T::ResponseBody: Default,
77 T: tonic::codegen::Service<
78 http::Request<tonic::body::Body>,
79 Response = http::Response<
80 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
81 >,
82 >,
83 <T as tonic::codegen::Service<
84 http::Request<tonic::body::Body>,
85 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
86 {
87 PermissionServiceClient::new(InterceptedService::new(inner, interceptor))
88 }
89 #[must_use]
94 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
95 self.inner = self.inner.send_compressed(encoding);
96 self
97 }
98 #[must_use]
100 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
101 self.inner = self.inner.accept_compressed(encoding);
102 self
103 }
104 #[must_use]
108 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
109 self.inner = self.inner.max_decoding_message_size(limit);
110 self
111 }
112 #[must_use]
116 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
117 self.inner = self.inner.max_encoding_message_size(limit);
118 self
119 }
120 pub async fn check_permissions(
122 &mut self,
123 request: impl tonic::IntoRequest<super::CheckPermissionsRequest>,
124 ) -> std::result::Result<
125 tonic::Response<super::CheckPermissionsResponse>,
126 tonic::Status,
127 > {
128 self.inner
129 .ready()
130 .await
131 .map_err(|e| {
132 tonic::Status::unknown(
133 format!("Service was not ready: {}", e.into()),
134 )
135 })?;
136 let codec = tonic::codec::ProstCodec::default();
137 let path = http::uri::PathAndQuery::from_static(
138 "/nominal.authorization.permissions.v1.PermissionService/CheckPermissions",
139 );
140 let mut req = request.into_request();
141 req.extensions_mut()
142 .insert(
143 GrpcMethod::new(
144 "nominal.authorization.permissions.v1.PermissionService",
145 "CheckPermissions",
146 ),
147 );
148 self.inner.unary(req, path, codec).await
149 }
150 }
151}