Skip to main content

nominal_api_proto/proto/
nominal.internalauthorization.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GetAccessTokenFromApiKeyRequest {
4    #[prost(string, tag = "1")]
5    pub api_key_value: ::prost::alloc::string::String,
6}
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct GetAccessTokenFromApiKeyResponse {
9    #[prost(string, tag = "1")]
10    pub access_token: ::prost::alloc::string::String,
11    #[prost(int64, tag = "2")]
12    pub expires_at_seconds: i64,
13    #[prost(string, tag = "3")]
14    pub user_uuid: ::prost::alloc::string::String,
15    #[prost(string, tag = "4")]
16    pub org_uuid: ::prost::alloc::string::String,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct IssueSandboxTokenRequest {
20    #[prost(int64, optional, tag = "1")]
21    pub requested_ttl_seconds: ::core::option::Option<i64>,
22    #[prost(string, optional, tag = "2")]
23    pub shared_secret: ::core::option::Option<::prost::alloc::string::String>,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct IssueSandboxTokenResponse {
27    #[prost(string, tag = "1")]
28    pub access_token: ::prost::alloc::string::String,
29    #[prost(int64, tag = "2")]
30    pub expires_at_seconds: i64,
31    #[prost(string, tag = "3")]
32    pub user_uuid: ::prost::alloc::string::String,
33    #[prost(string, tag = "4")]
34    pub org_uuid: ::prost::alloc::string::String,
35    #[prost(string, tag = "5")]
36    pub workspace_rid: ::prost::alloc::string::String,
37}
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
39#[repr(i32)]
40pub enum InternalApiKeyError {
41    ApiKeyNotFound = 0,
42}
43impl InternalApiKeyError {
44    /// String value of the enum field names used in the ProtoBuf definition.
45    ///
46    /// The values are not transformed in any way and thus are considered stable
47    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
48    pub fn as_str_name(&self) -> &'static str {
49        match self {
50            Self::ApiKeyNotFound => "INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND",
51        }
52    }
53    /// Creates an enum from field names used in the ProtoBuf definition.
54    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
55        match value {
56            "INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND" => Some(Self::ApiKeyNotFound),
57            _ => None,
58        }
59    }
60}
61#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
62#[repr(i32)]
63pub enum InternalSandboxTokenError {
64    SandboxTokenUnavailable = 0,
65}
66impl InternalSandboxTokenError {
67    /// String value of the enum field names used in the ProtoBuf definition.
68    ///
69    /// The values are not transformed in any way and thus are considered stable
70    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
71    pub fn as_str_name(&self) -> &'static str {
72        match self {
73            Self::SandboxTokenUnavailable => {
74                "INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE"
75            }
76        }
77    }
78    /// Creates an enum from field names used in the ProtoBuf definition.
79    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
80        match value {
81            "INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE" => {
82                Some(Self::SandboxTokenUnavailable)
83            }
84            _ => None,
85        }
86    }
87}
88/// Generated client implementations.
89pub mod internal_api_key_service_client {
90    #![allow(
91        unused_variables,
92        dead_code,
93        missing_docs,
94        clippy::wildcard_imports,
95        clippy::let_unit_value,
96    )]
97    use tonic::codegen::*;
98    use tonic::codegen::http::Uri;
99    #[derive(Debug, Clone)]
100    pub struct InternalApiKeyServiceClient<T> {
101        inner: tonic::client::Grpc<T>,
102    }
103    impl InternalApiKeyServiceClient<tonic::transport::Channel> {
104        /// Attempt to create a new client by connecting to a given endpoint.
105        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
106        where
107            D: TryInto<tonic::transport::Endpoint>,
108            D::Error: Into<StdError>,
109        {
110            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
111            Ok(Self::new(conn))
112        }
113    }
114    impl<T> InternalApiKeyServiceClient<T>
115    where
116        T: tonic::client::GrpcService<tonic::body::Body>,
117        T::Error: Into<StdError>,
118        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
119        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
120    {
121        pub fn new(inner: T) -> Self {
122            let inner = tonic::client::Grpc::new(inner);
123            Self { inner }
124        }
125        pub fn with_origin(inner: T, origin: Uri) -> Self {
126            let inner = tonic::client::Grpc::with_origin(inner, origin);
127            Self { inner }
128        }
129        pub fn with_interceptor<F>(
130            inner: T,
131            interceptor: F,
132        ) -> InternalApiKeyServiceClient<InterceptedService<T, F>>
133        where
134            F: tonic::service::Interceptor,
135            T::ResponseBody: Default,
136            T: tonic::codegen::Service<
137                http::Request<tonic::body::Body>,
138                Response = http::Response<
139                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
140                >,
141            >,
142            <T as tonic::codegen::Service<
143                http::Request<tonic::body::Body>,
144            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
145        {
146            InternalApiKeyServiceClient::new(InterceptedService::new(inner, interceptor))
147        }
148        /// Compress requests with the given encoding.
149        ///
150        /// This requires the server to support it otherwise it might respond with an
151        /// error.
152        #[must_use]
153        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
154            self.inner = self.inner.send_compressed(encoding);
155            self
156        }
157        /// Enable decompressing responses.
158        #[must_use]
159        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
160            self.inner = self.inner.accept_compressed(encoding);
161            self
162        }
163        /// Limits the maximum size of a decoded message.
164        ///
165        /// Default: `4MB`
166        #[must_use]
167        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
168            self.inner = self.inner.max_decoding_message_size(limit);
169            self
170        }
171        /// Limits the maximum size of an encoded message.
172        ///
173        /// Default: `usize::MAX`
174        #[must_use]
175        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
176            self.inner = self.inner.max_encoding_message_size(limit);
177            self
178        }
179        pub async fn get_access_token_from_api_key_value(
180            &mut self,
181            request: impl tonic::IntoRequest<super::GetAccessTokenFromApiKeyRequest>,
182        ) -> std::result::Result<
183            tonic::Response<super::GetAccessTokenFromApiKeyResponse>,
184            tonic::Status,
185        > {
186            self.inner
187                .ready()
188                .await
189                .map_err(|e| {
190                    tonic::Status::unknown(
191                        format!("Service was not ready: {}", e.into()),
192                    )
193                })?;
194            let codec = tonic::codec::ProstCodec::default();
195            let path = http::uri::PathAndQuery::from_static(
196                "/nominal.internalauthorization.v1.InternalApiKeyService/GetAccessTokenFromApiKeyValue",
197            );
198            let mut req = request.into_request();
199            req.extensions_mut()
200                .insert(
201                    GrpcMethod::new(
202                        "nominal.internalauthorization.v1.InternalApiKeyService",
203                        "GetAccessTokenFromApiKeyValue",
204                    ),
205                );
206            self.inner.unary(req, path, codec).await
207        }
208    }
209}
210/// Generated client implementations.
211pub mod internal_sandbox_token_service_client {
212    #![allow(
213        unused_variables,
214        dead_code,
215        missing_docs,
216        clippy::wildcard_imports,
217        clippy::let_unit_value,
218    )]
219    use tonic::codegen::*;
220    use tonic::codegen::http::Uri;
221    #[derive(Debug, Clone)]
222    pub struct InternalSandboxTokenServiceClient<T> {
223        inner: tonic::client::Grpc<T>,
224    }
225    impl InternalSandboxTokenServiceClient<tonic::transport::Channel> {
226        /// Attempt to create a new client by connecting to a given endpoint.
227        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
228        where
229            D: TryInto<tonic::transport::Endpoint>,
230            D::Error: Into<StdError>,
231        {
232            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
233            Ok(Self::new(conn))
234        }
235    }
236    impl<T> InternalSandboxTokenServiceClient<T>
237    where
238        T: tonic::client::GrpcService<tonic::body::Body>,
239        T::Error: Into<StdError>,
240        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
241        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
242    {
243        pub fn new(inner: T) -> Self {
244            let inner = tonic::client::Grpc::new(inner);
245            Self { inner }
246        }
247        pub fn with_origin(inner: T, origin: Uri) -> Self {
248            let inner = tonic::client::Grpc::with_origin(inner, origin);
249            Self { inner }
250        }
251        pub fn with_interceptor<F>(
252            inner: T,
253            interceptor: F,
254        ) -> InternalSandboxTokenServiceClient<InterceptedService<T, F>>
255        where
256            F: tonic::service::Interceptor,
257            T::ResponseBody: Default,
258            T: tonic::codegen::Service<
259                http::Request<tonic::body::Body>,
260                Response = http::Response<
261                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
262                >,
263            >,
264            <T as tonic::codegen::Service<
265                http::Request<tonic::body::Body>,
266            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
267        {
268            InternalSandboxTokenServiceClient::new(
269                InterceptedService::new(inner, interceptor),
270            )
271        }
272        /// Compress requests with the given encoding.
273        ///
274        /// This requires the server to support it otherwise it might respond with an
275        /// error.
276        #[must_use]
277        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
278            self.inner = self.inner.send_compressed(encoding);
279            self
280        }
281        /// Enable decompressing responses.
282        #[must_use]
283        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
284            self.inner = self.inner.accept_compressed(encoding);
285            self
286        }
287        /// Limits the maximum size of a decoded message.
288        ///
289        /// Default: `4MB`
290        #[must_use]
291        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
292            self.inner = self.inner.max_decoding_message_size(limit);
293            self
294        }
295        /// Limits the maximum size of an encoded message.
296        ///
297        /// Default: `usize::MAX`
298        #[must_use]
299        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
300            self.inner = self.inner.max_encoding_message_size(limit);
301            self
302        }
303        pub async fn issue_sandbox_token(
304            &mut self,
305            request: impl tonic::IntoRequest<super::IssueSandboxTokenRequest>,
306        ) -> std::result::Result<
307            tonic::Response<super::IssueSandboxTokenResponse>,
308            tonic::Status,
309        > {
310            self.inner
311                .ready()
312                .await
313                .map_err(|e| {
314                    tonic::Status::unknown(
315                        format!("Service was not ready: {}", e.into()),
316                    )
317                })?;
318            let codec = tonic::codec::ProstCodec::default();
319            let path = http::uri::PathAndQuery::from_static(
320                "/nominal.internalauthorization.v1.InternalSandboxTokenService/IssueSandboxToken",
321            );
322            let mut req = request.into_request();
323            req.extensions_mut()
324                .insert(
325                    GrpcMethod::new(
326                        "nominal.internalauthorization.v1.InternalSandboxTokenService",
327                        "IssueSandboxToken",
328                    ),
329                );
330            self.inner.unary(req, path, codec).await
331        }
332    }
333}