1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct CreateRequest {
5 #[prost(string, tag = "1")]
7 pub parent_fid: ::prost::alloc::string::String,
8 #[prost(oneof = "create_request::El", tags = "2, 3, 4, 5")]
10 pub el: ::core::option::Option<create_request::El>,
11}
12pub mod create_request {
14 #[derive(Clone, PartialEq, ::prost::Oneof)]
16 pub enum El {
17 #[prost(message, tag = "2")]
18 Member(super::Member),
19 #[prost(message, tag = "3")]
20 Room(super::Room),
21 #[prost(message, tag = "4")]
22 WebrtcPlay(super::WebRtcPlayEndpoint),
23 #[prost(message, tag = "5")]
24 WebrtcPub(super::WebRtcPublishEndpoint),
25 }
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct IdRequest {
30 #[prost(string, repeated, tag = "1")]
32 pub fid: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
33}
34#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct ApplyRequest {
37 #[prost(string, tag = "1")]
39 pub parent_fid: ::prost::alloc::string::String,
40 #[prost(oneof = "apply_request::El", tags = "2, 3, 4, 5")]
42 pub el: ::core::option::Option<apply_request::El>,
43}
44pub mod apply_request {
46 #[derive(Clone, PartialEq, ::prost::Oneof)]
48 pub enum El {
49 #[prost(message, tag = "2")]
50 Member(super::Member),
51 #[prost(message, tag = "3")]
52 Room(super::Room),
53 #[prost(message, tag = "4")]
54 WebrtcPlay(super::WebRtcPlayEndpoint),
55 #[prost(message, tag = "5")]
56 WebrtcPub(super::WebRtcPublishEndpoint),
57 }
58}
59#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct Response {
66 #[prost(message, optional, tag = "1")]
68 pub error: ::core::option::Option<Error>,
69}
70#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct CreateResponse {
76 #[prost(map = "string, string", tag = "1")]
81 pub sid: ::std::collections::HashMap<
82 ::prost::alloc::string::String,
83 ::prost::alloc::string::String,
84 >,
85 #[prost(message, optional, tag = "2")]
87 pub error: ::core::option::Option<Error>,
88}
89#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct GetResponse {
95 #[prost(map = "string, message", tag = "1")]
99 pub elements: ::std::collections::HashMap<::prost::alloc::string::String, Element>,
100 #[prost(message, optional, tag = "2")]
102 pub error: ::core::option::Option<Error>,
103}
104#[derive(Clone, PartialEq, ::prost::Message)]
108pub struct Error {
109 #[prost(uint32, tag = "1")]
111 pub code: u32,
112 #[prost(string, tag = "2")]
114 pub text: ::prost::alloc::string::String,
115 #[prost(string, tag = "3")]
119 pub doc: ::prost::alloc::string::String,
120 #[prost(string, tag = "4")]
126 pub element: ::prost::alloc::string::String,
127}
128#[derive(Clone, PartialEq, ::prost::Message)]
130pub struct Element {
131 #[prost(oneof = "element::El", tags = "1, 2, 3, 4")]
132 pub el: ::core::option::Option<element::El>,
133}
134pub mod element {
136 #[derive(Clone, PartialEq, ::prost::Oneof)]
137 pub enum El {
138 #[prost(message, tag = "1")]
139 Member(super::Member),
140 #[prost(message, tag = "2")]
141 Room(super::Room),
142 #[prost(message, tag = "3")]
143 WebrtcPlay(super::WebRtcPlayEndpoint),
144 #[prost(message, tag = "4")]
145 WebrtcPub(super::WebRtcPublishEndpoint),
146 }
147}
148#[derive(Clone, PartialEq, ::prost::Message)]
151pub struct Room {
152 #[prost(string, tag = "1")]
154 pub id: ::prost::alloc::string::String,
155 #[prost(map = "string, message", tag = "2")]
157 pub pipeline: ::std::collections::HashMap<
158 ::prost::alloc::string::String,
159 room::Element,
160 >,
161}
162pub mod room {
164 #[derive(Clone, PartialEq, ::prost::Message)]
166 pub struct Element {
167 #[prost(oneof = "element::El", tags = "1, 2, 3")]
168 pub el: ::core::option::Option<element::El>,
169 }
170 pub mod element {
172 #[derive(Clone, PartialEq, ::prost::Oneof)]
173 pub enum El {
174 #[prost(message, tag = "1")]
175 Member(super::super::Member),
176 #[prost(message, tag = "2")]
177 WebrtcPlay(super::super::WebRtcPlayEndpoint),
178 #[prost(message, tag = "3")]
179 WebrtcPub(super::super::WebRtcPublishEndpoint),
180 }
181 }
182}
183#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct Member {
187 #[prost(string, tag = "1")]
189 pub id: ::prost::alloc::string::String,
190 #[prost(string, tag = "2")]
193 pub on_join: ::prost::alloc::string::String,
194 #[prost(string, tag = "3")]
197 pub on_leave: ::prost::alloc::string::String,
198 #[prost(message, optional, tag = "6")]
201 pub idle_timeout: ::core::option::Option<::prost_types::Duration>,
202 #[prost(message, optional, tag = "7")]
205 pub reconnect_timeout: ::core::option::Option<::prost_types::Duration>,
206 #[prost(message, optional, tag = "8")]
211 pub ping_interval: ::core::option::Option<::prost_types::Duration>,
212 #[prost(map = "string, message", tag = "9")]
214 pub pipeline: ::std::collections::HashMap<
215 ::prost::alloc::string::String,
216 member::Element,
217 >,
218 #[prost(oneof = "member::Credentials", tags = "4, 5")]
228 pub credentials: ::core::option::Option<member::Credentials>,
229}
230pub mod member {
232 #[derive(Clone, PartialEq, ::prost::Message)]
234 pub struct Element {
235 #[prost(oneof = "element::El", tags = "1, 2")]
236 pub el: ::core::option::Option<element::El>,
237 }
238 pub mod element {
240 #[derive(Clone, PartialEq, ::prost::Oneof)]
241 pub enum El {
242 #[prost(message, tag = "1")]
243 WebrtcPlay(super::super::WebRtcPlayEndpoint),
244 #[prost(message, tag = "2")]
245 WebrtcPub(super::super::WebRtcPublishEndpoint),
246 }
247 }
248 #[derive(Clone, PartialEq, ::prost::Oneof)]
258 pub enum Credentials {
259 #[prost(string, tag = "4")]
261 Hash(::prost::alloc::string::String),
262 #[prost(string, tag = "5")]
264 Plain(::prost::alloc::string::String),
265 }
266}
267#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct WebRtcPublishEndpoint {
271 #[prost(string, tag = "1")]
273 pub id: ::prost::alloc::string::String,
274 #[prost(enumeration = "web_rtc_publish_endpoint::P2p", tag = "2")]
276 pub p2p: i32,
277 #[prost(string, tag = "3")]
279 pub on_start: ::prost::alloc::string::String,
280 #[prost(string, tag = "4")]
282 pub on_stop: ::prost::alloc::string::String,
283 #[prost(bool, tag = "5")]
285 pub force_relay: bool,
286 #[prost(message, optional, tag = "6")]
288 pub audio_settings: ::core::option::Option<web_rtc_publish_endpoint::AudioSettings>,
289 #[prost(message, optional, tag = "7")]
291 pub video_settings: ::core::option::Option<web_rtc_publish_endpoint::VideoSettings>,
292}
293pub mod web_rtc_publish_endpoint {
295 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
297 pub struct AudioSettings {
298 #[prost(enumeration = "PublishPolicy", tag = "1")]
300 pub publish_policy: i32,
301 }
302 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
304 pub struct VideoSettings {
305 #[prost(enumeration = "PublishPolicy", tag = "1")]
307 pub publish_policy: i32,
308 }
309 #[derive(
312 Clone,
313 Copy,
314 Debug,
315 PartialEq,
316 Eq,
317 Hash,
318 PartialOrd,
319 Ord,
320 ::prost::Enumeration
321 )]
322 #[repr(i32)]
323 pub enum PublishPolicy {
324 Optional = 0,
331 Required = 1,
337 Disabled = 2,
341 }
342 impl PublishPolicy {
343 pub fn as_str_name(&self) -> &'static str {
348 match self {
349 Self::Optional => "OPTIONAL",
350 Self::Required => "REQUIRED",
351 Self::Disabled => "DISABLED",
352 }
353 }
354 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
356 match value {
357 "OPTIONAL" => Some(Self::Optional),
358 "REQUIRED" => Some(Self::Required),
359 "DISABLED" => Some(Self::Disabled),
360 _ => None,
361 }
362 }
363 }
364 #[derive(
367 Clone,
368 Copy,
369 Debug,
370 PartialEq,
371 Eq,
372 Hash,
373 PartialOrd,
374 Ord,
375 ::prost::Enumeration
376 )]
377 #[repr(i32)]
378 pub enum P2p {
379 Never = 0,
382 IfPossible = 1,
385 Always = 2,
388 }
389 impl P2p {
390 pub fn as_str_name(&self) -> &'static str {
395 match self {
396 Self::Never => "NEVER",
397 Self::IfPossible => "IF_POSSIBLE",
398 Self::Always => "ALWAYS",
399 }
400 }
401 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
403 match value {
404 "NEVER" => Some(Self::Never),
405 "IF_POSSIBLE" => Some(Self::IfPossible),
406 "ALWAYS" => Some(Self::Always),
407 _ => None,
408 }
409 }
410 }
411}
412#[derive(Clone, PartialEq, ::prost::Message)]
414pub struct WebRtcPlayEndpoint {
415 #[prost(string, tag = "1")]
417 pub id: ::prost::alloc::string::String,
418 #[prost(string, tag = "2")]
420 pub src: ::prost::alloc::string::String,
421 #[prost(string, tag = "3")]
423 pub on_start: ::prost::alloc::string::String,
424 #[prost(string, tag = "4")]
426 pub on_stop: ::prost::alloc::string::String,
427 #[prost(bool, tag = "5")]
429 pub force_relay: bool,
430}
431#[derive(Clone, Copy, PartialEq, ::prost::Message)]
434pub struct Ping {
435 #[prost(uint32, tag = "1")]
437 pub nonce: u32,
438}
439#[derive(Clone, Copy, PartialEq, ::prost::Message)]
441pub struct Pong {
442 #[prost(uint32, tag = "1")]
444 pub nonce: u32,
445}
446pub mod control_api_client {
448 #![allow(
449 unused_variables,
450 dead_code,
451 missing_docs,
452 clippy::wildcard_imports,
453 clippy::let_unit_value,
454 )]
455 use tonic::codegen::*;
456 use tonic::codegen::http::Uri;
457 #[derive(Debug, Clone)]
460 pub struct ControlApiClient<T> {
461 inner: tonic::client::Grpc<T>,
462 }
463 impl ControlApiClient<tonic::transport::Channel> {
464 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
466 where
467 D: TryInto<tonic::transport::Endpoint>,
468 D::Error: Into<StdError>,
469 {
470 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
471 Ok(Self::new(conn))
472 }
473 }
474 impl<T> ControlApiClient<T>
475 where
476 T: tonic::client::GrpcService<tonic::body::Body>,
477 T::Error: Into<StdError>,
478 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
479 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
480 {
481 pub fn new(inner: T) -> Self {
482 let inner = tonic::client::Grpc::new(inner);
483 Self { inner }
484 }
485 pub fn with_origin(inner: T, origin: Uri) -> Self {
486 let inner = tonic::client::Grpc::with_origin(inner, origin);
487 Self { inner }
488 }
489 pub fn with_interceptor<F>(
490 inner: T,
491 interceptor: F,
492 ) -> ControlApiClient<InterceptedService<T, F>>
493 where
494 F: tonic::service::Interceptor,
495 T::ResponseBody: Default,
496 T: tonic::codegen::Service<
497 http::Request<tonic::body::Body>,
498 Response = http::Response<
499 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
500 >,
501 >,
502 <T as tonic::codegen::Service<
503 http::Request<tonic::body::Body>,
504 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
505 {
506 ControlApiClient::new(InterceptedService::new(inner, interceptor))
507 }
508 #[must_use]
513 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
514 self.inner = self.inner.send_compressed(encoding);
515 self
516 }
517 #[must_use]
519 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
520 self.inner = self.inner.accept_compressed(encoding);
521 self
522 }
523 #[must_use]
527 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
528 self.inner = self.inner.max_decoding_message_size(limit);
529 self
530 }
531 #[must_use]
535 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
536 self.inner = self.inner.max_encoding_message_size(limit);
537 self
538 }
539 pub async fn create(
543 &mut self,
544 request: impl tonic::IntoRequest<super::CreateRequest>,
545 ) -> std::result::Result<tonic::Response<super::CreateResponse>, tonic::Status> {
546 self.inner
547 .ready()
548 .await
549 .map_err(|e| {
550 tonic::Status::unknown(
551 format!("Service was not ready: {}", e.into()),
552 )
553 })?;
554 let codec = tonic::codec::ProstCodec::default();
555 let path = http::uri::PathAndQuery::from_static("/api.ControlApi/Create");
556 let mut req = request.into_request();
557 req.extensions_mut().insert(GrpcMethod::new("api.ControlApi", "Create"));
558 self.inner.unary(req, path, codec).await
559 }
560 pub async fn delete(
565 &mut self,
566 request: impl tonic::IntoRequest<super::IdRequest>,
567 ) -> std::result::Result<tonic::Response<super::Response>, tonic::Status> {
568 self.inner
569 .ready()
570 .await
571 .map_err(|e| {
572 tonic::Status::unknown(
573 format!("Service was not ready: {}", e.into()),
574 )
575 })?;
576 let codec = tonic::codec::ProstCodec::default();
577 let path = http::uri::PathAndQuery::from_static("/api.ControlApi/Delete");
578 let mut req = request.into_request();
579 req.extensions_mut().insert(GrpcMethod::new("api.ControlApi", "Delete"));
580 self.inner.unary(req, path, codec).await
581 }
582 pub async fn get(
586 &mut self,
587 request: impl tonic::IntoRequest<super::IdRequest>,
588 ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status> {
589 self.inner
590 .ready()
591 .await
592 .map_err(|e| {
593 tonic::Status::unknown(
594 format!("Service was not ready: {}", e.into()),
595 )
596 })?;
597 let codec = tonic::codec::ProstCodec::default();
598 let path = http::uri::PathAndQuery::from_static("/api.ControlApi/Get");
599 let mut req = request.into_request();
600 req.extensions_mut().insert(GrpcMethod::new("api.ControlApi", "Get"));
601 self.inner.unary(req, path, codec).await
602 }
603 pub async fn apply(
611 &mut self,
612 request: impl tonic::IntoRequest<super::ApplyRequest>,
613 ) -> std::result::Result<tonic::Response<super::CreateResponse>, tonic::Status> {
614 self.inner
615 .ready()
616 .await
617 .map_err(|e| {
618 tonic::Status::unknown(
619 format!("Service was not ready: {}", e.into()),
620 )
621 })?;
622 let codec = tonic::codec::ProstCodec::default();
623 let path = http::uri::PathAndQuery::from_static("/api.ControlApi/Apply");
624 let mut req = request.into_request();
625 req.extensions_mut().insert(GrpcMethod::new("api.ControlApi", "Apply"));
626 self.inner.unary(req, path, codec).await
627 }
628 pub async fn healthz(
632 &mut self,
633 request: impl tonic::IntoRequest<super::Ping>,
634 ) -> std::result::Result<tonic::Response<super::Pong>, tonic::Status> {
635 self.inner
636 .ready()
637 .await
638 .map_err(|e| {
639 tonic::Status::unknown(
640 format!("Service was not ready: {}", e.into()),
641 )
642 })?;
643 let codec = tonic::codec::ProstCodec::default();
644 let path = http::uri::PathAndQuery::from_static("/api.ControlApi/Healthz");
645 let mut req = request.into_request();
646 req.extensions_mut().insert(GrpcMethod::new("api.ControlApi", "Healthz"));
647 self.inner.unary(req, path, codec).await
648 }
649 }
650}
651pub mod control_api_server {
653 #![allow(
654 unused_variables,
655 dead_code,
656 missing_docs,
657 clippy::wildcard_imports,
658 clippy::let_unit_value,
659 )]
660 use tonic::codegen::*;
661 #[async_trait]
663 pub trait ControlApi: std::marker::Send + std::marker::Sync + 'static {
664 async fn create(
668 &self,
669 request: tonic::Request<super::CreateRequest>,
670 ) -> std::result::Result<tonic::Response<super::CreateResponse>, tonic::Status>;
671 async fn delete(
676 &self,
677 request: tonic::Request<super::IdRequest>,
678 ) -> std::result::Result<tonic::Response<super::Response>, tonic::Status>;
679 async fn get(
683 &self,
684 request: tonic::Request<super::IdRequest>,
685 ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status>;
686 async fn apply(
694 &self,
695 request: tonic::Request<super::ApplyRequest>,
696 ) -> std::result::Result<tonic::Response<super::CreateResponse>, tonic::Status>;
697 async fn healthz(
701 &self,
702 request: tonic::Request<super::Ping>,
703 ) -> std::result::Result<tonic::Response<super::Pong>, tonic::Status>;
704 }
705 #[derive(Debug)]
708 pub struct ControlApiServer<T> {
709 inner: Arc<T>,
710 accept_compression_encodings: EnabledCompressionEncodings,
711 send_compression_encodings: EnabledCompressionEncodings,
712 max_decoding_message_size: Option<usize>,
713 max_encoding_message_size: Option<usize>,
714 }
715 impl<T> ControlApiServer<T> {
716 pub fn new(inner: T) -> Self {
717 Self::from_arc(Arc::new(inner))
718 }
719 pub fn from_arc(inner: Arc<T>) -> Self {
720 Self {
721 inner,
722 accept_compression_encodings: Default::default(),
723 send_compression_encodings: Default::default(),
724 max_decoding_message_size: None,
725 max_encoding_message_size: None,
726 }
727 }
728 pub fn with_interceptor<F>(
729 inner: T,
730 interceptor: F,
731 ) -> InterceptedService<Self, F>
732 where
733 F: tonic::service::Interceptor,
734 {
735 InterceptedService::new(Self::new(inner), interceptor)
736 }
737 #[must_use]
739 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
740 self.accept_compression_encodings.enable(encoding);
741 self
742 }
743 #[must_use]
745 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
746 self.send_compression_encodings.enable(encoding);
747 self
748 }
749 #[must_use]
753 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
754 self.max_decoding_message_size = Some(limit);
755 self
756 }
757 #[must_use]
761 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
762 self.max_encoding_message_size = Some(limit);
763 self
764 }
765 }
766 impl<T, B> tonic::codegen::Service<http::Request<B>> for ControlApiServer<T>
767 where
768 T: ControlApi,
769 B: Body + std::marker::Send + 'static,
770 B::Error: Into<StdError> + std::marker::Send + 'static,
771 {
772 type Response = http::Response<tonic::body::Body>;
773 type Error = std::convert::Infallible;
774 type Future = BoxFuture<Self::Response, Self::Error>;
775 fn poll_ready(
776 &mut self,
777 _cx: &mut Context<'_>,
778 ) -> Poll<std::result::Result<(), Self::Error>> {
779 Poll::Ready(Ok(()))
780 }
781 fn call(&mut self, req: http::Request<B>) -> Self::Future {
782 match req.uri().path() {
783 "/api.ControlApi/Create" => {
784 #[allow(non_camel_case_types)]
785 struct CreateSvc<T: ControlApi>(pub Arc<T>);
786 impl<T: ControlApi> tonic::server::UnaryService<super::CreateRequest>
787 for CreateSvc<T> {
788 type Response = super::CreateResponse;
789 type Future = BoxFuture<
790 tonic::Response<Self::Response>,
791 tonic::Status,
792 >;
793 fn call(
794 &mut self,
795 request: tonic::Request<super::CreateRequest>,
796 ) -> Self::Future {
797 let inner = Arc::clone(&self.0);
798 let fut = async move {
799 <T as ControlApi>::create(&inner, request).await
800 };
801 Box::pin(fut)
802 }
803 }
804 let accept_compression_encodings = self.accept_compression_encodings;
805 let send_compression_encodings = self.send_compression_encodings;
806 let max_decoding_message_size = self.max_decoding_message_size;
807 let max_encoding_message_size = self.max_encoding_message_size;
808 let inner = self.inner.clone();
809 let fut = async move {
810 let method = CreateSvc(inner);
811 let codec = tonic::codec::ProstCodec::default();
812 let mut grpc = tonic::server::Grpc::new(codec)
813 .apply_compression_config(
814 accept_compression_encodings,
815 send_compression_encodings,
816 )
817 .apply_max_message_size_config(
818 max_decoding_message_size,
819 max_encoding_message_size,
820 );
821 let res = grpc.unary(method, req).await;
822 Ok(res)
823 };
824 Box::pin(fut)
825 }
826 "/api.ControlApi/Delete" => {
827 #[allow(non_camel_case_types)]
828 struct DeleteSvc<T: ControlApi>(pub Arc<T>);
829 impl<T: ControlApi> tonic::server::UnaryService<super::IdRequest>
830 for DeleteSvc<T> {
831 type Response = super::Response;
832 type Future = BoxFuture<
833 tonic::Response<Self::Response>,
834 tonic::Status,
835 >;
836 fn call(
837 &mut self,
838 request: tonic::Request<super::IdRequest>,
839 ) -> Self::Future {
840 let inner = Arc::clone(&self.0);
841 let fut = async move {
842 <T as ControlApi>::delete(&inner, request).await
843 };
844 Box::pin(fut)
845 }
846 }
847 let accept_compression_encodings = self.accept_compression_encodings;
848 let send_compression_encodings = self.send_compression_encodings;
849 let max_decoding_message_size = self.max_decoding_message_size;
850 let max_encoding_message_size = self.max_encoding_message_size;
851 let inner = self.inner.clone();
852 let fut = async move {
853 let method = DeleteSvc(inner);
854 let codec = tonic::codec::ProstCodec::default();
855 let mut grpc = tonic::server::Grpc::new(codec)
856 .apply_compression_config(
857 accept_compression_encodings,
858 send_compression_encodings,
859 )
860 .apply_max_message_size_config(
861 max_decoding_message_size,
862 max_encoding_message_size,
863 );
864 let res = grpc.unary(method, req).await;
865 Ok(res)
866 };
867 Box::pin(fut)
868 }
869 "/api.ControlApi/Get" => {
870 #[allow(non_camel_case_types)]
871 struct GetSvc<T: ControlApi>(pub Arc<T>);
872 impl<T: ControlApi> tonic::server::UnaryService<super::IdRequest>
873 for GetSvc<T> {
874 type Response = super::GetResponse;
875 type Future = BoxFuture<
876 tonic::Response<Self::Response>,
877 tonic::Status,
878 >;
879 fn call(
880 &mut self,
881 request: tonic::Request<super::IdRequest>,
882 ) -> Self::Future {
883 let inner = Arc::clone(&self.0);
884 let fut = async move {
885 <T as ControlApi>::get(&inner, request).await
886 };
887 Box::pin(fut)
888 }
889 }
890 let accept_compression_encodings = self.accept_compression_encodings;
891 let send_compression_encodings = self.send_compression_encodings;
892 let max_decoding_message_size = self.max_decoding_message_size;
893 let max_encoding_message_size = self.max_encoding_message_size;
894 let inner = self.inner.clone();
895 let fut = async move {
896 let method = GetSvc(inner);
897 let codec = tonic::codec::ProstCodec::default();
898 let mut grpc = tonic::server::Grpc::new(codec)
899 .apply_compression_config(
900 accept_compression_encodings,
901 send_compression_encodings,
902 )
903 .apply_max_message_size_config(
904 max_decoding_message_size,
905 max_encoding_message_size,
906 );
907 let res = grpc.unary(method, req).await;
908 Ok(res)
909 };
910 Box::pin(fut)
911 }
912 "/api.ControlApi/Apply" => {
913 #[allow(non_camel_case_types)]
914 struct ApplySvc<T: ControlApi>(pub Arc<T>);
915 impl<T: ControlApi> tonic::server::UnaryService<super::ApplyRequest>
916 for ApplySvc<T> {
917 type Response = super::CreateResponse;
918 type Future = BoxFuture<
919 tonic::Response<Self::Response>,
920 tonic::Status,
921 >;
922 fn call(
923 &mut self,
924 request: tonic::Request<super::ApplyRequest>,
925 ) -> Self::Future {
926 let inner = Arc::clone(&self.0);
927 let fut = async move {
928 <T as ControlApi>::apply(&inner, request).await
929 };
930 Box::pin(fut)
931 }
932 }
933 let accept_compression_encodings = self.accept_compression_encodings;
934 let send_compression_encodings = self.send_compression_encodings;
935 let max_decoding_message_size = self.max_decoding_message_size;
936 let max_encoding_message_size = self.max_encoding_message_size;
937 let inner = self.inner.clone();
938 let fut = async move {
939 let method = ApplySvc(inner);
940 let codec = tonic::codec::ProstCodec::default();
941 let mut grpc = tonic::server::Grpc::new(codec)
942 .apply_compression_config(
943 accept_compression_encodings,
944 send_compression_encodings,
945 )
946 .apply_max_message_size_config(
947 max_decoding_message_size,
948 max_encoding_message_size,
949 );
950 let res = grpc.unary(method, req).await;
951 Ok(res)
952 };
953 Box::pin(fut)
954 }
955 "/api.ControlApi/Healthz" => {
956 #[allow(non_camel_case_types)]
957 struct HealthzSvc<T: ControlApi>(pub Arc<T>);
958 impl<T: ControlApi> tonic::server::UnaryService<super::Ping>
959 for HealthzSvc<T> {
960 type Response = super::Pong;
961 type Future = BoxFuture<
962 tonic::Response<Self::Response>,
963 tonic::Status,
964 >;
965 fn call(
966 &mut self,
967 request: tonic::Request<super::Ping>,
968 ) -> Self::Future {
969 let inner = Arc::clone(&self.0);
970 let fut = async move {
971 <T as ControlApi>::healthz(&inner, request).await
972 };
973 Box::pin(fut)
974 }
975 }
976 let accept_compression_encodings = self.accept_compression_encodings;
977 let send_compression_encodings = self.send_compression_encodings;
978 let max_decoding_message_size = self.max_decoding_message_size;
979 let max_encoding_message_size = self.max_encoding_message_size;
980 let inner = self.inner.clone();
981 let fut = async move {
982 let method = HealthzSvc(inner);
983 let codec = tonic::codec::ProstCodec::default();
984 let mut grpc = tonic::server::Grpc::new(codec)
985 .apply_compression_config(
986 accept_compression_encodings,
987 send_compression_encodings,
988 )
989 .apply_max_message_size_config(
990 max_decoding_message_size,
991 max_encoding_message_size,
992 );
993 let res = grpc.unary(method, req).await;
994 Ok(res)
995 };
996 Box::pin(fut)
997 }
998 _ => {
999 Box::pin(async move {
1000 let mut response = http::Response::new(
1001 tonic::body::Body::default(),
1002 );
1003 let headers = response.headers_mut();
1004 headers
1005 .insert(
1006 tonic::Status::GRPC_STATUS,
1007 (tonic::Code::Unimplemented as i32).into(),
1008 );
1009 headers
1010 .insert(
1011 http::header::CONTENT_TYPE,
1012 tonic::metadata::GRPC_CONTENT_TYPE,
1013 );
1014 Ok(response)
1015 })
1016 }
1017 }
1018 }
1019 }
1020 impl<T> Clone for ControlApiServer<T> {
1021 fn clone(&self) -> Self {
1022 let inner = self.inner.clone();
1023 Self {
1024 inner,
1025 accept_compression_encodings: self.accept_compression_encodings,
1026 send_compression_encodings: self.send_compression_encodings,
1027 max_decoding_message_size: self.max_decoding_message_size,
1028 max_encoding_message_size: self.max_encoding_message_size,
1029 }
1030 }
1031 }
1032 pub const SERVICE_NAME: &str = "api.ControlApi";
1034 impl<T> tonic::server::NamedService for ControlApiServer<T> {
1035 const NAME: &'static str = SERVICE_NAME;
1036 }
1037}