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