nominal_api/proto/
nominal.edge.v1.rs

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