Skip to main content

nominal_api_proto/proto/
nominal.command.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CommandDeliveryEnvelope {
4    #[prost(string, tag = "1")]
5    pub command_id: ::prost::alloc::string::String,
6    #[prost(uint64, tag = "2")]
7    pub sequence: u64,
8    #[prost(message, optional, tag = "3")]
9    pub issued_at: ::core::option::Option<
10        super::super::super::google::protobuf::Timestamp,
11    >,
12    #[prost(message, optional, tag = "4")]
13    pub deadline: ::core::option::Option<
14        super::super::super::google::protobuf::Timestamp,
15    >,
16    #[prost(string, tag = "5")]
17    pub hub_id: ::prost::alloc::string::String,
18    #[prost(message, repeated, tag = "8")]
19    pub commands: ::prost::alloc::vec::Vec<ChannelCommand>,
20    #[prost(string, tag = "9")]
21    pub issued_by: ::prost::alloc::string::String,
22    #[prost(string, tag = "10")]
23    pub issued_by_email: ::prost::alloc::string::String,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct ChannelCommand {
27    #[prost(string, tag = "1")]
28    pub channel: ::prost::alloc::string::String,
29    #[prost(message, optional, tag = "2")]
30    pub value: ::core::option::Option<CommandValue>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct CommandValue {
34    #[prost(oneof = "command_value::Value", tags = "1, 2, 3, 4")]
35    pub value: ::core::option::Option<command_value::Value>,
36}
37/// Nested message and enum types in `CommandValue`.
38pub mod command_value {
39    #[derive(Clone, PartialEq, ::prost::Oneof)]
40    pub enum Value {
41        #[prost(int64, tag = "1")]
42        IntValue(i64),
43        #[prost(double, tag = "2")]
44        FloatValue(f64),
45        #[prost(bool, tag = "3")]
46        BoolValue(bool),
47        #[prost(string, tag = "4")]
48        EnumValue(::prost::alloc::string::String),
49    }
50}
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct CommandDeliveryAck {
53    #[prost(string, tag = "1")]
54    pub command_id: ::prost::alloc::string::String,
55    #[prost(uint64, tag = "2")]
56    pub sequence: u64,
57    #[prost(oneof = "command_delivery_ack::Outcome", tags = "3, 4")]
58    pub outcome: ::core::option::Option<command_delivery_ack::Outcome>,
59}
60/// Nested message and enum types in `CommandDeliveryAck`.
61pub mod command_delivery_ack {
62    #[derive(Clone, PartialEq, ::prost::Oneof)]
63    pub enum Outcome {
64        #[prost(message, tag = "3")]
65        Accepted(super::CommandDeliveryAccepted),
66        #[prost(message, tag = "4")]
67        Rejected(super::CommandDeliveryRejected),
68    }
69}
70#[derive(Clone, Copy, PartialEq, ::prost::Message)]
71pub struct CommandDeliveryAccepted {}
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct CommandDeliveryRejected {
74    #[prost(string, tag = "1")]
75    pub reason: ::prost::alloc::string::String,
76}
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct RegisterCommandHubRequest {
79    #[prost(string, tag = "2")]
80    pub dataset_rid: ::prost::alloc::string::String,
81    #[prost(map = "string, string", tag = "3")]
82    pub tags: ::std::collections::HashMap<
83        ::prost::alloc::string::String,
84        ::prost::alloc::string::String,
85    >,
86}
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct RegisterCommandHubResponse {
89    #[prost(string, tag = "1")]
90    pub registration_id: ::prost::alloc::string::String,
91    #[prost(message, optional, tag = "2")]
92    pub expires_at: ::core::option::Option<
93        super::super::super::google::protobuf::Timestamp,
94    >,
95    #[prost(message, optional, tag = "3")]
96    pub credential: ::core::option::Option<CommandHubCredential>,
97}
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct CommandHubCredential {
100    #[prost(string, tag = "1")]
101    pub nats_jwt: ::prost::alloc::string::String,
102    #[prost(string, tag = "2")]
103    pub nats_url: ::prost::alloc::string::String,
104    #[prost(message, optional, tag = "3")]
105    pub expires_at: ::core::option::Option<
106        super::super::super::google::protobuf::Timestamp,
107    >,
108}
109#[derive(Clone, PartialEq, ::prost::Message)]
110pub struct HeartbeatCommandHubRequest {
111    #[prost(string, tag = "1")]
112    pub registration_id: ::prost::alloc::string::String,
113}
114#[derive(Clone, Copy, PartialEq, ::prost::Message)]
115pub struct HeartbeatCommandHubResponse {
116    #[prost(message, optional, tag = "1")]
117    pub expires_at: ::core::option::Option<
118        super::super::super::google::protobuf::Timestamp,
119    >,
120}
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct DeregisterCommandHubRequest {
123    #[prost(string, tag = "1")]
124    pub registration_id: ::prost::alloc::string::String,
125}
126#[derive(Clone, Copy, PartialEq, ::prost::Message)]
127pub struct DeregisterCommandHubResponse {}
128/// Generated client implementations.
129pub mod command_hub_registry_service_client {
130    #![allow(
131        unused_variables,
132        dead_code,
133        missing_docs,
134        clippy::wildcard_imports,
135        clippy::let_unit_value,
136    )]
137    use tonic::codegen::*;
138    use tonic::codegen::http::Uri;
139    #[derive(Debug, Clone)]
140    pub struct CommandHubRegistryServiceClient<T> {
141        inner: tonic::client::Grpc<T>,
142    }
143    impl CommandHubRegistryServiceClient<tonic::transport::Channel> {
144        /// Attempt to create a new client by connecting to a given endpoint.
145        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
146        where
147            D: TryInto<tonic::transport::Endpoint>,
148            D::Error: Into<StdError>,
149        {
150            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
151            Ok(Self::new(conn))
152        }
153    }
154    impl<T> CommandHubRegistryServiceClient<T>
155    where
156        T: tonic::client::GrpcService<tonic::body::Body>,
157        T::Error: Into<StdError>,
158        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
159        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
160    {
161        pub fn new(inner: T) -> Self {
162            let inner = tonic::client::Grpc::new(inner);
163            Self { inner }
164        }
165        pub fn with_origin(inner: T, origin: Uri) -> Self {
166            let inner = tonic::client::Grpc::with_origin(inner, origin);
167            Self { inner }
168        }
169        pub fn with_interceptor<F>(
170            inner: T,
171            interceptor: F,
172        ) -> CommandHubRegistryServiceClient<InterceptedService<T, F>>
173        where
174            F: tonic::service::Interceptor,
175            T::ResponseBody: Default,
176            T: tonic::codegen::Service<
177                http::Request<tonic::body::Body>,
178                Response = http::Response<
179                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
180                >,
181            >,
182            <T as tonic::codegen::Service<
183                http::Request<tonic::body::Body>,
184            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
185        {
186            CommandHubRegistryServiceClient::new(
187                InterceptedService::new(inner, interceptor),
188            )
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        pub async fn register_command_hub(
222            &mut self,
223            request: impl tonic::IntoRequest<super::RegisterCommandHubRequest>,
224        ) -> std::result::Result<
225            tonic::Response<super::RegisterCommandHubResponse>,
226            tonic::Status,
227        > {
228            self.inner
229                .ready()
230                .await
231                .map_err(|e| {
232                    tonic::Status::unknown(
233                        format!("Service was not ready: {}", e.into()),
234                    )
235                })?;
236            let codec = tonic::codec::ProstCodec::default();
237            let path = http::uri::PathAndQuery::from_static(
238                "/nominal.command.v1.CommandHubRegistryService/RegisterCommandHub",
239            );
240            let mut req = request.into_request();
241            req.extensions_mut()
242                .insert(
243                    GrpcMethod::new(
244                        "nominal.command.v1.CommandHubRegistryService",
245                        "RegisterCommandHub",
246                    ),
247                );
248            self.inner.unary(req, path, codec).await
249        }
250        pub async fn heartbeat_command_hub(
251            &mut self,
252            request: impl tonic::IntoRequest<super::HeartbeatCommandHubRequest>,
253        ) -> std::result::Result<
254            tonic::Response<super::HeartbeatCommandHubResponse>,
255            tonic::Status,
256        > {
257            self.inner
258                .ready()
259                .await
260                .map_err(|e| {
261                    tonic::Status::unknown(
262                        format!("Service was not ready: {}", e.into()),
263                    )
264                })?;
265            let codec = tonic::codec::ProstCodec::default();
266            let path = http::uri::PathAndQuery::from_static(
267                "/nominal.command.v1.CommandHubRegistryService/HeartbeatCommandHub",
268            );
269            let mut req = request.into_request();
270            req.extensions_mut()
271                .insert(
272                    GrpcMethod::new(
273                        "nominal.command.v1.CommandHubRegistryService",
274                        "HeartbeatCommandHub",
275                    ),
276                );
277            self.inner.unary(req, path, codec).await
278        }
279        pub async fn deregister_command_hub(
280            &mut self,
281            request: impl tonic::IntoRequest<super::DeregisterCommandHubRequest>,
282        ) -> std::result::Result<
283            tonic::Response<super::DeregisterCommandHubResponse>,
284            tonic::Status,
285        > {
286            self.inner
287                .ready()
288                .await
289                .map_err(|e| {
290                    tonic::Status::unknown(
291                        format!("Service was not ready: {}", e.into()),
292                    )
293                })?;
294            let codec = tonic::codec::ProstCodec::default();
295            let path = http::uri::PathAndQuery::from_static(
296                "/nominal.command.v1.CommandHubRegistryService/DeregisterCommandHub",
297            );
298            let mut req = request.into_request();
299            req.extensions_mut()
300                .insert(
301                    GrpcMethod::new(
302                        "nominal.command.v1.CommandHubRegistryService",
303                        "DeregisterCommandHub",
304                    ),
305                );
306            self.inner.unary(req, path, codec).await
307        }
308    }
309}
310#[derive(Clone, PartialEq, ::prost::Message)]
311pub struct SendCommandsRequest {
312    #[prost(string, tag = "1")]
313    pub dataset_rid: ::prost::alloc::string::String,
314    #[prost(map = "string, string", tag = "2")]
315    pub tags: ::std::collections::HashMap<
316        ::prost::alloc::string::String,
317        ::prost::alloc::string::String,
318    >,
319    #[prost(message, repeated, tag = "3")]
320    pub commands: ::prost::alloc::vec::Vec<ChannelCommand>,
321}
322#[derive(Clone, PartialEq, ::prost::Message)]
323pub struct SendCommandsResponse {
324    #[prost(string, tag = "1")]
325    pub command_id: ::prost::alloc::string::String,
326    #[prost(uint64, tag = "2")]
327    pub sequence: u64,
328    #[prost(message, optional, tag = "3")]
329    pub issued_at: ::core::option::Option<
330        super::super::super::google::protobuf::Timestamp,
331    >,
332    #[prost(message, optional, tag = "4")]
333    pub expires_at: ::core::option::Option<
334        super::super::super::google::protobuf::Timestamp,
335    >,
336    #[prost(oneof = "send_commands_response::Result", tags = "5, 6, 7, 8")]
337    pub result: ::core::option::Option<send_commands_response::Result>,
338}
339/// Nested message and enum types in `SendCommandsResponse`.
340pub mod send_commands_response {
341    #[derive(Clone, PartialEq, ::prost::Oneof)]
342    pub enum Result {
343        #[prost(message, tag = "5")]
344        Accepted(super::CommandDeliveryAck),
345        #[prost(message, tag = "6")]
346        Rejected(super::CommandDeliveryAck),
347        #[prost(message, tag = "7")]
348        NoLiveHub(super::NoLiveHub),
349        #[prost(message, tag = "8")]
350        OutcomeUnknown(super::OutcomeUnknown),
351    }
352}
353#[derive(Clone, Copy, PartialEq, ::prost::Message)]
354pub struct NoLiveHub {}
355#[derive(Clone, Copy, PartialEq, ::prost::Message)]
356pub struct OutcomeUnknown {
357    #[prost(enumeration = "outcome_unknown::Reason", tag = "1")]
358    pub reason: i32,
359}
360/// Nested message and enum types in `OutcomeUnknown`.
361pub mod outcome_unknown {
362    #[derive(
363        Clone,
364        Copy,
365        Debug,
366        PartialEq,
367        Eq,
368        Hash,
369        PartialOrd,
370        Ord,
371        ::prost::Enumeration
372    )]
373    #[repr(i32)]
374    pub enum Reason {
375        Unspecified = 0,
376        TimedOut = 1,
377        MalformedAck = 2,
378        MismatchedAck = 3,
379        Interrupted = 4,
380        TransportError = 5,
381    }
382    impl Reason {
383        /// String value of the enum field names used in the ProtoBuf definition.
384        ///
385        /// The values are not transformed in any way and thus are considered stable
386        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
387        pub fn as_str_name(&self) -> &'static str {
388            match self {
389                Self::Unspecified => "REASON_UNSPECIFIED",
390                Self::TimedOut => "REASON_TIMED_OUT",
391                Self::MalformedAck => "REASON_MALFORMED_ACK",
392                Self::MismatchedAck => "REASON_MISMATCHED_ACK",
393                Self::Interrupted => "REASON_INTERRUPTED",
394                Self::TransportError => "REASON_TRANSPORT_ERROR",
395            }
396        }
397        /// Creates an enum from field names used in the ProtoBuf definition.
398        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
399            match value {
400                "REASON_UNSPECIFIED" => Some(Self::Unspecified),
401                "REASON_TIMED_OUT" => Some(Self::TimedOut),
402                "REASON_MALFORMED_ACK" => Some(Self::MalformedAck),
403                "REASON_MISMATCHED_ACK" => Some(Self::MismatchedAck),
404                "REASON_INTERRUPTED" => Some(Self::Interrupted),
405                "REASON_TRANSPORT_ERROR" => Some(Self::TransportError),
406                _ => None,
407            }
408        }
409    }
410}
411/// Generated client implementations.
412pub mod command_service_client {
413    #![allow(
414        unused_variables,
415        dead_code,
416        missing_docs,
417        clippy::wildcard_imports,
418        clippy::let_unit_value,
419    )]
420    use tonic::codegen::*;
421    use tonic::codegen::http::Uri;
422    #[derive(Debug, Clone)]
423    pub struct CommandServiceClient<T> {
424        inner: tonic::client::Grpc<T>,
425    }
426    impl CommandServiceClient<tonic::transport::Channel> {
427        /// Attempt to create a new client by connecting to a given endpoint.
428        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
429        where
430            D: TryInto<tonic::transport::Endpoint>,
431            D::Error: Into<StdError>,
432        {
433            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
434            Ok(Self::new(conn))
435        }
436    }
437    impl<T> CommandServiceClient<T>
438    where
439        T: tonic::client::GrpcService<tonic::body::Body>,
440        T::Error: Into<StdError>,
441        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
442        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
443    {
444        pub fn new(inner: T) -> Self {
445            let inner = tonic::client::Grpc::new(inner);
446            Self { inner }
447        }
448        pub fn with_origin(inner: T, origin: Uri) -> Self {
449            let inner = tonic::client::Grpc::with_origin(inner, origin);
450            Self { inner }
451        }
452        pub fn with_interceptor<F>(
453            inner: T,
454            interceptor: F,
455        ) -> CommandServiceClient<InterceptedService<T, F>>
456        where
457            F: tonic::service::Interceptor,
458            T::ResponseBody: Default,
459            T: tonic::codegen::Service<
460                http::Request<tonic::body::Body>,
461                Response = http::Response<
462                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
463                >,
464            >,
465            <T as tonic::codegen::Service<
466                http::Request<tonic::body::Body>,
467            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
468        {
469            CommandServiceClient::new(InterceptedService::new(inner, interceptor))
470        }
471        /// Compress requests with the given encoding.
472        ///
473        /// This requires the server to support it otherwise it might respond with an
474        /// error.
475        #[must_use]
476        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
477            self.inner = self.inner.send_compressed(encoding);
478            self
479        }
480        /// Enable decompressing responses.
481        #[must_use]
482        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
483            self.inner = self.inner.accept_compressed(encoding);
484            self
485        }
486        /// Limits the maximum size of a decoded message.
487        ///
488        /// Default: `4MB`
489        #[must_use]
490        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
491            self.inner = self.inner.max_decoding_message_size(limit);
492            self
493        }
494        /// Limits the maximum size of an encoded message.
495        ///
496        /// Default: `usize::MAX`
497        #[must_use]
498        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
499            self.inner = self.inner.max_encoding_message_size(limit);
500            self
501        }
502        pub async fn send_commands(
503            &mut self,
504            request: impl tonic::IntoRequest<super::SendCommandsRequest>,
505        ) -> std::result::Result<
506            tonic::Response<super::SendCommandsResponse>,
507            tonic::Status,
508        > {
509            self.inner
510                .ready()
511                .await
512                .map_err(|e| {
513                    tonic::Status::unknown(
514                        format!("Service was not ready: {}", e.into()),
515                    )
516                })?;
517            let codec = tonic::codec::ProstCodec::default();
518            let path = http::uri::PathAndQuery::from_static(
519                "/nominal.command.v1.CommandService/SendCommands",
520            );
521            let mut req = request.into_request();
522            req.extensions_mut()
523                .insert(
524                    GrpcMethod::new("nominal.command.v1.CommandService", "SendCommands"),
525                );
526            self.inner.unary(req, path, codec).await
527        }
528    }
529}