nominal_api/proto/
nominal.mesh.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Link {
4    /// Unique identifier for this link.
5    #[prost(string, tag = "1")]
6    pub rid: ::prost::alloc::string::String,
7    /// RID in the source environment.
8    #[prost(string, tag = "2")]
9    pub source_rid: ::prost::alloc::string::String,
10    /// RID in the sink environment.
11    #[prost(string, tag = "3")]
12    pub sink_rid: ::prost::alloc::string::String,
13    /// Secret to be used to authenticate with the sink environment.
14    #[prost(string, tag = "4")]
15    pub secret_rid: ::prost::alloc::string::String,
16    /// Whether or not the link should be enabled.
17    #[prost(bool, tag = "5")]
18    pub enabled: bool,
19    /// The type of resource this link is for.
20    #[prost(enumeration = "ResourceType", tag = "6")]
21    pub resource_type: i32,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct CreateLinkRequest {
25    /// RID in the source environment.
26    #[prost(string, tag = "1")]
27    pub source_rid: ::prost::alloc::string::String,
28    /// RID in the sink environment.
29    #[prost(string, tag = "2")]
30    pub sink_rid: ::prost::alloc::string::String,
31    /// Secret to be used to authenticate with the sink environment.
32    #[prost(string, tag = "3")]
33    pub secret_rid: ::prost::alloc::string::String,
34    /// Whether or not the link should be enabled.
35    #[prost(bool, tag = "4")]
36    pub enabled: bool,
37    /// The type of resource this link is for.
38    #[prost(enumeration = "ResourceType", tag = "5")]
39    pub resource_type: i32,
40}
41#[derive(Clone, Copy, PartialEq, ::prost::Message)]
42pub struct CreateLinkResponse {}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct GetLinkRequest {
45    #[prost(string, tag = "1")]
46    pub link_rid: ::prost::alloc::string::String,
47}
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct GetLinkResponse {
50    #[prost(message, optional, tag = "1")]
51    pub link: ::core::option::Option<Link>,
52}
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct UpdateLinkRequest {
55    /// Used to identify the link.
56    #[prost(string, tag = "1")]
57    pub link_rid: ::prost::alloc::string::String,
58    /// Optional fields to update.
59    #[prost(string, optional, tag = "2")]
60    pub secret_rid: ::core::option::Option<::prost::alloc::string::String>,
61    #[prost(bool, optional, tag = "3")]
62    pub enabled: ::core::option::Option<bool>,
63}
64#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct UpdateLinkResponse {
66    #[prost(message, optional, tag = "1")]
67    pub link: ::core::option::Option<Link>,
68}
69#[derive(Clone, PartialEq, ::prost::Message)]
70pub struct DeleteLinkRequest {
71    #[prost(string, tag = "1")]
72    pub link_rid: ::prost::alloc::string::String,
73}
74#[derive(Clone, Copy, PartialEq, ::prost::Message)]
75pub struct DeleteLinkResponse {}
76#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
77#[repr(i32)]
78pub enum ResourceType {
79    Unspecified = 0,
80    Dataset = 1,
81}
82impl ResourceType {
83    /// String value of the enum field names used in the ProtoBuf definition.
84    ///
85    /// The values are not transformed in any way and thus are considered stable
86    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
87    pub fn as_str_name(&self) -> &'static str {
88        match self {
89            Self::Unspecified => "RESOURCE_TYPE_UNSPECIFIED",
90            Self::Dataset => "RESOURCE_TYPE_DATASET",
91        }
92    }
93    /// Creates an enum from field names used in the ProtoBuf definition.
94    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
95        match value {
96            "RESOURCE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
97            "RESOURCE_TYPE_DATASET" => Some(Self::Dataset),
98            _ => None,
99        }
100    }
101}
102/// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
103#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
104#[repr(i32)]
105pub enum MeshServiceError {
106    LinkNotFound = 0,
107    LinkAlreadyExists = 1,
108}
109impl MeshServiceError {
110    /// String value of the enum field names used in the ProtoBuf definition.
111    ///
112    /// The values are not transformed in any way and thus are considered stable
113    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
114    pub fn as_str_name(&self) -> &'static str {
115        match self {
116            Self::LinkNotFound => "MESH_SERVICE_ERROR_LINK_NOT_FOUND",
117            Self::LinkAlreadyExists => "MESH_SERVICE_ERROR_LINK_ALREADY_EXISTS",
118        }
119    }
120    /// Creates an enum from field names used in the ProtoBuf definition.
121    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
122        match value {
123            "MESH_SERVICE_ERROR_LINK_NOT_FOUND" => Some(Self::LinkNotFound),
124            "MESH_SERVICE_ERROR_LINK_ALREADY_EXISTS" => Some(Self::LinkAlreadyExists),
125            _ => None,
126        }
127    }
128}
129/// This is the proto that is sent to sink environments to request mesh operations.
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct MeshRequest {
132    #[prost(oneof = "mesh_request::Request", tags = "1, 2")]
133    pub request: ::core::option::Option<mesh_request::Request>,
134}
135/// Nested message and enum types in `MeshRequest`.
136pub mod mesh_request {
137    #[derive(Clone, PartialEq, ::prost::Oneof)]
138    pub enum Request {
139        #[prost(message, tag = "1")]
140        DataStream(super::DataStreamRequest),
141        #[prost(message, tag = "2")]
142        FileIngest(super::FileIngestRequest),
143    }
144}
145#[derive(Clone, Copy, PartialEq, ::prost::Message)]
146pub struct MeshResponse {}
147#[derive(Clone, PartialEq, ::prost::Message)]
148pub struct DataStreamRequest {
149    #[prost(message, repeated, tag = "1")]
150    pub write_batches_request: ::prost::alloc::vec::Vec<
151        super::super::direct_channel_writer::v2::WriteBatchesRequest,
152    >,
153}
154#[derive(Clone, PartialEq, ::prost::Message)]
155pub struct FileIngestRequest {
156    #[prost(message, optional, tag = "1")]
157    pub file_metadata: ::core::option::Option<FileMetadata>,
158}
159#[derive(Clone, PartialEq, ::prost::Message)]
160pub struct FileMetadata {
161    /// Unique identifier for this file.
162    #[prost(string, tag = "1")]
163    pub uuid: ::prost::alloc::string::String,
164    /// UUID of the dataset this file belongs to.
165    #[prost(string, tag = "2")]
166    pub dataset_uuid: ::prost::alloc::string::String,
167    /// S3 path where the file is stored.
168    #[prost(string, tag = "3")]
169    pub s3_path: ::prost::alloc::string::String,
170    /// Original file name.
171    #[prost(string, tag = "4")]
172    pub file_name: ::prost::alloc::string::String,
173    /// Origin metadata associated with the file.
174    #[prost(map = "string, string", tag = "5")]
175    pub origin_metadata: ::std::collections::HashMap<
176        ::prost::alloc::string::String,
177        ::prost::alloc::string::String,
178    >,
179    /// Time bounds for the data in the file.
180    #[prost(message, optional, tag = "6")]
181    pub bounds: ::core::option::Option<super::super::types::time::Range>,
182    /// Timestamp when the file was uploaded.
183    #[prost(message, optional, tag = "7")]
184    pub uploaded_at: ::core::option::Option<super::super::types::time::Timestamp>,
185    /// Nanosecond timestamp when the file was ingested.
186    #[prost(int64, tag = "8")]
187    pub ingested_at_nanos: i64,
188    /// Columns that are used as tags.
189    #[prost(string, repeated, tag = "9")]
190    pub tag_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
191    /// Additional tags associated with the file.
192    #[prost(map = "string, string", tag = "10")]
193    pub additional_file_tags: ::std::collections::HashMap<
194        ::prost::alloc::string::String,
195        ::prost::alloc::string::String,
196    >,
197    /// Size of the file in bytes.
198    #[prost(int64, tag = "11")]
199    pub file_size: i64,
200    /// Additional metadata associated with the file.
201    #[prost(map = "string, string", tag = "12")]
202    pub metadata: ::std::collections::HashMap<
203        ::prost::alloc::string::String,
204        ::prost::alloc::string::String,
205    >,
206}
207/// Generated client implementations.
208pub mod mesh_service_client {
209    #![allow(
210        unused_variables,
211        dead_code,
212        missing_docs,
213        clippy::wildcard_imports,
214        clippy::let_unit_value,
215    )]
216    use tonic::codegen::*;
217    use tonic::codegen::http::Uri;
218    /// Manages mesh links between source and sink environments.
219    #[derive(Debug, Clone)]
220    pub struct MeshServiceClient<T> {
221        inner: tonic::client::Grpc<T>,
222    }
223    impl MeshServiceClient<tonic::transport::Channel> {
224        /// Attempt to create a new client by connecting to a given endpoint.
225        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
226        where
227            D: TryInto<tonic::transport::Endpoint>,
228            D::Error: Into<StdError>,
229        {
230            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
231            Ok(Self::new(conn))
232        }
233    }
234    impl<T> MeshServiceClient<T>
235    where
236        T: tonic::client::GrpcService<tonic::body::Body>,
237        T::Error: Into<StdError>,
238        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
239        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
240    {
241        pub fn new(inner: T) -> Self {
242            let inner = tonic::client::Grpc::new(inner);
243            Self { inner }
244        }
245        pub fn with_origin(inner: T, origin: Uri) -> Self {
246            let inner = tonic::client::Grpc::with_origin(inner, origin);
247            Self { inner }
248        }
249        pub fn with_interceptor<F>(
250            inner: T,
251            interceptor: F,
252        ) -> MeshServiceClient<InterceptedService<T, F>>
253        where
254            F: tonic::service::Interceptor,
255            T::ResponseBody: Default,
256            T: tonic::codegen::Service<
257                http::Request<tonic::body::Body>,
258                Response = http::Response<
259                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
260                >,
261            >,
262            <T as tonic::codegen::Service<
263                http::Request<tonic::body::Body>,
264            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
265        {
266            MeshServiceClient::new(InterceptedService::new(inner, interceptor))
267        }
268        /// Compress requests with the given encoding.
269        ///
270        /// This requires the server to support it otherwise it might respond with an
271        /// error.
272        #[must_use]
273        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
274            self.inner = self.inner.send_compressed(encoding);
275            self
276        }
277        /// Enable decompressing responses.
278        #[must_use]
279        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
280            self.inner = self.inner.accept_compressed(encoding);
281            self
282        }
283        /// Limits the maximum size of a decoded message.
284        ///
285        /// Default: `4MB`
286        #[must_use]
287        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
288            self.inner = self.inner.max_decoding_message_size(limit);
289            self
290        }
291        /// Limits the maximum size of an encoded message.
292        ///
293        /// Default: `usize::MAX`
294        #[must_use]
295        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
296            self.inner = self.inner.max_encoding_message_size(limit);
297            self
298        }
299        /// Core Mesh operations.
300        /// ------------------------------------------------------------------------------------------------------------
301        pub async fn mesh(
302            &mut self,
303            request: impl tonic::IntoRequest<super::MeshRequest>,
304        ) -> std::result::Result<tonic::Response<super::MeshResponse>, tonic::Status> {
305            self.inner
306                .ready()
307                .await
308                .map_err(|e| {
309                    tonic::Status::unknown(
310                        format!("Service was not ready: {}", e.into()),
311                    )
312                })?;
313            let codec = tonic::codec::ProstCodec::default();
314            let path = http::uri::PathAndQuery::from_static(
315                "/nominal.mesh.v1.MeshService/Mesh",
316            );
317            let mut req = request.into_request();
318            req.extensions_mut()
319                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "Mesh"));
320            self.inner.unary(req, path, codec).await
321        }
322        /// Link CRUD operations.
323        /// ------------------------------------------------------------------------------------------------------------
324        /// Creates a link which allows the specified resource to be synced between mesh environments.
325        /// Throws MESH_SERVICE_ERROR_LINK_ALREADY_EXISTS if a link already exists.
326        pub async fn create_link(
327            &mut self,
328            request: impl tonic::IntoRequest<super::CreateLinkRequest>,
329        ) -> std::result::Result<
330            tonic::Response<super::CreateLinkResponse>,
331            tonic::Status,
332        > {
333            self.inner
334                .ready()
335                .await
336                .map_err(|e| {
337                    tonic::Status::unknown(
338                        format!("Service was not ready: {}", e.into()),
339                    )
340                })?;
341            let codec = tonic::codec::ProstCodec::default();
342            let path = http::uri::PathAndQuery::from_static(
343                "/nominal.mesh.v1.MeshService/CreateLink",
344            );
345            let mut req = request.into_request();
346            req.extensions_mut()
347                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "CreateLink"));
348            self.inner.unary(req, path, codec).await
349        }
350        /// Retrieves a link for the requested resource, throwing MESH_SERVICE_ERROR_LINK_NOT_FOUND if there is no link.
351        pub async fn get_link(
352            &mut self,
353            request: impl tonic::IntoRequest<super::GetLinkRequest>,
354        ) -> std::result::Result<
355            tonic::Response<super::GetLinkResponse>,
356            tonic::Status,
357        > {
358            self.inner
359                .ready()
360                .await
361                .map_err(|e| {
362                    tonic::Status::unknown(
363                        format!("Service was not ready: {}", e.into()),
364                    )
365                })?;
366            let codec = tonic::codec::ProstCodec::default();
367            let path = http::uri::PathAndQuery::from_static(
368                "/nominal.mesh.v1.MeshService/GetLink",
369            );
370            let mut req = request.into_request();
371            req.extensions_mut()
372                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "GetLink"));
373            self.inner.unary(req, path, codec).await
374        }
375        /// Updates a link for the requested resource, throwing MESH_SERVICE_ERROR_LINK_NOT_FOUND if there is no link.
376        pub async fn update_link(
377            &mut self,
378            request: impl tonic::IntoRequest<super::UpdateLinkRequest>,
379        ) -> std::result::Result<
380            tonic::Response<super::UpdateLinkResponse>,
381            tonic::Status,
382        > {
383            self.inner
384                .ready()
385                .await
386                .map_err(|e| {
387                    tonic::Status::unknown(
388                        format!("Service was not ready: {}", e.into()),
389                    )
390                })?;
391            let codec = tonic::codec::ProstCodec::default();
392            let path = http::uri::PathAndQuery::from_static(
393                "/nominal.mesh.v1.MeshService/UpdateLink",
394            );
395            let mut req = request.into_request();
396            req.extensions_mut()
397                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "UpdateLink"));
398            self.inner.unary(req, path, codec).await
399        }
400        /// Deletes a link for the specified resource.
401        pub async fn delete_link(
402            &mut self,
403            request: impl tonic::IntoRequest<super::DeleteLinkRequest>,
404        ) -> std::result::Result<
405            tonic::Response<super::DeleteLinkResponse>,
406            tonic::Status,
407        > {
408            self.inner
409                .ready()
410                .await
411                .map_err(|e| {
412                    tonic::Status::unknown(
413                        format!("Service was not ready: {}", e.into()),
414                    )
415                })?;
416            let codec = tonic::codec::ProstCodec::default();
417            let path = http::uri::PathAndQuery::from_static(
418                "/nominal.mesh.v1.MeshService/DeleteLink",
419            );
420            let mut req = request.into_request();
421            req.extensions_mut()
422                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "DeleteLink"));
423            self.inner.unary(req, path, codec).await
424        }
425    }
426}