Skip to main content

nominal_api_proto/proto/
nominal.internalusagetracking.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct SystemUsageRecord {
4    #[prost(string, tag = "1")]
5    pub org_rid: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub workspace_rid: ::prost::alloc::string::String,
8    #[prost(string, optional, tag = "3")]
9    pub user_rid: ::core::option::Option<::prost::alloc::string::String>,
10    #[prost(string, tag = "4")]
11    pub channel: ::prost::alloc::string::String,
12    #[prost(int64, tag = "5")]
13    pub value: i64,
14    #[prost(string, tag = "6")]
15    pub unit: ::prost::alloc::string::String,
16    #[prost(message, optional, tag = "7")]
17    pub timestamp: ::core::option::Option<
18        super::super::super::google::protobuf::Timestamp,
19    >,
20    #[prost(map = "string, string", tag = "8")]
21    pub tags: ::std::collections::HashMap<
22        ::prost::alloc::string::String,
23        ::prost::alloc::string::String,
24    >,
25}
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct RecordSystemUsageRequest {
28    #[prost(message, repeated, tag = "1")]
29    pub records: ::prost::alloc::vec::Vec<SystemUsageRecord>,
30}
31#[derive(Clone, Copy, PartialEq, ::prost::Message)]
32pub struct RecordSystemUsageResponse {
33    #[prost(enumeration = "TrackingStatus", tag = "1")]
34    pub status: i32,
35}
36#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
37#[repr(i32)]
38pub enum TrackingStatus {
39    Unspecified = 0,
40    Tracked = 1,
41    Failed = 2,
42}
43impl TrackingStatus {
44    /// String value of the enum field names used in the ProtoBuf definition.
45    ///
46    /// The values are not transformed in any way and thus are considered stable
47    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
48    pub fn as_str_name(&self) -> &'static str {
49        match self {
50            Self::Unspecified => "TRACKING_STATUS_UNSPECIFIED",
51            Self::Tracked => "TRACKING_STATUS_TRACKED",
52            Self::Failed => "TRACKING_STATUS_FAILED",
53        }
54    }
55    /// Creates an enum from field names used in the ProtoBuf definition.
56    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
57        match value {
58            "TRACKING_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
59            "TRACKING_STATUS_TRACKED" => Some(Self::Tracked),
60            "TRACKING_STATUS_FAILED" => Some(Self::Failed),
61            _ => None,
62        }
63    }
64}
65/// Generated client implementations.
66pub mod internal_usage_tracking_service_client {
67    #![allow(
68        unused_variables,
69        dead_code,
70        missing_docs,
71        clippy::wildcard_imports,
72        clippy::let_unit_value,
73    )]
74    use tonic::codegen::*;
75    use tonic::codegen::http::Uri;
76    #[derive(Debug, Clone)]
77    pub struct InternalUsageTrackingServiceClient<T> {
78        inner: tonic::client::Grpc<T>,
79    }
80    impl InternalUsageTrackingServiceClient<tonic::transport::Channel> {
81        /// Attempt to create a new client by connecting to a given endpoint.
82        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
83        where
84            D: TryInto<tonic::transport::Endpoint>,
85            D::Error: Into<StdError>,
86        {
87            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
88            Ok(Self::new(conn))
89        }
90    }
91    impl<T> InternalUsageTrackingServiceClient<T>
92    where
93        T: tonic::client::GrpcService<tonic::body::Body>,
94        T::Error: Into<StdError>,
95        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
96        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
97    {
98        pub fn new(inner: T) -> Self {
99            let inner = tonic::client::Grpc::new(inner);
100            Self { inner }
101        }
102        pub fn with_origin(inner: T, origin: Uri) -> Self {
103            let inner = tonic::client::Grpc::with_origin(inner, origin);
104            Self { inner }
105        }
106        pub fn with_interceptor<F>(
107            inner: T,
108            interceptor: F,
109        ) -> InternalUsageTrackingServiceClient<InterceptedService<T, F>>
110        where
111            F: tonic::service::Interceptor,
112            T::ResponseBody: Default,
113            T: tonic::codegen::Service<
114                http::Request<tonic::body::Body>,
115                Response = http::Response<
116                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
117                >,
118            >,
119            <T as tonic::codegen::Service<
120                http::Request<tonic::body::Body>,
121            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
122        {
123            InternalUsageTrackingServiceClient::new(
124                InterceptedService::new(inner, interceptor),
125            )
126        }
127        /// Compress requests with the given encoding.
128        ///
129        /// This requires the server to support it otherwise it might respond with an
130        /// error.
131        #[must_use]
132        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
133            self.inner = self.inner.send_compressed(encoding);
134            self
135        }
136        /// Enable decompressing responses.
137        #[must_use]
138        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
139            self.inner = self.inner.accept_compressed(encoding);
140            self
141        }
142        /// Limits the maximum size of a decoded message.
143        ///
144        /// Default: `4MB`
145        #[must_use]
146        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
147            self.inner = self.inner.max_decoding_message_size(limit);
148            self
149        }
150        /// Limits the maximum size of an encoded message.
151        ///
152        /// Default: `usize::MAX`
153        #[must_use]
154        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
155            self.inner = self.inner.max_encoding_message_size(limit);
156            self
157        }
158        pub async fn record_system_usage(
159            &mut self,
160            request: impl tonic::IntoRequest<super::RecordSystemUsageRequest>,
161        ) -> std::result::Result<
162            tonic::Response<super::RecordSystemUsageResponse>,
163            tonic::Status,
164        > {
165            self.inner
166                .ready()
167                .await
168                .map_err(|e| {
169                    tonic::Status::unknown(
170                        format!("Service was not ready: {}", e.into()),
171                    )
172                })?;
173            let codec = tonic::codec::ProstCodec::default();
174            let path = http::uri::PathAndQuery::from_static(
175                "/nominal.internalusagetracking.v1.InternalUsageTrackingService/RecordSystemUsage",
176            );
177            let mut req = request.into_request();
178            req.extensions_mut()
179                .insert(
180                    GrpcMethod::new(
181                        "nominal.internalusagetracking.v1.InternalUsageTrackingService",
182                        "RecordSystemUsage",
183                    ),
184                );
185            self.inner.unary(req, path, codec).await
186        }
187    }
188}