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    #[prost(bool, tag = "5")]
18    pub is_guest: bool,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct IssueSandboxTokenRequest {
22    #[prost(int64, optional, tag = "1")]
23    pub requested_ttl_seconds: ::core::option::Option<i64>,
24    #[prost(string, optional, tag = "2")]
25    pub shared_secret: ::core::option::Option<::prost::alloc::string::String>,
26    #[prost(enumeration = "SandboxWorkspace", tag = "3")]
27    pub sandbox_workspace: i32,
28    #[prost(bool, tag = "4")]
29    pub is_admin: bool,
30}
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct IssueSandboxTokenResponse {
33    #[prost(string, tag = "1")]
34    pub access_token: ::prost::alloc::string::String,
35    #[prost(int64, tag = "2")]
36    pub expires_at_seconds: i64,
37    #[prost(string, tag = "3")]
38    pub user_uuid: ::prost::alloc::string::String,
39    #[prost(string, tag = "4")]
40    pub org_uuid: ::prost::alloc::string::String,
41    #[prost(string, tag = "5")]
42    pub workspace_rid: ::prost::alloc::string::String,
43}
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
45#[repr(i32)]
46pub enum SandboxWorkspace {
47    Unspecified = 0,
48    Primary = 1,
49    Secondary = 2,
50}
51impl SandboxWorkspace {
52    /// String value of the enum field names used in the ProtoBuf definition.
53    ///
54    /// The values are not transformed in any way and thus are considered stable
55    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
56    pub fn as_str_name(&self) -> &'static str {
57        match self {
58            Self::Unspecified => "SANDBOX_WORKSPACE_UNSPECIFIED",
59            Self::Primary => "SANDBOX_WORKSPACE_PRIMARY",
60            Self::Secondary => "SANDBOX_WORKSPACE_SECONDARY",
61        }
62    }
63    /// Creates an enum from field names used in the ProtoBuf definition.
64    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
65        match value {
66            "SANDBOX_WORKSPACE_UNSPECIFIED" => Some(Self::Unspecified),
67            "SANDBOX_WORKSPACE_PRIMARY" => Some(Self::Primary),
68            "SANDBOX_WORKSPACE_SECONDARY" => Some(Self::Secondary),
69            _ => None,
70        }
71    }
72}
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
74#[repr(i32)]
75pub enum InternalApiKeyError {
76    ApiKeyNotFound = 0,
77}
78impl InternalApiKeyError {
79    /// String value of the enum field names used in the ProtoBuf definition.
80    ///
81    /// The values are not transformed in any way and thus are considered stable
82    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
83    pub fn as_str_name(&self) -> &'static str {
84        match self {
85            Self::ApiKeyNotFound => "INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND",
86        }
87    }
88    /// Creates an enum from field names used in the ProtoBuf definition.
89    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
90        match value {
91            "INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND" => Some(Self::ApiKeyNotFound),
92            _ => None,
93        }
94    }
95}
96#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
97#[repr(i32)]
98pub enum InternalSandboxTokenError {
99    SandboxTokenUnavailable = 0,
100}
101impl InternalSandboxTokenError {
102    /// String value of the enum field names used in the ProtoBuf definition.
103    ///
104    /// The values are not transformed in any way and thus are considered stable
105    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
106    pub fn as_str_name(&self) -> &'static str {
107        match self {
108            Self::SandboxTokenUnavailable => {
109                "INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE"
110            }
111        }
112    }
113    /// Creates an enum from field names used in the ProtoBuf definition.
114    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
115        match value {
116            "INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE" => {
117                Some(Self::SandboxTokenUnavailable)
118            }
119            _ => None,
120        }
121    }
122}
123/// Generated client implementations.
124pub mod internal_api_key_service_client {
125    #![allow(
126        unused_variables,
127        dead_code,
128        missing_docs,
129        clippy::wildcard_imports,
130        clippy::let_unit_value,
131    )]
132    use tonic::codegen::*;
133    use tonic::codegen::http::Uri;
134    #[derive(Debug, Clone)]
135    pub struct InternalApiKeyServiceClient<T> {
136        inner: tonic::client::Grpc<T>,
137    }
138    impl InternalApiKeyServiceClient<tonic::transport::Channel> {
139        /// Attempt to create a new client by connecting to a given endpoint.
140        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
141        where
142            D: TryInto<tonic::transport::Endpoint>,
143            D::Error: Into<StdError>,
144        {
145            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
146            Ok(Self::new(conn))
147        }
148    }
149    impl<T> InternalApiKeyServiceClient<T>
150    where
151        T: tonic::client::GrpcService<tonic::body::Body>,
152        T::Error: Into<StdError>,
153        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
154        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
155    {
156        pub fn new(inner: T) -> Self {
157            let inner = tonic::client::Grpc::new(inner);
158            Self { inner }
159        }
160        pub fn with_origin(inner: T, origin: Uri) -> Self {
161            let inner = tonic::client::Grpc::with_origin(inner, origin);
162            Self { inner }
163        }
164        pub fn with_interceptor<F>(
165            inner: T,
166            interceptor: F,
167        ) -> InternalApiKeyServiceClient<InterceptedService<T, F>>
168        where
169            F: tonic::service::Interceptor,
170            T::ResponseBody: Default,
171            T: tonic::codegen::Service<
172                http::Request<tonic::body::Body>,
173                Response = http::Response<
174                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
175                >,
176            >,
177            <T as tonic::codegen::Service<
178                http::Request<tonic::body::Body>,
179            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
180        {
181            InternalApiKeyServiceClient::new(InterceptedService::new(inner, interceptor))
182        }
183        /// Compress requests with the given encoding.
184        ///
185        /// This requires the server to support it otherwise it might respond with an
186        /// error.
187        #[must_use]
188        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
189            self.inner = self.inner.send_compressed(encoding);
190            self
191        }
192        /// Enable decompressing responses.
193        #[must_use]
194        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
195            self.inner = self.inner.accept_compressed(encoding);
196            self
197        }
198        /// Limits the maximum size of a decoded message.
199        ///
200        /// Default: `4MB`
201        #[must_use]
202        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
203            self.inner = self.inner.max_decoding_message_size(limit);
204            self
205        }
206        /// Limits the maximum size of an encoded message.
207        ///
208        /// Default: `usize::MAX`
209        #[must_use]
210        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
211            self.inner = self.inner.max_encoding_message_size(limit);
212            self
213        }
214        pub async fn get_access_token_from_api_key_value(
215            &mut self,
216            request: impl tonic::IntoRequest<super::GetAccessTokenFromApiKeyRequest>,
217        ) -> std::result::Result<
218            tonic::Response<super::GetAccessTokenFromApiKeyResponse>,
219            tonic::Status,
220        > {
221            self.inner
222                .ready()
223                .await
224                .map_err(|e| {
225                    tonic::Status::unknown(
226                        format!("Service was not ready: {}", e.into()),
227                    )
228                })?;
229            let codec = tonic::codec::ProstCodec::default();
230            let path = http::uri::PathAndQuery::from_static(
231                "/nominal.internalauthorization.v1.InternalApiKeyService/GetAccessTokenFromApiKeyValue",
232            );
233            let mut req = request.into_request();
234            req.extensions_mut()
235                .insert(
236                    GrpcMethod::new(
237                        "nominal.internalauthorization.v1.InternalApiKeyService",
238                        "GetAccessTokenFromApiKeyValue",
239                    ),
240                );
241            self.inner.unary(req, path, codec).await
242        }
243    }
244}
245/// Generated client implementations.
246pub mod internal_sandbox_token_service_client {
247    #![allow(
248        unused_variables,
249        dead_code,
250        missing_docs,
251        clippy::wildcard_imports,
252        clippy::let_unit_value,
253    )]
254    use tonic::codegen::*;
255    use tonic::codegen::http::Uri;
256    #[derive(Debug, Clone)]
257    pub struct InternalSandboxTokenServiceClient<T> {
258        inner: tonic::client::Grpc<T>,
259    }
260    impl InternalSandboxTokenServiceClient<tonic::transport::Channel> {
261        /// Attempt to create a new client by connecting to a given endpoint.
262        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
263        where
264            D: TryInto<tonic::transport::Endpoint>,
265            D::Error: Into<StdError>,
266        {
267            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
268            Ok(Self::new(conn))
269        }
270    }
271    impl<T> InternalSandboxTokenServiceClient<T>
272    where
273        T: tonic::client::GrpcService<tonic::body::Body>,
274        T::Error: Into<StdError>,
275        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
276        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
277    {
278        pub fn new(inner: T) -> Self {
279            let inner = tonic::client::Grpc::new(inner);
280            Self { inner }
281        }
282        pub fn with_origin(inner: T, origin: Uri) -> Self {
283            let inner = tonic::client::Grpc::with_origin(inner, origin);
284            Self { inner }
285        }
286        pub fn with_interceptor<F>(
287            inner: T,
288            interceptor: F,
289        ) -> InternalSandboxTokenServiceClient<InterceptedService<T, F>>
290        where
291            F: tonic::service::Interceptor,
292            T::ResponseBody: Default,
293            T: tonic::codegen::Service<
294                http::Request<tonic::body::Body>,
295                Response = http::Response<
296                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
297                >,
298            >,
299            <T as tonic::codegen::Service<
300                http::Request<tonic::body::Body>,
301            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
302        {
303            InternalSandboxTokenServiceClient::new(
304                InterceptedService::new(inner, interceptor),
305            )
306        }
307        /// Compress requests with the given encoding.
308        ///
309        /// This requires the server to support it otherwise it might respond with an
310        /// error.
311        #[must_use]
312        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
313            self.inner = self.inner.send_compressed(encoding);
314            self
315        }
316        /// Enable decompressing responses.
317        #[must_use]
318        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
319            self.inner = self.inner.accept_compressed(encoding);
320            self
321        }
322        /// Limits the maximum size of a decoded message.
323        ///
324        /// Default: `4MB`
325        #[must_use]
326        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
327            self.inner = self.inner.max_decoding_message_size(limit);
328            self
329        }
330        /// Limits the maximum size of an encoded message.
331        ///
332        /// Default: `usize::MAX`
333        #[must_use]
334        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
335            self.inner = self.inner.max_encoding_message_size(limit);
336            self
337        }
338        pub async fn issue_sandbox_token(
339            &mut self,
340            request: impl tonic::IntoRequest<super::IssueSandboxTokenRequest>,
341        ) -> std::result::Result<
342            tonic::Response<super::IssueSandboxTokenResponse>,
343            tonic::Status,
344        > {
345            self.inner
346                .ready()
347                .await
348                .map_err(|e| {
349                    tonic::Status::unknown(
350                        format!("Service was not ready: {}", e.into()),
351                    )
352                })?;
353            let codec = tonic::codec::ProstCodec::default();
354            let path = http::uri::PathAndQuery::from_static(
355                "/nominal.internalauthorization.v1.InternalSandboxTokenService/IssueSandboxToken",
356            );
357            let mut req = request.into_request();
358            req.extensions_mut()
359                .insert(
360                    GrpcMethod::new(
361                        "nominal.internalauthorization.v1.InternalSandboxTokenService",
362                        "IssueSandboxToken",
363                    ),
364                );
365            self.inner.unary(req, path, codec).await
366        }
367    }
368}
369#[derive(Clone, Copy, PartialEq, ::prost::Message)]
370pub struct GetSystemWorkspaceRidRequest {}
371#[derive(Clone, PartialEq, ::prost::Message)]
372pub struct GetSystemWorkspaceRidResponse {
373    #[prost(string, optional, tag = "1")]
374    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
375    #[prost(string, optional, tag = "2")]
376    pub service_user_rid: ::core::option::Option<::prost::alloc::string::String>,
377    #[prost(string, optional, tag = "3")]
378    pub org_rid: ::core::option::Option<::prost::alloc::string::String>,
379}
380#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
381#[repr(i32)]
382pub enum InternalSystemWorkspaceError {
383    SystemWorkspaceUnavailable = 0,
384}
385impl InternalSystemWorkspaceError {
386    /// String value of the enum field names used in the ProtoBuf definition.
387    ///
388    /// The values are not transformed in any way and thus are considered stable
389    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
390    pub fn as_str_name(&self) -> &'static str {
391        match self {
392            Self::SystemWorkspaceUnavailable => {
393                "INTERNAL_SYSTEM_WORKSPACE_ERROR_SYSTEM_WORKSPACE_UNAVAILABLE"
394            }
395        }
396    }
397    /// Creates an enum from field names used in the ProtoBuf definition.
398    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
399        match value {
400            "INTERNAL_SYSTEM_WORKSPACE_ERROR_SYSTEM_WORKSPACE_UNAVAILABLE" => {
401                Some(Self::SystemWorkspaceUnavailable)
402            }
403            _ => None,
404        }
405    }
406}
407/// Generated client implementations.
408pub mod internal_system_workspace_service_client {
409    #![allow(
410        unused_variables,
411        dead_code,
412        missing_docs,
413        clippy::wildcard_imports,
414        clippy::let_unit_value,
415    )]
416    use tonic::codegen::*;
417    use tonic::codegen::http::Uri;
418    #[derive(Debug, Clone)]
419    pub struct InternalSystemWorkspaceServiceClient<T> {
420        inner: tonic::client::Grpc<T>,
421    }
422    impl InternalSystemWorkspaceServiceClient<tonic::transport::Channel> {
423        /// Attempt to create a new client by connecting to a given endpoint.
424        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
425        where
426            D: TryInto<tonic::transport::Endpoint>,
427            D::Error: Into<StdError>,
428        {
429            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
430            Ok(Self::new(conn))
431        }
432    }
433    impl<T> InternalSystemWorkspaceServiceClient<T>
434    where
435        T: tonic::client::GrpcService<tonic::body::Body>,
436        T::Error: Into<StdError>,
437        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
438        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
439    {
440        pub fn new(inner: T) -> Self {
441            let inner = tonic::client::Grpc::new(inner);
442            Self { inner }
443        }
444        pub fn with_origin(inner: T, origin: Uri) -> Self {
445            let inner = tonic::client::Grpc::with_origin(inner, origin);
446            Self { inner }
447        }
448        pub fn with_interceptor<F>(
449            inner: T,
450            interceptor: F,
451        ) -> InternalSystemWorkspaceServiceClient<InterceptedService<T, F>>
452        where
453            F: tonic::service::Interceptor,
454            T::ResponseBody: Default,
455            T: tonic::codegen::Service<
456                http::Request<tonic::body::Body>,
457                Response = http::Response<
458                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
459                >,
460            >,
461            <T as tonic::codegen::Service<
462                http::Request<tonic::body::Body>,
463            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
464        {
465            InternalSystemWorkspaceServiceClient::new(
466                InterceptedService::new(inner, interceptor),
467            )
468        }
469        /// Compress requests with the given encoding.
470        ///
471        /// This requires the server to support it otherwise it might respond with an
472        /// error.
473        #[must_use]
474        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
475            self.inner = self.inner.send_compressed(encoding);
476            self
477        }
478        /// Enable decompressing responses.
479        #[must_use]
480        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
481            self.inner = self.inner.accept_compressed(encoding);
482            self
483        }
484        /// Limits the maximum size of a decoded message.
485        ///
486        /// Default: `4MB`
487        #[must_use]
488        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
489            self.inner = self.inner.max_decoding_message_size(limit);
490            self
491        }
492        /// Limits the maximum size of an encoded message.
493        ///
494        /// Default: `usize::MAX`
495        #[must_use]
496        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
497            self.inner = self.inner.max_encoding_message_size(limit);
498            self
499        }
500        pub async fn get_system_workspace_rid(
501            &mut self,
502            request: impl tonic::IntoRequest<super::GetSystemWorkspaceRidRequest>,
503        ) -> std::result::Result<
504            tonic::Response<super::GetSystemWorkspaceRidResponse>,
505            tonic::Status,
506        > {
507            self.inner
508                .ready()
509                .await
510                .map_err(|e| {
511                    tonic::Status::unknown(
512                        format!("Service was not ready: {}", e.into()),
513                    )
514                })?;
515            let codec = tonic::codec::ProstCodec::default();
516            let path = http::uri::PathAndQuery::from_static(
517                "/nominal.internalauthorization.v1.InternalSystemWorkspaceService/GetSystemWorkspaceRid",
518            );
519            let mut req = request.into_request();
520            req.extensions_mut()
521                .insert(
522                    GrpcMethod::new(
523                        "nominal.internalauthorization.v1.InternalSystemWorkspaceService",
524                        "GetSystemWorkspaceRid",
525                    ),
526                );
527            self.inner.unary(req, path, codec).await
528        }
529    }
530}