1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct RecordUserEgressRequest {
4 #[prost(int64, tag = "1")]
5 pub bytes: i64,
6 #[prost(enumeration = "EgressDeliveryType", tag = "2")]
7 pub delivery_type: i32,
8 #[prost(string, repeated, tag = "3")]
9 pub resource_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
10}
11#[derive(Clone, Copy, PartialEq, ::prost::Message)]
12pub struct RecordUserEgressResponse {}
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
14#[repr(i32)]
15pub enum EgressDeliveryType {
16 Unspecified = 0,
17 ComputeStream = 1,
18}
19impl EgressDeliveryType {
20 pub fn as_str_name(&self) -> &'static str {
25 match self {
26 Self::Unspecified => "EGRESS_DELIVERY_TYPE_UNSPECIFIED",
27 Self::ComputeStream => "EGRESS_DELIVERY_TYPE_COMPUTE_STREAM",
28 }
29 }
30 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
32 match value {
33 "EGRESS_DELIVERY_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
34 "EGRESS_DELIVERY_TYPE_COMPUTE_STREAM" => Some(Self::ComputeStream),
35 _ => None,
36 }
37 }
38}
39pub mod internal_egress_service_client {
41 #![allow(
42 unused_variables,
43 dead_code,
44 missing_docs,
45 clippy::wildcard_imports,
46 clippy::let_unit_value,
47 )]
48 use tonic::codegen::*;
49 use tonic::codegen::http::Uri;
50 #[derive(Debug, Clone)]
51 pub struct InternalEgressServiceClient<T> {
52 inner: tonic::client::Grpc<T>,
53 }
54 impl InternalEgressServiceClient<tonic::transport::Channel> {
55 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
57 where
58 D: TryInto<tonic::transport::Endpoint>,
59 D::Error: Into<StdError>,
60 {
61 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
62 Ok(Self::new(conn))
63 }
64 }
65 impl<T> InternalEgressServiceClient<T>
66 where
67 T: tonic::client::GrpcService<tonic::body::Body>,
68 T::Error: Into<StdError>,
69 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
70 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
71 {
72 pub fn new(inner: T) -> Self {
73 let inner = tonic::client::Grpc::new(inner);
74 Self { inner }
75 }
76 pub fn with_origin(inner: T, origin: Uri) -> Self {
77 let inner = tonic::client::Grpc::with_origin(inner, origin);
78 Self { inner }
79 }
80 pub fn with_interceptor<F>(
81 inner: T,
82 interceptor: F,
83 ) -> InternalEgressServiceClient<InterceptedService<T, F>>
84 where
85 F: tonic::service::Interceptor,
86 T::ResponseBody: Default,
87 T: tonic::codegen::Service<
88 http::Request<tonic::body::Body>,
89 Response = http::Response<
90 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
91 >,
92 >,
93 <T as tonic::codegen::Service<
94 http::Request<tonic::body::Body>,
95 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
96 {
97 InternalEgressServiceClient::new(InterceptedService::new(inner, interceptor))
98 }
99 #[must_use]
104 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
105 self.inner = self.inner.send_compressed(encoding);
106 self
107 }
108 #[must_use]
110 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
111 self.inner = self.inner.accept_compressed(encoding);
112 self
113 }
114 #[must_use]
118 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
119 self.inner = self.inner.max_decoding_message_size(limit);
120 self
121 }
122 #[must_use]
126 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
127 self.inner = self.inner.max_encoding_message_size(limit);
128 self
129 }
130 pub async fn record_user_egress(
131 &mut self,
132 request: impl tonic::IntoRequest<super::RecordUserEgressRequest>,
133 ) -> std::result::Result<
134 tonic::Response<super::RecordUserEgressResponse>,
135 tonic::Status,
136 > {
137 self.inner
138 .ready()
139 .await
140 .map_err(|e| {
141 tonic::Status::unknown(
142 format!("Service was not ready: {}", e.into()),
143 )
144 })?;
145 let codec = tonic::codec::ProstCodec::default();
146 let path = http::uri::PathAndQuery::from_static(
147 "/nominal.internalusagetracking.v1.InternalEgressService/RecordUserEgress",
148 );
149 let mut req = request.into_request();
150 req.extensions_mut()
151 .insert(
152 GrpcMethod::new(
153 "nominal.internalusagetracking.v1.InternalEgressService",
154 "RecordUserEgress",
155 ),
156 );
157 self.inner.unary(req, path, codec).await
158 }
159 }
160}
161#[derive(Clone, PartialEq, ::prost::Message)]
162pub struct SystemUsageRecord {
163 #[prost(string, tag = "1")]
164 pub org_rid: ::prost::alloc::string::String,
165 #[prost(string, tag = "2")]
166 pub workspace_rid: ::prost::alloc::string::String,
167 #[prost(string, optional, tag = "3")]
168 pub user_rid: ::core::option::Option<::prost::alloc::string::String>,
169 #[prost(string, tag = "4")]
170 pub channel: ::prost::alloc::string::String,
171 #[prost(int64, tag = "5")]
172 pub value: i64,
173 #[prost(string, tag = "6")]
174 pub unit: ::prost::alloc::string::String,
175 #[prost(message, optional, tag = "7")]
176 pub timestamp: ::core::option::Option<
177 super::super::super::google::protobuf::Timestamp,
178 >,
179 #[prost(map = "string, string", tag = "8")]
180 pub tags: ::std::collections::HashMap<
181 ::prost::alloc::string::String,
182 ::prost::alloc::string::String,
183 >,
184}
185#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct RecordSystemUsageRequest {
187 #[prost(message, repeated, tag = "1")]
188 pub records: ::prost::alloc::vec::Vec<SystemUsageRecord>,
189}
190#[derive(Clone, Copy, PartialEq, ::prost::Message)]
191pub struct RecordSystemUsageResponse {
192 #[prost(enumeration = "TrackingStatus", tag = "1")]
193 pub status: i32,
194}
195#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
196#[repr(i32)]
197pub enum TrackingStatus {
198 Unspecified = 0,
199 Tracked = 1,
200 Failed = 2,
201}
202impl TrackingStatus {
203 pub fn as_str_name(&self) -> &'static str {
208 match self {
209 Self::Unspecified => "TRACKING_STATUS_UNSPECIFIED",
210 Self::Tracked => "TRACKING_STATUS_TRACKED",
211 Self::Failed => "TRACKING_STATUS_FAILED",
212 }
213 }
214 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
216 match value {
217 "TRACKING_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
218 "TRACKING_STATUS_TRACKED" => Some(Self::Tracked),
219 "TRACKING_STATUS_FAILED" => Some(Self::Failed),
220 _ => None,
221 }
222 }
223}
224pub mod internal_usage_tracking_service_client {
226 #![allow(
227 unused_variables,
228 dead_code,
229 missing_docs,
230 clippy::wildcard_imports,
231 clippy::let_unit_value,
232 )]
233 use tonic::codegen::*;
234 use tonic::codegen::http::Uri;
235 #[derive(Debug, Clone)]
236 pub struct InternalUsageTrackingServiceClient<T> {
237 inner: tonic::client::Grpc<T>,
238 }
239 impl InternalUsageTrackingServiceClient<tonic::transport::Channel> {
240 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
242 where
243 D: TryInto<tonic::transport::Endpoint>,
244 D::Error: Into<StdError>,
245 {
246 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
247 Ok(Self::new(conn))
248 }
249 }
250 impl<T> InternalUsageTrackingServiceClient<T>
251 where
252 T: tonic::client::GrpcService<tonic::body::Body>,
253 T::Error: Into<StdError>,
254 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
255 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
256 {
257 pub fn new(inner: T) -> Self {
258 let inner = tonic::client::Grpc::new(inner);
259 Self { inner }
260 }
261 pub fn with_origin(inner: T, origin: Uri) -> Self {
262 let inner = tonic::client::Grpc::with_origin(inner, origin);
263 Self { inner }
264 }
265 pub fn with_interceptor<F>(
266 inner: T,
267 interceptor: F,
268 ) -> InternalUsageTrackingServiceClient<InterceptedService<T, F>>
269 where
270 F: tonic::service::Interceptor,
271 T::ResponseBody: Default,
272 T: tonic::codegen::Service<
273 http::Request<tonic::body::Body>,
274 Response = http::Response<
275 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
276 >,
277 >,
278 <T as tonic::codegen::Service<
279 http::Request<tonic::body::Body>,
280 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
281 {
282 InternalUsageTrackingServiceClient::new(
283 InterceptedService::new(inner, interceptor),
284 )
285 }
286 #[must_use]
291 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
292 self.inner = self.inner.send_compressed(encoding);
293 self
294 }
295 #[must_use]
297 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
298 self.inner = self.inner.accept_compressed(encoding);
299 self
300 }
301 #[must_use]
305 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
306 self.inner = self.inner.max_decoding_message_size(limit);
307 self
308 }
309 #[must_use]
313 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
314 self.inner = self.inner.max_encoding_message_size(limit);
315 self
316 }
317 pub async fn record_system_usage(
318 &mut self,
319 request: impl tonic::IntoRequest<super::RecordSystemUsageRequest>,
320 ) -> std::result::Result<
321 tonic::Response<super::RecordSystemUsageResponse>,
322 tonic::Status,
323 > {
324 self.inner
325 .ready()
326 .await
327 .map_err(|e| {
328 tonic::Status::unknown(
329 format!("Service was not ready: {}", e.into()),
330 )
331 })?;
332 let codec = tonic::codec::ProstCodec::default();
333 let path = http::uri::PathAndQuery::from_static(
334 "/nominal.internalusagetracking.v1.InternalUsageTrackingService/RecordSystemUsage",
335 );
336 let mut req = request.into_request();
337 req.extensions_mut()
338 .insert(
339 GrpcMethod::new(
340 "nominal.internalusagetracking.v1.InternalUsageTrackingService",
341 "RecordSystemUsage",
342 ),
343 );
344 self.inner.unary(req, path, codec).await
345 }
346 }
347}