Skip to main content

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

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct AccessToken {
4    #[prost(string, tag = "1")]
5    pub token: ::prost::alloc::string::String,
6    #[prost(int64, tag = "2")]
7    pub expires_at_seconds: i64,
8    #[prost(string, tag = "3")]
9    pub user_rid: ::prost::alloc::string::String,
10    #[prost(string, tag = "4")]
11    pub org_rid: ::prost::alloc::string::String,
12    #[prost(bool, tag = "5")]
13    pub is_guest: bool,
14}
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct GetAccessTokenFromProxyJwtRequest {
17    #[prost(string, tag = "1")]
18    pub proxy_jwt: ::prost::alloc::string::String,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct GetAccessTokenFromProxyJwtResponse {
22    #[prost(message, optional, tag = "1")]
23    pub access_token: ::core::option::Option<AccessToken>,
24}
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
26#[repr(i32)]
27pub enum InternalProxyJwtError {
28    ProxyJwtUnavailable = 0,
29}
30impl InternalProxyJwtError {
31    /// String value of the enum field names used in the ProtoBuf definition.
32    ///
33    /// The values are not transformed in any way and thus are considered stable
34    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
35    pub fn as_str_name(&self) -> &'static str {
36        match self {
37            Self::ProxyJwtUnavailable => "INTERNAL_PROXY_JWT_ERROR_PROXY_JWT_UNAVAILABLE",
38        }
39    }
40    /// Creates an enum from field names used in the ProtoBuf definition.
41    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
42        match value {
43            "INTERNAL_PROXY_JWT_ERROR_PROXY_JWT_UNAVAILABLE" => {
44                Some(Self::ProxyJwtUnavailable)
45            }
46            _ => None,
47        }
48    }
49}
50/// Generated client implementations.
51pub mod internal_proxy_jwt_service_client {
52    #![allow(
53        unused_variables,
54        dead_code,
55        missing_docs,
56        clippy::wildcard_imports,
57        clippy::let_unit_value,
58    )]
59    use tonic::codegen::*;
60    use tonic::codegen::http::Uri;
61    #[derive(Debug, Clone)]
62    pub struct InternalProxyJwtServiceClient<T> {
63        inner: tonic::client::Grpc<T>,
64    }
65    impl InternalProxyJwtServiceClient<tonic::transport::Channel> {
66        /// Attempt to create a new client by connecting to a given endpoint.
67        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
68        where
69            D: TryInto<tonic::transport::Endpoint>,
70            D::Error: Into<StdError>,
71        {
72            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
73            Ok(Self::new(conn))
74        }
75    }
76    impl<T> InternalProxyJwtServiceClient<T>
77    where
78        T: tonic::client::GrpcService<tonic::body::Body>,
79        T::Error: Into<StdError>,
80        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
81        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
82    {
83        pub fn new(inner: T) -> Self {
84            let inner = tonic::client::Grpc::new(inner);
85            Self { inner }
86        }
87        pub fn with_origin(inner: T, origin: Uri) -> Self {
88            let inner = tonic::client::Grpc::with_origin(inner, origin);
89            Self { inner }
90        }
91        pub fn with_interceptor<F>(
92            inner: T,
93            interceptor: F,
94        ) -> InternalProxyJwtServiceClient<InterceptedService<T, F>>
95        where
96            F: tonic::service::Interceptor,
97            T::ResponseBody: Default,
98            T: tonic::codegen::Service<
99                http::Request<tonic::body::Body>,
100                Response = http::Response<
101                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
102                >,
103            >,
104            <T as tonic::codegen::Service<
105                http::Request<tonic::body::Body>,
106            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
107        {
108            InternalProxyJwtServiceClient::new(
109                InterceptedService::new(inner, interceptor),
110            )
111        }
112        /// Compress requests with the given encoding.
113        ///
114        /// This requires the server to support it otherwise it might respond with an
115        /// error.
116        #[must_use]
117        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
118            self.inner = self.inner.send_compressed(encoding);
119            self
120        }
121        /// Enable decompressing responses.
122        #[must_use]
123        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
124            self.inner = self.inner.accept_compressed(encoding);
125            self
126        }
127        /// Limits the maximum size of a decoded message.
128        ///
129        /// Default: `4MB`
130        #[must_use]
131        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
132            self.inner = self.inner.max_decoding_message_size(limit);
133            self
134        }
135        /// Limits the maximum size of an encoded message.
136        ///
137        /// Default: `usize::MAX`
138        #[must_use]
139        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
140            self.inner = self.inner.max_encoding_message_size(limit);
141            self
142        }
143        pub async fn get_access_token_from_proxy_jwt(
144            &mut self,
145            request: impl tonic::IntoRequest<super::GetAccessTokenFromProxyJwtRequest>,
146        ) -> std::result::Result<
147            tonic::Response<super::GetAccessTokenFromProxyJwtResponse>,
148            tonic::Status,
149        > {
150            self.inner
151                .ready()
152                .await
153                .map_err(|e| {
154                    tonic::Status::unknown(
155                        format!("Service was not ready: {}", e.into()),
156                    )
157                })?;
158            let codec = tonic::codec::ProstCodec::default();
159            let path = http::uri::PathAndQuery::from_static(
160                "/nominal.authorization.internal.v1.InternalProxyJwtService/GetAccessTokenFromProxyJwt",
161            );
162            let mut req = request.into_request();
163            req.extensions_mut()
164                .insert(
165                    GrpcMethod::new(
166                        "nominal.authorization.internal.v1.InternalProxyJwtService",
167                        "GetAccessTokenFromProxyJwt",
168                    ),
169                );
170            self.inner.unary(req, path, codec).await
171        }
172    }
173}
174#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct BeginRefreshRequest {
176    #[prost(string, tag = "1")]
177    pub credential_hash: ::prost::alloc::string::String,
178    #[prost(int64, tag = "2")]
179    pub lock_ttl_seconds: i64,
180}
181#[derive(Clone, PartialEq, ::prost::Message)]
182pub struct BeginRefreshResponse {
183    #[prost(enumeration = "RefreshCoordinationDecision", tag = "1")]
184    pub decision: i32,
185    #[prost(string, optional, tag = "2")]
186    pub encrypted_result: ::core::option::Option<::prost::alloc::string::String>,
187    #[prost(string, optional, tag = "3")]
188    pub lock_token: ::core::option::Option<::prost::alloc::string::String>,
189}
190#[derive(Clone, PartialEq, ::prost::Message)]
191pub struct CompleteRefreshRequest {
192    #[prost(string, tag = "1")]
193    pub credential_hash: ::prost::alloc::string::String,
194    #[prost(string, tag = "2")]
195    pub encrypted_result: ::prost::alloc::string::String,
196    #[prost(int64, tag = "3")]
197    pub result_ttl_seconds: i64,
198}
199#[derive(Clone, Copy, PartialEq, ::prost::Message)]
200pub struct CompleteRefreshResponse {}
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct AbandonRefreshRequest {
203    #[prost(string, tag = "1")]
204    pub credential_hash: ::prost::alloc::string::String,
205    #[prost(string, tag = "2")]
206    pub lock_token: ::prost::alloc::string::String,
207}
208#[derive(Clone, Copy, PartialEq, ::prost::Message)]
209pub struct AbandonRefreshResponse {}
210#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
211#[repr(i32)]
212pub enum RefreshCoordinationDecision {
213    Unspecified = 0,
214    Acquired = 1,
215    Wait = 2,
216    ResultAvailable = 3,
217}
218impl RefreshCoordinationDecision {
219    /// String value of the enum field names used in the ProtoBuf definition.
220    ///
221    /// The values are not transformed in any way and thus are considered stable
222    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
223    pub fn as_str_name(&self) -> &'static str {
224        match self {
225            Self::Unspecified => "REFRESH_COORDINATION_DECISION_UNSPECIFIED",
226            Self::Acquired => "REFRESH_COORDINATION_DECISION_ACQUIRED",
227            Self::Wait => "REFRESH_COORDINATION_DECISION_WAIT",
228            Self::ResultAvailable => "REFRESH_COORDINATION_DECISION_RESULT_AVAILABLE",
229        }
230    }
231    /// Creates an enum from field names used in the ProtoBuf definition.
232    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
233        match value {
234            "REFRESH_COORDINATION_DECISION_UNSPECIFIED" => Some(Self::Unspecified),
235            "REFRESH_COORDINATION_DECISION_ACQUIRED" => Some(Self::Acquired),
236            "REFRESH_COORDINATION_DECISION_WAIT" => Some(Self::Wait),
237            "REFRESH_COORDINATION_DECISION_RESULT_AVAILABLE" => {
238                Some(Self::ResultAvailable)
239            }
240            _ => None,
241        }
242    }
243}
244/// Generated client implementations.
245pub mod internal_refresh_coordination_service_client {
246    #![allow(
247        unused_variables,
248        dead_code,
249        missing_docs,
250        clippy::wildcard_imports,
251        clippy::let_unit_value,
252    )]
253    use tonic::codegen::*;
254    use tonic::codegen::http::Uri;
255    #[derive(Debug, Clone)]
256    pub struct InternalRefreshCoordinationServiceClient<T> {
257        inner: tonic::client::Grpc<T>,
258    }
259    impl InternalRefreshCoordinationServiceClient<tonic::transport::Channel> {
260        /// Attempt to create a new client by connecting to a given endpoint.
261        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
262        where
263            D: TryInto<tonic::transport::Endpoint>,
264            D::Error: Into<StdError>,
265        {
266            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
267            Ok(Self::new(conn))
268        }
269    }
270    impl<T> InternalRefreshCoordinationServiceClient<T>
271    where
272        T: tonic::client::GrpcService<tonic::body::Body>,
273        T::Error: Into<StdError>,
274        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
275        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
276    {
277        pub fn new(inner: T) -> Self {
278            let inner = tonic::client::Grpc::new(inner);
279            Self { inner }
280        }
281        pub fn with_origin(inner: T, origin: Uri) -> Self {
282            let inner = tonic::client::Grpc::with_origin(inner, origin);
283            Self { inner }
284        }
285        pub fn with_interceptor<F>(
286            inner: T,
287            interceptor: F,
288        ) -> InternalRefreshCoordinationServiceClient<InterceptedService<T, F>>
289        where
290            F: tonic::service::Interceptor,
291            T::ResponseBody: Default,
292            T: tonic::codegen::Service<
293                http::Request<tonic::body::Body>,
294                Response = http::Response<
295                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
296                >,
297            >,
298            <T as tonic::codegen::Service<
299                http::Request<tonic::body::Body>,
300            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
301        {
302            InternalRefreshCoordinationServiceClient::new(
303                InterceptedService::new(inner, interceptor),
304            )
305        }
306        /// Compress requests with the given encoding.
307        ///
308        /// This requires the server to support it otherwise it might respond with an
309        /// error.
310        #[must_use]
311        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
312            self.inner = self.inner.send_compressed(encoding);
313            self
314        }
315        /// Enable decompressing responses.
316        #[must_use]
317        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
318            self.inner = self.inner.accept_compressed(encoding);
319            self
320        }
321        /// Limits the maximum size of a decoded message.
322        ///
323        /// Default: `4MB`
324        #[must_use]
325        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
326            self.inner = self.inner.max_decoding_message_size(limit);
327            self
328        }
329        /// Limits the maximum size of an encoded message.
330        ///
331        /// Default: `usize::MAX`
332        #[must_use]
333        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
334            self.inner = self.inner.max_encoding_message_size(limit);
335            self
336        }
337        pub async fn begin_refresh(
338            &mut self,
339            request: impl tonic::IntoRequest<super::BeginRefreshRequest>,
340        ) -> std::result::Result<
341            tonic::Response<super::BeginRefreshResponse>,
342            tonic::Status,
343        > {
344            self.inner
345                .ready()
346                .await
347                .map_err(|e| {
348                    tonic::Status::unknown(
349                        format!("Service was not ready: {}", e.into()),
350                    )
351                })?;
352            let codec = tonic::codec::ProstCodec::default();
353            let path = http::uri::PathAndQuery::from_static(
354                "/nominal.authorization.internal.v1.InternalRefreshCoordinationService/BeginRefresh",
355            );
356            let mut req = request.into_request();
357            req.extensions_mut()
358                .insert(
359                    GrpcMethod::new(
360                        "nominal.authorization.internal.v1.InternalRefreshCoordinationService",
361                        "BeginRefresh",
362                    ),
363                );
364            self.inner.unary(req, path, codec).await
365        }
366        pub async fn complete_refresh(
367            &mut self,
368            request: impl tonic::IntoRequest<super::CompleteRefreshRequest>,
369        ) -> std::result::Result<
370            tonic::Response<super::CompleteRefreshResponse>,
371            tonic::Status,
372        > {
373            self.inner
374                .ready()
375                .await
376                .map_err(|e| {
377                    tonic::Status::unknown(
378                        format!("Service was not ready: {}", e.into()),
379                    )
380                })?;
381            let codec = tonic::codec::ProstCodec::default();
382            let path = http::uri::PathAndQuery::from_static(
383                "/nominal.authorization.internal.v1.InternalRefreshCoordinationService/CompleteRefresh",
384            );
385            let mut req = request.into_request();
386            req.extensions_mut()
387                .insert(
388                    GrpcMethod::new(
389                        "nominal.authorization.internal.v1.InternalRefreshCoordinationService",
390                        "CompleteRefresh",
391                    ),
392                );
393            self.inner.unary(req, path, codec).await
394        }
395        pub async fn abandon_refresh(
396            &mut self,
397            request: impl tonic::IntoRequest<super::AbandonRefreshRequest>,
398        ) -> std::result::Result<
399            tonic::Response<super::AbandonRefreshResponse>,
400            tonic::Status,
401        > {
402            self.inner
403                .ready()
404                .await
405                .map_err(|e| {
406                    tonic::Status::unknown(
407                        format!("Service was not ready: {}", e.into()),
408                    )
409                })?;
410            let codec = tonic::codec::ProstCodec::default();
411            let path = http::uri::PathAndQuery::from_static(
412                "/nominal.authorization.internal.v1.InternalRefreshCoordinationService/AbandonRefresh",
413            );
414            let mut req = request.into_request();
415            req.extensions_mut()
416                .insert(
417                    GrpcMethod::new(
418                        "nominal.authorization.internal.v1.InternalRefreshCoordinationService",
419                        "AbandonRefresh",
420                    ),
421                );
422            self.inner.unary(req, path, codec).await
423        }
424    }
425}