Skip to main content

nominal_api_proto/proto/
nominal.secrets.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CreateSecretRequest {
4    #[prost(string, tag = "1")]
5    pub name: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub description: ::prost::alloc::string::String,
8    #[prost(string, tag = "3")]
9    pub decrypted_value: ::prost::alloc::string::String,
10    #[prost(map = "string, string", tag = "4")]
11    pub properties: ::std::collections::HashMap<
12        ::prost::alloc::string::String,
13        ::prost::alloc::string::String,
14    >,
15    #[prost(string, repeated, tag = "5")]
16    pub labels: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
17    #[prost(string, optional, tag = "6")]
18    pub workspace: ::core::option::Option<::prost::alloc::string::String>,
19}
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct GetSecretsRequest {
22    #[prost(string, repeated, tag = "1")]
23    pub secret_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct GetSecretsResponse {
27    #[prost(message, repeated, tag = "1")]
28    pub response: ::prost::alloc::vec::Vec<Secret>,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct SearchSecretsQuery {
32    #[prost(string, optional, tag = "1")]
33    pub search_text: ::core::option::Option<::prost::alloc::string::String>,
34    #[prost(string, optional, tag = "2")]
35    pub label: ::core::option::Option<::prost::alloc::string::String>,
36    #[prost(message, optional, tag = "3")]
37    pub property: ::core::option::Option<super::super::types::Property>,
38    #[prost(message, repeated, tag = "4")]
39    pub and: ::prost::alloc::vec::Vec<SearchSecretsQuery>,
40    #[prost(message, repeated, tag = "5")]
41    pub or: ::prost::alloc::vec::Vec<SearchSecretsQuery>,
42    #[prost(string, optional, tag = "6")]
43    pub workspace: ::core::option::Option<::prost::alloc::string::String>,
44}
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct SearchSecretsRequest {
47    #[prost(message, optional, tag = "1")]
48    pub query: ::core::option::Option<SearchSecretsQuery>,
49    #[prost(int32, optional, tag = "2")]
50    pub page_size: ::core::option::Option<i32>,
51    #[prost(message, optional, tag = "3")]
52    pub sort: ::core::option::Option<SortOptions>,
53    #[prost(string, optional, tag = "4")]
54    pub token: ::core::option::Option<::prost::alloc::string::String>,
55    #[prost(enumeration = "super::super::types::ArchivedStatus", repeated, tag = "5")]
56    pub archived_statuses: ::prost::alloc::vec::Vec<i32>,
57}
58#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct SearchSecretsResponse {
60    #[prost(message, repeated, tag = "1")]
61    pub results: ::prost::alloc::vec::Vec<Secret>,
62    #[prost(string, optional, tag = "2")]
63    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
64}
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct Secret {
67    #[prost(string, tag = "1")]
68    pub rid: ::prost::alloc::string::String,
69    #[prost(string, tag = "2")]
70    pub name: ::prost::alloc::string::String,
71    #[prost(string, tag = "3")]
72    pub description: ::prost::alloc::string::String,
73    #[prost(string, tag = "4")]
74    pub created_by: ::prost::alloc::string::String,
75    #[prost(map = "string, string", tag = "5")]
76    pub properties: ::std::collections::HashMap<
77        ::prost::alloc::string::String,
78        ::prost::alloc::string::String,
79    >,
80    #[prost(string, repeated, tag = "6")]
81    pub labels: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
82    #[prost(message, optional, tag = "7")]
83    pub created_at: ::core::option::Option<
84        super::super::super::google::protobuf::Timestamp,
85    >,
86    #[prost(bool, tag = "8")]
87    pub is_archived: bool,
88}
89#[derive(Clone, Copy, PartialEq, ::prost::Message)]
90pub struct SortOptions {
91    #[prost(bool, tag = "1")]
92    pub is_descending: bool,
93    #[prost(enumeration = "SortField", tag = "2")]
94    pub field: i32,
95}
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct UpdateSecretRequest {
98    #[prost(string, optional, tag = "1")]
99    pub name: ::core::option::Option<::prost::alloc::string::String>,
100    #[prost(string, optional, tag = "2")]
101    pub description: ::core::option::Option<::prost::alloc::string::String>,
102    #[prost(message, optional, tag = "3")]
103    pub properties: ::core::option::Option<super::super::types::PropertyUpdateWrapper>,
104    #[prost(message, optional, tag = "4")]
105    pub labels: ::core::option::Option<super::super::types::LabelUpdateWrapper>,
106    #[prost(string, optional, tag = "5")]
107    pub decrypted_value: ::core::option::Option<::prost::alloc::string::String>,
108}
109#[derive(Clone, PartialEq, ::prost::Message)]
110pub struct CreateResponse {
111    #[prost(message, optional, tag = "1")]
112    pub secret: ::core::option::Option<Secret>,
113}
114#[derive(Clone, PartialEq, ::prost::Message)]
115pub struct GetRequest {
116    #[prost(string, tag = "1")]
117    pub rid: ::prost::alloc::string::String,
118}
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct GetResponse {
121    #[prost(message, optional, tag = "1")]
122    pub secret: ::core::option::Option<Secret>,
123}
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct UpdateRequest {
126    #[prost(string, tag = "1")]
127    pub rid: ::prost::alloc::string::String,
128    #[prost(message, optional, tag = "2")]
129    pub request: ::core::option::Option<UpdateSecretRequest>,
130}
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct UpdateResponse {
133    #[prost(message, optional, tag = "1")]
134    pub secret: ::core::option::Option<Secret>,
135}
136#[derive(Clone, PartialEq, ::prost::Message)]
137pub struct DeleteRequest {
138    #[prost(string, tag = "1")]
139    pub rid: ::prost::alloc::string::String,
140}
141#[derive(Clone, Copy, PartialEq, ::prost::Message)]
142pub struct DeleteResponse {}
143#[derive(Clone, PartialEq, ::prost::Message)]
144pub struct ArchiveRequest {
145    #[prost(string, tag = "1")]
146    pub rid: ::prost::alloc::string::String,
147}
148#[derive(Clone, Copy, PartialEq, ::prost::Message)]
149pub struct ArchiveResponse {}
150#[derive(Clone, PartialEq, ::prost::Message)]
151pub struct UnarchiveRequest {
152    #[prost(string, tag = "1")]
153    pub rid: ::prost::alloc::string::String,
154}
155#[derive(Clone, Copy, PartialEq, ::prost::Message)]
156pub struct UnarchiveResponse {}
157#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
158#[repr(i32)]
159pub enum SortField {
160    Unspecified = 0,
161    CreatedAt = 1,
162}
163impl SortField {
164    /// String value of the enum field names used in the ProtoBuf definition.
165    ///
166    /// The values are not transformed in any way and thus are considered stable
167    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
168    pub fn as_str_name(&self) -> &'static str {
169        match self {
170            Self::Unspecified => "SORT_FIELD_UNSPECIFIED",
171            Self::CreatedAt => "CREATED_AT",
172        }
173    }
174    /// Creates an enum from field names used in the ProtoBuf definition.
175    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
176        match value {
177            "SORT_FIELD_UNSPECIFIED" => Some(Self::Unspecified),
178            "CREATED_AT" => Some(Self::CreatedAt),
179            _ => None,
180        }
181    }
182}
183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
184#[repr(i32)]
185pub enum SecretsError {
186    SecretNotFound = 0,
187    SecretsNotFound = 1,
188    UnableToEncryptSecret = 2,
189    InvalidArgument = 3,
190}
191impl SecretsError {
192    /// String value of the enum field names used in the ProtoBuf definition.
193    ///
194    /// The values are not transformed in any way and thus are considered stable
195    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
196    pub fn as_str_name(&self) -> &'static str {
197        match self {
198            Self::SecretNotFound => "SECRETS_ERROR_SECRET_NOT_FOUND",
199            Self::SecretsNotFound => "SECRETS_ERROR_SECRETS_NOT_FOUND",
200            Self::UnableToEncryptSecret => "SECRETS_ERROR_UNABLE_TO_ENCRYPT_SECRET",
201            Self::InvalidArgument => "SECRETS_ERROR_INVALID_ARGUMENT",
202        }
203    }
204    /// Creates an enum from field names used in the ProtoBuf definition.
205    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
206        match value {
207            "SECRETS_ERROR_SECRET_NOT_FOUND" => Some(Self::SecretNotFound),
208            "SECRETS_ERROR_SECRETS_NOT_FOUND" => Some(Self::SecretsNotFound),
209            "SECRETS_ERROR_UNABLE_TO_ENCRYPT_SECRET" => Some(Self::UnableToEncryptSecret),
210            "SECRETS_ERROR_INVALID_ARGUMENT" => Some(Self::InvalidArgument),
211            _ => None,
212        }
213    }
214}
215/// Generated client implementations.
216pub mod secret_service_client {
217    #![allow(
218        unused_variables,
219        dead_code,
220        missing_docs,
221        clippy::wildcard_imports,
222        clippy::let_unit_value,
223    )]
224    use tonic::codegen::*;
225    use tonic::codegen::http::Uri;
226    #[derive(Debug, Clone)]
227    pub struct SecretServiceClient<T> {
228        inner: tonic::client::Grpc<T>,
229    }
230    impl SecretServiceClient<tonic::transport::Channel> {
231        /// Attempt to create a new client by connecting to a given endpoint.
232        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
233        where
234            D: TryInto<tonic::transport::Endpoint>,
235            D::Error: Into<StdError>,
236        {
237            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
238            Ok(Self::new(conn))
239        }
240    }
241    impl<T> SecretServiceClient<T>
242    where
243        T: tonic::client::GrpcService<tonic::body::Body>,
244        T::Error: Into<StdError>,
245        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
246        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
247    {
248        pub fn new(inner: T) -> Self {
249            let inner = tonic::client::Grpc::new(inner);
250            Self { inner }
251        }
252        pub fn with_origin(inner: T, origin: Uri) -> Self {
253            let inner = tonic::client::Grpc::with_origin(inner, origin);
254            Self { inner }
255        }
256        pub fn with_interceptor<F>(
257            inner: T,
258            interceptor: F,
259        ) -> SecretServiceClient<InterceptedService<T, F>>
260        where
261            F: tonic::service::Interceptor,
262            T::ResponseBody: Default,
263            T: tonic::codegen::Service<
264                http::Request<tonic::body::Body>,
265                Response = http::Response<
266                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
267                >,
268            >,
269            <T as tonic::codegen::Service<
270                http::Request<tonic::body::Body>,
271            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
272        {
273            SecretServiceClient::new(InterceptedService::new(inner, interceptor))
274        }
275        /// Compress requests with the given encoding.
276        ///
277        /// This requires the server to support it otherwise it might respond with an
278        /// error.
279        #[must_use]
280        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
281            self.inner = self.inner.send_compressed(encoding);
282            self
283        }
284        /// Enable decompressing responses.
285        #[must_use]
286        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
287            self.inner = self.inner.accept_compressed(encoding);
288            self
289        }
290        /// Limits the maximum size of a decoded message.
291        ///
292        /// Default: `4MB`
293        #[must_use]
294        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
295            self.inner = self.inner.max_decoding_message_size(limit);
296            self
297        }
298        /// Limits the maximum size of an encoded message.
299        ///
300        /// Default: `usize::MAX`
301        #[must_use]
302        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
303            self.inner = self.inner.max_encoding_message_size(limit);
304            self
305        }
306        pub async fn create(
307            &mut self,
308            request: impl tonic::IntoRequest<super::CreateSecretRequest>,
309        ) -> std::result::Result<tonic::Response<super::CreateResponse>, tonic::Status> {
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.secrets.v1.SecretService/Create",
321            );
322            let mut req = request.into_request();
323            req.extensions_mut()
324                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Create"));
325            self.inner.unary(req, path, codec).await
326        }
327        pub async fn get(
328            &mut self,
329            request: impl tonic::IntoRequest<super::GetRequest>,
330        ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status> {
331            self.inner
332                .ready()
333                .await
334                .map_err(|e| {
335                    tonic::Status::unknown(
336                        format!("Service was not ready: {}", e.into()),
337                    )
338                })?;
339            let codec = tonic::codec::ProstCodec::default();
340            let path = http::uri::PathAndQuery::from_static(
341                "/nominal.secrets.v1.SecretService/Get",
342            );
343            let mut req = request.into_request();
344            req.extensions_mut()
345                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Get"));
346            self.inner.unary(req, path, codec).await
347        }
348        pub async fn get_batch(
349            &mut self,
350            request: impl tonic::IntoRequest<super::GetSecretsRequest>,
351        ) -> std::result::Result<
352            tonic::Response<super::GetSecretsResponse>,
353            tonic::Status,
354        > {
355            self.inner
356                .ready()
357                .await
358                .map_err(|e| {
359                    tonic::Status::unknown(
360                        format!("Service was not ready: {}", e.into()),
361                    )
362                })?;
363            let codec = tonic::codec::ProstCodec::default();
364            let path = http::uri::PathAndQuery::from_static(
365                "/nominal.secrets.v1.SecretService/GetBatch",
366            );
367            let mut req = request.into_request();
368            req.extensions_mut()
369                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "GetBatch"));
370            self.inner.unary(req, path, codec).await
371        }
372        pub async fn update(
373            &mut self,
374            request: impl tonic::IntoRequest<super::UpdateRequest>,
375        ) -> std::result::Result<tonic::Response<super::UpdateResponse>, tonic::Status> {
376            self.inner
377                .ready()
378                .await
379                .map_err(|e| {
380                    tonic::Status::unknown(
381                        format!("Service was not ready: {}", e.into()),
382                    )
383                })?;
384            let codec = tonic::codec::ProstCodec::default();
385            let path = http::uri::PathAndQuery::from_static(
386                "/nominal.secrets.v1.SecretService/Update",
387            );
388            let mut req = request.into_request();
389            req.extensions_mut()
390                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Update"));
391            self.inner.unary(req, path, codec).await
392        }
393        pub async fn delete(
394            &mut self,
395            request: impl tonic::IntoRequest<super::DeleteRequest>,
396        ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
397            self.inner
398                .ready()
399                .await
400                .map_err(|e| {
401                    tonic::Status::unknown(
402                        format!("Service was not ready: {}", e.into()),
403                    )
404                })?;
405            let codec = tonic::codec::ProstCodec::default();
406            let path = http::uri::PathAndQuery::from_static(
407                "/nominal.secrets.v1.SecretService/Delete",
408            );
409            let mut req = request.into_request();
410            req.extensions_mut()
411                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Delete"));
412            self.inner.unary(req, path, codec).await
413        }
414        pub async fn archive(
415            &mut self,
416            request: impl tonic::IntoRequest<super::ArchiveRequest>,
417        ) -> std::result::Result<
418            tonic::Response<super::ArchiveResponse>,
419            tonic::Status,
420        > {
421            self.inner
422                .ready()
423                .await
424                .map_err(|e| {
425                    tonic::Status::unknown(
426                        format!("Service was not ready: {}", e.into()),
427                    )
428                })?;
429            let codec = tonic::codec::ProstCodec::default();
430            let path = http::uri::PathAndQuery::from_static(
431                "/nominal.secrets.v1.SecretService/Archive",
432            );
433            let mut req = request.into_request();
434            req.extensions_mut()
435                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Archive"));
436            self.inner.unary(req, path, codec).await
437        }
438        pub async fn unarchive(
439            &mut self,
440            request: impl tonic::IntoRequest<super::UnarchiveRequest>,
441        ) -> std::result::Result<
442            tonic::Response<super::UnarchiveResponse>,
443            tonic::Status,
444        > {
445            self.inner
446                .ready()
447                .await
448                .map_err(|e| {
449                    tonic::Status::unknown(
450                        format!("Service was not ready: {}", e.into()),
451                    )
452                })?;
453            let codec = tonic::codec::ProstCodec::default();
454            let path = http::uri::PathAndQuery::from_static(
455                "/nominal.secrets.v1.SecretService/Unarchive",
456            );
457            let mut req = request.into_request();
458            req.extensions_mut()
459                .insert(
460                    GrpcMethod::new("nominal.secrets.v1.SecretService", "Unarchive"),
461                );
462            self.inner.unary(req, path, codec).await
463        }
464        pub async fn search(
465            &mut self,
466            request: impl tonic::IntoRequest<super::SearchSecretsRequest>,
467        ) -> std::result::Result<
468            tonic::Response<super::SearchSecretsResponse>,
469            tonic::Status,
470        > {
471            self.inner
472                .ready()
473                .await
474                .map_err(|e| {
475                    tonic::Status::unknown(
476                        format!("Service was not ready: {}", e.into()),
477                    )
478                })?;
479            let codec = tonic::codec::ProstCodec::default();
480            let path = http::uri::PathAndQuery::from_static(
481                "/nominal.secrets.v1.SecretService/Search",
482            );
483            let mut req = request.into_request();
484            req.extensions_mut()
485                .insert(GrpcMethod::new("nominal.secrets.v1.SecretService", "Search"));
486            self.inner.unary(req, path, codec).await
487        }
488    }
489}