xds_api/generated/
envoy.service.event_reporting.v3.rs

1// This file is @generated by prost-build.
2/// \[#not-implemented-hide:\]
3/// An events envoy sends to the management server.
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct StreamEventsRequest {
6    /// Identifier data that will only be sent in the first message on the stream. This is effectively
7    /// structured metadata and is a performance optimization.
8    #[prost(message, optional, tag = "1")]
9    pub identifier: ::core::option::Option<stream_events_request::Identifier>,
10    /// Batch of events. When the stream is already active, it will be the events occurred
11    /// since the last message had been sent. If the server receives unknown event type, it should
12    /// silently ignore it.
13    ///
14    /// The following events are supported:
15    ///
16    /// * :ref:`HealthCheckEvent <envoy_v3_api_msg_data.core.v3.HealthCheckEvent>`
17    /// * :ref:`OutlierDetectionEvent <envoy_v3_api_msg_data.cluster.v3.OutlierDetectionEvent>`
18    #[prost(message, repeated, tag = "2")]
19    pub events: ::prost::alloc::vec::Vec<
20        super::super::super::super::google::protobuf::Any,
21    >,
22}
23/// Nested message and enum types in `StreamEventsRequest`.
24pub mod stream_events_request {
25    #[derive(Clone, PartialEq, ::prost::Message)]
26    pub struct Identifier {
27        /// The node sending the event messages over the stream.
28        #[prost(message, optional, tag = "1")]
29        pub node: ::core::option::Option<
30            super::super::super::super::config::core::v3::Node,
31        >,
32    }
33    impl ::prost::Name for Identifier {
34        const NAME: &'static str = "Identifier";
35        const PACKAGE: &'static str = "envoy.service.event_reporting.v3";
36        fn full_name() -> ::prost::alloc::string::String {
37            "envoy.service.event_reporting.v3.StreamEventsRequest.Identifier".into()
38        }
39        fn type_url() -> ::prost::alloc::string::String {
40            "type.googleapis.com/envoy.service.event_reporting.v3.StreamEventsRequest.Identifier"
41                .into()
42        }
43    }
44}
45impl ::prost::Name for StreamEventsRequest {
46    const NAME: &'static str = "StreamEventsRequest";
47    const PACKAGE: &'static str = "envoy.service.event_reporting.v3";
48    fn full_name() -> ::prost::alloc::string::String {
49        "envoy.service.event_reporting.v3.StreamEventsRequest".into()
50    }
51    fn type_url() -> ::prost::alloc::string::String {
52        "type.googleapis.com/envoy.service.event_reporting.v3.StreamEventsRequest".into()
53    }
54}
55/// \[#not-implemented-hide:\]
56/// The management server may send envoy a StreamEventsResponse to tell which events the server
57/// is interested in. In future, with aggregated event reporting service, this message will
58/// contain, for example, clusters the envoy should send events for, or event types the server
59/// wants to process.
60#[derive(Clone, Copy, PartialEq, ::prost::Message)]
61pub struct StreamEventsResponse {}
62impl ::prost::Name for StreamEventsResponse {
63    const NAME: &'static str = "StreamEventsResponse";
64    const PACKAGE: &'static str = "envoy.service.event_reporting.v3";
65    fn full_name() -> ::prost::alloc::string::String {
66        "envoy.service.event_reporting.v3.StreamEventsResponse".into()
67    }
68    fn type_url() -> ::prost::alloc::string::String {
69        "type.googleapis.com/envoy.service.event_reporting.v3.StreamEventsResponse"
70            .into()
71    }
72}
73/// Generated client implementations.
74pub mod event_reporting_service_client {
75    #![allow(
76        unused_variables,
77        dead_code,
78        missing_docs,
79        clippy::wildcard_imports,
80        clippy::let_unit_value,
81    )]
82    use tonic::codegen::*;
83    use tonic::codegen::http::Uri;
84    /// [#not-implemented-hide:]
85    /// Service for streaming different types of events from Envoy to a server. The examples of
86    /// such events may be health check or outlier detection events.
87    #[derive(Debug, Clone)]
88    pub struct EventReportingServiceClient<T> {
89        inner: tonic::client::Grpc<T>,
90    }
91    impl<T> EventReportingServiceClient<T>
92    where
93        T: tonic::client::GrpcService<tonic::body::BoxBody>,
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        ) -> EventReportingServiceClient<InterceptedService<T, F>>
110        where
111            F: tonic::service::Interceptor,
112            T::ResponseBody: Default,
113            T: tonic::codegen::Service<
114                http::Request<tonic::body::BoxBody>,
115                Response = http::Response<
116                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
117                >,
118            >,
119            <T as tonic::codegen::Service<
120                http::Request<tonic::body::BoxBody>,
121            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
122        {
123            EventReportingServiceClient::new(InterceptedService::new(inner, interceptor))
124        }
125        /// Compress requests with the given encoding.
126        ///
127        /// This requires the server to support it otherwise it might respond with an
128        /// error.
129        #[must_use]
130        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
131            self.inner = self.inner.send_compressed(encoding);
132            self
133        }
134        /// Enable decompressing responses.
135        #[must_use]
136        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
137            self.inner = self.inner.accept_compressed(encoding);
138            self
139        }
140        /// Limits the maximum size of a decoded message.
141        ///
142        /// Default: `4MB`
143        #[must_use]
144        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
145            self.inner = self.inner.max_decoding_message_size(limit);
146            self
147        }
148        /// Limits the maximum size of an encoded message.
149        ///
150        /// Default: `usize::MAX`
151        #[must_use]
152        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
153            self.inner = self.inner.max_encoding_message_size(limit);
154            self
155        }
156        /// Envoy will connect and send StreamEventsRequest messages forever.
157        /// The management server may send StreamEventsResponse to configure event stream. See below.
158        /// This API is designed for high throughput with the expectation that it might be lossy.
159        pub async fn stream_events(
160            &mut self,
161            request: impl tonic::IntoStreamingRequest<
162                Message = super::StreamEventsRequest,
163            >,
164        ) -> std::result::Result<
165            tonic::Response<tonic::codec::Streaming<super::StreamEventsResponse>>,
166            tonic::Status,
167        > {
168            self.inner
169                .ready()
170                .await
171                .map_err(|e| {
172                    tonic::Status::unknown(
173                        format!("Service was not ready: {}", e.into()),
174                    )
175                })?;
176            let codec = tonic::codec::ProstCodec::default();
177            let path = http::uri::PathAndQuery::from_static(
178                "/envoy.service.event_reporting.v3.EventReportingService/StreamEvents",
179            );
180            let mut req = request.into_streaming_request();
181            req.extensions_mut()
182                .insert(
183                    GrpcMethod::new(
184                        "envoy.service.event_reporting.v3.EventReportingService",
185                        "StreamEvents",
186                    ),
187                );
188            self.inner.streaming(req, path, codec).await
189        }
190    }
191}
192/// Generated server implementations.
193pub mod event_reporting_service_server {
194    #![allow(
195        unused_variables,
196        dead_code,
197        missing_docs,
198        clippy::wildcard_imports,
199        clippy::let_unit_value,
200    )]
201    use tonic::codegen::*;
202    /// Generated trait containing gRPC methods that should be implemented for use with EventReportingServiceServer.
203    #[async_trait]
204    pub trait EventReportingService: std::marker::Send + std::marker::Sync + 'static {
205        /// Server streaming response type for the StreamEvents method.
206        type StreamEventsStream: tonic::codegen::tokio_stream::Stream<
207                Item = std::result::Result<super::StreamEventsResponse, tonic::Status>,
208            >
209            + std::marker::Send
210            + 'static;
211        /// Envoy will connect and send StreamEventsRequest messages forever.
212        /// The management server may send StreamEventsResponse to configure event stream. See below.
213        /// This API is designed for high throughput with the expectation that it might be lossy.
214        async fn stream_events(
215            &self,
216            request: tonic::Request<tonic::Streaming<super::StreamEventsRequest>>,
217        ) -> std::result::Result<
218            tonic::Response<Self::StreamEventsStream>,
219            tonic::Status,
220        >;
221    }
222    /// [#not-implemented-hide:]
223    /// Service for streaming different types of events from Envoy to a server. The examples of
224    /// such events may be health check or outlier detection events.
225    #[derive(Debug)]
226    pub struct EventReportingServiceServer<T> {
227        inner: Arc<T>,
228        accept_compression_encodings: EnabledCompressionEncodings,
229        send_compression_encodings: EnabledCompressionEncodings,
230        max_decoding_message_size: Option<usize>,
231        max_encoding_message_size: Option<usize>,
232    }
233    impl<T> EventReportingServiceServer<T> {
234        pub fn new(inner: T) -> Self {
235            Self::from_arc(Arc::new(inner))
236        }
237        pub fn from_arc(inner: Arc<T>) -> Self {
238            Self {
239                inner,
240                accept_compression_encodings: Default::default(),
241                send_compression_encodings: Default::default(),
242                max_decoding_message_size: None,
243                max_encoding_message_size: None,
244            }
245        }
246        pub fn with_interceptor<F>(
247            inner: T,
248            interceptor: F,
249        ) -> InterceptedService<Self, F>
250        where
251            F: tonic::service::Interceptor,
252        {
253            InterceptedService::new(Self::new(inner), interceptor)
254        }
255        /// Enable decompressing requests with the given encoding.
256        #[must_use]
257        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
258            self.accept_compression_encodings.enable(encoding);
259            self
260        }
261        /// Compress responses with the given encoding, if the client supports it.
262        #[must_use]
263        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
264            self.send_compression_encodings.enable(encoding);
265            self
266        }
267        /// Limits the maximum size of a decoded message.
268        ///
269        /// Default: `4MB`
270        #[must_use]
271        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
272            self.max_decoding_message_size = Some(limit);
273            self
274        }
275        /// Limits the maximum size of an encoded message.
276        ///
277        /// Default: `usize::MAX`
278        #[must_use]
279        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
280            self.max_encoding_message_size = Some(limit);
281            self
282        }
283    }
284    impl<T, B> tonic::codegen::Service<http::Request<B>>
285    for EventReportingServiceServer<T>
286    where
287        T: EventReportingService,
288        B: Body + std::marker::Send + 'static,
289        B::Error: Into<StdError> + std::marker::Send + 'static,
290    {
291        type Response = http::Response<tonic::body::BoxBody>;
292        type Error = std::convert::Infallible;
293        type Future = BoxFuture<Self::Response, Self::Error>;
294        fn poll_ready(
295            &mut self,
296            _cx: &mut Context<'_>,
297        ) -> Poll<std::result::Result<(), Self::Error>> {
298            Poll::Ready(Ok(()))
299        }
300        fn call(&mut self, req: http::Request<B>) -> Self::Future {
301            match req.uri().path() {
302                "/envoy.service.event_reporting.v3.EventReportingService/StreamEvents" => {
303                    #[allow(non_camel_case_types)]
304                    struct StreamEventsSvc<T: EventReportingService>(pub Arc<T>);
305                    impl<
306                        T: EventReportingService,
307                    > tonic::server::StreamingService<super::StreamEventsRequest>
308                    for StreamEventsSvc<T> {
309                        type Response = super::StreamEventsResponse;
310                        type ResponseStream = T::StreamEventsStream;
311                        type Future = BoxFuture<
312                            tonic::Response<Self::ResponseStream>,
313                            tonic::Status,
314                        >;
315                        fn call(
316                            &mut self,
317                            request: tonic::Request<
318                                tonic::Streaming<super::StreamEventsRequest>,
319                            >,
320                        ) -> Self::Future {
321                            let inner = Arc::clone(&self.0);
322                            let fut = async move {
323                                <T as EventReportingService>::stream_events(&inner, request)
324                                    .await
325                            };
326                            Box::pin(fut)
327                        }
328                    }
329                    let accept_compression_encodings = self.accept_compression_encodings;
330                    let send_compression_encodings = self.send_compression_encodings;
331                    let max_decoding_message_size = self.max_decoding_message_size;
332                    let max_encoding_message_size = self.max_encoding_message_size;
333                    let inner = self.inner.clone();
334                    let fut = async move {
335                        let method = StreamEventsSvc(inner);
336                        let codec = tonic::codec::ProstCodec::default();
337                        let mut grpc = tonic::server::Grpc::new(codec)
338                            .apply_compression_config(
339                                accept_compression_encodings,
340                                send_compression_encodings,
341                            )
342                            .apply_max_message_size_config(
343                                max_decoding_message_size,
344                                max_encoding_message_size,
345                            );
346                        let res = grpc.streaming(method, req).await;
347                        Ok(res)
348                    };
349                    Box::pin(fut)
350                }
351                _ => {
352                    Box::pin(async move {
353                        let mut response = http::Response::new(empty_body());
354                        let headers = response.headers_mut();
355                        headers
356                            .insert(
357                                tonic::Status::GRPC_STATUS,
358                                (tonic::Code::Unimplemented as i32).into(),
359                            );
360                        headers
361                            .insert(
362                                http::header::CONTENT_TYPE,
363                                tonic::metadata::GRPC_CONTENT_TYPE,
364                            );
365                        Ok(response)
366                    })
367                }
368            }
369        }
370    }
371    impl<T> Clone for EventReportingServiceServer<T> {
372        fn clone(&self) -> Self {
373            let inner = self.inner.clone();
374            Self {
375                inner,
376                accept_compression_encodings: self.accept_compression_encodings,
377                send_compression_encodings: self.send_compression_encodings,
378                max_decoding_message_size: self.max_decoding_message_size,
379                max_encoding_message_size: self.max_encoding_message_size,
380            }
381        }
382    }
383    /// Generated gRPC service name
384    pub const SERVICE_NAME: &str = "envoy.service.event_reporting.v3.EventReportingService";
385    impl<T> tonic::server::NamedService for EventReportingServiceServer<T> {
386        const NAME: &'static str = SERVICE_NAME;
387    }
388}