// @generated /// Generated client implementations. pub mod cluster_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct ClusterDiscoveryServiceClient { inner: tonic::client::Grpc, } impl ClusterDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl ClusterDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> ClusterDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { ClusterDiscoveryServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn stream_clusters( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ClusterDiscoveryService/StreamClusters", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn delta_clusters( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ClusterDiscoveryService/DeltaClusters", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn fetch_clusters( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ClusterDiscoveryService/FetchClusters", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod cluster_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with ClusterDiscoveryServiceServer. #[async_trait] pub trait ClusterDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the StreamClusters method. type StreamClustersStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn stream_clusters( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// Server streaming response type for the DeltaClusters method. type DeltaClustersStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn delta_clusters( &self, request: tonic::Request>, ) -> Result, tonic::Status>; async fn fetch_clusters( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct ClusterDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl ClusterDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for ClusterDiscoveryServiceServer where T: ClusterDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.ClusterDiscoveryService/StreamClusters" => { #[allow(non_camel_case_types)] struct StreamClustersSvc(pub Arc); impl< T: ClusterDiscoveryService, > tonic::server::StreamingService for StreamClustersSvc { type Response = super::DiscoveryResponse; type ResponseStream = T::StreamClustersStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).stream_clusters(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = StreamClustersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ClusterDiscoveryService/DeltaClusters" => { #[allow(non_camel_case_types)] struct DeltaClustersSvc(pub Arc); impl< T: ClusterDiscoveryService, > tonic::server::StreamingService for DeltaClustersSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaClustersStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_clusters(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaClustersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ClusterDiscoveryService/FetchClusters" => { #[allow(non_camel_case_types)] struct FetchClustersSvc(pub Arc); impl< T: ClusterDiscoveryService, > tonic::server::UnaryService for FetchClustersSvc { type Response = super::DiscoveryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).fetch_clusters(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = FetchClustersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for ClusterDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for ClusterDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.ClusterDiscoveryService"; } } /// Generated client implementations. pub mod endpoint_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct EndpointDiscoveryServiceClient { inner: tonic::client::Grpc, } impl EndpointDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl EndpointDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> EndpointDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { EndpointDiscoveryServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn stream_endpoints( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn delta_endpoints( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.EndpointDiscoveryService/DeltaEndpoints", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn fetch_endpoints( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod endpoint_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with EndpointDiscoveryServiceServer. #[async_trait] pub trait EndpointDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the StreamEndpoints method. type StreamEndpointsStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn stream_endpoints( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// Server streaming response type for the DeltaEndpoints method. type DeltaEndpointsStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn delta_endpoints( &self, request: tonic::Request>, ) -> Result, tonic::Status>; async fn fetch_endpoints( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct EndpointDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl EndpointDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for EndpointDiscoveryServiceServer where T: EndpointDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" => { #[allow(non_camel_case_types)] struct StreamEndpointsSvc(pub Arc); impl< T: EndpointDiscoveryService, > tonic::server::StreamingService for StreamEndpointsSvc { type Response = super::DiscoveryResponse; type ResponseStream = T::StreamEndpointsStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).stream_endpoints(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = StreamEndpointsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.EndpointDiscoveryService/DeltaEndpoints" => { #[allow(non_camel_case_types)] struct DeltaEndpointsSvc(pub Arc); impl< T: EndpointDiscoveryService, > tonic::server::StreamingService for DeltaEndpointsSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaEndpointsStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_endpoints(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaEndpointsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints" => { #[allow(non_camel_case_types)] struct FetchEndpointsSvc(pub Arc); impl< T: EndpointDiscoveryService, > tonic::server::UnaryService for FetchEndpointsSvc { type Response = super::DiscoveryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).fetch_endpoints(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = FetchEndpointsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for EndpointDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for EndpointDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.EndpointDiscoveryService"; } } /// Generated client implementations. pub mod listener_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct ListenerDiscoveryServiceClient { inner: tonic::client::Grpc, } impl ListenerDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl ListenerDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> ListenerDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { ListenerDiscoveryServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn delta_listeners( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ListenerDiscoveryService/DeltaListeners", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn stream_listeners( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ListenerDiscoveryService/StreamListeners", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn fetch_listeners( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ListenerDiscoveryService/FetchListeners", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod listener_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with ListenerDiscoveryServiceServer. #[async_trait] pub trait ListenerDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the DeltaListeners method. type DeltaListenersStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn delta_listeners( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// Server streaming response type for the StreamListeners method. type StreamListenersStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn stream_listeners( &self, request: tonic::Request>, ) -> Result, tonic::Status>; async fn fetch_listeners( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct ListenerDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl ListenerDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for ListenerDiscoveryServiceServer where T: ListenerDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.ListenerDiscoveryService/DeltaListeners" => { #[allow(non_camel_case_types)] struct DeltaListenersSvc(pub Arc); impl< T: ListenerDiscoveryService, > tonic::server::StreamingService for DeltaListenersSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaListenersStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_listeners(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaListenersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ListenerDiscoveryService/StreamListeners" => { #[allow(non_camel_case_types)] struct StreamListenersSvc(pub Arc); impl< T: ListenerDiscoveryService, > tonic::server::StreamingService for StreamListenersSvc { type Response = super::DiscoveryResponse; type ResponseStream = T::StreamListenersStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).stream_listeners(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = StreamListenersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ListenerDiscoveryService/FetchListeners" => { #[allow(non_camel_case_types)] struct FetchListenersSvc(pub Arc); impl< T: ListenerDiscoveryService, > tonic::server::UnaryService for FetchListenersSvc { type Response = super::DiscoveryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).fetch_listeners(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = FetchListenersSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for ListenerDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for ListenerDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.ListenerDiscoveryService"; } } /// Generated client implementations. pub mod route_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct RouteDiscoveryServiceClient { inner: tonic::client::Grpc, } impl RouteDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl RouteDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> RouteDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { RouteDiscoveryServiceClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn stream_routes( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.RouteDiscoveryService/StreamRoutes", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } /// pub async fn delta_routes( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.RouteDiscoveryService/DeltaRoutes", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } /// pub async fn fetch_routes( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.RouteDiscoveryService/FetchRoutes", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod route_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with RouteDiscoveryServiceServer. #[async_trait] pub trait RouteDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the StreamRoutes method. type StreamRoutesStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn stream_routes( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// Server streaming response type for the DeltaRoutes method. type DeltaRoutesStream: futures_core::Stream< Item = Result, > + Send + 'static; /// async fn delta_routes( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// async fn fetch_routes( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct RouteDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl RouteDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for RouteDiscoveryServiceServer where T: RouteDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.RouteDiscoveryService/StreamRoutes" => { #[allow(non_camel_case_types)] struct StreamRoutesSvc(pub Arc); impl< T: RouteDiscoveryService, > tonic::server::StreamingService for StreamRoutesSvc { type Response = super::DiscoveryResponse; type ResponseStream = T::StreamRoutesStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).stream_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = StreamRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.RouteDiscoveryService/DeltaRoutes" => { #[allow(non_camel_case_types)] struct DeltaRoutesSvc(pub Arc); impl< T: RouteDiscoveryService, > tonic::server::StreamingService for DeltaRoutesSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaRoutesStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.RouteDiscoveryService/FetchRoutes" => { #[allow(non_camel_case_types)] struct FetchRoutesSvc(pub Arc); impl< T: RouteDiscoveryService, > tonic::server::UnaryService for FetchRoutesSvc { type Response = super::DiscoveryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).fetch_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = FetchRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for RouteDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for RouteDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.RouteDiscoveryService"; } } /// Generated client implementations. pub mod virtual_host_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; /** Virtual Host Discovery Service (VHDS) is used to dynamically update the list of virtual hosts for a given RouteConfiguration. If VHDS is configured a virtual host list update will be triggered during the processing of an HTTP request if a route for the request cannot be resolved. The :ref:`resource_names_subscribe ` field contains a list of virtual host names or aliases to track. The contents of an alias would be the contents of a *host* or *authority* header used to make an http request. An xDS server will match an alias to a virtual host based on the content of :ref:`domains' ` field. The *resource_names_unsubscribe* field contains a list of virtual host names that have been :ref:`unsubscribed ` from the routing table associated with the RouteConfiguration. */ #[derive(Debug, Clone)] pub struct VirtualHostDiscoveryServiceClient { inner: tonic::client::Grpc, } impl VirtualHostDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl VirtualHostDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> VirtualHostDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { VirtualHostDiscoveryServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn delta_virtual_hosts( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.VirtualHostDiscoveryService/DeltaVirtualHosts", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } } } /// Generated server implementations. pub mod virtual_host_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with VirtualHostDiscoveryServiceServer. #[async_trait] pub trait VirtualHostDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the DeltaVirtualHosts method. type DeltaVirtualHostsStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn delta_virtual_hosts( &self, request: tonic::Request>, ) -> Result, tonic::Status>; } /** Virtual Host Discovery Service (VHDS) is used to dynamically update the list of virtual hosts for a given RouteConfiguration. If VHDS is configured a virtual host list update will be triggered during the processing of an HTTP request if a route for the request cannot be resolved. The :ref:`resource_names_subscribe ` field contains a list of virtual host names or aliases to track. The contents of an alias would be the contents of a *host* or *authority* header used to make an http request. An xDS server will match an alias to a virtual host based on the content of :ref:`domains' ` field. The *resource_names_unsubscribe* field contains a list of virtual host names that have been :ref:`unsubscribed ` from the routing table associated with the RouteConfiguration. */ #[derive(Debug)] pub struct VirtualHostDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl VirtualHostDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for VirtualHostDiscoveryServiceServer where T: VirtualHostDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.VirtualHostDiscoveryService/DeltaVirtualHosts" => { #[allow(non_camel_case_types)] struct DeltaVirtualHostsSvc( pub Arc, ); impl< T: VirtualHostDiscoveryService, > tonic::server::StreamingService for DeltaVirtualHostsSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaVirtualHostsStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_virtual_hosts(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaVirtualHostsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for VirtualHostDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for VirtualHostDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.VirtualHostDiscoveryService"; } } /// Generated client implementations. pub mod scoped_routes_discovery_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct ScopedRoutesDiscoveryServiceClient { inner: tonic::client::Grpc, } impl ScopedRoutesDiscoveryServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl ScopedRoutesDiscoveryServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> ScopedRoutesDiscoveryServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { ScopedRoutesDiscoveryServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } pub async fn stream_scoped_routes( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ScopedRoutesDiscoveryService/StreamScopedRoutes", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn delta_scoped_routes( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::DeltaDiscoveryRequest, >, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ScopedRoutesDiscoveryService/DeltaScopedRoutes", ); self.inner.streaming(request.into_streaming_request(), path, codec).await } pub async fn fetch_scoped_routes( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/envoy.api.v2.ScopedRoutesDiscoveryService/FetchScopedRoutes", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod scoped_routes_discovery_service_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with ScopedRoutesDiscoveryServiceServer. #[async_trait] pub trait ScopedRoutesDiscoveryService: Send + Sync + 'static { /// Server streaming response type for the StreamScopedRoutes method. type StreamScopedRoutesStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn stream_scoped_routes( &self, request: tonic::Request>, ) -> Result, tonic::Status>; /// Server streaming response type for the DeltaScopedRoutes method. type DeltaScopedRoutesStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn delta_scoped_routes( &self, request: tonic::Request>, ) -> Result, tonic::Status>; async fn fetch_scoped_routes( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct ScopedRoutesDiscoveryServiceServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, } struct _Inner(Arc); impl ScopedRoutesDiscoveryServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } } impl tonic::codegen::Service> for ScopedRoutesDiscoveryServiceServer where T: ScopedRoutesDiscoveryService, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/envoy.api.v2.ScopedRoutesDiscoveryService/StreamScopedRoutes" => { #[allow(non_camel_case_types)] struct StreamScopedRoutesSvc( pub Arc, ); impl< T: ScopedRoutesDiscoveryService, > tonic::server::StreamingService for StreamScopedRoutesSvc { type Response = super::DiscoveryResponse; type ResponseStream = T::StreamScopedRoutesStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).stream_scoped_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = StreamScopedRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ScopedRoutesDiscoveryService/DeltaScopedRoutes" => { #[allow(non_camel_case_types)] struct DeltaScopedRoutesSvc( pub Arc, ); impl< T: ScopedRoutesDiscoveryService, > tonic::server::StreamingService for DeltaScopedRoutesSvc { type Response = super::DeltaDiscoveryResponse; type ResponseStream = T::DeltaScopedRoutesStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< tonic::Streaming, >, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).delta_scoped_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = DeltaScopedRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/envoy.api.v2.ScopedRoutesDiscoveryService/FetchScopedRoutes" => { #[allow(non_camel_case_types)] struct FetchScopedRoutesSvc( pub Arc, ); impl< T: ScopedRoutesDiscoveryService, > tonic::server::UnaryService for FetchScopedRoutesSvc { type Response = super::DiscoveryResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).fetch_scoped_routes(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = FetchScopedRoutesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for ScopedRoutesDiscoveryServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::server::NamedService for ScopedRoutesDiscoveryServiceServer { const NAME: &'static str = "envoy.api.v2.ScopedRoutesDiscoveryService"; } }