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/// Generated client implementations.
130pub mod mesh_service_client {
131    #![allow(
132        unused_variables,
133        dead_code,
134        missing_docs,
135        clippy::wildcard_imports,
136        clippy::let_unit_value,
137    )]
138    use tonic::codegen::*;
139    use tonic::codegen::http::Uri;
140    /// Manages mesh links between source and sink environments.
141    #[derive(Debug, Clone)]
142    pub struct MeshServiceClient<T> {
143        inner: tonic::client::Grpc<T>,
144    }
145    impl MeshServiceClient<tonic::transport::Channel> {
146        /// Attempt to create a new client by connecting to a given endpoint.
147        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
148        where
149            D: TryInto<tonic::transport::Endpoint>,
150            D::Error: Into<StdError>,
151        {
152            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
153            Ok(Self::new(conn))
154        }
155    }
156    impl<T> MeshServiceClient<T>
157    where
158        T: tonic::client::GrpcService<tonic::body::Body>,
159        T::Error: Into<StdError>,
160        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
161        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
162    {
163        pub fn new(inner: T) -> Self {
164            let inner = tonic::client::Grpc::new(inner);
165            Self { inner }
166        }
167        pub fn with_origin(inner: T, origin: Uri) -> Self {
168            let inner = tonic::client::Grpc::with_origin(inner, origin);
169            Self { inner }
170        }
171        pub fn with_interceptor<F>(
172            inner: T,
173            interceptor: F,
174        ) -> MeshServiceClient<InterceptedService<T, F>>
175        where
176            F: tonic::service::Interceptor,
177            T::ResponseBody: Default,
178            T: tonic::codegen::Service<
179                http::Request<tonic::body::Body>,
180                Response = http::Response<
181                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
182                >,
183            >,
184            <T as tonic::codegen::Service<
185                http::Request<tonic::body::Body>,
186            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
187        {
188            MeshServiceClient::new(InterceptedService::new(inner, interceptor))
189        }
190        /// Compress requests with the given encoding.
191        ///
192        /// This requires the server to support it otherwise it might respond with an
193        /// error.
194        #[must_use]
195        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
196            self.inner = self.inner.send_compressed(encoding);
197            self
198        }
199        /// Enable decompressing responses.
200        #[must_use]
201        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
202            self.inner = self.inner.accept_compressed(encoding);
203            self
204        }
205        /// Limits the maximum size of a decoded message.
206        ///
207        /// Default: `4MB`
208        #[must_use]
209        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
210            self.inner = self.inner.max_decoding_message_size(limit);
211            self
212        }
213        /// Limits the maximum size of an encoded message.
214        ///
215        /// Default: `usize::MAX`
216        #[must_use]
217        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
218            self.inner = self.inner.max_encoding_message_size(limit);
219            self
220        }
221        /// Creates a link which allows the specified resource to be synced between mesh environments.
222        /// Throws MESH_SERVICE_ERROR_LINK_ALREADY_EXISTS if a link already exists.
223        pub async fn create_link(
224            &mut self,
225            request: impl tonic::IntoRequest<super::CreateLinkRequest>,
226        ) -> std::result::Result<
227            tonic::Response<super::CreateLinkResponse>,
228            tonic::Status,
229        > {
230            self.inner
231                .ready()
232                .await
233                .map_err(|e| {
234                    tonic::Status::unknown(
235                        format!("Service was not ready: {}", e.into()),
236                    )
237                })?;
238            let codec = tonic::codec::ProstCodec::default();
239            let path = http::uri::PathAndQuery::from_static(
240                "/nominal.mesh.v1.MeshService/CreateLink",
241            );
242            let mut req = request.into_request();
243            req.extensions_mut()
244                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "CreateLink"));
245            self.inner.unary(req, path, codec).await
246        }
247        /// Retrieves a link for the requested resource, throwing MESH_SERVICE_ERROR_LINK_NOT_FOUND if there is no link.
248        pub async fn get_link(
249            &mut self,
250            request: impl tonic::IntoRequest<super::GetLinkRequest>,
251        ) -> std::result::Result<
252            tonic::Response<super::GetLinkResponse>,
253            tonic::Status,
254        > {
255            self.inner
256                .ready()
257                .await
258                .map_err(|e| {
259                    tonic::Status::unknown(
260                        format!("Service was not ready: {}", e.into()),
261                    )
262                })?;
263            let codec = tonic::codec::ProstCodec::default();
264            let path = http::uri::PathAndQuery::from_static(
265                "/nominal.mesh.v1.MeshService/GetLink",
266            );
267            let mut req = request.into_request();
268            req.extensions_mut()
269                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "GetLink"));
270            self.inner.unary(req, path, codec).await
271        }
272        /// Updates a link for the requested resource, throwing MESH_SERVICE_ERROR_LINK_NOT_FOUND if there is no link.
273        pub async fn update_link(
274            &mut self,
275            request: impl tonic::IntoRequest<super::UpdateLinkRequest>,
276        ) -> std::result::Result<
277            tonic::Response<super::UpdateLinkResponse>,
278            tonic::Status,
279        > {
280            self.inner
281                .ready()
282                .await
283                .map_err(|e| {
284                    tonic::Status::unknown(
285                        format!("Service was not ready: {}", e.into()),
286                    )
287                })?;
288            let codec = tonic::codec::ProstCodec::default();
289            let path = http::uri::PathAndQuery::from_static(
290                "/nominal.mesh.v1.MeshService/UpdateLink",
291            );
292            let mut req = request.into_request();
293            req.extensions_mut()
294                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "UpdateLink"));
295            self.inner.unary(req, path, codec).await
296        }
297        /// Deletes a link for the specified resource.
298        pub async fn delete_link(
299            &mut self,
300            request: impl tonic::IntoRequest<super::DeleteLinkRequest>,
301        ) -> std::result::Result<
302            tonic::Response<super::DeleteLinkResponse>,
303            tonic::Status,
304        > {
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/DeleteLink",
316            );
317            let mut req = request.into_request();
318            req.extensions_mut()
319                .insert(GrpcMethod::new("nominal.mesh.v1.MeshService", "DeleteLink"));
320            self.inner.unary(req, path, codec).await
321        }
322    }
323}