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