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

1// This file is @generated by prost-build.
2/// This represents the different types of messages that Envoy can send
3/// to an external processing server.
4/// \[#next-free-field: 11\]
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct ProcessingRequest {
7    /// Dynamic metadata associated with the request.
8    #[prost(message, optional, tag = "8")]
9    pub metadata_context: ::core::option::Option<
10        super::super::super::config::core::v3::Metadata,
11    >,
12    /// The values of properties selected by the ``request_attributes``
13    /// or ``response_attributes`` list in the configuration. Each entry
14    /// in the list is populated from the standard
15    /// :ref:`attributes <arch_overview_attributes>` supported across Envoy.
16    #[prost(map = "string, message", tag = "9")]
17    pub attributes: ::std::collections::HashMap<
18        ::prost::alloc::string::String,
19        super::super::super::super::google::protobuf::Struct,
20    >,
21    /// Specify whether the filter that sent this request is running in :ref:`observability_mode
22    /// <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.observability_mode>`
23    /// and defaults to false.
24    ///
25    /// * A value of ``false`` indicates that the server must respond
26    ///    to this message by either sending back a matching ProcessingResponse message,
27    ///    or by closing the stream.
28    /// * A value of ``true`` indicates that the server should not respond to this message, as any
29    ///    responses will be ignored. However, it may still close the stream to indicate that no more messages
30    ///    are needed.
31    ///
32    #[prost(bool, tag = "10")]
33    pub observability_mode: bool,
34    /// Each request message will include one of the following sub-messages. Which
35    /// ones are set for a particular HTTP request/response depend on the
36    /// processing mode.
37    #[prost(oneof = "processing_request::Request", tags = "2, 3, 4, 5, 6, 7")]
38    pub request: ::core::option::Option<processing_request::Request>,
39}
40/// Nested message and enum types in `ProcessingRequest`.
41pub mod processing_request {
42    /// Each request message will include one of the following sub-messages. Which
43    /// ones are set for a particular HTTP request/response depend on the
44    /// processing mode.
45    #[derive(Clone, PartialEq, ::prost::Oneof)]
46    pub enum Request {
47        /// Information about the HTTP request headers, as well as peer info and additional
48        /// properties. Unless ``observability_mode`` is ``true``, the server must send back a
49        /// HeaderResponse message, an ImmediateResponse message, or close the stream.
50        #[prost(message, tag = "2")]
51        RequestHeaders(super::HttpHeaders),
52        /// Information about the HTTP response headers, as well as peer info and additional
53        /// properties. Unless ``observability_mode`` is ``true``, the server must send back a
54        /// HeaderResponse message or close the stream.
55        #[prost(message, tag = "3")]
56        ResponseHeaders(super::HttpHeaders),
57        /// A chunk of the HTTP request body. Unless ``observability_mode`` is true, the server must send back
58        /// a BodyResponse message, an ImmediateResponse message, or close the stream.
59        #[prost(message, tag = "4")]
60        RequestBody(super::HttpBody),
61        /// A chunk of the HTTP response body. Unless ``observability_mode`` is ``true``, the server must send back
62        /// a BodyResponse message or close the stream.
63        #[prost(message, tag = "5")]
64        ResponseBody(super::HttpBody),
65        /// The HTTP trailers for the request path. Unless ``observability_mode`` is ``true``, the server
66        /// must send back a TrailerResponse message or close the stream.
67        ///
68        /// This message is only sent if the trailers processing mode is set to ``SEND`` and
69        /// the original downstream request has trailers.
70        #[prost(message, tag = "6")]
71        RequestTrailers(super::HttpTrailers),
72        /// The HTTP trailers for the response path. Unless ``observability_mode`` is ``true``, the server
73        /// must send back a TrailerResponse message or close the stream.
74        ///
75        /// This message is only sent if the trailers processing mode is set to ``SEND`` and
76        /// the original upstream response has trailers.
77        #[prost(message, tag = "7")]
78        ResponseTrailers(super::HttpTrailers),
79    }
80}
81impl ::prost::Name for ProcessingRequest {
82    const NAME: &'static str = "ProcessingRequest";
83    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
84    fn full_name() -> ::prost::alloc::string::String {
85        "envoy.service.ext_proc.v3.ProcessingRequest".into()
86    }
87    fn type_url() -> ::prost::alloc::string::String {
88        "type.googleapis.com/envoy.service.ext_proc.v3.ProcessingRequest".into()
89    }
90}
91/// For every ProcessingRequest received by the server with the ``observability_mode`` field
92/// set to false, the server must send back exactly one ProcessingResponse message.
93/// \[#next-free-field: 11\]
94#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct ProcessingResponse {
96    /// Optional metadata that will be emitted as dynamic metadata to be consumed by
97    /// following filters. This metadata will be placed in the namespace(s) specified by the top-level
98    /// field name(s) of the struct.
99    #[prost(message, optional, tag = "8")]
100    pub dynamic_metadata: ::core::option::Option<
101        super::super::super::super::google::protobuf::Struct,
102    >,
103    /// Override how parts of the HTTP request and response are processed
104    /// for the duration of this particular request/response only. Servers
105    /// may use this to intelligently control how requests are processed
106    /// based on the headers and other metadata that they see.
107    /// This field is only applicable when servers responding to the header requests.
108    /// If it is set in the response to the body or trailer requests, it will be ignored by Envoy.
109    /// It is also ignored by Envoy when the ext_proc filter config
110    /// :ref:`allow_mode_override
111    /// <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.allow_mode_override>`
112    /// is set to false.
113    #[prost(message, optional, tag = "9")]
114    pub mode_override: ::core::option::Option<
115        super::super::super::extensions::filters::http::ext_proc::v3::ProcessingMode,
116    >,
117    /// When ext_proc server receives a request message, in case it needs more
118    /// time to process the message, it sends back a ProcessingResponse message
119    /// with a new timeout value. When Envoy receives this response message,
120    /// it ignores other fields in the response, just stop the original timer,
121    /// which has the timeout value specified in
122    /// :ref:`message_timeout
123    /// <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.message_timeout>`
124    /// and start a new timer with this ``override_message_timeout`` value and keep the
125    /// Envoy ext_proc filter state machine intact.
126    /// Has to be >= 1ms and <=
127    /// :ref:`max_message_timeout <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.max_message_timeout>`
128    /// Such message can be sent at most once in a particular Envoy ext_proc filter processing state.
129    /// To enable this API, one has to set ``max_message_timeout`` to a number >= 1ms.
130    #[prost(message, optional, tag = "10")]
131    pub override_message_timeout: ::core::option::Option<
132        super::super::super::super::google::protobuf::Duration,
133    >,
134    #[prost(oneof = "processing_response::Response", tags = "1, 2, 3, 4, 5, 6, 7")]
135    pub response: ::core::option::Option<processing_response::Response>,
136}
137/// Nested message and enum types in `ProcessingResponse`.
138pub mod processing_response {
139    #[derive(Clone, PartialEq, ::prost::Oneof)]
140    pub enum Response {
141        /// The server must send back this message in response to a message with the
142        /// ``request_headers`` field set.
143        #[prost(message, tag = "1")]
144        RequestHeaders(super::HeadersResponse),
145        /// The server must send back this message in response to a message with the
146        /// ``response_headers`` field set.
147        #[prost(message, tag = "2")]
148        ResponseHeaders(super::HeadersResponse),
149        /// The server must send back this message in response to a message with
150        /// the ``request_body`` field set.
151        #[prost(message, tag = "3")]
152        RequestBody(super::BodyResponse),
153        /// The server must send back this message in response to a message with
154        /// the ``response_body`` field set.
155        #[prost(message, tag = "4")]
156        ResponseBody(super::BodyResponse),
157        /// The server must send back this message in response to a message with
158        /// the ``request_trailers`` field set.
159        #[prost(message, tag = "5")]
160        RequestTrailers(super::TrailersResponse),
161        /// The server must send back this message in response to a message with
162        /// the ``response_trailers`` field set.
163        #[prost(message, tag = "6")]
164        ResponseTrailers(super::TrailersResponse),
165        /// If specified, attempt to create a locally generated response, send it
166        /// downstream, and stop processing additional filters and ignore any
167        /// additional messages received from the remote server for this request or
168        /// response. If a response has already started -- for example, if this
169        /// message is sent response to a ``response_body`` message -- then
170        /// this will either ship the reply directly to the downstream codec,
171        /// or reset the stream.
172        #[prost(message, tag = "7")]
173        ImmediateResponse(super::ImmediateResponse),
174    }
175}
176impl ::prost::Name for ProcessingResponse {
177    const NAME: &'static str = "ProcessingResponse";
178    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
179    fn full_name() -> ::prost::alloc::string::String {
180        "envoy.service.ext_proc.v3.ProcessingResponse".into()
181    }
182    fn type_url() -> ::prost::alloc::string::String {
183        "type.googleapis.com/envoy.service.ext_proc.v3.ProcessingResponse".into()
184    }
185}
186/// This message is sent to the external server when the HTTP request and responses
187/// are first received.
188#[derive(Clone, PartialEq, ::prost::Message)]
189pub struct HttpHeaders {
190    /// The HTTP request headers. All header keys will be
191    /// lower-cased, because HTTP header keys are case-insensitive.
192    /// The ``headers`` encoding is based on the runtime guard
193    /// envoy_reloadable_features_send_header_raw_value setting.
194    /// When it is true, the header value is encoded in the
195    /// :ref:`raw_value <envoy_v3_api_field_config.core.v3.HeaderValue.raw_value>` field.
196    /// When it is false, the header value is encoded in the
197    /// :ref:`value <envoy_v3_api_field_config.core.v3.HeaderValue.value>` field.
198    #[prost(message, optional, tag = "1")]
199    pub headers: ::core::option::Option<
200        super::super::super::config::core::v3::HeaderMap,
201    >,
202    /// \[#not-implemented-hide:\]
203    /// This field is deprecated and not implemented. Attributes will be sent in
204    /// the  top-level :ref:`attributes <envoy_v3_api_field_service.ext_proc.v3.ProcessingRequest.attributes`
205    /// field.
206    #[prost(map = "string, message", tag = "2")]
207    pub attributes: ::std::collections::HashMap<
208        ::prost::alloc::string::String,
209        super::super::super::super::google::protobuf::Struct,
210    >,
211    /// If true, then there is no message body associated with this
212    /// request or response.
213    #[prost(bool, tag = "3")]
214    pub end_of_stream: bool,
215}
216impl ::prost::Name for HttpHeaders {
217    const NAME: &'static str = "HttpHeaders";
218    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
219    fn full_name() -> ::prost::alloc::string::String {
220        "envoy.service.ext_proc.v3.HttpHeaders".into()
221    }
222    fn type_url() -> ::prost::alloc::string::String {
223        "type.googleapis.com/envoy.service.ext_proc.v3.HttpHeaders".into()
224    }
225}
226/// This message contains the message body that Envoy sends to the external server.
227#[derive(Clone, PartialEq, ::prost::Message)]
228pub struct HttpBody {
229    #[prost(bytes = "vec", tag = "1")]
230    pub body: ::prost::alloc::vec::Vec<u8>,
231    #[prost(bool, tag = "2")]
232    pub end_of_stream: bool,
233}
234impl ::prost::Name for HttpBody {
235    const NAME: &'static str = "HttpBody";
236    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
237    fn full_name() -> ::prost::alloc::string::String {
238        "envoy.service.ext_proc.v3.HttpBody".into()
239    }
240    fn type_url() -> ::prost::alloc::string::String {
241        "type.googleapis.com/envoy.service.ext_proc.v3.HttpBody".into()
242    }
243}
244/// This message contains the trailers.
245#[derive(Clone, PartialEq, ::prost::Message)]
246pub struct HttpTrailers {
247    /// The ``trailers`` encoding is based on the runtime guard
248    /// envoy_reloadable_features_send_header_raw_value setting.
249    /// When it is true, the header value is encoded in the
250    /// :ref:`raw_value <envoy_v3_api_field_config.core.v3.HeaderValue.raw_value>` field.
251    /// When it is false, the header value is encoded in the
252    /// :ref:`value <envoy_v3_api_field_config.core.v3.HeaderValue.value>` field.
253    #[prost(message, optional, tag = "1")]
254    pub trailers: ::core::option::Option<
255        super::super::super::config::core::v3::HeaderMap,
256    >,
257}
258impl ::prost::Name for HttpTrailers {
259    const NAME: &'static str = "HttpTrailers";
260    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
261    fn full_name() -> ::prost::alloc::string::String {
262        "envoy.service.ext_proc.v3.HttpTrailers".into()
263    }
264    fn type_url() -> ::prost::alloc::string::String {
265        "type.googleapis.com/envoy.service.ext_proc.v3.HttpTrailers".into()
266    }
267}
268/// This message must be sent in response to an HttpHeaders message.
269#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct HeadersResponse {
271    #[prost(message, optional, tag = "1")]
272    pub response: ::core::option::Option<CommonResponse>,
273}
274impl ::prost::Name for HeadersResponse {
275    const NAME: &'static str = "HeadersResponse";
276    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
277    fn full_name() -> ::prost::alloc::string::String {
278        "envoy.service.ext_proc.v3.HeadersResponse".into()
279    }
280    fn type_url() -> ::prost::alloc::string::String {
281        "type.googleapis.com/envoy.service.ext_proc.v3.HeadersResponse".into()
282    }
283}
284/// This message must be sent in response to an HttpTrailers message.
285#[derive(Clone, PartialEq, ::prost::Message)]
286pub struct TrailersResponse {
287    /// Instructions on how to manipulate the trailers
288    #[prost(message, optional, tag = "1")]
289    pub header_mutation: ::core::option::Option<HeaderMutation>,
290}
291impl ::prost::Name for TrailersResponse {
292    const NAME: &'static str = "TrailersResponse";
293    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
294    fn full_name() -> ::prost::alloc::string::String {
295        "envoy.service.ext_proc.v3.TrailersResponse".into()
296    }
297    fn type_url() -> ::prost::alloc::string::String {
298        "type.googleapis.com/envoy.service.ext_proc.v3.TrailersResponse".into()
299    }
300}
301/// This message must be sent in response to an HttpBody message.
302#[derive(Clone, PartialEq, ::prost::Message)]
303pub struct BodyResponse {
304    #[prost(message, optional, tag = "1")]
305    pub response: ::core::option::Option<CommonResponse>,
306}
307impl ::prost::Name for BodyResponse {
308    const NAME: &'static str = "BodyResponse";
309    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
310    fn full_name() -> ::prost::alloc::string::String {
311        "envoy.service.ext_proc.v3.BodyResponse".into()
312    }
313    fn type_url() -> ::prost::alloc::string::String {
314        "type.googleapis.com/envoy.service.ext_proc.v3.BodyResponse".into()
315    }
316}
317/// This message contains common fields between header and body responses.
318/// \[#next-free-field: 6\]
319#[derive(Clone, PartialEq, ::prost::Message)]
320pub struct CommonResponse {
321    /// If set, provide additional direction on how the Envoy proxy should
322    /// handle the rest of the HTTP filter chain.
323    #[prost(enumeration = "common_response::ResponseStatus", tag = "1")]
324    pub status: i32,
325    /// Instructions on how to manipulate the headers. When responding to an
326    /// HttpBody request, header mutations will only take effect if
327    /// the current processing mode for the body is BUFFERED.
328    #[prost(message, optional, tag = "2")]
329    pub header_mutation: ::core::option::Option<HeaderMutation>,
330    /// Replace the body of the last message sent to the remote server on this
331    /// stream. If responding to an HttpBody request, simply replace or clear
332    /// the body chunk that was sent with that request. Body mutations may take
333    /// effect in response either to ``header`` or ``body`` messages. When it is
334    /// in response to ``header`` messages, it only take effect if the
335    /// :ref:`status <envoy_v3_api_field_service.ext_proc.v3.CommonResponse.status>`
336    /// is set to CONTINUE_AND_REPLACE.
337    #[prost(message, optional, tag = "3")]
338    pub body_mutation: ::core::option::Option<BodyMutation>,
339    /// \[#not-implemented-hide:\]
340    /// Add new trailers to the message. This may be used when responding to either a
341    /// HttpHeaders or HttpBody message, but only if this message is returned
342    /// along with the CONTINUE_AND_REPLACE status.
343    /// The ``trailers`` encoding is based on the runtime guard
344    /// envoy_reloadable_features_send_header_raw_value setting.
345    /// When it is true, the header value is encoded in the
346    /// :ref:`raw_value <envoy_v3_api_field_config.core.v3.HeaderValue.raw_value>` field.
347    /// When it is false, the header value is encoded in the
348    /// :ref:`value <envoy_v3_api_field_config.core.v3.HeaderValue.value>` field.
349    #[prost(message, optional, tag = "4")]
350    pub trailers: ::core::option::Option<
351        super::super::super::config::core::v3::HeaderMap,
352    >,
353    /// Clear the route cache for the current client request. This is necessary
354    /// if the remote server modified headers that are used to calculate the route.
355    /// This field is ignored in the response direction. This field is also ignored
356    /// if the Envoy ext_proc filter is in the upstream filter chain.
357    #[prost(bool, tag = "5")]
358    pub clear_route_cache: bool,
359}
360/// Nested message and enum types in `CommonResponse`.
361pub mod common_response {
362    #[derive(
363        Clone,
364        Copy,
365        Debug,
366        PartialEq,
367        Eq,
368        Hash,
369        PartialOrd,
370        Ord,
371        ::prost::Enumeration
372    )]
373    #[repr(i32)]
374    pub enum ResponseStatus {
375        /// Apply the mutation instructions in this message to the
376        /// request or response, and then continue processing the filter
377        /// stream as normal. This is the default.
378        Continue = 0,
379        /// Apply the specified header mutation, replace the body with the body
380        /// specified in the body mutation (if present), and do not send any
381        /// further messages for this request or response even if the processing
382        /// mode is configured to do so.
383        ///
384        /// When used in response to a request_headers or response_headers message,
385        /// this status makes it possible to either completely replace the body
386        /// while discarding the original body, or to add a body to a message that
387        /// formerly did not have one.
388        ///
389        /// In other words, this response makes it possible to turn an HTTP GET
390        /// into a POST, PUT, or PATCH.
391        ContinueAndReplace = 1,
392    }
393    impl ResponseStatus {
394        /// String value of the enum field names used in the ProtoBuf definition.
395        ///
396        /// The values are not transformed in any way and thus are considered stable
397        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
398        pub fn as_str_name(&self) -> &'static str {
399            match self {
400                Self::Continue => "CONTINUE",
401                Self::ContinueAndReplace => "CONTINUE_AND_REPLACE",
402            }
403        }
404        /// Creates an enum from field names used in the ProtoBuf definition.
405        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
406            match value {
407                "CONTINUE" => Some(Self::Continue),
408                "CONTINUE_AND_REPLACE" => Some(Self::ContinueAndReplace),
409                _ => None,
410            }
411        }
412    }
413}
414impl ::prost::Name for CommonResponse {
415    const NAME: &'static str = "CommonResponse";
416    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
417    fn full_name() -> ::prost::alloc::string::String {
418        "envoy.service.ext_proc.v3.CommonResponse".into()
419    }
420    fn type_url() -> ::prost::alloc::string::String {
421        "type.googleapis.com/envoy.service.ext_proc.v3.CommonResponse".into()
422    }
423}
424/// This message causes the filter to attempt to create a locally
425/// generated response, send it  downstream, stop processing
426/// additional filters, and ignore any additional messages received
427/// from the remote server for this request or response. If a response
428/// has already started, then  this will either ship the reply directly
429/// to the downstream codec, or reset the stream.
430/// \[#next-free-field: 6\]
431#[derive(Clone, PartialEq, ::prost::Message)]
432pub struct ImmediateResponse {
433    /// The response code to return
434    #[prost(message, optional, tag = "1")]
435    pub status: ::core::option::Option<super::super::super::r#type::v3::HttpStatus>,
436    /// Apply changes to the default headers, which will include content-type.
437    #[prost(message, optional, tag = "2")]
438    pub headers: ::core::option::Option<HeaderMutation>,
439    /// The message body to return with the response which is sent using the
440    /// text/plain content type, or encoded in the grpc-message header.
441    #[prost(bytes = "vec", tag = "3")]
442    pub body: ::prost::alloc::vec::Vec<u8>,
443    /// If set, then include a gRPC status trailer.
444    #[prost(message, optional, tag = "4")]
445    pub grpc_status: ::core::option::Option<GrpcStatus>,
446    /// A string detailing why this local reply was sent, which may be included
447    /// in log and debug output (e.g. this populates the %RESPONSE_CODE_DETAILS%
448    /// command operator field for use in access logging).
449    #[prost(string, tag = "5")]
450    pub details: ::prost::alloc::string::String,
451}
452impl ::prost::Name for ImmediateResponse {
453    const NAME: &'static str = "ImmediateResponse";
454    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
455    fn full_name() -> ::prost::alloc::string::String {
456        "envoy.service.ext_proc.v3.ImmediateResponse".into()
457    }
458    fn type_url() -> ::prost::alloc::string::String {
459        "type.googleapis.com/envoy.service.ext_proc.v3.ImmediateResponse".into()
460    }
461}
462/// This message specifies a gRPC status for an ImmediateResponse message.
463#[derive(Clone, Copy, PartialEq, ::prost::Message)]
464pub struct GrpcStatus {
465    /// The actual gRPC status
466    #[prost(uint32, tag = "1")]
467    pub status: u32,
468}
469impl ::prost::Name for GrpcStatus {
470    const NAME: &'static str = "GrpcStatus";
471    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
472    fn full_name() -> ::prost::alloc::string::String {
473        "envoy.service.ext_proc.v3.GrpcStatus".into()
474    }
475    fn type_url() -> ::prost::alloc::string::String {
476        "type.googleapis.com/envoy.service.ext_proc.v3.GrpcStatus".into()
477    }
478}
479/// Change HTTP headers or trailers by appending, replacing, or removing
480/// headers.
481#[derive(Clone, PartialEq, ::prost::Message)]
482pub struct HeaderMutation {
483    /// Add or replace HTTP headers. Attempts to set the value of
484    /// any ``x-envoy`` header, and attempts to set the ``:method``,
485    /// ``:authority``, ``:scheme``, or ``host`` headers will be ignored.
486    /// The ``set_headers`` encoding is based on the runtime guard
487    /// envoy_reloadable_features_send_header_raw_value setting.
488    /// When it is true, the header value is encoded in the
489    /// :ref:`raw_value <envoy_v3_api_field_config.core.v3.HeaderValue.raw_value>` field.
490    /// When it is false, the header value is encoded in the
491    /// :ref:`value <envoy_v3_api_field_config.core.v3.HeaderValue.value>` field.
492    #[prost(message, repeated, tag = "1")]
493    pub set_headers: ::prost::alloc::vec::Vec<
494        super::super::super::config::core::v3::HeaderValueOption,
495    >,
496    /// Remove these HTTP headers. Attempts to remove system headers --
497    /// any header starting with ``:``, plus ``host`` -- will be ignored.
498    #[prost(string, repeated, tag = "2")]
499    pub remove_headers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
500}
501impl ::prost::Name for HeaderMutation {
502    const NAME: &'static str = "HeaderMutation";
503    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
504    fn full_name() -> ::prost::alloc::string::String {
505        "envoy.service.ext_proc.v3.HeaderMutation".into()
506    }
507    fn type_url() -> ::prost::alloc::string::String {
508        "type.googleapis.com/envoy.service.ext_proc.v3.HeaderMutation".into()
509    }
510}
511/// Replace the entire message body chunk received in the corresponding
512/// HttpBody message with this new body, or clear the body.
513#[derive(Clone, PartialEq, ::prost::Message)]
514pub struct BodyMutation {
515    #[prost(oneof = "body_mutation::Mutation", tags = "1, 2")]
516    pub mutation: ::core::option::Option<body_mutation::Mutation>,
517}
518/// Nested message and enum types in `BodyMutation`.
519pub mod body_mutation {
520    #[derive(Clone, PartialEq, ::prost::Oneof)]
521    pub enum Mutation {
522        /// The entire body to replace
523        #[prost(bytes, tag = "1")]
524        Body(::prost::alloc::vec::Vec<u8>),
525        /// Clear the corresponding body chunk
526        #[prost(bool, tag = "2")]
527        ClearBody(bool),
528    }
529}
530impl ::prost::Name for BodyMutation {
531    const NAME: &'static str = "BodyMutation";
532    const PACKAGE: &'static str = "envoy.service.ext_proc.v3";
533    fn full_name() -> ::prost::alloc::string::String {
534        "envoy.service.ext_proc.v3.BodyMutation".into()
535    }
536    fn type_url() -> ::prost::alloc::string::String {
537        "type.googleapis.com/envoy.service.ext_proc.v3.BodyMutation".into()
538    }
539}
540/// Generated client implementations.
541pub mod external_processor_client {
542    #![allow(
543        unused_variables,
544        dead_code,
545        missing_docs,
546        clippy::wildcard_imports,
547        clippy::let_unit_value,
548    )]
549    use tonic::codegen::*;
550    use tonic::codegen::http::Uri;
551    #[derive(Debug, Clone)]
552    pub struct ExternalProcessorClient<T> {
553        inner: tonic::client::Grpc<T>,
554    }
555    impl<T> ExternalProcessorClient<T>
556    where
557        T: tonic::client::GrpcService<tonic::body::BoxBody>,
558        T::Error: Into<StdError>,
559        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
560        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
561    {
562        pub fn new(inner: T) -> Self {
563            let inner = tonic::client::Grpc::new(inner);
564            Self { inner }
565        }
566        pub fn with_origin(inner: T, origin: Uri) -> Self {
567            let inner = tonic::client::Grpc::with_origin(inner, origin);
568            Self { inner }
569        }
570        pub fn with_interceptor<F>(
571            inner: T,
572            interceptor: F,
573        ) -> ExternalProcessorClient<InterceptedService<T, F>>
574        where
575            F: tonic::service::Interceptor,
576            T::ResponseBody: Default,
577            T: tonic::codegen::Service<
578                http::Request<tonic::body::BoxBody>,
579                Response = http::Response<
580                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
581                >,
582            >,
583            <T as tonic::codegen::Service<
584                http::Request<tonic::body::BoxBody>,
585            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
586        {
587            ExternalProcessorClient::new(InterceptedService::new(inner, interceptor))
588        }
589        /// Compress requests with the given encoding.
590        ///
591        /// This requires the server to support it otherwise it might respond with an
592        /// error.
593        #[must_use]
594        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
595            self.inner = self.inner.send_compressed(encoding);
596            self
597        }
598        /// Enable decompressing responses.
599        #[must_use]
600        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
601            self.inner = self.inner.accept_compressed(encoding);
602            self
603        }
604        /// Limits the maximum size of a decoded message.
605        ///
606        /// Default: `4MB`
607        #[must_use]
608        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
609            self.inner = self.inner.max_decoding_message_size(limit);
610            self
611        }
612        /// Limits the maximum size of an encoded message.
613        ///
614        /// Default: `usize::MAX`
615        #[must_use]
616        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
617            self.inner = self.inner.max_encoding_message_size(limit);
618            self
619        }
620        /// This begins the bidirectional stream that Envoy will use to
621        /// give the server control over what the filter does. The actual
622        /// protocol is described by the ProcessingRequest and ProcessingResponse
623        /// messages below.
624        pub async fn process(
625            &mut self,
626            request: impl tonic::IntoStreamingRequest<Message = super::ProcessingRequest>,
627        ) -> std::result::Result<
628            tonic::Response<tonic::codec::Streaming<super::ProcessingResponse>>,
629            tonic::Status,
630        > {
631            self.inner
632                .ready()
633                .await
634                .map_err(|e| {
635                    tonic::Status::unknown(
636                        format!("Service was not ready: {}", e.into()),
637                    )
638                })?;
639            let codec = tonic::codec::ProstCodec::default();
640            let path = http::uri::PathAndQuery::from_static(
641                "/envoy.service.ext_proc.v3.ExternalProcessor/Process",
642            );
643            let mut req = request.into_streaming_request();
644            req.extensions_mut()
645                .insert(
646                    GrpcMethod::new(
647                        "envoy.service.ext_proc.v3.ExternalProcessor",
648                        "Process",
649                    ),
650                );
651            self.inner.streaming(req, path, codec).await
652        }
653    }
654}
655/// Generated server implementations.
656pub mod external_processor_server {
657    #![allow(
658        unused_variables,
659        dead_code,
660        missing_docs,
661        clippy::wildcard_imports,
662        clippy::let_unit_value,
663    )]
664    use tonic::codegen::*;
665    /// Generated trait containing gRPC methods that should be implemented for use with ExternalProcessorServer.
666    #[async_trait]
667    pub trait ExternalProcessor: std::marker::Send + std::marker::Sync + 'static {
668        /// Server streaming response type for the Process method.
669        type ProcessStream: tonic::codegen::tokio_stream::Stream<
670                Item = std::result::Result<super::ProcessingResponse, tonic::Status>,
671            >
672            + std::marker::Send
673            + 'static;
674        /// This begins the bidirectional stream that Envoy will use to
675        /// give the server control over what the filter does. The actual
676        /// protocol is described by the ProcessingRequest and ProcessingResponse
677        /// messages below.
678        async fn process(
679            &self,
680            request: tonic::Request<tonic::Streaming<super::ProcessingRequest>>,
681        ) -> std::result::Result<tonic::Response<Self::ProcessStream>, tonic::Status>;
682    }
683    #[derive(Debug)]
684    pub struct ExternalProcessorServer<T> {
685        inner: Arc<T>,
686        accept_compression_encodings: EnabledCompressionEncodings,
687        send_compression_encodings: EnabledCompressionEncodings,
688        max_decoding_message_size: Option<usize>,
689        max_encoding_message_size: Option<usize>,
690    }
691    impl<T> ExternalProcessorServer<T> {
692        pub fn new(inner: T) -> Self {
693            Self::from_arc(Arc::new(inner))
694        }
695        pub fn from_arc(inner: Arc<T>) -> Self {
696            Self {
697                inner,
698                accept_compression_encodings: Default::default(),
699                send_compression_encodings: Default::default(),
700                max_decoding_message_size: None,
701                max_encoding_message_size: None,
702            }
703        }
704        pub fn with_interceptor<F>(
705            inner: T,
706            interceptor: F,
707        ) -> InterceptedService<Self, F>
708        where
709            F: tonic::service::Interceptor,
710        {
711            InterceptedService::new(Self::new(inner), interceptor)
712        }
713        /// Enable decompressing requests with the given encoding.
714        #[must_use]
715        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
716            self.accept_compression_encodings.enable(encoding);
717            self
718        }
719        /// Compress responses with the given encoding, if the client supports it.
720        #[must_use]
721        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
722            self.send_compression_encodings.enable(encoding);
723            self
724        }
725        /// Limits the maximum size of a decoded message.
726        ///
727        /// Default: `4MB`
728        #[must_use]
729        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
730            self.max_decoding_message_size = Some(limit);
731            self
732        }
733        /// Limits the maximum size of an encoded message.
734        ///
735        /// Default: `usize::MAX`
736        #[must_use]
737        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
738            self.max_encoding_message_size = Some(limit);
739            self
740        }
741    }
742    impl<T, B> tonic::codegen::Service<http::Request<B>> for ExternalProcessorServer<T>
743    where
744        T: ExternalProcessor,
745        B: Body + std::marker::Send + 'static,
746        B::Error: Into<StdError> + std::marker::Send + 'static,
747    {
748        type Response = http::Response<tonic::body::BoxBody>;
749        type Error = std::convert::Infallible;
750        type Future = BoxFuture<Self::Response, Self::Error>;
751        fn poll_ready(
752            &mut self,
753            _cx: &mut Context<'_>,
754        ) -> Poll<std::result::Result<(), Self::Error>> {
755            Poll::Ready(Ok(()))
756        }
757        fn call(&mut self, req: http::Request<B>) -> Self::Future {
758            match req.uri().path() {
759                "/envoy.service.ext_proc.v3.ExternalProcessor/Process" => {
760                    #[allow(non_camel_case_types)]
761                    struct ProcessSvc<T: ExternalProcessor>(pub Arc<T>);
762                    impl<
763                        T: ExternalProcessor,
764                    > tonic::server::StreamingService<super::ProcessingRequest>
765                    for ProcessSvc<T> {
766                        type Response = super::ProcessingResponse;
767                        type ResponseStream = T::ProcessStream;
768                        type Future = BoxFuture<
769                            tonic::Response<Self::ResponseStream>,
770                            tonic::Status,
771                        >;
772                        fn call(
773                            &mut self,
774                            request: tonic::Request<
775                                tonic::Streaming<super::ProcessingRequest>,
776                            >,
777                        ) -> Self::Future {
778                            let inner = Arc::clone(&self.0);
779                            let fut = async move {
780                                <T as ExternalProcessor>::process(&inner, request).await
781                            };
782                            Box::pin(fut)
783                        }
784                    }
785                    let accept_compression_encodings = self.accept_compression_encodings;
786                    let send_compression_encodings = self.send_compression_encodings;
787                    let max_decoding_message_size = self.max_decoding_message_size;
788                    let max_encoding_message_size = self.max_encoding_message_size;
789                    let inner = self.inner.clone();
790                    let fut = async move {
791                        let method = ProcessSvc(inner);
792                        let codec = tonic::codec::ProstCodec::default();
793                        let mut grpc = tonic::server::Grpc::new(codec)
794                            .apply_compression_config(
795                                accept_compression_encodings,
796                                send_compression_encodings,
797                            )
798                            .apply_max_message_size_config(
799                                max_decoding_message_size,
800                                max_encoding_message_size,
801                            );
802                        let res = grpc.streaming(method, req).await;
803                        Ok(res)
804                    };
805                    Box::pin(fut)
806                }
807                _ => {
808                    Box::pin(async move {
809                        let mut response = http::Response::new(empty_body());
810                        let headers = response.headers_mut();
811                        headers
812                            .insert(
813                                tonic::Status::GRPC_STATUS,
814                                (tonic::Code::Unimplemented as i32).into(),
815                            );
816                        headers
817                            .insert(
818                                http::header::CONTENT_TYPE,
819                                tonic::metadata::GRPC_CONTENT_TYPE,
820                            );
821                        Ok(response)
822                    })
823                }
824            }
825        }
826    }
827    impl<T> Clone for ExternalProcessorServer<T> {
828        fn clone(&self) -> Self {
829            let inner = self.inner.clone();
830            Self {
831                inner,
832                accept_compression_encodings: self.accept_compression_encodings,
833                send_compression_encodings: self.send_compression_encodings,
834                max_decoding_message_size: self.max_decoding_message_size,
835                max_encoding_message_size: self.max_encoding_message_size,
836            }
837        }
838    }
839    /// Generated gRPC service name
840    pub const SERVICE_NAME: &str = "envoy.service.ext_proc.v3.ExternalProcessor";
841    impl<T> tonic::server::NamedService for ExternalProcessorServer<T> {
842        const NAME: &'static str = SERVICE_NAME;
843    }
844}