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

1// This file is @generated by prost-build.
2/// Main message for a rate limit request. The rate limit service is designed to be fully generic
3/// in the sense that it can operate on arbitrary hierarchical key/value pairs. The loaded
4/// configuration will parse the request and find the most specific limit to apply. In addition,
5/// a RateLimitRequest can contain multiple "descriptors" to limit on. When multiple descriptors
6/// are provided, the server will limit on *ALL* of them and return an OVER_LIMIT response if any
7/// of them are over limit. This enables more complex application level rate limiting scenarios
8/// if desired.
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct RateLimitRequest {
11    /// All rate limit requests must specify a domain. This enables the configuration to be per
12    /// application without fear of overlap. E.g., "envoy".
13    #[prost(string, tag = "1")]
14    pub domain: ::prost::alloc::string::String,
15    /// All rate limit requests must specify at least one RateLimitDescriptor. Each descriptor is
16    /// processed by the service (see below). If any of the descriptors are over limit, the entire
17    /// request is considered to be over limit.
18    #[prost(message, repeated, tag = "2")]
19    pub descriptors: ::prost::alloc::vec::Vec<
20        super::super::super::extensions::common::ratelimit::v3::RateLimitDescriptor,
21    >,
22    /// Rate limit requests can optionally specify the number of hits a request adds to the matched
23    /// limit. If the value is not set in the message, a request increases the matched limit by 1.
24    #[prost(uint32, tag = "3")]
25    pub hits_addend: u32,
26}
27impl ::prost::Name for RateLimitRequest {
28    const NAME: &'static str = "RateLimitRequest";
29    const PACKAGE: &'static str = "envoy.service.ratelimit.v3";
30    fn full_name() -> ::prost::alloc::string::String {
31        "envoy.service.ratelimit.v3.RateLimitRequest".into()
32    }
33    fn type_url() -> ::prost::alloc::string::String {
34        "type.googleapis.com/envoy.service.ratelimit.v3.RateLimitRequest".into()
35    }
36}
37/// A response from a ShouldRateLimit call.
38/// \[#next-free-field: 8\]
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct RateLimitResponse {
41    /// The overall response code which takes into account all of the descriptors that were passed
42    /// in the RateLimitRequest message.
43    #[prost(enumeration = "rate_limit_response::Code", tag = "1")]
44    pub overall_code: i32,
45    /// A list of DescriptorStatus messages which matches the length of the descriptor list passed
46    /// in the RateLimitRequest. This can be used by the caller to determine which individual
47    /// descriptors failed and/or what the currently configured limits are for all of them.
48    #[prost(message, repeated, tag = "2")]
49    pub statuses: ::prost::alloc::vec::Vec<rate_limit_response::DescriptorStatus>,
50    /// A list of headers to add to the response
51    #[prost(message, repeated, tag = "3")]
52    pub response_headers_to_add: ::prost::alloc::vec::Vec<
53        super::super::super::config::core::v3::HeaderValue,
54    >,
55    /// A list of headers to add to the request when forwarded
56    #[prost(message, repeated, tag = "4")]
57    pub request_headers_to_add: ::prost::alloc::vec::Vec<
58        super::super::super::config::core::v3::HeaderValue,
59    >,
60    /// A response body to send to the downstream client when the response code is not OK.
61    #[prost(bytes = "vec", tag = "5")]
62    pub raw_body: ::prost::alloc::vec::Vec<u8>,
63    /// Optional response metadata that will be emitted as dynamic metadata to be consumed by the next
64    /// filter. This metadata lives in a namespace specified by the canonical name of extension filter
65    /// that requires it:
66    ///
67    /// - :ref:`envoy.filters.http.ratelimit <config_http_filters_ratelimit_dynamic_metadata>` for HTTP filter.
68    /// - :ref:`envoy.filters.network.ratelimit <config_network_filters_ratelimit_dynamic_metadata>` for network filter.
69    /// - :ref:`envoy.filters.thrift.rate_limit <config_thrift_filters_rate_limit_dynamic_metadata>` for Thrift filter.
70    #[prost(message, optional, tag = "6")]
71    pub dynamic_metadata: ::core::option::Option<
72        super::super::super::super::google::protobuf::Struct,
73    >,
74    /// Quota is available for a request if its entire descriptor set has cached quota available.
75    /// This is a union of all descriptors in the descriptor set. Clients can use the quota for future matches if and only if the descriptor set matches what was sent in the request that originated this response.
76    ///
77    /// If quota is available, a RLS request will not be made and the quota will be reduced by 1.
78    /// If quota is not available (i.e., a cached entry doesn't exist for a RLS descriptor set), a RLS request will be triggered.
79    /// If the server did not provide a quota, such as the quota message is empty then the request admission is determined by the
80    /// :ref:`overall_code <envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.overall_code>`.
81    ///
82    /// If there is not sufficient quota and the cached entry exists for a RLS descriptor set is out-of-quota but not expired,
83    /// the request will be treated as OVER_LIMIT.
84    /// \[#not-implemented-hide:\]
85    #[prost(message, optional, tag = "7")]
86    pub quota: ::core::option::Option<rate_limit_response::Quota>,
87}
88/// Nested message and enum types in `RateLimitResponse`.
89pub mod rate_limit_response {
90    /// Defines an actual rate limit in terms of requests per unit of time and the unit itself.
91    #[derive(Clone, PartialEq, ::prost::Message)]
92    pub struct RateLimit {
93        /// A name or description of this limit.
94        #[prost(string, tag = "3")]
95        pub name: ::prost::alloc::string::String,
96        /// The number of requests per unit of time.
97        #[prost(uint32, tag = "1")]
98        pub requests_per_unit: u32,
99        /// The unit of time.
100        #[prost(enumeration = "rate_limit::Unit", tag = "2")]
101        pub unit: i32,
102    }
103    /// Nested message and enum types in `RateLimit`.
104    pub mod rate_limit {
105        /// Identifies the unit of of time for rate limit.
106        /// \[#comment: replace by envoy/type/v3/ratelimit_unit.proto in v4\]
107        #[derive(
108            Clone,
109            Copy,
110            Debug,
111            PartialEq,
112            Eq,
113            Hash,
114            PartialOrd,
115            Ord,
116            ::prost::Enumeration
117        )]
118        #[repr(i32)]
119        pub enum Unit {
120            /// The time unit is not known.
121            Unknown = 0,
122            /// The time unit representing a second.
123            Second = 1,
124            /// The time unit representing a minute.
125            Minute = 2,
126            /// The time unit representing an hour.
127            Hour = 3,
128            /// The time unit representing a day.
129            Day = 4,
130            /// The time unit representing a month.
131            Month = 5,
132            /// The time unit representing a year.
133            Year = 6,
134        }
135        impl Unit {
136            /// String value of the enum field names used in the ProtoBuf definition.
137            ///
138            /// The values are not transformed in any way and thus are considered stable
139            /// (if the ProtoBuf definition does not change) and safe for programmatic use.
140            pub fn as_str_name(&self) -> &'static str {
141                match self {
142                    Self::Unknown => "UNKNOWN",
143                    Self::Second => "SECOND",
144                    Self::Minute => "MINUTE",
145                    Self::Hour => "HOUR",
146                    Self::Day => "DAY",
147                    Self::Month => "MONTH",
148                    Self::Year => "YEAR",
149                }
150            }
151            /// Creates an enum from field names used in the ProtoBuf definition.
152            pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
153                match value {
154                    "UNKNOWN" => Some(Self::Unknown),
155                    "SECOND" => Some(Self::Second),
156                    "MINUTE" => Some(Self::Minute),
157                    "HOUR" => Some(Self::Hour),
158                    "DAY" => Some(Self::Day),
159                    "MONTH" => Some(Self::Month),
160                    "YEAR" => Some(Self::Year),
161                    _ => None,
162                }
163            }
164        }
165    }
166    impl ::prost::Name for RateLimit {
167        const NAME: &'static str = "RateLimit";
168        const PACKAGE: &'static str = "envoy.service.ratelimit.v3";
169        fn full_name() -> ::prost::alloc::string::String {
170            "envoy.service.ratelimit.v3.RateLimitResponse.RateLimit".into()
171        }
172        fn type_url() -> ::prost::alloc::string::String {
173            "type.googleapis.com/envoy.service.ratelimit.v3.RateLimitResponse.RateLimit"
174                .into()
175        }
176    }
177    /// Cacheable quota for responses.
178    /// Quota can be granted at different levels: either for each individual descriptor or for the whole descriptor set.
179    /// This is a certain number of requests over a period of time.
180    /// The client may cache this result and apply the effective RateLimitResponse to future matching
181    /// requests without querying rate limit service.
182    ///
183    /// When quota expires due to timeout, a new RLS request will also be made.
184    /// The implementation may choose to preemptively query the rate limit server for more quota on or
185    /// before expiration or before the available quota runs out.
186    /// \[#not-implemented-hide:\]
187    #[derive(Clone, PartialEq, ::prost::Message)]
188    pub struct Quota {
189        /// Number of matching requests granted in quota. Must be 1 or more.
190        #[prost(uint32, tag = "1")]
191        pub requests: u32,
192        /// The unique id that is associated with each Quota either at individual descriptor level or whole descriptor set level.
193        ///
194        /// For a matching policy with boolean logic, for example, match: "request.headers\['environment'\] == 'staging' || request.headers\['environment'\] == 'dev'"),
195        /// the request_headers action produces a distinct list of descriptors for each possible value of the ‘environment’ header even though the granted quota is same.
196        /// Thus, the client will use this id information (returned from RLS server) to correctly correlate the multiple descriptors/descriptor sets that have been granted with same quota (i.e., share the same quota among multiple descriptors or descriptor sets.)
197        ///
198        /// If id is empty, this id field will be ignored. If quota for the same id changes (e.g. due to configuration update), the old quota will be overridden by the new one. Shared quotas referenced by ID will still adhere to expiration after `valid_until`.
199        #[prost(string, tag = "3")]
200        pub id: ::prost::alloc::string::String,
201        #[prost(oneof = "quota::ExpirationSpecifier", tags = "2")]
202        pub expiration_specifier: ::core::option::Option<quota::ExpirationSpecifier>,
203    }
204    /// Nested message and enum types in `Quota`.
205    pub mod quota {
206        #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
207        pub enum ExpirationSpecifier {
208            /// Point in time at which the quota expires.
209            #[prost(message, tag = "2")]
210            ValidUntil(
211                super::super::super::super::super::super::google::protobuf::Timestamp,
212            ),
213        }
214    }
215    impl ::prost::Name for Quota {
216        const NAME: &'static str = "Quota";
217        const PACKAGE: &'static str = "envoy.service.ratelimit.v3";
218        fn full_name() -> ::prost::alloc::string::String {
219            "envoy.service.ratelimit.v3.RateLimitResponse.Quota".into()
220        }
221        fn type_url() -> ::prost::alloc::string::String {
222            "type.googleapis.com/envoy.service.ratelimit.v3.RateLimitResponse.Quota"
223                .into()
224        }
225    }
226    /// \[#next-free-field: 6\]
227    #[derive(Clone, PartialEq, ::prost::Message)]
228    pub struct DescriptorStatus {
229        /// The response code for an individual descriptor.
230        #[prost(enumeration = "Code", tag = "1")]
231        pub code: i32,
232        /// The current limit as configured by the server. Useful for debugging, etc.
233        #[prost(message, optional, tag = "2")]
234        pub current_limit: ::core::option::Option<RateLimit>,
235        /// The limit remaining in the current time unit.
236        #[prost(uint32, tag = "3")]
237        pub limit_remaining: u32,
238        /// Duration until reset of the current limit window.
239        #[prost(message, optional, tag = "4")]
240        pub duration_until_reset: ::core::option::Option<
241            super::super::super::super::super::google::protobuf::Duration,
242        >,
243        /// Quota is available for a request if its descriptor set has cached quota available for all
244        /// descriptors.
245        /// This is for each individual descriptor in the descriptor set. The client will perform matches for each individual descriptor against available per-descriptor quota.
246        ///
247        /// If quota is available, a RLS request will not be made and the quota will be reduced by 1 for
248        /// all matching descriptors.
249        ///
250        /// If there is not sufficient quota, there are three cases:
251        /// 1. A cached entry exists for a RLS descriptor that is out-of-quota, but not expired.
252        ///     In this case, the request will be treated as OVER_LIMIT.
253        /// 2. Some RLS descriptors have a cached entry that has valid quota but some RLS descriptors
254        ///     have no cached entry. This will trigger a new RLS request.
255        ///     When the result is returned, a single unit will be consumed from the quota for all
256        ///     matching descriptors.
257        ///     If the server did not provide a quota, such as the quota message is empty for some of
258        ///     the descriptors, then the request admission is determined by the
259        ///     :ref:`overall_code <envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.overall_code>`.
260        /// 3. All RLS descriptors lack a cached entry, this will trigger a new RLS request,
261        ///     When the result is returned, a single unit will be consumed from the quota for all
262        ///     matching descriptors.
263        ///     If the server did not provide a quota, such as the quota message is empty for some of
264        ///     the descriptors, then the request admission is determined by the
265        ///     :ref:`overall_code <envoy_v3_api_field_service.ratelimit.v3.RateLimitResponse.overall_code>`.
266        /// \[#not-implemented-hide:\]
267        #[prost(message, optional, tag = "5")]
268        pub quota: ::core::option::Option<Quota>,
269    }
270    impl ::prost::Name for DescriptorStatus {
271        const NAME: &'static str = "DescriptorStatus";
272        const PACKAGE: &'static str = "envoy.service.ratelimit.v3";
273        fn full_name() -> ::prost::alloc::string::String {
274            "envoy.service.ratelimit.v3.RateLimitResponse.DescriptorStatus".into()
275        }
276        fn type_url() -> ::prost::alloc::string::String {
277            "type.googleapis.com/envoy.service.ratelimit.v3.RateLimitResponse.DescriptorStatus"
278                .into()
279        }
280    }
281    #[derive(
282        Clone,
283        Copy,
284        Debug,
285        PartialEq,
286        Eq,
287        Hash,
288        PartialOrd,
289        Ord,
290        ::prost::Enumeration
291    )]
292    #[repr(i32)]
293    pub enum Code {
294        /// The response code is not known.
295        Unknown = 0,
296        /// The response code to notify that the number of requests are under limit.
297        Ok = 1,
298        /// The response code to notify that the number of requests are over limit.
299        OverLimit = 2,
300    }
301    impl Code {
302        /// String value of the enum field names used in the ProtoBuf definition.
303        ///
304        /// The values are not transformed in any way and thus are considered stable
305        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
306        pub fn as_str_name(&self) -> &'static str {
307            match self {
308                Self::Unknown => "UNKNOWN",
309                Self::Ok => "OK",
310                Self::OverLimit => "OVER_LIMIT",
311            }
312        }
313        /// Creates an enum from field names used in the ProtoBuf definition.
314        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
315            match value {
316                "UNKNOWN" => Some(Self::Unknown),
317                "OK" => Some(Self::Ok),
318                "OVER_LIMIT" => Some(Self::OverLimit),
319                _ => None,
320            }
321        }
322    }
323}
324impl ::prost::Name for RateLimitResponse {
325    const NAME: &'static str = "RateLimitResponse";
326    const PACKAGE: &'static str = "envoy.service.ratelimit.v3";
327    fn full_name() -> ::prost::alloc::string::String {
328        "envoy.service.ratelimit.v3.RateLimitResponse".into()
329    }
330    fn type_url() -> ::prost::alloc::string::String {
331        "type.googleapis.com/envoy.service.ratelimit.v3.RateLimitResponse".into()
332    }
333}
334/// Generated client implementations.
335pub mod rate_limit_service_client {
336    #![allow(
337        unused_variables,
338        dead_code,
339        missing_docs,
340        clippy::wildcard_imports,
341        clippy::let_unit_value,
342    )]
343    use tonic::codegen::*;
344    use tonic::codegen::http::Uri;
345    #[derive(Debug, Clone)]
346    pub struct RateLimitServiceClient<T> {
347        inner: tonic::client::Grpc<T>,
348    }
349    impl<T> RateLimitServiceClient<T>
350    where
351        T: tonic::client::GrpcService<tonic::body::BoxBody>,
352        T::Error: Into<StdError>,
353        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
354        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
355    {
356        pub fn new(inner: T) -> Self {
357            let inner = tonic::client::Grpc::new(inner);
358            Self { inner }
359        }
360        pub fn with_origin(inner: T, origin: Uri) -> Self {
361            let inner = tonic::client::Grpc::with_origin(inner, origin);
362            Self { inner }
363        }
364        pub fn with_interceptor<F>(
365            inner: T,
366            interceptor: F,
367        ) -> RateLimitServiceClient<InterceptedService<T, F>>
368        where
369            F: tonic::service::Interceptor,
370            T::ResponseBody: Default,
371            T: tonic::codegen::Service<
372                http::Request<tonic::body::BoxBody>,
373                Response = http::Response<
374                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
375                >,
376            >,
377            <T as tonic::codegen::Service<
378                http::Request<tonic::body::BoxBody>,
379            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
380        {
381            RateLimitServiceClient::new(InterceptedService::new(inner, interceptor))
382        }
383        /// Compress requests with the given encoding.
384        ///
385        /// This requires the server to support it otherwise it might respond with an
386        /// error.
387        #[must_use]
388        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
389            self.inner = self.inner.send_compressed(encoding);
390            self
391        }
392        /// Enable decompressing responses.
393        #[must_use]
394        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
395            self.inner = self.inner.accept_compressed(encoding);
396            self
397        }
398        /// Limits the maximum size of a decoded message.
399        ///
400        /// Default: `4MB`
401        #[must_use]
402        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
403            self.inner = self.inner.max_decoding_message_size(limit);
404            self
405        }
406        /// Limits the maximum size of an encoded message.
407        ///
408        /// Default: `usize::MAX`
409        #[must_use]
410        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
411            self.inner = self.inner.max_encoding_message_size(limit);
412            self
413        }
414        /// Determine whether rate limiting should take place.
415        pub async fn should_rate_limit(
416            &mut self,
417            request: impl tonic::IntoRequest<super::RateLimitRequest>,
418        ) -> std::result::Result<
419            tonic::Response<super::RateLimitResponse>,
420            tonic::Status,
421        > {
422            self.inner
423                .ready()
424                .await
425                .map_err(|e| {
426                    tonic::Status::unknown(
427                        format!("Service was not ready: {}", e.into()),
428                    )
429                })?;
430            let codec = tonic::codec::ProstCodec::default();
431            let path = http::uri::PathAndQuery::from_static(
432                "/envoy.service.ratelimit.v3.RateLimitService/ShouldRateLimit",
433            );
434            let mut req = request.into_request();
435            req.extensions_mut()
436                .insert(
437                    GrpcMethod::new(
438                        "envoy.service.ratelimit.v3.RateLimitService",
439                        "ShouldRateLimit",
440                    ),
441                );
442            self.inner.unary(req, path, codec).await
443        }
444    }
445}
446/// Generated server implementations.
447pub mod rate_limit_service_server {
448    #![allow(
449        unused_variables,
450        dead_code,
451        missing_docs,
452        clippy::wildcard_imports,
453        clippy::let_unit_value,
454    )]
455    use tonic::codegen::*;
456    /// Generated trait containing gRPC methods that should be implemented for use with RateLimitServiceServer.
457    #[async_trait]
458    pub trait RateLimitService: std::marker::Send + std::marker::Sync + 'static {
459        /// Determine whether rate limiting should take place.
460        async fn should_rate_limit(
461            &self,
462            request: tonic::Request<super::RateLimitRequest>,
463        ) -> std::result::Result<
464            tonic::Response<super::RateLimitResponse>,
465            tonic::Status,
466        >;
467    }
468    #[derive(Debug)]
469    pub struct RateLimitServiceServer<T> {
470        inner: Arc<T>,
471        accept_compression_encodings: EnabledCompressionEncodings,
472        send_compression_encodings: EnabledCompressionEncodings,
473        max_decoding_message_size: Option<usize>,
474        max_encoding_message_size: Option<usize>,
475    }
476    impl<T> RateLimitServiceServer<T> {
477        pub fn new(inner: T) -> Self {
478            Self::from_arc(Arc::new(inner))
479        }
480        pub fn from_arc(inner: Arc<T>) -> Self {
481            Self {
482                inner,
483                accept_compression_encodings: Default::default(),
484                send_compression_encodings: Default::default(),
485                max_decoding_message_size: None,
486                max_encoding_message_size: None,
487            }
488        }
489        pub fn with_interceptor<F>(
490            inner: T,
491            interceptor: F,
492        ) -> InterceptedService<Self, F>
493        where
494            F: tonic::service::Interceptor,
495        {
496            InterceptedService::new(Self::new(inner), interceptor)
497        }
498        /// Enable decompressing requests with the given encoding.
499        #[must_use]
500        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
501            self.accept_compression_encodings.enable(encoding);
502            self
503        }
504        /// Compress responses with the given encoding, if the client supports it.
505        #[must_use]
506        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
507            self.send_compression_encodings.enable(encoding);
508            self
509        }
510        /// Limits the maximum size of a decoded message.
511        ///
512        /// Default: `4MB`
513        #[must_use]
514        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
515            self.max_decoding_message_size = Some(limit);
516            self
517        }
518        /// Limits the maximum size of an encoded message.
519        ///
520        /// Default: `usize::MAX`
521        #[must_use]
522        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
523            self.max_encoding_message_size = Some(limit);
524            self
525        }
526    }
527    impl<T, B> tonic::codegen::Service<http::Request<B>> for RateLimitServiceServer<T>
528    where
529        T: RateLimitService,
530        B: Body + std::marker::Send + 'static,
531        B::Error: Into<StdError> + std::marker::Send + 'static,
532    {
533        type Response = http::Response<tonic::body::BoxBody>;
534        type Error = std::convert::Infallible;
535        type Future = BoxFuture<Self::Response, Self::Error>;
536        fn poll_ready(
537            &mut self,
538            _cx: &mut Context<'_>,
539        ) -> Poll<std::result::Result<(), Self::Error>> {
540            Poll::Ready(Ok(()))
541        }
542        fn call(&mut self, req: http::Request<B>) -> Self::Future {
543            match req.uri().path() {
544                "/envoy.service.ratelimit.v3.RateLimitService/ShouldRateLimit" => {
545                    #[allow(non_camel_case_types)]
546                    struct ShouldRateLimitSvc<T: RateLimitService>(pub Arc<T>);
547                    impl<
548                        T: RateLimitService,
549                    > tonic::server::UnaryService<super::RateLimitRequest>
550                    for ShouldRateLimitSvc<T> {
551                        type Response = super::RateLimitResponse;
552                        type Future = BoxFuture<
553                            tonic::Response<Self::Response>,
554                            tonic::Status,
555                        >;
556                        fn call(
557                            &mut self,
558                            request: tonic::Request<super::RateLimitRequest>,
559                        ) -> Self::Future {
560                            let inner = Arc::clone(&self.0);
561                            let fut = async move {
562                                <T as RateLimitService>::should_rate_limit(&inner, request)
563                                    .await
564                            };
565                            Box::pin(fut)
566                        }
567                    }
568                    let accept_compression_encodings = self.accept_compression_encodings;
569                    let send_compression_encodings = self.send_compression_encodings;
570                    let max_decoding_message_size = self.max_decoding_message_size;
571                    let max_encoding_message_size = self.max_encoding_message_size;
572                    let inner = self.inner.clone();
573                    let fut = async move {
574                        let method = ShouldRateLimitSvc(inner);
575                        let codec = tonic::codec::ProstCodec::default();
576                        let mut grpc = tonic::server::Grpc::new(codec)
577                            .apply_compression_config(
578                                accept_compression_encodings,
579                                send_compression_encodings,
580                            )
581                            .apply_max_message_size_config(
582                                max_decoding_message_size,
583                                max_encoding_message_size,
584                            );
585                        let res = grpc.unary(method, req).await;
586                        Ok(res)
587                    };
588                    Box::pin(fut)
589                }
590                _ => {
591                    Box::pin(async move {
592                        let mut response = http::Response::new(empty_body());
593                        let headers = response.headers_mut();
594                        headers
595                            .insert(
596                                tonic::Status::GRPC_STATUS,
597                                (tonic::Code::Unimplemented as i32).into(),
598                            );
599                        headers
600                            .insert(
601                                http::header::CONTENT_TYPE,
602                                tonic::metadata::GRPC_CONTENT_TYPE,
603                            );
604                        Ok(response)
605                    })
606                }
607            }
608        }
609    }
610    impl<T> Clone for RateLimitServiceServer<T> {
611        fn clone(&self) -> Self {
612            let inner = self.inner.clone();
613            Self {
614                inner,
615                accept_compression_encodings: self.accept_compression_encodings,
616                send_compression_encodings: self.send_compression_encodings,
617                max_decoding_message_size: self.max_decoding_message_size,
618                max_encoding_message_size: self.max_encoding_message_size,
619            }
620        }
621    }
622    /// Generated gRPC service name
623    pub const SERVICE_NAME: &str = "envoy.service.ratelimit.v3.RateLimitService";
624    impl<T> tonic::server::NamedService for RateLimitServiceServer<T> {
625        const NAME: &'static str = SERVICE_NAME;
626    }
627}