linkerd2_proxy_api/gen/
io.linkerd.proxy.destination.rs

1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GetDestination {
4    #[prost(string, tag = "1")]
5    pub scheme: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub path: ::prost::alloc::string::String,
8    /// An opaque value that is set at injection-time and sent with destintion
9    /// lookups.
10    ///
11    /// If, for instance, the token encodes a namespace or some locality
12    /// information, the service may alter its results to take this locality into
13    /// account.
14    #[prost(string, tag = "3")]
15    pub context_token: ::prost::alloc::string::String,
16}
17#[allow(clippy::derive_partial_eq_without_eq)]
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Update {
20    #[prost(oneof = "update::Update", tags = "1, 2, 3")]
21    pub update: ::core::option::Option<update::Update>,
22}
23/// Nested message and enum types in `Update`.
24pub mod update {
25    #[allow(clippy::derive_partial_eq_without_eq)]
26    #[derive(Clone, PartialEq, ::prost::Oneof)]
27    pub enum Update {
28        /// A new set of endpoints are available for the service. The set might be
29        /// empty.
30        #[prost(message, tag = "1")]
31        Add(super::WeightedAddrSet),
32        /// Some endpoints have been removed from the service.
33        #[prost(message, tag = "2")]
34        Remove(super::AddrSet),
35        /// `no_endpoints{exists: false}` indicates that the service does not exist
36        /// and the client MAY try an alternate service discovery method (e.g. DNS).
37        ///
38        /// `no_endpoints(exists: true)` indicates that the service does exist and
39        /// the client MUST NOT fall back to an alternate service discovery method.
40        #[prost(message, tag = "3")]
41        NoEndpoints(super::NoEndpoints),
42    }
43}
44#[allow(clippy::derive_partial_eq_without_eq)]
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct AddrSet {
47    #[prost(message, repeated, tag = "1")]
48    pub addrs: ::prost::alloc::vec::Vec<super::net::TcpAddress>,
49}
50#[allow(clippy::derive_partial_eq_without_eq)]
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct WeightedAddrSet {
53    #[prost(message, repeated, tag = "1")]
54    pub addrs: ::prost::alloc::vec::Vec<WeightedAddr>,
55    #[prost(map = "string, string", tag = "2")]
56    pub metric_labels: ::std::collections::HashMap<
57        ::prost::alloc::string::String,
58        ::prost::alloc::string::String,
59    >,
60}
61#[allow(clippy::derive_partial_eq_without_eq)]
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct WeightedAddr {
64    #[prost(message, optional, tag = "1")]
65    pub addr: ::core::option::Option<super::net::TcpAddress>,
66    #[prost(uint32, tag = "3")]
67    pub weight: u32,
68    #[prost(map = "string, string", tag = "4")]
69    pub metric_labels: ::std::collections::HashMap<
70        ::prost::alloc::string::String,
71        ::prost::alloc::string::String,
72    >,
73    #[prost(message, optional, tag = "5")]
74    pub tls_identity: ::core::option::Option<TlsIdentity>,
75    #[prost(message, optional, tag = "6")]
76    pub protocol_hint: ::core::option::Option<ProtocolHint>,
77    #[prost(message, optional, tag = "7")]
78    pub authority_override: ::core::option::Option<AuthorityOverride>,
79    /// The HTTP/2 parameters to use when connecting to the destination, if HTTP/2
80    /// is used. These parameters are used by proxies when the application traffic
81    /// is HTTP/2 or when the H2 ProtocolHint is used to transport HTTP/1
82    /// connections over HTTP/2.
83    #[prost(message, optional, tag = "8")]
84    pub http2: ::core::option::Option<Http2ClientParams>,
85    /// A reference to the metadata for this endpoint, usually a Pod. This may be
86    /// omitted when the resource type is unknown.
87    #[prost(message, optional, tag = "9")]
88    pub resource_ref: ::core::option::Option<super::meta::Metadata>,
89}
90#[allow(clippy::derive_partial_eq_without_eq)]
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct TlsIdentity {
93    /// The server name of the endpoint. This is the value that needs to be included
94    /// by clients in the ClientHello SNI extension of the TLS handshake when they
95    /// initiate TLS connections to servers.
96    #[prost(message, optional, tag = "4")]
97    pub server_name: ::core::option::Option<tls_identity::DnsLikeIdentity>,
98    #[prost(oneof = "tls_identity::Strategy", tags = "1, 3")]
99    pub strategy: ::core::option::Option<tls_identity::Strategy>,
100}
101/// Nested message and enum types in `TlsIdentity`.
102pub mod tls_identity {
103    /// Verify the certificate based on the Kubernetes pod identity.
104    #[allow(clippy::derive_partial_eq_without_eq)]
105    #[derive(Clone, PartialEq, ::prost::Message)]
106    pub struct DnsLikeIdentity {
107        /// A DNS-like name that encodes workload coordinates.
108        ///
109        /// For example:
110        ///     {name}.{namespace}.{type}.identity.{control-namespace}.{trust-domain...}
111        #[prost(string, tag = "1")]
112        pub name: ::prost::alloc::string::String,
113    }
114    /// Verify the certificate based on an URI identity.
115    #[allow(clippy::derive_partial_eq_without_eq)]
116    #[derive(Clone, PartialEq, ::prost::Message)]
117    pub struct UriLikeIdentity {
118        /// A URI name that encodes workload identity.
119        ///
120        /// For example:
121        ///     spiffe://trust-domain/workload-dentifier
122        #[prost(string, tag = "1")]
123        pub uri: ::prost::alloc::string::String,
124    }
125    #[allow(clippy::derive_partial_eq_without_eq)]
126    #[derive(Clone, PartialEq, ::prost::Oneof)]
127    pub enum Strategy {
128        #[prost(message, tag = "1")]
129        DnsLikeIdentity(DnsLikeIdentity),
130        #[prost(message, tag = "3")]
131        UriLikeIdentity(UriLikeIdentity),
132    }
133}
134#[allow(clippy::derive_partial_eq_without_eq)]
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct AuthorityOverride {
137    #[prost(string, tag = "1")]
138    pub authority_override: ::prost::alloc::string::String,
139}
140#[allow(clippy::derive_partial_eq_without_eq)]
141#[derive(Clone, PartialEq, ::prost::Message)]
142pub struct NoEndpoints {
143    #[prost(bool, tag = "1")]
144    pub exists: bool,
145}
146/// A hint of what protocol the service knows. The default value is
147/// for the `hint` field to be not be set, essentially meaning "unknown".
148#[allow(clippy::derive_partial_eq_without_eq)]
149#[derive(Clone, PartialEq, ::prost::Message)]
150pub struct ProtocolHint {
151    /// When set, indicates that the target supports receiving opaque traffic
152    /// wrapped with the Linkerd connection header on the specified port.
153    #[prost(message, optional, tag = "2")]
154    pub opaque_transport: ::core::option::Option<protocol_hint::OpaqueTransport>,
155    #[prost(oneof = "protocol_hint::Protocol", tags = "1, 3")]
156    pub protocol: ::core::option::Option<protocol_hint::Protocol>,
157}
158/// Nested message and enum types in `ProtocolHint`.
159pub mod protocol_hint {
160    #[allow(clippy::derive_partial_eq_without_eq)]
161    #[derive(Clone, PartialEq, ::prost::Message)]
162    pub struct H2 {}
163    #[allow(clippy::derive_partial_eq_without_eq)]
164    #[derive(Clone, PartialEq, ::prost::Message)]
165    pub struct Opaque {}
166    #[allow(clippy::derive_partial_eq_without_eq)]
167    #[derive(Clone, PartialEq, ::prost::Message)]
168    pub struct OpaqueTransport {
169        /// The target proxy's inbound port.
170        #[prost(uint32, tag = "1")]
171        pub inbound_port: u32,
172    }
173    #[allow(clippy::derive_partial_eq_without_eq)]
174    #[derive(Clone, PartialEq, ::prost::Oneof)]
175    pub enum Protocol {
176        /// Hints that the service understands HTTP2 and the proxy's internal
177        /// http2-upgrade mechanism.
178        #[prost(message, tag = "1")]
179        H2(H2),
180        /// Hints that the destination will handle this connection as an opaque TCP
181        /// stream, and (if `opaque_transport` is set) that the proxy should not send
182        /// a `SessionProtocol` as part of its transport header.
183        #[prost(message, tag = "3")]
184        Opaque(Opaque),
185    }
186}
187/// Configures the parameters used to initialize an HTTP/2 connection.
188#[allow(clippy::derive_partial_eq_without_eq)]
189#[derive(Clone, PartialEq, ::prost::Message)]
190pub struct Http2ClientParams {
191    /// Overrides the default client flow control settings.
192    #[prost(message, optional, tag = "1")]
193    pub flow_control: ::core::option::Option<http2_client_params::FlowControl>,
194    /// Enables keep-alive timeouts.
195    #[prost(message, optional, tag = "2")]
196    pub keep_alive: ::core::option::Option<http2_client_params::KeepAlive>,
197    /// Configures Hyper internals.
198    #[prost(message, optional, tag = "3")]
199    pub internals: ::core::option::Option<http2_client_params::Internals>,
200}
201/// Nested message and enum types in `Http2ClientParams`.
202pub mod http2_client_params {
203    #[allow(clippy::derive_partial_eq_without_eq)]
204    #[derive(Clone, PartialEq, ::prost::Message)]
205    pub struct FlowControl {
206        /// Configures the maximum connection-level flow control window size.
207        #[prost(uint32, tag = "1")]
208        pub initial_connection_window_size: u32,
209        /// Configures the maximum stream-level flow control window size.
210        #[prost(uint32, tag = "2")]
211        pub initial_stream_window_size: u32,
212        /// Enables Hyper's adaptive flow control, ignoring other window settings.
213        #[prost(bool, tag = "3")]
214        pub adaptive_flow_control: bool,
215    }
216    #[allow(clippy::derive_partial_eq_without_eq)]
217    #[derive(Clone, PartialEq, ::prost::Message)]
218    pub struct KeepAlive {
219        /// The time between pings.
220        #[prost(message, optional, tag = "1")]
221        pub interval: ::core::option::Option<::prost_types::Duration>,
222        /// The time to wait for a ping response before considering the connection
223        /// dead.
224        #[prost(message, optional, tag = "2")]
225        pub timeout: ::core::option::Option<::prost_types::Duration>,
226        /// Whether to send pings when there is no other traffic.
227        #[prost(bool, tag = "3")]
228        pub while_idle: bool,
229    }
230    #[allow(clippy::derive_partial_eq_without_eq)]
231    #[derive(Clone, PartialEq, ::prost::Message)]
232    pub struct Internals {
233        #[prost(uint32, tag = "1")]
234        pub max_concurrent_reset_streams: u32,
235        #[prost(uint32, tag = "2")]
236        pub max_frame_size: u32,
237        #[prost(uint32, tag = "3")]
238        pub max_send_buf_size: u32,
239    }
240}
241#[allow(clippy::derive_partial_eq_without_eq)]
242#[derive(Clone, PartialEq, ::prost::Message)]
243pub struct DestinationProfile {
244    /// The fully-qualified service name, if one exists.
245    ///
246    /// When resolving (especially by IP), this field provides the fully-qualified
247    /// name of the resolved service, if one exists. This field does NOT include
248    /// any port information. E.g. a lookup for 10.2.3.4:8080 might have a name
249    /// like `foo.bar.svc.cluster.local`.
250    ///
251    /// Implementations MAY provide names for non-service IP-lookups (e.g., pod or
252    /// node dns names), but this is not required.
253    ///
254    /// If the lookup does not refer to a known named entity, this field MUST be
255    /// left empty.
256    #[prost(string, tag = "5")]
257    pub fully_qualified_name: ::prost::alloc::string::String,
258    /// Indicates that connections on this service address should be handled as
259    /// opaque TCP streams. HTTP routes returned on for such services will be
260    /// ignored.
261    #[prost(bool, tag = "4")]
262    pub opaque_protocol: bool,
263    /// A list of routes, each with a RequestMatch.  If a request matches
264    /// more than one route, the first match wins.
265    #[prost(message, repeated, tag = "1")]
266    pub routes: ::prost::alloc::vec::Vec<Route>,
267    /// The retry budget controls how much additional load the proxy can generate
268    /// as retries. Failured requests on retryable routes will not be retried if
269    /// there is no available budget.
270    #[prost(message, optional, tag = "2")]
271    pub retry_budget: ::core::option::Option<RetryBudget>,
272    /// If this list is non-empty, requests to this destination should instead be
273    /// split between the destinations in this list.  Each destination should
274    /// receive a portion of the requests proportional to its weight.  If this
275    /// list is empty, requests should be sent to this destination as normal.
276    #[prost(message, repeated, tag = "3")]
277    pub dst_overrides: ::prost::alloc::vec::Vec<WeightedDst>,
278    /// If this field is set, it indicates that the target is a known endpoint (and
279    /// not a service address). The values of `fully_qualified_name` and
280    /// `dst_overrides` will be ignored for the purposes of service discovery--
281    /// traffic split and load balancing will be skipped and the single endpoint
282    /// are used.
283    ///
284    /// No endpoint should be set If the target is unknown.
285    #[prost(message, optional, tag = "6")]
286    pub endpoint: ::core::option::Option<WeightedAddr>,
287    /// A reference to the metadata for this destination, usually a service. May be
288    /// omitted if the destination is not a service.
289    #[prost(message, optional, tag = "7")]
290    pub parent_ref: ::core::option::Option<super::meta::Metadata>,
291    /// A reference to the metadata for a ServiceProfile resource. This is omitted
292    /// when no ServiceProfile resource exists.
293    #[prost(message, optional, tag = "8")]
294    pub profile_ref: ::core::option::Option<super::meta::Metadata>,
295}
296#[allow(clippy::derive_partial_eq_without_eq)]
297#[derive(Clone, PartialEq, ::prost::Message)]
298pub struct Route {
299    /// This route contains requests which match this condition.
300    #[prost(message, optional, tag = "1")]
301    pub condition: ::core::option::Option<RequestMatch>,
302    /// A list of response classes for this route.  If a response matches
303    /// more than one ResponseClass, the first match wins.  If a response does not
304    /// match any ResponseClasses, it is considered to be a successful response.
305    #[prost(message, repeated, tag = "2")]
306    pub response_classes: ::prost::alloc::vec::Vec<ResponseClass>,
307    /// Metric labels to attach to requests and responses that match this route.
308    #[prost(map = "string, string", tag = "3")]
309    pub metrics_labels: ::std::collections::HashMap<
310        ::prost::alloc::string::String,
311        ::prost::alloc::string::String,
312    >,
313    /// If a route is retryable, any failed requests on that route may be retried
314    /// by the proxy.
315    #[prost(bool, tag = "4")]
316    pub is_retryable: bool,
317    /// After this time has elapsed since receiving the initial request, any
318    /// outstanding request will be cancelled, a timeout error response will be
319    /// returned, and no more retries will be attempted.
320    #[prost(message, optional, tag = "5")]
321    pub timeout: ::core::option::Option<::prost_types::Duration>,
322}
323#[allow(clippy::derive_partial_eq_without_eq)]
324#[derive(Clone, PartialEq, ::prost::Message)]
325pub struct RetryBudget {
326    /// The ratio of additional traffic that may be added by retries.  A
327    /// retry_ratio of 0.1 means that 1 retry may be attempted for every 10 regular
328    /// requests.  A retry_ratio of 1.0 means that 1 retry may be attempted for
329    /// every 1 regular request (in other words, total request load may be doubled
330    /// as a result of retries).
331    #[prost(float, tag = "1")]
332    pub retry_ratio: f32,
333    /// The proxy may always attempt this number of retries per second, even if it
334    /// would violate the retry_ratio.  This is to allow retries to happen even
335    /// when the request rate is very low.
336    #[prost(uint32, tag = "2")]
337    pub min_retries_per_second: u32,
338    /// This duration indicates for how long requests should be considered for the
339    /// purposes of enforcing the retry_ratio.  A higher value considers a larger
340    /// window and therefore allows burstier retries.
341    #[prost(message, optional, tag = "3")]
342    pub ttl: ::core::option::Option<::prost_types::Duration>,
343}
344#[allow(clippy::derive_partial_eq_without_eq)]
345#[derive(Clone, PartialEq, ::prost::Message)]
346pub struct ResponseClass {
347    /// This class contains responses which match this condition.
348    #[prost(message, optional, tag = "1")]
349    pub condition: ::core::option::Option<ResponseMatch>,
350    /// If responses in this class should be considered failures.  This defaults
351    /// to false (success).
352    #[prost(bool, tag = "2")]
353    pub is_failure: bool,
354}
355#[allow(clippy::derive_partial_eq_without_eq)]
356#[derive(Clone, PartialEq, ::prost::Message)]
357pub struct RequestMatch {
358    #[prost(oneof = "request_match::Match", tags = "1, 2, 3, 4, 5")]
359    pub r#match: ::core::option::Option<request_match::Match>,
360}
361/// Nested message and enum types in `RequestMatch`.
362pub mod request_match {
363    #[allow(clippy::derive_partial_eq_without_eq)]
364    #[derive(Clone, PartialEq, ::prost::Message)]
365    pub struct Seq {
366        #[prost(message, repeated, tag = "1")]
367        pub matches: ::prost::alloc::vec::Vec<super::RequestMatch>,
368    }
369    #[allow(clippy::derive_partial_eq_without_eq)]
370    #[derive(Clone, PartialEq, ::prost::Oneof)]
371    pub enum Match {
372        #[prost(message, tag = "1")]
373        All(Seq),
374        #[prost(message, tag = "2")]
375        Any(Seq),
376        #[prost(message, tag = "3")]
377        Not(::prost::alloc::boxed::Box<super::RequestMatch>),
378        #[prost(message, tag = "4")]
379        Path(super::PathMatch),
380        /// TODO: match on arbitrary header
381        #[prost(message, tag = "5")]
382        Method(super::super::http_types::HttpMethod),
383    }
384}
385#[allow(clippy::derive_partial_eq_without_eq)]
386#[derive(Clone, PartialEq, ::prost::Message)]
387pub struct PathMatch {
388    /// Match if the request path matches this regex.
389    #[prost(string, tag = "1")]
390    pub regex: ::prost::alloc::string::String,
391}
392#[allow(clippy::derive_partial_eq_without_eq)]
393#[derive(Clone, PartialEq, ::prost::Message)]
394pub struct ResponseMatch {
395    #[prost(oneof = "response_match::Match", tags = "1, 2, 3, 4")]
396    pub r#match: ::core::option::Option<response_match::Match>,
397}
398/// Nested message and enum types in `ResponseMatch`.
399pub mod response_match {
400    #[allow(clippy::derive_partial_eq_without_eq)]
401    #[derive(Clone, PartialEq, ::prost::Message)]
402    pub struct Seq {
403        #[prost(message, repeated, tag = "1")]
404        pub matches: ::prost::alloc::vec::Vec<super::ResponseMatch>,
405    }
406    #[allow(clippy::derive_partial_eq_without_eq)]
407    #[derive(Clone, PartialEq, ::prost::Oneof)]
408    pub enum Match {
409        #[prost(message, tag = "1")]
410        All(Seq),
411        #[prost(message, tag = "2")]
412        Any(Seq),
413        #[prost(message, tag = "3")]
414        Not(::prost::alloc::boxed::Box<super::ResponseMatch>),
415        /// TODO: match on arbitrary header or trailer
416        #[prost(message, tag = "4")]
417        Status(super::HttpStatusRange),
418    }
419}
420/// If either a minimum or maximum is not specified, the range is considered to
421/// be over a discrete value.
422#[allow(clippy::derive_partial_eq_without_eq)]
423#[derive(Clone, PartialEq, ::prost::Message)]
424pub struct HttpStatusRange {
425    /// Minimum matching http status code (inclusive), if specified.
426    #[prost(uint32, tag = "1")]
427    pub min: u32,
428    /// Maximum matching http status code (inclusive), if specified.
429    #[prost(uint32, tag = "2")]
430    pub max: u32,
431}
432#[allow(clippy::derive_partial_eq_without_eq)]
433#[derive(Clone, PartialEq, ::prost::Message)]
434pub struct WeightedDst {
435    /// This authority will be used as the `path` in a call to the Destination.Get
436    /// rpc.
437    #[prost(string, tag = "1")]
438    pub authority: ::prost::alloc::string::String,
439    /// The proportion of requests to send to this destination.  This value is
440    /// relative to other weights in the same dst_overrides list.
441    #[prost(uint32, tag = "2")]
442    pub weight: u32,
443    /// A reference to the metadata for a Service resource.
444    #[prost(message, optional, tag = "3")]
445    pub backend_ref: ::core::option::Option<super::meta::Metadata>,
446}
447/// Generated client implementations.
448pub mod destination_client {
449    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
450    use tonic::codegen::*;
451    use tonic::codegen::http::Uri;
452    #[derive(Debug, Clone)]
453    pub struct DestinationClient<T> {
454        inner: tonic::client::Grpc<T>,
455    }
456    impl<T> DestinationClient<T>
457    where
458        T: tonic::client::GrpcService<tonic::body::BoxBody>,
459        T::Error: Into<StdError>,
460        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
461        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
462    {
463        pub fn new(inner: T) -> Self {
464            let inner = tonic::client::Grpc::new(inner);
465            Self { inner }
466        }
467        pub fn with_origin(inner: T, origin: Uri) -> Self {
468            let inner = tonic::client::Grpc::with_origin(inner, origin);
469            Self { inner }
470        }
471        pub fn with_interceptor<F>(
472            inner: T,
473            interceptor: F,
474        ) -> DestinationClient<InterceptedService<T, F>>
475        where
476            F: tonic::service::Interceptor,
477            T::ResponseBody: Default,
478            T: tonic::codegen::Service<
479                http::Request<tonic::body::BoxBody>,
480                Response = http::Response<
481                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
482                >,
483            >,
484            <T as tonic::codegen::Service<
485                http::Request<tonic::body::BoxBody>,
486            >>::Error: Into<StdError> + Send + Sync,
487        {
488            DestinationClient::new(InterceptedService::new(inner, interceptor))
489        }
490        /// Compress requests with the given encoding.
491        ///
492        /// This requires the server to support it otherwise it might respond with an
493        /// error.
494        #[must_use]
495        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
496            self.inner = self.inner.send_compressed(encoding);
497            self
498        }
499        /// Enable decompressing responses.
500        #[must_use]
501        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
502            self.inner = self.inner.accept_compressed(encoding);
503            self
504        }
505        /// Limits the maximum size of a decoded message.
506        ///
507        /// Default: `4MB`
508        #[must_use]
509        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
510            self.inner = self.inner.max_decoding_message_size(limit);
511            self
512        }
513        /// Limits the maximum size of an encoded message.
514        ///
515        /// Default: `usize::MAX`
516        #[must_use]
517        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
518            self.inner = self.inner.max_encoding_message_size(limit);
519            self
520        }
521        /// Given a destination, return all addresses in that destination as a long-
522        /// running stream of updates.
523        pub async fn get(
524            &mut self,
525            request: impl tonic::IntoRequest<super::GetDestination>,
526        ) -> std::result::Result<
527            tonic::Response<tonic::codec::Streaming<super::Update>>,
528            tonic::Status,
529        > {
530            self.inner
531                .ready()
532                .await
533                .map_err(|e| {
534                    tonic::Status::new(
535                        tonic::Code::Unknown,
536                        format!("Service was not ready: {}", e.into()),
537                    )
538                })?;
539            let codec = tonic::codec::ProstCodec::default();
540            let path = http::uri::PathAndQuery::from_static(
541                "/io.linkerd.proxy.destination.Destination/Get",
542            );
543            let mut req = request.into_request();
544            req.extensions_mut()
545                .insert(
546                    GrpcMethod::new("io.linkerd.proxy.destination.Destination", "Get"),
547                );
548            self.inner.server_streaming(req, path, codec).await
549        }
550        /// Given a destination, return that destination's profile and send an update
551        /// whenever it changes.
552        pub async fn get_profile(
553            &mut self,
554            request: impl tonic::IntoRequest<super::GetDestination>,
555        ) -> std::result::Result<
556            tonic::Response<tonic::codec::Streaming<super::DestinationProfile>>,
557            tonic::Status,
558        > {
559            self.inner
560                .ready()
561                .await
562                .map_err(|e| {
563                    tonic::Status::new(
564                        tonic::Code::Unknown,
565                        format!("Service was not ready: {}", e.into()),
566                    )
567                })?;
568            let codec = tonic::codec::ProstCodec::default();
569            let path = http::uri::PathAndQuery::from_static(
570                "/io.linkerd.proxy.destination.Destination/GetProfile",
571            );
572            let mut req = request.into_request();
573            req.extensions_mut()
574                .insert(
575                    GrpcMethod::new(
576                        "io.linkerd.proxy.destination.Destination",
577                        "GetProfile",
578                    ),
579                );
580            self.inner.server_streaming(req, path, codec).await
581        }
582    }
583}
584/// Generated server implementations.
585pub mod destination_server {
586    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
587    use tonic::codegen::*;
588    /// Generated trait containing gRPC methods that should be implemented for use with DestinationServer.
589    #[async_trait]
590    pub trait Destination: Send + Sync + 'static {
591        /// Server streaming response type for the Get method.
592        type GetStream: tonic::codegen::tokio_stream::Stream<
593                Item = std::result::Result<super::Update, tonic::Status>,
594            >
595            + Send
596            + 'static;
597        /// Given a destination, return all addresses in that destination as a long-
598        /// running stream of updates.
599        async fn get(
600            &self,
601            request: tonic::Request<super::GetDestination>,
602        ) -> std::result::Result<tonic::Response<Self::GetStream>, tonic::Status>;
603        /// Server streaming response type for the GetProfile method.
604        type GetProfileStream: tonic::codegen::tokio_stream::Stream<
605                Item = std::result::Result<super::DestinationProfile, tonic::Status>,
606            >
607            + Send
608            + 'static;
609        /// Given a destination, return that destination's profile and send an update
610        /// whenever it changes.
611        async fn get_profile(
612            &self,
613            request: tonic::Request<super::GetDestination>,
614        ) -> std::result::Result<tonic::Response<Self::GetProfileStream>, tonic::Status>;
615    }
616    #[derive(Debug)]
617    pub struct DestinationServer<T: Destination> {
618        inner: _Inner<T>,
619        accept_compression_encodings: EnabledCompressionEncodings,
620        send_compression_encodings: EnabledCompressionEncodings,
621        max_decoding_message_size: Option<usize>,
622        max_encoding_message_size: Option<usize>,
623    }
624    struct _Inner<T>(Arc<T>);
625    impl<T: Destination> DestinationServer<T> {
626        pub fn new(inner: T) -> Self {
627            Self::from_arc(Arc::new(inner))
628        }
629        pub fn from_arc(inner: Arc<T>) -> Self {
630            let inner = _Inner(inner);
631            Self {
632                inner,
633                accept_compression_encodings: Default::default(),
634                send_compression_encodings: Default::default(),
635                max_decoding_message_size: None,
636                max_encoding_message_size: None,
637            }
638        }
639        pub fn with_interceptor<F>(
640            inner: T,
641            interceptor: F,
642        ) -> InterceptedService<Self, F>
643        where
644            F: tonic::service::Interceptor,
645        {
646            InterceptedService::new(Self::new(inner), interceptor)
647        }
648        /// Enable decompressing requests with the given encoding.
649        #[must_use]
650        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
651            self.accept_compression_encodings.enable(encoding);
652            self
653        }
654        /// Compress responses with the given encoding, if the client supports it.
655        #[must_use]
656        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
657            self.send_compression_encodings.enable(encoding);
658            self
659        }
660        /// Limits the maximum size of a decoded message.
661        ///
662        /// Default: `4MB`
663        #[must_use]
664        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
665            self.max_decoding_message_size = Some(limit);
666            self
667        }
668        /// Limits the maximum size of an encoded message.
669        ///
670        /// Default: `usize::MAX`
671        #[must_use]
672        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
673            self.max_encoding_message_size = Some(limit);
674            self
675        }
676    }
677    impl<T, B> tonic::codegen::Service<http::Request<B>> for DestinationServer<T>
678    where
679        T: Destination,
680        B: Body + Send + 'static,
681        B::Error: Into<StdError> + Send + 'static,
682    {
683        type Response = http::Response<tonic::body::BoxBody>;
684        type Error = std::convert::Infallible;
685        type Future = BoxFuture<Self::Response, Self::Error>;
686        fn poll_ready(
687            &mut self,
688            _cx: &mut Context<'_>,
689        ) -> Poll<std::result::Result<(), Self::Error>> {
690            Poll::Ready(Ok(()))
691        }
692        fn call(&mut self, req: http::Request<B>) -> Self::Future {
693            let inner = self.inner.clone();
694            match req.uri().path() {
695                "/io.linkerd.proxy.destination.Destination/Get" => {
696                    #[allow(non_camel_case_types)]
697                    struct GetSvc<T: Destination>(pub Arc<T>);
698                    impl<
699                        T: Destination,
700                    > tonic::server::ServerStreamingService<super::GetDestination>
701                    for GetSvc<T> {
702                        type Response = super::Update;
703                        type ResponseStream = T::GetStream;
704                        type Future = BoxFuture<
705                            tonic::Response<Self::ResponseStream>,
706                            tonic::Status,
707                        >;
708                        fn call(
709                            &mut self,
710                            request: tonic::Request<super::GetDestination>,
711                        ) -> Self::Future {
712                            let inner = Arc::clone(&self.0);
713                            let fut = async move {
714                                <T as Destination>::get(&inner, request).await
715                            };
716                            Box::pin(fut)
717                        }
718                    }
719                    let accept_compression_encodings = self.accept_compression_encodings;
720                    let send_compression_encodings = self.send_compression_encodings;
721                    let max_decoding_message_size = self.max_decoding_message_size;
722                    let max_encoding_message_size = self.max_encoding_message_size;
723                    let inner = self.inner.clone();
724                    let fut = async move {
725                        let inner = inner.0;
726                        let method = GetSvc(inner);
727                        let codec = tonic::codec::ProstCodec::default();
728                        let mut grpc = tonic::server::Grpc::new(codec)
729                            .apply_compression_config(
730                                accept_compression_encodings,
731                                send_compression_encodings,
732                            )
733                            .apply_max_message_size_config(
734                                max_decoding_message_size,
735                                max_encoding_message_size,
736                            );
737                        let res = grpc.server_streaming(method, req).await;
738                        Ok(res)
739                    };
740                    Box::pin(fut)
741                }
742                "/io.linkerd.proxy.destination.Destination/GetProfile" => {
743                    #[allow(non_camel_case_types)]
744                    struct GetProfileSvc<T: Destination>(pub Arc<T>);
745                    impl<
746                        T: Destination,
747                    > tonic::server::ServerStreamingService<super::GetDestination>
748                    for GetProfileSvc<T> {
749                        type Response = super::DestinationProfile;
750                        type ResponseStream = T::GetProfileStream;
751                        type Future = BoxFuture<
752                            tonic::Response<Self::ResponseStream>,
753                            tonic::Status,
754                        >;
755                        fn call(
756                            &mut self,
757                            request: tonic::Request<super::GetDestination>,
758                        ) -> Self::Future {
759                            let inner = Arc::clone(&self.0);
760                            let fut = async move {
761                                <T as Destination>::get_profile(&inner, request).await
762                            };
763                            Box::pin(fut)
764                        }
765                    }
766                    let accept_compression_encodings = self.accept_compression_encodings;
767                    let send_compression_encodings = self.send_compression_encodings;
768                    let max_decoding_message_size = self.max_decoding_message_size;
769                    let max_encoding_message_size = self.max_encoding_message_size;
770                    let inner = self.inner.clone();
771                    let fut = async move {
772                        let inner = inner.0;
773                        let method = GetProfileSvc(inner);
774                        let codec = tonic::codec::ProstCodec::default();
775                        let mut grpc = tonic::server::Grpc::new(codec)
776                            .apply_compression_config(
777                                accept_compression_encodings,
778                                send_compression_encodings,
779                            )
780                            .apply_max_message_size_config(
781                                max_decoding_message_size,
782                                max_encoding_message_size,
783                            );
784                        let res = grpc.server_streaming(method, req).await;
785                        Ok(res)
786                    };
787                    Box::pin(fut)
788                }
789                _ => {
790                    Box::pin(async move {
791                        Ok(
792                            http::Response::builder()
793                                .status(200)
794                                .header("grpc-status", "12")
795                                .header("content-type", "application/grpc")
796                                .body(empty_body())
797                                .unwrap(),
798                        )
799                    })
800                }
801            }
802        }
803    }
804    impl<T: Destination> Clone for DestinationServer<T> {
805        fn clone(&self) -> Self {
806            let inner = self.inner.clone();
807            Self {
808                inner,
809                accept_compression_encodings: self.accept_compression_encodings,
810                send_compression_encodings: self.send_compression_encodings,
811                max_decoding_message_size: self.max_decoding_message_size,
812                max_encoding_message_size: self.max_encoding_message_size,
813            }
814        }
815    }
816    impl<T: Destination> Clone for _Inner<T> {
817        fn clone(&self) -> Self {
818            Self(Arc::clone(&self.0))
819        }
820    }
821    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
822        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
823            write!(f, "{:?}", self.0)
824        }
825    }
826    impl<T: Destination> tonic::server::NamedService for DestinationServer<T> {
827        const NAME: &'static str = "io.linkerd.proxy.destination.Destination";
828    }
829}