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

1// This file is @generated by prost-build.
2/// Empty response for the StreamAccessLogs API. Will never be sent. See below.
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct StreamAccessLogsResponse {}
5impl ::prost::Name for StreamAccessLogsResponse {
6    const NAME: &'static str = "StreamAccessLogsResponse";
7    const PACKAGE: &'static str = "envoy.service.accesslog.v3";
8    fn full_name() -> ::prost::alloc::string::String {
9        "envoy.service.accesslog.v3.StreamAccessLogsResponse".into()
10    }
11    fn type_url() -> ::prost::alloc::string::String {
12        "type.googleapis.com/envoy.service.accesslog.v3.StreamAccessLogsResponse".into()
13    }
14}
15/// Stream message for the StreamAccessLogs API. Envoy will open a stream to the server and stream
16/// access logs without ever expecting a response.
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct StreamAccessLogsMessage {
19    /// Identifier data that will only be sent in the first message on the stream. This is effectively
20    /// structured metadata and is a performance optimization.
21    #[prost(message, optional, tag = "1")]
22    pub identifier: ::core::option::Option<stream_access_logs_message::Identifier>,
23    /// Batches of log entries of a single type. Generally speaking, a given stream should only
24    /// ever include one type of log entry.
25    #[prost(oneof = "stream_access_logs_message::LogEntries", tags = "2, 3")]
26    pub log_entries: ::core::option::Option<stream_access_logs_message::LogEntries>,
27}
28/// Nested message and enum types in `StreamAccessLogsMessage`.
29pub mod stream_access_logs_message {
30    #[derive(Clone, PartialEq, ::prost::Message)]
31    pub struct Identifier {
32        /// The node sending the access log messages over the stream.
33        #[prost(message, optional, tag = "1")]
34        pub node: ::core::option::Option<
35            super::super::super::super::config::core::v3::Node,
36        >,
37        /// The friendly name of the log configured in :ref:`CommonGrpcAccessLogConfig
38        /// <envoy_v3_api_msg_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig>`.
39        #[prost(string, tag = "2")]
40        pub log_name: ::prost::alloc::string::String,
41    }
42    impl ::prost::Name for Identifier {
43        const NAME: &'static str = "Identifier";
44        const PACKAGE: &'static str = "envoy.service.accesslog.v3";
45        fn full_name() -> ::prost::alloc::string::String {
46            "envoy.service.accesslog.v3.StreamAccessLogsMessage.Identifier".into()
47        }
48        fn type_url() -> ::prost::alloc::string::String {
49            "type.googleapis.com/envoy.service.accesslog.v3.StreamAccessLogsMessage.Identifier"
50                .into()
51        }
52    }
53    /// Wrapper for batches of HTTP access log entries.
54    #[derive(Clone, PartialEq, ::prost::Message)]
55    pub struct HttpAccessLogEntries {
56        #[prost(message, repeated, tag = "1")]
57        pub log_entry: ::prost::alloc::vec::Vec<
58            super::super::super::super::data::accesslog::v3::HttpAccessLogEntry,
59        >,
60    }
61    impl ::prost::Name for HttpAccessLogEntries {
62        const NAME: &'static str = "HTTPAccessLogEntries";
63        const PACKAGE: &'static str = "envoy.service.accesslog.v3";
64        fn full_name() -> ::prost::alloc::string::String {
65            "envoy.service.accesslog.v3.StreamAccessLogsMessage.HTTPAccessLogEntries"
66                .into()
67        }
68        fn type_url() -> ::prost::alloc::string::String {
69            "type.googleapis.com/envoy.service.accesslog.v3.StreamAccessLogsMessage.HTTPAccessLogEntries"
70                .into()
71        }
72    }
73    /// Wrapper for batches of TCP access log entries.
74    #[derive(Clone, PartialEq, ::prost::Message)]
75    pub struct TcpAccessLogEntries {
76        #[prost(message, repeated, tag = "1")]
77        pub log_entry: ::prost::alloc::vec::Vec<
78            super::super::super::super::data::accesslog::v3::TcpAccessLogEntry,
79        >,
80    }
81    impl ::prost::Name for TcpAccessLogEntries {
82        const NAME: &'static str = "TCPAccessLogEntries";
83        const PACKAGE: &'static str = "envoy.service.accesslog.v3";
84        fn full_name() -> ::prost::alloc::string::String {
85            "envoy.service.accesslog.v3.StreamAccessLogsMessage.TCPAccessLogEntries"
86                .into()
87        }
88        fn type_url() -> ::prost::alloc::string::String {
89            "type.googleapis.com/envoy.service.accesslog.v3.StreamAccessLogsMessage.TCPAccessLogEntries"
90                .into()
91        }
92    }
93    /// Batches of log entries of a single type. Generally speaking, a given stream should only
94    /// ever include one type of log entry.
95    #[derive(Clone, PartialEq, ::prost::Oneof)]
96    pub enum LogEntries {
97        #[prost(message, tag = "2")]
98        HttpLogs(HttpAccessLogEntries),
99        #[prost(message, tag = "3")]
100        TcpLogs(TcpAccessLogEntries),
101    }
102}
103impl ::prost::Name for StreamAccessLogsMessage {
104    const NAME: &'static str = "StreamAccessLogsMessage";
105    const PACKAGE: &'static str = "envoy.service.accesslog.v3";
106    fn full_name() -> ::prost::alloc::string::String {
107        "envoy.service.accesslog.v3.StreamAccessLogsMessage".into()
108    }
109    fn type_url() -> ::prost::alloc::string::String {
110        "type.googleapis.com/envoy.service.accesslog.v3.StreamAccessLogsMessage".into()
111    }
112}
113/// Generated client implementations.
114pub mod access_log_service_client {
115    #![allow(
116        unused_variables,
117        dead_code,
118        missing_docs,
119        clippy::wildcard_imports,
120        clippy::let_unit_value,
121    )]
122    use tonic::codegen::*;
123    use tonic::codegen::http::Uri;
124    /// Service for streaming access logs from Envoy to an access log server.
125    #[derive(Debug, Clone)]
126    pub struct AccessLogServiceClient<T> {
127        inner: tonic::client::Grpc<T>,
128    }
129    impl<T> AccessLogServiceClient<T>
130    where
131        T: tonic::client::GrpcService<tonic::body::BoxBody>,
132        T::Error: Into<StdError>,
133        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
134        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
135    {
136        pub fn new(inner: T) -> Self {
137            let inner = tonic::client::Grpc::new(inner);
138            Self { inner }
139        }
140        pub fn with_origin(inner: T, origin: Uri) -> Self {
141            let inner = tonic::client::Grpc::with_origin(inner, origin);
142            Self { inner }
143        }
144        pub fn with_interceptor<F>(
145            inner: T,
146            interceptor: F,
147        ) -> AccessLogServiceClient<InterceptedService<T, F>>
148        where
149            F: tonic::service::Interceptor,
150            T::ResponseBody: Default,
151            T: tonic::codegen::Service<
152                http::Request<tonic::body::BoxBody>,
153                Response = http::Response<
154                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
155                >,
156            >,
157            <T as tonic::codegen::Service<
158                http::Request<tonic::body::BoxBody>,
159            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
160        {
161            AccessLogServiceClient::new(InterceptedService::new(inner, interceptor))
162        }
163        /// Compress requests with the given encoding.
164        ///
165        /// This requires the server to support it otherwise it might respond with an
166        /// error.
167        #[must_use]
168        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
169            self.inner = self.inner.send_compressed(encoding);
170            self
171        }
172        /// Enable decompressing responses.
173        #[must_use]
174        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
175            self.inner = self.inner.accept_compressed(encoding);
176            self
177        }
178        /// Limits the maximum size of a decoded message.
179        ///
180        /// Default: `4MB`
181        #[must_use]
182        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
183            self.inner = self.inner.max_decoding_message_size(limit);
184            self
185        }
186        /// Limits the maximum size of an encoded message.
187        ///
188        /// Default: `usize::MAX`
189        #[must_use]
190        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
191            self.inner = self.inner.max_encoding_message_size(limit);
192            self
193        }
194        /// Envoy will connect and send StreamAccessLogsMessage messages forever. It does not expect any
195        /// response to be sent as nothing would be done in the case of failure. The server should
196        /// disconnect if it expects Envoy to reconnect. In the future we may decide to add a different
197        /// API for "critical" access logs in which Envoy will buffer access logs for some period of time
198        /// until it gets an ACK so it could then retry. This API is designed for high throughput with the
199        /// expectation that it might be lossy.
200        pub async fn stream_access_logs(
201            &mut self,
202            request: impl tonic::IntoStreamingRequest<
203                Message = super::StreamAccessLogsMessage,
204            >,
205        ) -> std::result::Result<
206            tonic::Response<super::StreamAccessLogsResponse>,
207            tonic::Status,
208        > {
209            self.inner
210                .ready()
211                .await
212                .map_err(|e| {
213                    tonic::Status::unknown(
214                        format!("Service was not ready: {}", e.into()),
215                    )
216                })?;
217            let codec = tonic::codec::ProstCodec::default();
218            let path = http::uri::PathAndQuery::from_static(
219                "/envoy.service.accesslog.v3.AccessLogService/StreamAccessLogs",
220            );
221            let mut req = request.into_streaming_request();
222            req.extensions_mut()
223                .insert(
224                    GrpcMethod::new(
225                        "envoy.service.accesslog.v3.AccessLogService",
226                        "StreamAccessLogs",
227                    ),
228                );
229            self.inner.client_streaming(req, path, codec).await
230        }
231    }
232}
233/// Generated server implementations.
234pub mod access_log_service_server {
235    #![allow(
236        unused_variables,
237        dead_code,
238        missing_docs,
239        clippy::wildcard_imports,
240        clippy::let_unit_value,
241    )]
242    use tonic::codegen::*;
243    /// Generated trait containing gRPC methods that should be implemented for use with AccessLogServiceServer.
244    #[async_trait]
245    pub trait AccessLogService: std::marker::Send + std::marker::Sync + 'static {
246        /// Envoy will connect and send StreamAccessLogsMessage messages forever. It does not expect any
247        /// response to be sent as nothing would be done in the case of failure. The server should
248        /// disconnect if it expects Envoy to reconnect. In the future we may decide to add a different
249        /// API for "critical" access logs in which Envoy will buffer access logs for some period of time
250        /// until it gets an ACK so it could then retry. This API is designed for high throughput with the
251        /// expectation that it might be lossy.
252        async fn stream_access_logs(
253            &self,
254            request: tonic::Request<tonic::Streaming<super::StreamAccessLogsMessage>>,
255        ) -> std::result::Result<
256            tonic::Response<super::StreamAccessLogsResponse>,
257            tonic::Status,
258        >;
259    }
260    /// Service for streaming access logs from Envoy to an access log server.
261    #[derive(Debug)]
262    pub struct AccessLogServiceServer<T> {
263        inner: Arc<T>,
264        accept_compression_encodings: EnabledCompressionEncodings,
265        send_compression_encodings: EnabledCompressionEncodings,
266        max_decoding_message_size: Option<usize>,
267        max_encoding_message_size: Option<usize>,
268    }
269    impl<T> AccessLogServiceServer<T> {
270        pub fn new(inner: T) -> Self {
271            Self::from_arc(Arc::new(inner))
272        }
273        pub fn from_arc(inner: Arc<T>) -> Self {
274            Self {
275                inner,
276                accept_compression_encodings: Default::default(),
277                send_compression_encodings: Default::default(),
278                max_decoding_message_size: None,
279                max_encoding_message_size: None,
280            }
281        }
282        pub fn with_interceptor<F>(
283            inner: T,
284            interceptor: F,
285        ) -> InterceptedService<Self, F>
286        where
287            F: tonic::service::Interceptor,
288        {
289            InterceptedService::new(Self::new(inner), interceptor)
290        }
291        /// Enable decompressing requests with the given encoding.
292        #[must_use]
293        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
294            self.accept_compression_encodings.enable(encoding);
295            self
296        }
297        /// Compress responses with the given encoding, if the client supports it.
298        #[must_use]
299        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
300            self.send_compression_encodings.enable(encoding);
301            self
302        }
303        /// Limits the maximum size of a decoded message.
304        ///
305        /// Default: `4MB`
306        #[must_use]
307        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
308            self.max_decoding_message_size = Some(limit);
309            self
310        }
311        /// Limits the maximum size of an encoded message.
312        ///
313        /// Default: `usize::MAX`
314        #[must_use]
315        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
316            self.max_encoding_message_size = Some(limit);
317            self
318        }
319    }
320    impl<T, B> tonic::codegen::Service<http::Request<B>> for AccessLogServiceServer<T>
321    where
322        T: AccessLogService,
323        B: Body + std::marker::Send + 'static,
324        B::Error: Into<StdError> + std::marker::Send + 'static,
325    {
326        type Response = http::Response<tonic::body::BoxBody>;
327        type Error = std::convert::Infallible;
328        type Future = BoxFuture<Self::Response, Self::Error>;
329        fn poll_ready(
330            &mut self,
331            _cx: &mut Context<'_>,
332        ) -> Poll<std::result::Result<(), Self::Error>> {
333            Poll::Ready(Ok(()))
334        }
335        fn call(&mut self, req: http::Request<B>) -> Self::Future {
336            match req.uri().path() {
337                "/envoy.service.accesslog.v3.AccessLogService/StreamAccessLogs" => {
338                    #[allow(non_camel_case_types)]
339                    struct StreamAccessLogsSvc<T: AccessLogService>(pub Arc<T>);
340                    impl<
341                        T: AccessLogService,
342                    > tonic::server::ClientStreamingService<
343                        super::StreamAccessLogsMessage,
344                    > for StreamAccessLogsSvc<T> {
345                        type Response = super::StreamAccessLogsResponse;
346                        type Future = BoxFuture<
347                            tonic::Response<Self::Response>,
348                            tonic::Status,
349                        >;
350                        fn call(
351                            &mut self,
352                            request: tonic::Request<
353                                tonic::Streaming<super::StreamAccessLogsMessage>,
354                            >,
355                        ) -> Self::Future {
356                            let inner = Arc::clone(&self.0);
357                            let fut = async move {
358                                <T as AccessLogService>::stream_access_logs(&inner, request)
359                                    .await
360                            };
361                            Box::pin(fut)
362                        }
363                    }
364                    let accept_compression_encodings = self.accept_compression_encodings;
365                    let send_compression_encodings = self.send_compression_encodings;
366                    let max_decoding_message_size = self.max_decoding_message_size;
367                    let max_encoding_message_size = self.max_encoding_message_size;
368                    let inner = self.inner.clone();
369                    let fut = async move {
370                        let method = StreamAccessLogsSvc(inner);
371                        let codec = tonic::codec::ProstCodec::default();
372                        let mut grpc = tonic::server::Grpc::new(codec)
373                            .apply_compression_config(
374                                accept_compression_encodings,
375                                send_compression_encodings,
376                            )
377                            .apply_max_message_size_config(
378                                max_decoding_message_size,
379                                max_encoding_message_size,
380                            );
381                        let res = grpc.client_streaming(method, req).await;
382                        Ok(res)
383                    };
384                    Box::pin(fut)
385                }
386                _ => {
387                    Box::pin(async move {
388                        let mut response = http::Response::new(empty_body());
389                        let headers = response.headers_mut();
390                        headers
391                            .insert(
392                                tonic::Status::GRPC_STATUS,
393                                (tonic::Code::Unimplemented as i32).into(),
394                            );
395                        headers
396                            .insert(
397                                http::header::CONTENT_TYPE,
398                                tonic::metadata::GRPC_CONTENT_TYPE,
399                            );
400                        Ok(response)
401                    })
402                }
403            }
404        }
405    }
406    impl<T> Clone for AccessLogServiceServer<T> {
407        fn clone(&self) -> Self {
408            let inner = self.inner.clone();
409            Self {
410                inner,
411                accept_compression_encodings: self.accept_compression_encodings,
412                send_compression_encodings: self.send_compression_encodings,
413                max_decoding_message_size: self.max_decoding_message_size,
414                max_encoding_message_size: self.max_encoding_message_size,
415            }
416        }
417    }
418    /// Generated gRPC service name
419    pub const SERVICE_NAME: &str = "envoy.service.accesslog.v3.AccessLogService";
420    impl<T> tonic::server::NamedService for AccessLogServiceServer<T> {
421        const NAME: &'static str = SERVICE_NAME;
422    }
423}