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