#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandDeliveryEnvelope {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub sequence: u64,
#[prost(message, optional, tag = "3")]
pub issued_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "4")]
pub deadline: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(string, tag = "5")]
pub hub_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "8")]
pub commands: ::prost::alloc::vec::Vec<ChannelCommand>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChannelCommand {
#[prost(string, tag = "1")]
pub channel: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<CommandValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandValue {
#[prost(oneof = "command_value::Value", tags = "1, 2, 3, 4")]
pub value: ::core::option::Option<command_value::Value>,
}
pub mod command_value {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(int64, tag = "1")]
IntValue(i64),
#[prost(double, tag = "2")]
FloatValue(f64),
#[prost(bool, tag = "3")]
BoolValue(bool),
#[prost(string, tag = "4")]
EnumValue(::prost::alloc::string::String),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandDeliveryAck {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub sequence: u64,
#[prost(oneof = "command_delivery_ack::Outcome", tags = "3, 4")]
pub outcome: ::core::option::Option<command_delivery_ack::Outcome>,
}
pub mod command_delivery_ack {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Outcome {
#[prost(message, tag = "3")]
Accepted(super::CommandDeliveryAccepted),
#[prost(message, tag = "4")]
Rejected(super::CommandDeliveryRejected),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CommandDeliveryAccepted {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandDeliveryRejected {
#[prost(string, tag = "1")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterCommandHubRequest {
#[prost(string, tag = "2")]
pub dataset_rid: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "3")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterCommandHubResponse {
#[prost(string, tag = "1")]
pub registration_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub expires_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "3")]
pub credential: ::core::option::Option<CommandHubCredential>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandHubCredential {
#[prost(string, tag = "1")]
pub nats_jwt: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub nats_url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub expires_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeartbeatCommandHubRequest {
#[prost(string, tag = "1")]
pub registration_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct HeartbeatCommandHubResponse {
#[prost(message, optional, tag = "1")]
pub expires_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeregisterCommandHubRequest {
#[prost(string, tag = "1")]
pub registration_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeregisterCommandHubResponse {}
pub mod command_hub_registry_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct CommandHubRegistryServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CommandHubRegistryServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> CommandHubRegistryServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CommandHubRegistryServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
CommandHubRegistryServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn register_command_hub(
&mut self,
request: impl tonic::IntoRequest<super::RegisterCommandHubRequest>,
) -> std::result::Result<
tonic::Response<super::RegisterCommandHubResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.command.v1.CommandHubRegistryService/RegisterCommandHub",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.command.v1.CommandHubRegistryService",
"RegisterCommandHub",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn heartbeat_command_hub(
&mut self,
request: impl tonic::IntoRequest<super::HeartbeatCommandHubRequest>,
) -> std::result::Result<
tonic::Response<super::HeartbeatCommandHubResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.command.v1.CommandHubRegistryService/HeartbeatCommandHub",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.command.v1.CommandHubRegistryService",
"HeartbeatCommandHub",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn deregister_command_hub(
&mut self,
request: impl tonic::IntoRequest<super::DeregisterCommandHubRequest>,
) -> std::result::Result<
tonic::Response<super::DeregisterCommandHubResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.command.v1.CommandHubRegistryService/DeregisterCommandHub",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.command.v1.CommandHubRegistryService",
"DeregisterCommandHub",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendCommandsRequest {
#[prost(string, tag = "1")]
pub dataset_rid: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub tags: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, repeated, tag = "3")]
pub commands: ::prost::alloc::vec::Vec<ChannelCommand>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendCommandsResponse {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub sequence: u64,
#[prost(message, optional, tag = "3")]
pub issued_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "4")]
pub expires_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(oneof = "send_commands_response::Result", tags = "5, 6, 7, 8")]
pub result: ::core::option::Option<send_commands_response::Result>,
}
pub mod send_commands_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
#[prost(message, tag = "5")]
Accepted(super::CommandDeliveryAck),
#[prost(message, tag = "6")]
Rejected(super::CommandDeliveryAck),
#[prost(message, tag = "7")]
NoLiveHub(super::NoLiveHub),
#[prost(message, tag = "8")]
OutcomeUnknown(super::OutcomeUnknown),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NoLiveHub {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OutcomeUnknown {
#[prost(enumeration = "outcome_unknown::Reason", tag = "1")]
pub reason: i32,
}
pub mod outcome_unknown {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Reason {
Unspecified = 0,
TimedOut = 1,
MalformedAck = 2,
MismatchedAck = 3,
Interrupted = 4,
TransportError = 5,
}
impl Reason {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "REASON_UNSPECIFIED",
Self::TimedOut => "REASON_TIMED_OUT",
Self::MalformedAck => "REASON_MALFORMED_ACK",
Self::MismatchedAck => "REASON_MISMATCHED_ACK",
Self::Interrupted => "REASON_INTERRUPTED",
Self::TransportError => "REASON_TRANSPORT_ERROR",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REASON_UNSPECIFIED" => Some(Self::Unspecified),
"REASON_TIMED_OUT" => Some(Self::TimedOut),
"REASON_MALFORMED_ACK" => Some(Self::MalformedAck),
"REASON_MISMATCHED_ACK" => Some(Self::MismatchedAck),
"REASON_INTERRUPTED" => Some(Self::Interrupted),
"REASON_TRANSPORT_ERROR" => Some(Self::TransportError),
_ => None,
}
}
}
}
pub mod command_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct CommandServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CommandServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> CommandServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CommandServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
CommandServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn send_commands(
&mut self,
request: impl tonic::IntoRequest<super::SendCommandsRequest>,
) -> std::result::Result<
tonic::Response<super::SendCommandsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.command.v1.CommandService/SendCommands",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.command.v1.CommandService", "SendCommands"),
);
self.inner.unary(req, path, codec).await
}
}
}