Skip to main content

nominal_api/proto/
nominal.connections.v1.rs

1// This file is @generated by prost-build.
2/// Nanosecond precision timestamp type, represented by an epoch time in seconds and a nanosecond offset.
3/// The nanosecond offset is from the start of the epoch second, so must be less than 1 billion.
4#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5pub struct Timestamp {
6    #[prost(int64, tag = "1")]
7    pub seconds: i64,
8    #[prost(int64, tag = "2")]
9    pub nanos: i64,
10}
11#[derive(Clone, Copy, PartialEq, ::prost::Message)]
12pub struct Range {
13    #[prost(message, optional, tag = "1")]
14    pub start_time_inclusive: ::core::option::Option<Timestamp>,
15    #[prost(message, optional, tag = "2")]
16    pub end_time_exclusive: ::core::option::Option<Timestamp>,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct TagValues {
20    /// All the allowed values the tag can have. Tag values are opaque and will be passed back to the server in future
21    /// calls. The values are expected to be unique.
22    #[prost(string, repeated, tag = "1")]
23    pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct ChannelMetadata {
27    /// Channels are opaque values that will be passed back to the server in future calls.
28    #[prost(string, tag = "1")]
29    pub channel: ::prost::alloc::string::String,
30    /// Every value in the channel is expected to have the same type.
31    #[prost(enumeration = "DataType", tag = "2")]
32    pub data_type: i32,
33    /// All the possible tags and their values associated with the channel.
34    #[prost(map = "string, message", tag = "3")]
35    pub all_tag_values: ::std::collections::HashMap<
36        ::prost::alloc::string::String,
37        TagValues,
38    >,
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct ListChannelsRequest {
42    /// The max number of elements returned in the response, the actual number can be lower but should never exceed this.
43    #[prost(int32, tag = "1")]
44    pub page_size: i32,
45    /// The time range for which we want to see channels which exist
46    #[prost(message, optional, tag = "2")]
47    pub range: ::core::option::Option<Range>,
48    /// Where to continue paging from in subsequent requests. This will be empty on the first call.
49    #[prost(string, optional, tag = "3")]
50    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct ListChannelsResponse {
54    #[prost(message, repeated, tag = "1")]
55    pub channels: ::prost::alloc::vec::Vec<ChannelMetadata>,
56    #[prost(string, optional, tag = "2")]
57    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
58}
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct QueryChannelRequest {
61    /// The channel should be a value that was previously returned by a ListChannels call.
62    #[prost(string, tag = "1")]
63    pub channel: ::prost::alloc::string::String,
64    /// The tag name/value pairs to filter on.
65    #[prost(map = "string, string", tag = "2")]
66    pub tags: ::std::collections::HashMap<
67        ::prost::alloc::string::String,
68        ::prost::alloc::string::String,
69    >,
70    /// The time range to filter on.
71    #[prost(message, optional, tag = "3")]
72    pub range: ::core::option::Option<Range>,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct IntPoints {
76    #[prost(message, repeated, tag = "1")]
77    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
78    #[prost(int64, repeated, tag = "2")]
79    pub values: ::prost::alloc::vec::Vec<i64>,
80}
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct DoublePoints {
83    #[prost(message, repeated, tag = "1")]
84    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
85    #[prost(double, repeated, tag = "2")]
86    pub values: ::prost::alloc::vec::Vec<f64>,
87}
88#[derive(Clone, PartialEq, ::prost::Message)]
89pub struct StringPoints {
90    #[prost(message, repeated, tag = "1")]
91    pub timestamps: ::prost::alloc::vec::Vec<Timestamp>,
92    #[prost(string, repeated, tag = "2")]
93    pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
94}
95#[derive(Clone, PartialEq, ::prost::Message)]
96pub struct QueryChannelResponse {
97    #[prost(oneof = "query_channel_response::Values", tags = "1, 2, 3")]
98    pub values: ::core::option::Option<query_channel_response::Values>,
99}
100/// Nested message and enum types in `QueryChannelResponse`.
101pub mod query_channel_response {
102    #[derive(Clone, PartialEq, ::prost::Oneof)]
103    pub enum Values {
104        #[prost(message, tag = "1")]
105        Ints(super::IntPoints),
106        #[prost(message, tag = "2")]
107        Doubles(super::DoublePoints),
108        #[prost(message, tag = "3")]
109        Strings(super::StringPoints),
110    }
111}
112#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
113#[repr(i32)]
114pub enum DataType {
115    Unspecified = 0,
116    Int = 1,
117    Double = 2,
118    String = 3,
119}
120impl DataType {
121    /// String value of the enum field names used in the ProtoBuf definition.
122    ///
123    /// The values are not transformed in any way and thus are considered stable
124    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
125    pub fn as_str_name(&self) -> &'static str {
126        match self {
127            Self::Unspecified => "DATA_TYPE_UNSPECIFIED",
128            Self::Int => "DATA_TYPE_INT",
129            Self::Double => "DATA_TYPE_DOUBLE",
130            Self::String => "DATA_TYPE_STRING",
131        }
132    }
133    /// Creates an enum from field names used in the ProtoBuf definition.
134    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
135        match value {
136            "DATA_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
137            "DATA_TYPE_INT" => Some(Self::Int),
138            "DATA_TYPE_DOUBLE" => Some(Self::Double),
139            "DATA_TYPE_STRING" => Some(Self::String),
140            _ => None,
141        }
142    }
143}
144/// Generated client implementations.
145pub mod connections_service_client {
146    #![allow(
147        unused_variables,
148        dead_code,
149        missing_docs,
150        clippy::wildcard_imports,
151        clippy::let_unit_value,
152    )]
153    use tonic::codegen::*;
154    use tonic::codegen::http::Uri;
155    /// *
156    /// Defines the interface for how Nominal expects to interact with custom connection implementations. All sources of
157    /// time series data is abstracted by a channel identifier, allowing for flexibility of the underlying data source
158    /// implementations.
159    ///
160    /// The authorization credentials are passed as http headers as:
161    ///     "Authorization: Bearer <token>"
162    #[derive(Debug, Clone)]
163    pub struct ConnectionsServiceClient<T> {
164        inner: tonic::client::Grpc<T>,
165    }
166    impl ConnectionsServiceClient<tonic::transport::Channel> {
167        /// Attempt to create a new client by connecting to a given endpoint.
168        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
169        where
170            D: TryInto<tonic::transport::Endpoint>,
171            D::Error: Into<StdError>,
172        {
173            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
174            Ok(Self::new(conn))
175        }
176    }
177    impl<T> ConnectionsServiceClient<T>
178    where
179        T: tonic::client::GrpcService<tonic::body::Body>,
180        T::Error: Into<StdError>,
181        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
182        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
183    {
184        pub fn new(inner: T) -> Self {
185            let inner = tonic::client::Grpc::new(inner);
186            Self { inner }
187        }
188        pub fn with_origin(inner: T, origin: Uri) -> Self {
189            let inner = tonic::client::Grpc::with_origin(inner, origin);
190            Self { inner }
191        }
192        pub fn with_interceptor<F>(
193            inner: T,
194            interceptor: F,
195        ) -> ConnectionsServiceClient<InterceptedService<T, F>>
196        where
197            F: tonic::service::Interceptor,
198            T::ResponseBody: Default,
199            T: tonic::codegen::Service<
200                http::Request<tonic::body::Body>,
201                Response = http::Response<
202                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
203                >,
204            >,
205            <T as tonic::codegen::Service<
206                http::Request<tonic::body::Body>,
207            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
208        {
209            ConnectionsServiceClient::new(InterceptedService::new(inner, interceptor))
210        }
211        /// Compress requests with the given encoding.
212        ///
213        /// This requires the server to support it otherwise it might respond with an
214        /// error.
215        #[must_use]
216        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
217            self.inner = self.inner.send_compressed(encoding);
218            self
219        }
220        /// Enable decompressing responses.
221        #[must_use]
222        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
223            self.inner = self.inner.accept_compressed(encoding);
224            self
225        }
226        /// Limits the maximum size of a decoded message.
227        ///
228        /// Default: `4MB`
229        #[must_use]
230        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
231            self.inner = self.inner.max_decoding_message_size(limit);
232            self
233        }
234        /// Limits the maximum size of an encoded message.
235        ///
236        /// Default: `usize::MAX`
237        #[must_use]
238        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
239            self.inner = self.inner.max_encoding_message_size(limit);
240            self
241        }
242        /// *
243        /// Paging endpoint to list all the channels and their allowed tag values. Callers should expect that more results are
244        /// available as long as ListChannelsResponse continues to return a pageToken and will pass in this pageToken in the
245        /// next ListChannelsRequest.
246        pub async fn list_channels(
247            &mut self,
248            request: impl tonic::IntoRequest<super::ListChannelsRequest>,
249        ) -> std::result::Result<
250            tonic::Response<super::ListChannelsResponse>,
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.connections.v1.ConnectionsService/ListChannels",
264            );
265            let mut req = request.into_request();
266            req.extensions_mut()
267                .insert(
268                    GrpcMethod::new(
269                        "nominal.connections.v1.ConnectionsService",
270                        "ListChannels",
271                    ),
272                );
273            self.inner.unary(req, path, codec).await
274        }
275        /// *
276        /// Endpoint to query a given channel for time series data for a given set of tags and time range. The response is a
277        /// stream of points.
278        pub async fn query_channel(
279            &mut self,
280            request: impl tonic::IntoRequest<super::QueryChannelRequest>,
281        ) -> std::result::Result<
282            tonic::Response<tonic::codec::Streaming<super::QueryChannelResponse>>,
283            tonic::Status,
284        > {
285            self.inner
286                .ready()
287                .await
288                .map_err(|e| {
289                    tonic::Status::unknown(
290                        format!("Service was not ready: {}", e.into()),
291                    )
292                })?;
293            let codec = tonic::codec::ProstCodec::default();
294            let path = http::uri::PathAndQuery::from_static(
295                "/nominal.connections.v1.ConnectionsService/QueryChannel",
296            );
297            let mut req = request.into_request();
298            req.extensions_mut()
299                .insert(
300                    GrpcMethod::new(
301                        "nominal.connections.v1.ConnectionsService",
302                        "QueryChannel",
303                    ),
304                );
305            self.inner.server_streaming(req, path, codec).await
306        }
307    }
308}