nominal_api_proto/proto/
nominal.authorization.internal.v1.rs1#[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 pub fn as_str_name(&self) -> &'static str {
34 match self {
35 Self::ProxyJwtUnavailable => "INTERNAL_PROXY_JWT_ERROR_PROXY_JWT_UNAVAILABLE",
36 }
37 }
38 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}
48pub 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 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 #[must_use]
115 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
116 self.inner = self.inner.send_compressed(encoding);
117 self
118 }
119 #[must_use]
121 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
122 self.inner = self.inner.accept_compressed(encoding);
123 self
124 }
125 #[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 #[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}