1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct RoleDefinition {
4 #[prost(string, tag = "1")]
5 pub name: ::prost::alloc::string::String,
6 #[prost(string, repeated, tag = "2")]
8 pub permissions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
9 #[prost(bool, tag = "3")]
10 pub system: bool,
11}
12#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
13pub struct CreateRoleRequest {
14 #[prost(message, optional, tag = "1")]
15 pub role: ::core::option::Option<RoleDefinition>,
16}
17#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
18pub struct CreateRoleResponse {
19 #[prost(bool, tag = "1")]
20 pub success: bool,
21}
22#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
23pub struct GetRoleRequest {
24 #[prost(string, tag = "1")]
25 pub name: ::prost::alloc::string::String,
26}
27#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
28pub struct GetRoleResponse {
29 #[prost(message, optional, tag = "1")]
30 pub role: ::core::option::Option<RoleDefinition>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct ListRolesResponse {
34 #[prost(message, repeated, tag = "1")]
35 pub roles: ::prost::alloc::vec::Vec<RoleDefinition>,
36}
37#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
38pub struct DeleteRoleRequest {
39 #[prost(string, tag = "1")]
40 pub name: ::prost::alloc::string::String,
41}
42#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
43pub struct DeleteRoleResponse {
44 #[prost(bool, tag = "1")]
45 pub success: bool,
46}
47#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
48pub struct BindingDefinition {
49 #[prost(string, tag = "1")]
50 pub id: ::prost::alloc::string::String,
51 #[prost(string, tag = "2")]
53 pub principal_type: ::prost::alloc::string::String,
54 #[prost(string, tag = "3")]
55 pub principal_name: ::prost::alloc::string::String,
56 #[prost(string, repeated, tag = "4")]
57 pub role_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
58 #[prost(string, tag = "5")]
60 pub scope: ::prost::alloc::string::String,
61 #[prost(string, tag = "6")]
63 pub resource_name: ::prost::alloc::string::String,
64}
65#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
66pub struct CreateBindingRequest {
67 #[prost(message, optional, tag = "1")]
68 pub binding: ::core::option::Option<BindingDefinition>,
69}
70#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
71pub struct CreateBindingResponse {
72 #[prost(bool, tag = "1")]
73 pub success: bool,
74}
75#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
76pub struct GetBindingRequest {
77 #[prost(string, tag = "1")]
78 pub scope: ::prost::alloc::string::String,
79 #[prost(string, tag = "2")]
80 pub resource_name: ::prost::alloc::string::String,
81 #[prost(string, tag = "3")]
82 pub binding_id: ::prost::alloc::string::String,
83}
84#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
85pub struct GetBindingResponse {
86 #[prost(message, optional, tag = "1")]
87 pub binding: ::core::option::Option<BindingDefinition>,
88}
89#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
90pub struct ListBindingsRequest {
91 #[prost(string, tag = "1")]
93 pub scope: ::prost::alloc::string::String,
94 #[prost(string, tag = "2")]
96 pub resource_name: ::prost::alloc::string::String,
97}
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct ListBindingsResponse {
100 #[prost(message, repeated, tag = "1")]
101 pub bindings: ::prost::alloc::vec::Vec<BindingDefinition>,
102}
103#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
104pub struct DeleteBindingRequest {
105 #[prost(string, tag = "1")]
106 pub scope: ::prost::alloc::string::String,
107 #[prost(string, tag = "2")]
108 pub resource_name: ::prost::alloc::string::String,
109 #[prost(string, tag = "3")]
110 pub binding_id: ::prost::alloc::string::String,
111}
112#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
113pub struct DeleteBindingResponse {
114 #[prost(bool, tag = "1")]
115 pub success: bool,
116}
117#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
119pub struct Empty {}
120#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
121pub struct NamespaceRequest {
122 #[prost(string, tag = "1")]
123 pub name: ::prost::alloc::string::String,
124}
125#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
126pub struct NamespaceResponse {
127 #[prost(bool, tag = "1")]
128 pub success: bool,
129}
130#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
131pub struct NewTopicRequest {
132 #[prost(string, tag = "1")]
133 pub name: ::prost::alloc::string::String,
134 #[prost(string, optional, tag = "2")]
136 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
137 #[prost(enumeration = "DispatchStrategy", tag = "3")]
138 pub dispatch_strategy: i32,
139}
140#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
141pub struct TopicRequest {
142 #[prost(string, tag = "1")]
143 pub name: ::prost::alloc::string::String,
144}
145#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
146pub struct TopicResponse {
147 #[prost(bool, tag = "1")]
148 pub success: bool,
149}
150#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
151pub struct PartitionedTopicRequest {
152 #[prost(string, tag = "1")]
154 pub base_name: ::prost::alloc::string::String,
155 #[prost(uint32, tag = "2")]
157 pub partitions: u32,
158 #[prost(string, optional, tag = "3")]
160 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
161 #[prost(enumeration = "DispatchStrategy", tag = "4")]
162 pub dispatch_strategy: i32,
163}
164#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
165pub struct SubscriptionRequest {
166 #[prost(string, tag = "1")]
167 pub topic: ::prost::alloc::string::String,
168 #[prost(string, tag = "2")]
169 pub subscription: ::prost::alloc::string::String,
170}
171#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
172pub struct SubscriptionResponse {
173 #[prost(bool, tag = "1")]
174 pub success: bool,
175}
176#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
177pub struct SubscriptionFailurePolicy {
178 #[prost(uint32, tag = "1")]
179 pub max_redelivery_count: u32,
180 #[prost(uint64, tag = "2")]
181 pub ack_timeout_ms: u64,
182 #[prost(uint64, tag = "3")]
183 pub base_redelivery_delay_ms: u64,
184 #[prost(uint64, tag = "4")]
185 pub max_redelivery_delay_ms: u64,
186 #[prost(enumeration = "SubscriptionBackoffStrategy", tag = "5")]
187 pub backoff_strategy: i32,
188 #[prost(string, optional, tag = "6")]
189 pub dead_letter_topic: ::core::option::Option<::prost::alloc::string::String>,
190 #[prost(enumeration = "SubscriptionPoisonPolicy", tag = "7")]
191 pub poison_policy: i32,
192}
193#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
194pub struct SetSubscriptionFailurePolicyRequest {
195 #[prost(string, tag = "1")]
196 pub topic: ::prost::alloc::string::String,
197 #[prost(string, tag = "2")]
198 pub subscription: ::prost::alloc::string::String,
199 #[prost(message, optional, tag = "3")]
200 pub failure_policy: ::core::option::Option<SubscriptionFailurePolicy>,
201}
202#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
203pub struct GetSubscriptionFailurePolicyRequest {
204 #[prost(string, tag = "1")]
205 pub topic: ::prost::alloc::string::String,
206 #[prost(string, tag = "2")]
207 pub subscription: ::prost::alloc::string::String,
208}
209#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
210pub struct GetSubscriptionFailurePolicyResponse {
211 #[prost(message, optional, tag = "1")]
212 pub failure_policy: ::core::option::Option<SubscriptionFailurePolicy>,
213}
214#[derive(Clone, PartialEq, ::prost::Message)]
216pub struct BrokerListResponse {
217 #[prost(message, repeated, tag = "1")]
218 pub brokers: ::prost::alloc::vec::Vec<BrokerInfo>,
219}
220#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
221pub struct BrokerInfo {
222 #[prost(string, tag = "1")]
223 pub broker_id: ::prost::alloc::string::String,
224 #[prost(string, tag = "2")]
225 pub broker_addr: ::prost::alloc::string::String,
226 #[prost(string, tag = "3")]
227 pub broker_role: ::prost::alloc::string::String,
228 #[prost(string, tag = "4")]
229 pub admin_addr: ::prost::alloc::string::String,
230 #[prost(string, tag = "5")]
231 pub metrics_addr: ::prost::alloc::string::String,
232 #[prost(string, tag = "6")]
233 pub broker_status: ::prost::alloc::string::String,
234}
235#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
236pub struct BrokerResponse {
237 #[prost(string, tag = "1")]
238 pub leader: ::prost::alloc::string::String,
239}
240#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
241pub struct NamespaceListResponse {
242 #[prost(string, repeated, tag = "1")]
243 pub namespaces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
244}
245#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
246pub struct TopicListResponse {
247 #[prost(string, repeated, tag = "1")]
248 pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
249}
250#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
252pub struct TopicInfo {
253 #[prost(string, tag = "1")]
255 pub name: ::prost::alloc::string::String,
256 #[prost(string, tag = "2")]
258 pub broker_id: ::prost::alloc::string::String,
259 #[prost(string, tag = "3")]
261 pub delivery: ::prost::alloc::string::String,
262}
263#[derive(Clone, PartialEq, ::prost::Message)]
264pub struct TopicInfoListResponse {
265 #[prost(message, repeated, tag = "1")]
266 pub topics: ::prost::alloc::vec::Vec<TopicInfo>,
267}
268#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
270pub struct BrokerRequest {
271 #[prost(string, tag = "1")]
272 pub broker_id: ::prost::alloc::string::String,
273}
274#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
275pub struct PolicyResponse {
276 #[prost(string, tag = "1")]
277 pub policies: ::prost::alloc::string::String,
278}
279#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
280pub struct SubscriptionListResponse {
281 #[prost(string, repeated, tag = "1")]
282 pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
283}
284#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
286pub struct DescribeTopicRequest {
287 #[prost(string, tag = "1")]
289 pub name: ::prost::alloc::string::String,
290}
291#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
292pub struct DescribeTopicResponse {
293 #[prost(string, tag = "1")]
294 pub name: ::prost::alloc::string::String,
295 #[prost(string, repeated, tag = "2")]
296 pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
297 #[prost(string, tag = "3")]
298 pub broker_id: ::prost::alloc::string::String,
299 #[prost(string, tag = "4")]
301 pub delivery: ::prost::alloc::string::String,
302 #[prost(string, optional, tag = "5")]
306 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
307 #[prost(uint64, optional, tag = "6")]
309 pub schema_id: ::core::option::Option<u64>,
310 #[prost(uint32, optional, tag = "7")]
312 pub schema_version: ::core::option::Option<u32>,
313 #[prost(string, optional, tag = "8")]
315 pub schema_type: ::core::option::Option<::prost::alloc::string::String>,
316 #[prost(string, optional, tag = "9")]
318 pub compatibility_mode: ::core::option::Option<::prost::alloc::string::String>,
319}
320#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
322pub struct UnloadBrokerRequest {
323 #[prost(string, tag = "1")]
325 pub broker_id: ::prost::alloc::string::String,
326 #[prost(uint32, tag = "2")]
328 pub max_parallel: u32,
329 #[prost(string, repeated, tag = "3")]
331 pub namespaces_include: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
332 #[prost(string, repeated, tag = "4")]
333 pub namespaces_exclude: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
334 #[prost(bool, tag = "5")]
336 pub dry_run: bool,
337 #[prost(uint32, tag = "6")]
339 pub timeout_seconds: u32,
340}
341#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
342pub struct UnloadBrokerResponse {
343 #[prost(bool, tag = "1")]
345 pub started: bool,
346 #[prost(uint32, tag = "2")]
347 pub total: u32,
348 #[prost(uint32, tag = "3")]
349 pub succeeded: u32,
350 #[prost(uint32, tag = "4")]
351 pub failed: u32,
352 #[prost(uint32, tag = "5")]
353 pub pending: u32,
354 #[prost(string, repeated, tag = "6")]
355 pub failed_topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
356}
357#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
359pub struct ActivateBrokerRequest {
360 #[prost(string, tag = "1")]
362 pub broker_id: ::prost::alloc::string::String,
363 #[prost(string, tag = "2")]
365 pub reason: ::prost::alloc::string::String,
366}
367#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
368pub struct ActivateBrokerResponse {
369 #[prost(bool, tag = "1")]
370 pub success: bool,
371}
372#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
374pub struct ClusterBalanceRequest {}
375#[derive(Clone, PartialEq, ::prost::Message)]
377pub struct ClusterBalanceResponse {
378 #[prost(double, tag = "1")]
380 pub coefficient_of_variation: f64,
381 #[prost(double, tag = "2")]
383 pub mean_load: f64,
384 #[prost(double, tag = "3")]
386 pub max_load: f64,
387 #[prost(double, tag = "4")]
389 pub min_load: f64,
390 #[prost(double, tag = "5")]
392 pub std_deviation: f64,
393 #[prost(uint32, tag = "6")]
395 pub broker_count: u32,
396 #[prost(message, repeated, tag = "7")]
398 pub brokers: ::prost::alloc::vec::Vec<BrokerLoadInfo>,
399 #[prost(string, tag = "8")]
401 pub assignment_strategy: ::prost::alloc::string::String,
402}
403#[derive(Clone, Copy, PartialEq, ::prost::Message)]
405pub struct BrokerLoadInfo {
406 #[prost(uint64, tag = "1")]
407 pub broker_id: u64,
408 #[prost(double, tag = "2")]
409 pub load: f64,
410 #[prost(uint32, tag = "3")]
411 pub topic_count: u32,
412 #[prost(bool, tag = "4")]
413 pub is_overloaded: bool,
414 #[prost(bool, tag = "5")]
415 pub is_underloaded: bool,
416}
417#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
419pub struct RebalanceRequest {
420 #[prost(bool, tag = "1")]
422 pub dry_run: bool,
423 #[prost(uint32, optional, tag = "2")]
425 pub max_moves: ::core::option::Option<u32>,
426}
427#[derive(Clone, PartialEq, ::prost::Message)]
429pub struct RebalanceResponse {
430 #[prost(bool, tag = "1")]
432 pub success: bool,
433 #[prost(uint32, tag = "2")]
435 pub moves_executed: u32,
436 #[prost(message, repeated, tag = "3")]
438 pub proposed_moves: ::prost::alloc::vec::Vec<ProposedMove>,
439 #[prost(string, tag = "4")]
441 pub error_message: ::prost::alloc::string::String,
442}
443#[derive(Clone, PartialEq, ::prost::Message)]
445pub struct ProposedMove {
446 #[prost(string, tag = "1")]
447 pub topic_name: ::prost::alloc::string::String,
448 #[prost(uint64, tag = "2")]
449 pub from_broker: u64,
450 #[prost(uint64, tag = "3")]
451 pub to_broker: u64,
452 #[prost(double, tag = "4")]
453 pub estimated_load: f64,
454 #[prost(string, tag = "5")]
455 pub reason: ::prost::alloc::string::String,
456}
457#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
458pub struct ClusterStatusResponse {
459 #[prost(uint64, tag = "1")]
461 pub leader_id: u64,
462 #[prost(uint64, tag = "2")]
464 pub current_term: u64,
465 #[prost(uint64, tag = "3")]
467 pub last_applied: u64,
468 #[prost(uint64, repeated, tag = "4")]
470 pub voters: ::prost::alloc::vec::Vec<u64>,
471 #[prost(uint64, repeated, tag = "5")]
473 pub learners: ::prost::alloc::vec::Vec<u64>,
474 #[prost(uint64, tag = "6")]
476 pub self_node_id: u64,
477 #[prost(string, tag = "7")]
479 pub raft_addr: ::prost::alloc::string::String,
480}
481#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
482pub struct AddNodeRequest {
483 #[prost(string, tag = "1")]
485 pub addr: ::prost::alloc::string::String,
486 #[prost(uint64, tag = "2")]
488 pub node_id: u64,
489}
490#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
491pub struct AddNodeResponse {
492 #[prost(bool, tag = "1")]
493 pub success: bool,
494 #[prost(uint64, tag = "2")]
495 pub node_id: u64,
496 #[prost(string, tag = "3")]
497 pub message: ::prost::alloc::string::String,
498}
499#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
500pub struct PromoteNodeRequest {
501 #[prost(uint64, tag = "1")]
502 pub node_id: u64,
503}
504#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
505pub struct PromoteNodeResponse {
506 #[prost(bool, tag = "1")]
507 pub success: bool,
508 #[prost(string, tag = "2")]
509 pub message: ::prost::alloc::string::String,
510}
511#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
512pub struct RemoveNodeRequest {
513 #[prost(uint64, tag = "1")]
514 pub node_id: u64,
515}
516#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
517pub struct RemoveNodeResponse {
518 #[prost(bool, tag = "1")]
519 pub success: bool,
520 #[prost(string, tag = "2")]
521 pub message: ::prost::alloc::string::String,
522}
523#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
525#[repr(i32)]
526pub enum DispatchStrategy {
527 NonReliable = 0,
528 Reliable = 1,
529}
530impl DispatchStrategy {
531 pub fn as_str_name(&self) -> &'static str {
536 match self {
537 Self::NonReliable => "NonReliable",
538 Self::Reliable => "Reliable",
539 }
540 }
541 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
543 match value {
544 "NonReliable" => Some(Self::NonReliable),
545 "Reliable" => Some(Self::Reliable),
546 _ => None,
547 }
548 }
549}
550#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
551#[repr(i32)]
552pub enum SubscriptionBackoffStrategy {
553 Fixed = 0,
554 Exponential = 1,
555}
556impl SubscriptionBackoffStrategy {
557 pub fn as_str_name(&self) -> &'static str {
562 match self {
563 Self::Fixed => "Fixed",
564 Self::Exponential => "Exponential",
565 }
566 }
567 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
569 match value {
570 "Fixed" => Some(Self::Fixed),
571 "Exponential" => Some(Self::Exponential),
572 _ => None,
573 }
574 }
575}
576#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
577#[repr(i32)]
578pub enum SubscriptionPoisonPolicy {
579 DeadLetter = 0,
580 Block = 1,
581 Drop = 2,
582}
583impl SubscriptionPoisonPolicy {
584 pub fn as_str_name(&self) -> &'static str {
589 match self {
590 Self::DeadLetter => "DeadLetter",
591 Self::Block => "Block",
592 Self::Drop => "Drop",
593 }
594 }
595 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
597 match value {
598 "DeadLetter" => Some(Self::DeadLetter),
599 "Block" => Some(Self::Block),
600 "Drop" => Some(Self::Drop),
601 _ => None,
602 }
603 }
604}
605pub mod broker_admin_client {
607 #![allow(
608 unused_variables,
609 dead_code,
610 missing_docs,
611 clippy::wildcard_imports,
612 clippy::let_unit_value,
613 )]
614 use tonic::codegen::*;
615 use tonic::codegen::http::Uri;
616 #[derive(Debug, Clone)]
617 pub struct BrokerAdminClient<T> {
618 inner: tonic::client::Grpc<T>,
619 }
620 impl BrokerAdminClient<tonic::transport::Channel> {
621 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
623 where
624 D: TryInto<tonic::transport::Endpoint>,
625 D::Error: Into<StdError>,
626 {
627 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
628 Ok(Self::new(conn))
629 }
630 }
631 impl<T> BrokerAdminClient<T>
632 where
633 T: tonic::client::GrpcService<tonic::body::Body>,
634 T::Error: Into<StdError>,
635 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
636 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
637 {
638 pub fn new(inner: T) -> Self {
639 let inner = tonic::client::Grpc::new(inner);
640 Self { inner }
641 }
642 pub fn with_origin(inner: T, origin: Uri) -> Self {
643 let inner = tonic::client::Grpc::with_origin(inner, origin);
644 Self { inner }
645 }
646 pub fn with_interceptor<F>(
647 inner: T,
648 interceptor: F,
649 ) -> BrokerAdminClient<InterceptedService<T, F>>
650 where
651 F: tonic::service::Interceptor,
652 T::ResponseBody: Default,
653 T: tonic::codegen::Service<
654 http::Request<tonic::body::Body>,
655 Response = http::Response<
656 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
657 >,
658 >,
659 <T as tonic::codegen::Service<
660 http::Request<tonic::body::Body>,
661 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
662 {
663 BrokerAdminClient::new(InterceptedService::new(inner, interceptor))
664 }
665 #[must_use]
670 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
671 self.inner = self.inner.send_compressed(encoding);
672 self
673 }
674 #[must_use]
676 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
677 self.inner = self.inner.accept_compressed(encoding);
678 self
679 }
680 #[must_use]
684 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
685 self.inner = self.inner.max_decoding_message_size(limit);
686 self
687 }
688 #[must_use]
692 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
693 self.inner = self.inner.max_encoding_message_size(limit);
694 self
695 }
696 pub async fn list_brokers(
698 &mut self,
699 request: impl tonic::IntoRequest<super::Empty>,
700 ) -> std::result::Result<
701 tonic::Response<super::BrokerListResponse>,
702 tonic::Status,
703 > {
704 self.inner
705 .ready()
706 .await
707 .map_err(|e| {
708 tonic::Status::unknown(
709 format!("Service was not ready: {}", e.into()),
710 )
711 })?;
712 let codec = tonic_prost::ProstCodec::default();
713 let path = http::uri::PathAndQuery::from_static(
714 "/danube_admin.BrokerAdmin/ListBrokers",
715 );
716 let mut req = request.into_request();
717 req.extensions_mut()
718 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListBrokers"));
719 self.inner.unary(req, path, codec).await
720 }
721 pub async fn get_leader_broker(
722 &mut self,
723 request: impl tonic::IntoRequest<super::Empty>,
724 ) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status> {
725 self.inner
726 .ready()
727 .await
728 .map_err(|e| {
729 tonic::Status::unknown(
730 format!("Service was not ready: {}", e.into()),
731 )
732 })?;
733 let codec = tonic_prost::ProstCodec::default();
734 let path = http::uri::PathAndQuery::from_static(
735 "/danube_admin.BrokerAdmin/GetLeaderBroker",
736 );
737 let mut req = request.into_request();
738 req.extensions_mut()
739 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "GetLeaderBroker"));
740 self.inner.unary(req, path, codec).await
741 }
742 pub async fn list_namespaces(
743 &mut self,
744 request: impl tonic::IntoRequest<super::Empty>,
745 ) -> std::result::Result<
746 tonic::Response<super::NamespaceListResponse>,
747 tonic::Status,
748 > {
749 self.inner
750 .ready()
751 .await
752 .map_err(|e| {
753 tonic::Status::unknown(
754 format!("Service was not ready: {}", e.into()),
755 )
756 })?;
757 let codec = tonic_prost::ProstCodec::default();
758 let path = http::uri::PathAndQuery::from_static(
759 "/danube_admin.BrokerAdmin/ListNamespaces",
760 );
761 let mut req = request.into_request();
762 req.extensions_mut()
763 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListNamespaces"));
764 self.inner.unary(req, path, codec).await
765 }
766 pub async fn unload_broker(
767 &mut self,
768 request: impl tonic::IntoRequest<super::UnloadBrokerRequest>,
769 ) -> std::result::Result<
770 tonic::Response<super::UnloadBrokerResponse>,
771 tonic::Status,
772 > {
773 self.inner
774 .ready()
775 .await
776 .map_err(|e| {
777 tonic::Status::unknown(
778 format!("Service was not ready: {}", e.into()),
779 )
780 })?;
781 let codec = tonic_prost::ProstCodec::default();
782 let path = http::uri::PathAndQuery::from_static(
783 "/danube_admin.BrokerAdmin/UnloadBroker",
784 );
785 let mut req = request.into_request();
786 req.extensions_mut()
787 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "UnloadBroker"));
788 self.inner.unary(req, path, codec).await
789 }
790 pub async fn activate_broker(
791 &mut self,
792 request: impl tonic::IntoRequest<super::ActivateBrokerRequest>,
793 ) -> std::result::Result<
794 tonic::Response<super::ActivateBrokerResponse>,
795 tonic::Status,
796 > {
797 self.inner
798 .ready()
799 .await
800 .map_err(|e| {
801 tonic::Status::unknown(
802 format!("Service was not ready: {}", e.into()),
803 )
804 })?;
805 let codec = tonic_prost::ProstCodec::default();
806 let path = http::uri::PathAndQuery::from_static(
807 "/danube_admin.BrokerAdmin/ActivateBroker",
808 );
809 let mut req = request.into_request();
810 req.extensions_mut()
811 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ActivateBroker"));
812 self.inner.unary(req, path, codec).await
813 }
814 pub async fn get_cluster_balance(
816 &mut self,
817 request: impl tonic::IntoRequest<super::ClusterBalanceRequest>,
818 ) -> std::result::Result<
819 tonic::Response<super::ClusterBalanceResponse>,
820 tonic::Status,
821 > {
822 self.inner
823 .ready()
824 .await
825 .map_err(|e| {
826 tonic::Status::unknown(
827 format!("Service was not ready: {}", e.into()),
828 )
829 })?;
830 let codec = tonic_prost::ProstCodec::default();
831 let path = http::uri::PathAndQuery::from_static(
832 "/danube_admin.BrokerAdmin/GetClusterBalance",
833 );
834 let mut req = request.into_request();
835 req.extensions_mut()
836 .insert(
837 GrpcMethod::new("danube_admin.BrokerAdmin", "GetClusterBalance"),
838 );
839 self.inner.unary(req, path, codec).await
840 }
841 pub async fn trigger_rebalance(
842 &mut self,
843 request: impl tonic::IntoRequest<super::RebalanceRequest>,
844 ) -> std::result::Result<
845 tonic::Response<super::RebalanceResponse>,
846 tonic::Status,
847 > {
848 self.inner
849 .ready()
850 .await
851 .map_err(|e| {
852 tonic::Status::unknown(
853 format!("Service was not ready: {}", e.into()),
854 )
855 })?;
856 let codec = tonic_prost::ProstCodec::default();
857 let path = http::uri::PathAndQuery::from_static(
858 "/danube_admin.BrokerAdmin/TriggerRebalance",
859 );
860 let mut req = request.into_request();
861 req.extensions_mut()
862 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "TriggerRebalance"));
863 self.inner.unary(req, path, codec).await
864 }
865 }
866}
867pub mod broker_admin_server {
869 #![allow(
870 unused_variables,
871 dead_code,
872 missing_docs,
873 clippy::wildcard_imports,
874 clippy::let_unit_value,
875 )]
876 use tonic::codegen::*;
877 #[async_trait]
879 pub trait BrokerAdmin: std::marker::Send + std::marker::Sync + 'static {
880 async fn list_brokers(
882 &self,
883 request: tonic::Request<super::Empty>,
884 ) -> std::result::Result<
885 tonic::Response<super::BrokerListResponse>,
886 tonic::Status,
887 >;
888 async fn get_leader_broker(
889 &self,
890 request: tonic::Request<super::Empty>,
891 ) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status>;
892 async fn list_namespaces(
893 &self,
894 request: tonic::Request<super::Empty>,
895 ) -> std::result::Result<
896 tonic::Response<super::NamespaceListResponse>,
897 tonic::Status,
898 >;
899 async fn unload_broker(
900 &self,
901 request: tonic::Request<super::UnloadBrokerRequest>,
902 ) -> std::result::Result<
903 tonic::Response<super::UnloadBrokerResponse>,
904 tonic::Status,
905 >;
906 async fn activate_broker(
907 &self,
908 request: tonic::Request<super::ActivateBrokerRequest>,
909 ) -> std::result::Result<
910 tonic::Response<super::ActivateBrokerResponse>,
911 tonic::Status,
912 >;
913 async fn get_cluster_balance(
915 &self,
916 request: tonic::Request<super::ClusterBalanceRequest>,
917 ) -> std::result::Result<
918 tonic::Response<super::ClusterBalanceResponse>,
919 tonic::Status,
920 >;
921 async fn trigger_rebalance(
922 &self,
923 request: tonic::Request<super::RebalanceRequest>,
924 ) -> std::result::Result<
925 tonic::Response<super::RebalanceResponse>,
926 tonic::Status,
927 >;
928 }
929 #[derive(Debug)]
930 pub struct BrokerAdminServer<T> {
931 inner: Arc<T>,
932 accept_compression_encodings: EnabledCompressionEncodings,
933 send_compression_encodings: EnabledCompressionEncodings,
934 max_decoding_message_size: Option<usize>,
935 max_encoding_message_size: Option<usize>,
936 }
937 impl<T> BrokerAdminServer<T> {
938 pub fn new(inner: T) -> Self {
939 Self::from_arc(Arc::new(inner))
940 }
941 pub fn from_arc(inner: Arc<T>) -> Self {
942 Self {
943 inner,
944 accept_compression_encodings: Default::default(),
945 send_compression_encodings: Default::default(),
946 max_decoding_message_size: None,
947 max_encoding_message_size: None,
948 }
949 }
950 pub fn with_interceptor<F>(
951 inner: T,
952 interceptor: F,
953 ) -> InterceptedService<Self, F>
954 where
955 F: tonic::service::Interceptor,
956 {
957 InterceptedService::new(Self::new(inner), interceptor)
958 }
959 #[must_use]
961 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
962 self.accept_compression_encodings.enable(encoding);
963 self
964 }
965 #[must_use]
967 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
968 self.send_compression_encodings.enable(encoding);
969 self
970 }
971 #[must_use]
975 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
976 self.max_decoding_message_size = Some(limit);
977 self
978 }
979 #[must_use]
983 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
984 self.max_encoding_message_size = Some(limit);
985 self
986 }
987 }
988 impl<T, B> tonic::codegen::Service<http::Request<B>> for BrokerAdminServer<T>
989 where
990 T: BrokerAdmin,
991 B: Body + std::marker::Send + 'static,
992 B::Error: Into<StdError> + std::marker::Send + 'static,
993 {
994 type Response = http::Response<tonic::body::Body>;
995 type Error = std::convert::Infallible;
996 type Future = BoxFuture<Self::Response, Self::Error>;
997 fn poll_ready(
998 &mut self,
999 _cx: &mut Context<'_>,
1000 ) -> Poll<std::result::Result<(), Self::Error>> {
1001 Poll::Ready(Ok(()))
1002 }
1003 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1004 match req.uri().path() {
1005 "/danube_admin.BrokerAdmin/ListBrokers" => {
1006 #[allow(non_camel_case_types)]
1007 struct ListBrokersSvc<T: BrokerAdmin>(pub Arc<T>);
1008 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
1009 for ListBrokersSvc<T> {
1010 type Response = super::BrokerListResponse;
1011 type Future = BoxFuture<
1012 tonic::Response<Self::Response>,
1013 tonic::Status,
1014 >;
1015 fn call(
1016 &mut self,
1017 request: tonic::Request<super::Empty>,
1018 ) -> Self::Future {
1019 let inner = Arc::clone(&self.0);
1020 let fut = async move {
1021 <T as BrokerAdmin>::list_brokers(&inner, request).await
1022 };
1023 Box::pin(fut)
1024 }
1025 }
1026 let accept_compression_encodings = self.accept_compression_encodings;
1027 let send_compression_encodings = self.send_compression_encodings;
1028 let max_decoding_message_size = self.max_decoding_message_size;
1029 let max_encoding_message_size = self.max_encoding_message_size;
1030 let inner = self.inner.clone();
1031 let fut = async move {
1032 let method = ListBrokersSvc(inner);
1033 let codec = tonic_prost::ProstCodec::default();
1034 let mut grpc = tonic::server::Grpc::new(codec)
1035 .apply_compression_config(
1036 accept_compression_encodings,
1037 send_compression_encodings,
1038 )
1039 .apply_max_message_size_config(
1040 max_decoding_message_size,
1041 max_encoding_message_size,
1042 );
1043 let res = grpc.unary(method, req).await;
1044 Ok(res)
1045 };
1046 Box::pin(fut)
1047 }
1048 "/danube_admin.BrokerAdmin/GetLeaderBroker" => {
1049 #[allow(non_camel_case_types)]
1050 struct GetLeaderBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
1051 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
1052 for GetLeaderBrokerSvc<T> {
1053 type Response = super::BrokerResponse;
1054 type Future = BoxFuture<
1055 tonic::Response<Self::Response>,
1056 tonic::Status,
1057 >;
1058 fn call(
1059 &mut self,
1060 request: tonic::Request<super::Empty>,
1061 ) -> Self::Future {
1062 let inner = Arc::clone(&self.0);
1063 let fut = async move {
1064 <T as BrokerAdmin>::get_leader_broker(&inner, request).await
1065 };
1066 Box::pin(fut)
1067 }
1068 }
1069 let accept_compression_encodings = self.accept_compression_encodings;
1070 let send_compression_encodings = self.send_compression_encodings;
1071 let max_decoding_message_size = self.max_decoding_message_size;
1072 let max_encoding_message_size = self.max_encoding_message_size;
1073 let inner = self.inner.clone();
1074 let fut = async move {
1075 let method = GetLeaderBrokerSvc(inner);
1076 let codec = tonic_prost::ProstCodec::default();
1077 let mut grpc = tonic::server::Grpc::new(codec)
1078 .apply_compression_config(
1079 accept_compression_encodings,
1080 send_compression_encodings,
1081 )
1082 .apply_max_message_size_config(
1083 max_decoding_message_size,
1084 max_encoding_message_size,
1085 );
1086 let res = grpc.unary(method, req).await;
1087 Ok(res)
1088 };
1089 Box::pin(fut)
1090 }
1091 "/danube_admin.BrokerAdmin/ListNamespaces" => {
1092 #[allow(non_camel_case_types)]
1093 struct ListNamespacesSvc<T: BrokerAdmin>(pub Arc<T>);
1094 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
1095 for ListNamespacesSvc<T> {
1096 type Response = super::NamespaceListResponse;
1097 type Future = BoxFuture<
1098 tonic::Response<Self::Response>,
1099 tonic::Status,
1100 >;
1101 fn call(
1102 &mut self,
1103 request: tonic::Request<super::Empty>,
1104 ) -> Self::Future {
1105 let inner = Arc::clone(&self.0);
1106 let fut = async move {
1107 <T as BrokerAdmin>::list_namespaces(&inner, request).await
1108 };
1109 Box::pin(fut)
1110 }
1111 }
1112 let accept_compression_encodings = self.accept_compression_encodings;
1113 let send_compression_encodings = self.send_compression_encodings;
1114 let max_decoding_message_size = self.max_decoding_message_size;
1115 let max_encoding_message_size = self.max_encoding_message_size;
1116 let inner = self.inner.clone();
1117 let fut = async move {
1118 let method = ListNamespacesSvc(inner);
1119 let codec = tonic_prost::ProstCodec::default();
1120 let mut grpc = tonic::server::Grpc::new(codec)
1121 .apply_compression_config(
1122 accept_compression_encodings,
1123 send_compression_encodings,
1124 )
1125 .apply_max_message_size_config(
1126 max_decoding_message_size,
1127 max_encoding_message_size,
1128 );
1129 let res = grpc.unary(method, req).await;
1130 Ok(res)
1131 };
1132 Box::pin(fut)
1133 }
1134 "/danube_admin.BrokerAdmin/UnloadBroker" => {
1135 #[allow(non_camel_case_types)]
1136 struct UnloadBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
1137 impl<
1138 T: BrokerAdmin,
1139 > tonic::server::UnaryService<super::UnloadBrokerRequest>
1140 for UnloadBrokerSvc<T> {
1141 type Response = super::UnloadBrokerResponse;
1142 type Future = BoxFuture<
1143 tonic::Response<Self::Response>,
1144 tonic::Status,
1145 >;
1146 fn call(
1147 &mut self,
1148 request: tonic::Request<super::UnloadBrokerRequest>,
1149 ) -> Self::Future {
1150 let inner = Arc::clone(&self.0);
1151 let fut = async move {
1152 <T as BrokerAdmin>::unload_broker(&inner, request).await
1153 };
1154 Box::pin(fut)
1155 }
1156 }
1157 let accept_compression_encodings = self.accept_compression_encodings;
1158 let send_compression_encodings = self.send_compression_encodings;
1159 let max_decoding_message_size = self.max_decoding_message_size;
1160 let max_encoding_message_size = self.max_encoding_message_size;
1161 let inner = self.inner.clone();
1162 let fut = async move {
1163 let method = UnloadBrokerSvc(inner);
1164 let codec = tonic_prost::ProstCodec::default();
1165 let mut grpc = tonic::server::Grpc::new(codec)
1166 .apply_compression_config(
1167 accept_compression_encodings,
1168 send_compression_encodings,
1169 )
1170 .apply_max_message_size_config(
1171 max_decoding_message_size,
1172 max_encoding_message_size,
1173 );
1174 let res = grpc.unary(method, req).await;
1175 Ok(res)
1176 };
1177 Box::pin(fut)
1178 }
1179 "/danube_admin.BrokerAdmin/ActivateBroker" => {
1180 #[allow(non_camel_case_types)]
1181 struct ActivateBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
1182 impl<
1183 T: BrokerAdmin,
1184 > tonic::server::UnaryService<super::ActivateBrokerRequest>
1185 for ActivateBrokerSvc<T> {
1186 type Response = super::ActivateBrokerResponse;
1187 type Future = BoxFuture<
1188 tonic::Response<Self::Response>,
1189 tonic::Status,
1190 >;
1191 fn call(
1192 &mut self,
1193 request: tonic::Request<super::ActivateBrokerRequest>,
1194 ) -> Self::Future {
1195 let inner = Arc::clone(&self.0);
1196 let fut = async move {
1197 <T as BrokerAdmin>::activate_broker(&inner, request).await
1198 };
1199 Box::pin(fut)
1200 }
1201 }
1202 let accept_compression_encodings = self.accept_compression_encodings;
1203 let send_compression_encodings = self.send_compression_encodings;
1204 let max_decoding_message_size = self.max_decoding_message_size;
1205 let max_encoding_message_size = self.max_encoding_message_size;
1206 let inner = self.inner.clone();
1207 let fut = async move {
1208 let method = ActivateBrokerSvc(inner);
1209 let codec = tonic_prost::ProstCodec::default();
1210 let mut grpc = tonic::server::Grpc::new(codec)
1211 .apply_compression_config(
1212 accept_compression_encodings,
1213 send_compression_encodings,
1214 )
1215 .apply_max_message_size_config(
1216 max_decoding_message_size,
1217 max_encoding_message_size,
1218 );
1219 let res = grpc.unary(method, req).await;
1220 Ok(res)
1221 };
1222 Box::pin(fut)
1223 }
1224 "/danube_admin.BrokerAdmin/GetClusterBalance" => {
1225 #[allow(non_camel_case_types)]
1226 struct GetClusterBalanceSvc<T: BrokerAdmin>(pub Arc<T>);
1227 impl<
1228 T: BrokerAdmin,
1229 > tonic::server::UnaryService<super::ClusterBalanceRequest>
1230 for GetClusterBalanceSvc<T> {
1231 type Response = super::ClusterBalanceResponse;
1232 type Future = BoxFuture<
1233 tonic::Response<Self::Response>,
1234 tonic::Status,
1235 >;
1236 fn call(
1237 &mut self,
1238 request: tonic::Request<super::ClusterBalanceRequest>,
1239 ) -> Self::Future {
1240 let inner = Arc::clone(&self.0);
1241 let fut = async move {
1242 <T as BrokerAdmin>::get_cluster_balance(&inner, request)
1243 .await
1244 };
1245 Box::pin(fut)
1246 }
1247 }
1248 let accept_compression_encodings = self.accept_compression_encodings;
1249 let send_compression_encodings = self.send_compression_encodings;
1250 let max_decoding_message_size = self.max_decoding_message_size;
1251 let max_encoding_message_size = self.max_encoding_message_size;
1252 let inner = self.inner.clone();
1253 let fut = async move {
1254 let method = GetClusterBalanceSvc(inner);
1255 let codec = tonic_prost::ProstCodec::default();
1256 let mut grpc = tonic::server::Grpc::new(codec)
1257 .apply_compression_config(
1258 accept_compression_encodings,
1259 send_compression_encodings,
1260 )
1261 .apply_max_message_size_config(
1262 max_decoding_message_size,
1263 max_encoding_message_size,
1264 );
1265 let res = grpc.unary(method, req).await;
1266 Ok(res)
1267 };
1268 Box::pin(fut)
1269 }
1270 "/danube_admin.BrokerAdmin/TriggerRebalance" => {
1271 #[allow(non_camel_case_types)]
1272 struct TriggerRebalanceSvc<T: BrokerAdmin>(pub Arc<T>);
1273 impl<
1274 T: BrokerAdmin,
1275 > tonic::server::UnaryService<super::RebalanceRequest>
1276 for TriggerRebalanceSvc<T> {
1277 type Response = super::RebalanceResponse;
1278 type Future = BoxFuture<
1279 tonic::Response<Self::Response>,
1280 tonic::Status,
1281 >;
1282 fn call(
1283 &mut self,
1284 request: tonic::Request<super::RebalanceRequest>,
1285 ) -> Self::Future {
1286 let inner = Arc::clone(&self.0);
1287 let fut = async move {
1288 <T as BrokerAdmin>::trigger_rebalance(&inner, request).await
1289 };
1290 Box::pin(fut)
1291 }
1292 }
1293 let accept_compression_encodings = self.accept_compression_encodings;
1294 let send_compression_encodings = self.send_compression_encodings;
1295 let max_decoding_message_size = self.max_decoding_message_size;
1296 let max_encoding_message_size = self.max_encoding_message_size;
1297 let inner = self.inner.clone();
1298 let fut = async move {
1299 let method = TriggerRebalanceSvc(inner);
1300 let codec = tonic_prost::ProstCodec::default();
1301 let mut grpc = tonic::server::Grpc::new(codec)
1302 .apply_compression_config(
1303 accept_compression_encodings,
1304 send_compression_encodings,
1305 )
1306 .apply_max_message_size_config(
1307 max_decoding_message_size,
1308 max_encoding_message_size,
1309 );
1310 let res = grpc.unary(method, req).await;
1311 Ok(res)
1312 };
1313 Box::pin(fut)
1314 }
1315 _ => {
1316 Box::pin(async move {
1317 let mut response = http::Response::new(
1318 tonic::body::Body::default(),
1319 );
1320 let headers = response.headers_mut();
1321 headers
1322 .insert(
1323 tonic::Status::GRPC_STATUS,
1324 (tonic::Code::Unimplemented as i32).into(),
1325 );
1326 headers
1327 .insert(
1328 http::header::CONTENT_TYPE,
1329 tonic::metadata::GRPC_CONTENT_TYPE,
1330 );
1331 Ok(response)
1332 })
1333 }
1334 }
1335 }
1336 }
1337 impl<T> Clone for BrokerAdminServer<T> {
1338 fn clone(&self) -> Self {
1339 let inner = self.inner.clone();
1340 Self {
1341 inner,
1342 accept_compression_encodings: self.accept_compression_encodings,
1343 send_compression_encodings: self.send_compression_encodings,
1344 max_decoding_message_size: self.max_decoding_message_size,
1345 max_encoding_message_size: self.max_encoding_message_size,
1346 }
1347 }
1348 }
1349 pub const SERVICE_NAME: &str = "danube_admin.BrokerAdmin";
1351 impl<T> tonic::server::NamedService for BrokerAdminServer<T> {
1352 const NAME: &'static str = SERVICE_NAME;
1353 }
1354}
1355pub mod cluster_admin_client {
1357 #![allow(
1358 unused_variables,
1359 dead_code,
1360 missing_docs,
1361 clippy::wildcard_imports,
1362 clippy::let_unit_value,
1363 )]
1364 use tonic::codegen::*;
1365 use tonic::codegen::http::Uri;
1366 #[derive(Debug, Clone)]
1369 pub struct ClusterAdminClient<T> {
1370 inner: tonic::client::Grpc<T>,
1371 }
1372 impl ClusterAdminClient<tonic::transport::Channel> {
1373 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1375 where
1376 D: TryInto<tonic::transport::Endpoint>,
1377 D::Error: Into<StdError>,
1378 {
1379 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1380 Ok(Self::new(conn))
1381 }
1382 }
1383 impl<T> ClusterAdminClient<T>
1384 where
1385 T: tonic::client::GrpcService<tonic::body::Body>,
1386 T::Error: Into<StdError>,
1387 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1388 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1389 {
1390 pub fn new(inner: T) -> Self {
1391 let inner = tonic::client::Grpc::new(inner);
1392 Self { inner }
1393 }
1394 pub fn with_origin(inner: T, origin: Uri) -> Self {
1395 let inner = tonic::client::Grpc::with_origin(inner, origin);
1396 Self { inner }
1397 }
1398 pub fn with_interceptor<F>(
1399 inner: T,
1400 interceptor: F,
1401 ) -> ClusterAdminClient<InterceptedService<T, F>>
1402 where
1403 F: tonic::service::Interceptor,
1404 T::ResponseBody: Default,
1405 T: tonic::codegen::Service<
1406 http::Request<tonic::body::Body>,
1407 Response = http::Response<
1408 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1409 >,
1410 >,
1411 <T as tonic::codegen::Service<
1412 http::Request<tonic::body::Body>,
1413 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1414 {
1415 ClusterAdminClient::new(InterceptedService::new(inner, interceptor))
1416 }
1417 #[must_use]
1422 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1423 self.inner = self.inner.send_compressed(encoding);
1424 self
1425 }
1426 #[must_use]
1428 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1429 self.inner = self.inner.accept_compressed(encoding);
1430 self
1431 }
1432 #[must_use]
1436 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1437 self.inner = self.inner.max_decoding_message_size(limit);
1438 self
1439 }
1440 #[must_use]
1444 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1445 self.inner = self.inner.max_encoding_message_size(limit);
1446 self
1447 }
1448 pub async fn cluster_status(
1450 &mut self,
1451 request: impl tonic::IntoRequest<super::Empty>,
1452 ) -> std::result::Result<
1453 tonic::Response<super::ClusterStatusResponse>,
1454 tonic::Status,
1455 > {
1456 self.inner
1457 .ready()
1458 .await
1459 .map_err(|e| {
1460 tonic::Status::unknown(
1461 format!("Service was not ready: {}", e.into()),
1462 )
1463 })?;
1464 let codec = tonic_prost::ProstCodec::default();
1465 let path = http::uri::PathAndQuery::from_static(
1466 "/danube_admin.ClusterAdmin/ClusterStatus",
1467 );
1468 let mut req = request.into_request();
1469 req.extensions_mut()
1470 .insert(GrpcMethod::new("danube_admin.ClusterAdmin", "ClusterStatus"));
1471 self.inner.unary(req, path, codec).await
1472 }
1473 pub async fn add_node(
1475 &mut self,
1476 request: impl tonic::IntoRequest<super::AddNodeRequest>,
1477 ) -> std::result::Result<
1478 tonic::Response<super::AddNodeResponse>,
1479 tonic::Status,
1480 > {
1481 self.inner
1482 .ready()
1483 .await
1484 .map_err(|e| {
1485 tonic::Status::unknown(
1486 format!("Service was not ready: {}", e.into()),
1487 )
1488 })?;
1489 let codec = tonic_prost::ProstCodec::default();
1490 let path = http::uri::PathAndQuery::from_static(
1491 "/danube_admin.ClusterAdmin/AddNode",
1492 );
1493 let mut req = request.into_request();
1494 req.extensions_mut()
1495 .insert(GrpcMethod::new("danube_admin.ClusterAdmin", "AddNode"));
1496 self.inner.unary(req, path, codec).await
1497 }
1498 pub async fn promote_node(
1500 &mut self,
1501 request: impl tonic::IntoRequest<super::PromoteNodeRequest>,
1502 ) -> std::result::Result<
1503 tonic::Response<super::PromoteNodeResponse>,
1504 tonic::Status,
1505 > {
1506 self.inner
1507 .ready()
1508 .await
1509 .map_err(|e| {
1510 tonic::Status::unknown(
1511 format!("Service was not ready: {}", e.into()),
1512 )
1513 })?;
1514 let codec = tonic_prost::ProstCodec::default();
1515 let path = http::uri::PathAndQuery::from_static(
1516 "/danube_admin.ClusterAdmin/PromoteNode",
1517 );
1518 let mut req = request.into_request();
1519 req.extensions_mut()
1520 .insert(GrpcMethod::new("danube_admin.ClusterAdmin", "PromoteNode"));
1521 self.inner.unary(req, path, codec).await
1522 }
1523 pub async fn remove_node(
1525 &mut self,
1526 request: impl tonic::IntoRequest<super::RemoveNodeRequest>,
1527 ) -> std::result::Result<
1528 tonic::Response<super::RemoveNodeResponse>,
1529 tonic::Status,
1530 > {
1531 self.inner
1532 .ready()
1533 .await
1534 .map_err(|e| {
1535 tonic::Status::unknown(
1536 format!("Service was not ready: {}", e.into()),
1537 )
1538 })?;
1539 let codec = tonic_prost::ProstCodec::default();
1540 let path = http::uri::PathAndQuery::from_static(
1541 "/danube_admin.ClusterAdmin/RemoveNode",
1542 );
1543 let mut req = request.into_request();
1544 req.extensions_mut()
1545 .insert(GrpcMethod::new("danube_admin.ClusterAdmin", "RemoveNode"));
1546 self.inner.unary(req, path, codec).await
1547 }
1548 }
1549}
1550pub mod cluster_admin_server {
1552 #![allow(
1553 unused_variables,
1554 dead_code,
1555 missing_docs,
1556 clippy::wildcard_imports,
1557 clippy::let_unit_value,
1558 )]
1559 use tonic::codegen::*;
1560 #[async_trait]
1562 pub trait ClusterAdmin: std::marker::Send + std::marker::Sync + 'static {
1563 async fn cluster_status(
1565 &self,
1566 request: tonic::Request<super::Empty>,
1567 ) -> std::result::Result<
1568 tonic::Response<super::ClusterStatusResponse>,
1569 tonic::Status,
1570 >;
1571 async fn add_node(
1573 &self,
1574 request: tonic::Request<super::AddNodeRequest>,
1575 ) -> std::result::Result<tonic::Response<super::AddNodeResponse>, tonic::Status>;
1576 async fn promote_node(
1578 &self,
1579 request: tonic::Request<super::PromoteNodeRequest>,
1580 ) -> std::result::Result<
1581 tonic::Response<super::PromoteNodeResponse>,
1582 tonic::Status,
1583 >;
1584 async fn remove_node(
1586 &self,
1587 request: tonic::Request<super::RemoveNodeRequest>,
1588 ) -> std::result::Result<
1589 tonic::Response<super::RemoveNodeResponse>,
1590 tonic::Status,
1591 >;
1592 }
1593 #[derive(Debug)]
1596 pub struct ClusterAdminServer<T> {
1597 inner: Arc<T>,
1598 accept_compression_encodings: EnabledCompressionEncodings,
1599 send_compression_encodings: EnabledCompressionEncodings,
1600 max_decoding_message_size: Option<usize>,
1601 max_encoding_message_size: Option<usize>,
1602 }
1603 impl<T> ClusterAdminServer<T> {
1604 pub fn new(inner: T) -> Self {
1605 Self::from_arc(Arc::new(inner))
1606 }
1607 pub fn from_arc(inner: Arc<T>) -> Self {
1608 Self {
1609 inner,
1610 accept_compression_encodings: Default::default(),
1611 send_compression_encodings: Default::default(),
1612 max_decoding_message_size: None,
1613 max_encoding_message_size: None,
1614 }
1615 }
1616 pub fn with_interceptor<F>(
1617 inner: T,
1618 interceptor: F,
1619 ) -> InterceptedService<Self, F>
1620 where
1621 F: tonic::service::Interceptor,
1622 {
1623 InterceptedService::new(Self::new(inner), interceptor)
1624 }
1625 #[must_use]
1627 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1628 self.accept_compression_encodings.enable(encoding);
1629 self
1630 }
1631 #[must_use]
1633 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1634 self.send_compression_encodings.enable(encoding);
1635 self
1636 }
1637 #[must_use]
1641 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1642 self.max_decoding_message_size = Some(limit);
1643 self
1644 }
1645 #[must_use]
1649 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1650 self.max_encoding_message_size = Some(limit);
1651 self
1652 }
1653 }
1654 impl<T, B> tonic::codegen::Service<http::Request<B>> for ClusterAdminServer<T>
1655 where
1656 T: ClusterAdmin,
1657 B: Body + std::marker::Send + 'static,
1658 B::Error: Into<StdError> + std::marker::Send + 'static,
1659 {
1660 type Response = http::Response<tonic::body::Body>;
1661 type Error = std::convert::Infallible;
1662 type Future = BoxFuture<Self::Response, Self::Error>;
1663 fn poll_ready(
1664 &mut self,
1665 _cx: &mut Context<'_>,
1666 ) -> Poll<std::result::Result<(), Self::Error>> {
1667 Poll::Ready(Ok(()))
1668 }
1669 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1670 match req.uri().path() {
1671 "/danube_admin.ClusterAdmin/ClusterStatus" => {
1672 #[allow(non_camel_case_types)]
1673 struct ClusterStatusSvc<T: ClusterAdmin>(pub Arc<T>);
1674 impl<T: ClusterAdmin> tonic::server::UnaryService<super::Empty>
1675 for ClusterStatusSvc<T> {
1676 type Response = super::ClusterStatusResponse;
1677 type Future = BoxFuture<
1678 tonic::Response<Self::Response>,
1679 tonic::Status,
1680 >;
1681 fn call(
1682 &mut self,
1683 request: tonic::Request<super::Empty>,
1684 ) -> Self::Future {
1685 let inner = Arc::clone(&self.0);
1686 let fut = async move {
1687 <T as ClusterAdmin>::cluster_status(&inner, request).await
1688 };
1689 Box::pin(fut)
1690 }
1691 }
1692 let accept_compression_encodings = self.accept_compression_encodings;
1693 let send_compression_encodings = self.send_compression_encodings;
1694 let max_decoding_message_size = self.max_decoding_message_size;
1695 let max_encoding_message_size = self.max_encoding_message_size;
1696 let inner = self.inner.clone();
1697 let fut = async move {
1698 let method = ClusterStatusSvc(inner);
1699 let codec = tonic_prost::ProstCodec::default();
1700 let mut grpc = tonic::server::Grpc::new(codec)
1701 .apply_compression_config(
1702 accept_compression_encodings,
1703 send_compression_encodings,
1704 )
1705 .apply_max_message_size_config(
1706 max_decoding_message_size,
1707 max_encoding_message_size,
1708 );
1709 let res = grpc.unary(method, req).await;
1710 Ok(res)
1711 };
1712 Box::pin(fut)
1713 }
1714 "/danube_admin.ClusterAdmin/AddNode" => {
1715 #[allow(non_camel_case_types)]
1716 struct AddNodeSvc<T: ClusterAdmin>(pub Arc<T>);
1717 impl<
1718 T: ClusterAdmin,
1719 > tonic::server::UnaryService<super::AddNodeRequest>
1720 for AddNodeSvc<T> {
1721 type Response = super::AddNodeResponse;
1722 type Future = BoxFuture<
1723 tonic::Response<Self::Response>,
1724 tonic::Status,
1725 >;
1726 fn call(
1727 &mut self,
1728 request: tonic::Request<super::AddNodeRequest>,
1729 ) -> Self::Future {
1730 let inner = Arc::clone(&self.0);
1731 let fut = async move {
1732 <T as ClusterAdmin>::add_node(&inner, request).await
1733 };
1734 Box::pin(fut)
1735 }
1736 }
1737 let accept_compression_encodings = self.accept_compression_encodings;
1738 let send_compression_encodings = self.send_compression_encodings;
1739 let max_decoding_message_size = self.max_decoding_message_size;
1740 let max_encoding_message_size = self.max_encoding_message_size;
1741 let inner = self.inner.clone();
1742 let fut = async move {
1743 let method = AddNodeSvc(inner);
1744 let codec = tonic_prost::ProstCodec::default();
1745 let mut grpc = tonic::server::Grpc::new(codec)
1746 .apply_compression_config(
1747 accept_compression_encodings,
1748 send_compression_encodings,
1749 )
1750 .apply_max_message_size_config(
1751 max_decoding_message_size,
1752 max_encoding_message_size,
1753 );
1754 let res = grpc.unary(method, req).await;
1755 Ok(res)
1756 };
1757 Box::pin(fut)
1758 }
1759 "/danube_admin.ClusterAdmin/PromoteNode" => {
1760 #[allow(non_camel_case_types)]
1761 struct PromoteNodeSvc<T: ClusterAdmin>(pub Arc<T>);
1762 impl<
1763 T: ClusterAdmin,
1764 > tonic::server::UnaryService<super::PromoteNodeRequest>
1765 for PromoteNodeSvc<T> {
1766 type Response = super::PromoteNodeResponse;
1767 type Future = BoxFuture<
1768 tonic::Response<Self::Response>,
1769 tonic::Status,
1770 >;
1771 fn call(
1772 &mut self,
1773 request: tonic::Request<super::PromoteNodeRequest>,
1774 ) -> Self::Future {
1775 let inner = Arc::clone(&self.0);
1776 let fut = async move {
1777 <T as ClusterAdmin>::promote_node(&inner, request).await
1778 };
1779 Box::pin(fut)
1780 }
1781 }
1782 let accept_compression_encodings = self.accept_compression_encodings;
1783 let send_compression_encodings = self.send_compression_encodings;
1784 let max_decoding_message_size = self.max_decoding_message_size;
1785 let max_encoding_message_size = self.max_encoding_message_size;
1786 let inner = self.inner.clone();
1787 let fut = async move {
1788 let method = PromoteNodeSvc(inner);
1789 let codec = tonic_prost::ProstCodec::default();
1790 let mut grpc = tonic::server::Grpc::new(codec)
1791 .apply_compression_config(
1792 accept_compression_encodings,
1793 send_compression_encodings,
1794 )
1795 .apply_max_message_size_config(
1796 max_decoding_message_size,
1797 max_encoding_message_size,
1798 );
1799 let res = grpc.unary(method, req).await;
1800 Ok(res)
1801 };
1802 Box::pin(fut)
1803 }
1804 "/danube_admin.ClusterAdmin/RemoveNode" => {
1805 #[allow(non_camel_case_types)]
1806 struct RemoveNodeSvc<T: ClusterAdmin>(pub Arc<T>);
1807 impl<
1808 T: ClusterAdmin,
1809 > tonic::server::UnaryService<super::RemoveNodeRequest>
1810 for RemoveNodeSvc<T> {
1811 type Response = super::RemoveNodeResponse;
1812 type Future = BoxFuture<
1813 tonic::Response<Self::Response>,
1814 tonic::Status,
1815 >;
1816 fn call(
1817 &mut self,
1818 request: tonic::Request<super::RemoveNodeRequest>,
1819 ) -> Self::Future {
1820 let inner = Arc::clone(&self.0);
1821 let fut = async move {
1822 <T as ClusterAdmin>::remove_node(&inner, request).await
1823 };
1824 Box::pin(fut)
1825 }
1826 }
1827 let accept_compression_encodings = self.accept_compression_encodings;
1828 let send_compression_encodings = self.send_compression_encodings;
1829 let max_decoding_message_size = self.max_decoding_message_size;
1830 let max_encoding_message_size = self.max_encoding_message_size;
1831 let inner = self.inner.clone();
1832 let fut = async move {
1833 let method = RemoveNodeSvc(inner);
1834 let codec = tonic_prost::ProstCodec::default();
1835 let mut grpc = tonic::server::Grpc::new(codec)
1836 .apply_compression_config(
1837 accept_compression_encodings,
1838 send_compression_encodings,
1839 )
1840 .apply_max_message_size_config(
1841 max_decoding_message_size,
1842 max_encoding_message_size,
1843 );
1844 let res = grpc.unary(method, req).await;
1845 Ok(res)
1846 };
1847 Box::pin(fut)
1848 }
1849 _ => {
1850 Box::pin(async move {
1851 let mut response = http::Response::new(
1852 tonic::body::Body::default(),
1853 );
1854 let headers = response.headers_mut();
1855 headers
1856 .insert(
1857 tonic::Status::GRPC_STATUS,
1858 (tonic::Code::Unimplemented as i32).into(),
1859 );
1860 headers
1861 .insert(
1862 http::header::CONTENT_TYPE,
1863 tonic::metadata::GRPC_CONTENT_TYPE,
1864 );
1865 Ok(response)
1866 })
1867 }
1868 }
1869 }
1870 }
1871 impl<T> Clone for ClusterAdminServer<T> {
1872 fn clone(&self) -> Self {
1873 let inner = self.inner.clone();
1874 Self {
1875 inner,
1876 accept_compression_encodings: self.accept_compression_encodings,
1877 send_compression_encodings: self.send_compression_encodings,
1878 max_decoding_message_size: self.max_decoding_message_size,
1879 max_encoding_message_size: self.max_encoding_message_size,
1880 }
1881 }
1882 }
1883 pub const SERVICE_NAME: &str = "danube_admin.ClusterAdmin";
1885 impl<T> tonic::server::NamedService for ClusterAdminServer<T> {
1886 const NAME: &'static str = SERVICE_NAME;
1887 }
1888}
1889pub mod namespace_admin_client {
1891 #![allow(
1892 unused_variables,
1893 dead_code,
1894 missing_docs,
1895 clippy::wildcard_imports,
1896 clippy::let_unit_value,
1897 )]
1898 use tonic::codegen::*;
1899 use tonic::codegen::http::Uri;
1900 #[derive(Debug, Clone)]
1901 pub struct NamespaceAdminClient<T> {
1902 inner: tonic::client::Grpc<T>,
1903 }
1904 impl NamespaceAdminClient<tonic::transport::Channel> {
1905 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1907 where
1908 D: TryInto<tonic::transport::Endpoint>,
1909 D::Error: Into<StdError>,
1910 {
1911 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1912 Ok(Self::new(conn))
1913 }
1914 }
1915 impl<T> NamespaceAdminClient<T>
1916 where
1917 T: tonic::client::GrpcService<tonic::body::Body>,
1918 T::Error: Into<StdError>,
1919 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1920 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1921 {
1922 pub fn new(inner: T) -> Self {
1923 let inner = tonic::client::Grpc::new(inner);
1924 Self { inner }
1925 }
1926 pub fn with_origin(inner: T, origin: Uri) -> Self {
1927 let inner = tonic::client::Grpc::with_origin(inner, origin);
1928 Self { inner }
1929 }
1930 pub fn with_interceptor<F>(
1931 inner: T,
1932 interceptor: F,
1933 ) -> NamespaceAdminClient<InterceptedService<T, F>>
1934 where
1935 F: tonic::service::Interceptor,
1936 T::ResponseBody: Default,
1937 T: tonic::codegen::Service<
1938 http::Request<tonic::body::Body>,
1939 Response = http::Response<
1940 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1941 >,
1942 >,
1943 <T as tonic::codegen::Service<
1944 http::Request<tonic::body::Body>,
1945 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1946 {
1947 NamespaceAdminClient::new(InterceptedService::new(inner, interceptor))
1948 }
1949 #[must_use]
1954 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1955 self.inner = self.inner.send_compressed(encoding);
1956 self
1957 }
1958 #[must_use]
1960 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1961 self.inner = self.inner.accept_compressed(encoding);
1962 self
1963 }
1964 #[must_use]
1968 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1969 self.inner = self.inner.max_decoding_message_size(limit);
1970 self
1971 }
1972 #[must_use]
1976 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1977 self.inner = self.inner.max_encoding_message_size(limit);
1978 self
1979 }
1980 pub async fn get_namespace_topics(
1982 &mut self,
1983 request: impl tonic::IntoRequest<super::NamespaceRequest>,
1984 ) -> std::result::Result<
1985 tonic::Response<super::TopicListResponse>,
1986 tonic::Status,
1987 > {
1988 self.inner
1989 .ready()
1990 .await
1991 .map_err(|e| {
1992 tonic::Status::unknown(
1993 format!("Service was not ready: {}", e.into()),
1994 )
1995 })?;
1996 let codec = tonic_prost::ProstCodec::default();
1997 let path = http::uri::PathAndQuery::from_static(
1998 "/danube_admin.NamespaceAdmin/GetNamespaceTopics",
1999 );
2000 let mut req = request.into_request();
2001 req.extensions_mut()
2002 .insert(
2003 GrpcMethod::new("danube_admin.NamespaceAdmin", "GetNamespaceTopics"),
2004 );
2005 self.inner.unary(req, path, codec).await
2006 }
2007 pub async fn get_namespace_policies(
2008 &mut self,
2009 request: impl tonic::IntoRequest<super::NamespaceRequest>,
2010 ) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status> {
2011 self.inner
2012 .ready()
2013 .await
2014 .map_err(|e| {
2015 tonic::Status::unknown(
2016 format!("Service was not ready: {}", e.into()),
2017 )
2018 })?;
2019 let codec = tonic_prost::ProstCodec::default();
2020 let path = http::uri::PathAndQuery::from_static(
2021 "/danube_admin.NamespaceAdmin/GetNamespacePolicies",
2022 );
2023 let mut req = request.into_request();
2024 req.extensions_mut()
2025 .insert(
2026 GrpcMethod::new(
2027 "danube_admin.NamespaceAdmin",
2028 "GetNamespacePolicies",
2029 ),
2030 );
2031 self.inner.unary(req, path, codec).await
2032 }
2033 pub async fn create_namespace(
2034 &mut self,
2035 request: impl tonic::IntoRequest<super::NamespaceRequest>,
2036 ) -> std::result::Result<
2037 tonic::Response<super::NamespaceResponse>,
2038 tonic::Status,
2039 > {
2040 self.inner
2041 .ready()
2042 .await
2043 .map_err(|e| {
2044 tonic::Status::unknown(
2045 format!("Service was not ready: {}", e.into()),
2046 )
2047 })?;
2048 let codec = tonic_prost::ProstCodec::default();
2049 let path = http::uri::PathAndQuery::from_static(
2050 "/danube_admin.NamespaceAdmin/CreateNamespace",
2051 );
2052 let mut req = request.into_request();
2053 req.extensions_mut()
2054 .insert(
2055 GrpcMethod::new("danube_admin.NamespaceAdmin", "CreateNamespace"),
2056 );
2057 self.inner.unary(req, path, codec).await
2058 }
2059 pub async fn delete_namespace(
2060 &mut self,
2061 request: impl tonic::IntoRequest<super::NamespaceRequest>,
2062 ) -> std::result::Result<
2063 tonic::Response<super::NamespaceResponse>,
2064 tonic::Status,
2065 > {
2066 self.inner
2067 .ready()
2068 .await
2069 .map_err(|e| {
2070 tonic::Status::unknown(
2071 format!("Service was not ready: {}", e.into()),
2072 )
2073 })?;
2074 let codec = tonic_prost::ProstCodec::default();
2075 let path = http::uri::PathAndQuery::from_static(
2076 "/danube_admin.NamespaceAdmin/DeleteNamespace",
2077 );
2078 let mut req = request.into_request();
2079 req.extensions_mut()
2080 .insert(
2081 GrpcMethod::new("danube_admin.NamespaceAdmin", "DeleteNamespace"),
2082 );
2083 self.inner.unary(req, path, codec).await
2084 }
2085 }
2086}
2087pub mod namespace_admin_server {
2089 #![allow(
2090 unused_variables,
2091 dead_code,
2092 missing_docs,
2093 clippy::wildcard_imports,
2094 clippy::let_unit_value,
2095 )]
2096 use tonic::codegen::*;
2097 #[async_trait]
2099 pub trait NamespaceAdmin: std::marker::Send + std::marker::Sync + 'static {
2100 async fn get_namespace_topics(
2102 &self,
2103 request: tonic::Request<super::NamespaceRequest>,
2104 ) -> std::result::Result<
2105 tonic::Response<super::TopicListResponse>,
2106 tonic::Status,
2107 >;
2108 async fn get_namespace_policies(
2109 &self,
2110 request: tonic::Request<super::NamespaceRequest>,
2111 ) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status>;
2112 async fn create_namespace(
2113 &self,
2114 request: tonic::Request<super::NamespaceRequest>,
2115 ) -> std::result::Result<
2116 tonic::Response<super::NamespaceResponse>,
2117 tonic::Status,
2118 >;
2119 async fn delete_namespace(
2120 &self,
2121 request: tonic::Request<super::NamespaceRequest>,
2122 ) -> std::result::Result<
2123 tonic::Response<super::NamespaceResponse>,
2124 tonic::Status,
2125 >;
2126 }
2127 #[derive(Debug)]
2128 pub struct NamespaceAdminServer<T> {
2129 inner: Arc<T>,
2130 accept_compression_encodings: EnabledCompressionEncodings,
2131 send_compression_encodings: EnabledCompressionEncodings,
2132 max_decoding_message_size: Option<usize>,
2133 max_encoding_message_size: Option<usize>,
2134 }
2135 impl<T> NamespaceAdminServer<T> {
2136 pub fn new(inner: T) -> Self {
2137 Self::from_arc(Arc::new(inner))
2138 }
2139 pub fn from_arc(inner: Arc<T>) -> Self {
2140 Self {
2141 inner,
2142 accept_compression_encodings: Default::default(),
2143 send_compression_encodings: Default::default(),
2144 max_decoding_message_size: None,
2145 max_encoding_message_size: None,
2146 }
2147 }
2148 pub fn with_interceptor<F>(
2149 inner: T,
2150 interceptor: F,
2151 ) -> InterceptedService<Self, F>
2152 where
2153 F: tonic::service::Interceptor,
2154 {
2155 InterceptedService::new(Self::new(inner), interceptor)
2156 }
2157 #[must_use]
2159 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2160 self.accept_compression_encodings.enable(encoding);
2161 self
2162 }
2163 #[must_use]
2165 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2166 self.send_compression_encodings.enable(encoding);
2167 self
2168 }
2169 #[must_use]
2173 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2174 self.max_decoding_message_size = Some(limit);
2175 self
2176 }
2177 #[must_use]
2181 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2182 self.max_encoding_message_size = Some(limit);
2183 self
2184 }
2185 }
2186 impl<T, B> tonic::codegen::Service<http::Request<B>> for NamespaceAdminServer<T>
2187 where
2188 T: NamespaceAdmin,
2189 B: Body + std::marker::Send + 'static,
2190 B::Error: Into<StdError> + std::marker::Send + 'static,
2191 {
2192 type Response = http::Response<tonic::body::Body>;
2193 type Error = std::convert::Infallible;
2194 type Future = BoxFuture<Self::Response, Self::Error>;
2195 fn poll_ready(
2196 &mut self,
2197 _cx: &mut Context<'_>,
2198 ) -> Poll<std::result::Result<(), Self::Error>> {
2199 Poll::Ready(Ok(()))
2200 }
2201 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2202 match req.uri().path() {
2203 "/danube_admin.NamespaceAdmin/GetNamespaceTopics" => {
2204 #[allow(non_camel_case_types)]
2205 struct GetNamespaceTopicsSvc<T: NamespaceAdmin>(pub Arc<T>);
2206 impl<
2207 T: NamespaceAdmin,
2208 > tonic::server::UnaryService<super::NamespaceRequest>
2209 for GetNamespaceTopicsSvc<T> {
2210 type Response = super::TopicListResponse;
2211 type Future = BoxFuture<
2212 tonic::Response<Self::Response>,
2213 tonic::Status,
2214 >;
2215 fn call(
2216 &mut self,
2217 request: tonic::Request<super::NamespaceRequest>,
2218 ) -> Self::Future {
2219 let inner = Arc::clone(&self.0);
2220 let fut = async move {
2221 <T as NamespaceAdmin>::get_namespace_topics(&inner, request)
2222 .await
2223 };
2224 Box::pin(fut)
2225 }
2226 }
2227 let accept_compression_encodings = self.accept_compression_encodings;
2228 let send_compression_encodings = self.send_compression_encodings;
2229 let max_decoding_message_size = self.max_decoding_message_size;
2230 let max_encoding_message_size = self.max_encoding_message_size;
2231 let inner = self.inner.clone();
2232 let fut = async move {
2233 let method = GetNamespaceTopicsSvc(inner);
2234 let codec = tonic_prost::ProstCodec::default();
2235 let mut grpc = tonic::server::Grpc::new(codec)
2236 .apply_compression_config(
2237 accept_compression_encodings,
2238 send_compression_encodings,
2239 )
2240 .apply_max_message_size_config(
2241 max_decoding_message_size,
2242 max_encoding_message_size,
2243 );
2244 let res = grpc.unary(method, req).await;
2245 Ok(res)
2246 };
2247 Box::pin(fut)
2248 }
2249 "/danube_admin.NamespaceAdmin/GetNamespacePolicies" => {
2250 #[allow(non_camel_case_types)]
2251 struct GetNamespacePoliciesSvc<T: NamespaceAdmin>(pub Arc<T>);
2252 impl<
2253 T: NamespaceAdmin,
2254 > tonic::server::UnaryService<super::NamespaceRequest>
2255 for GetNamespacePoliciesSvc<T> {
2256 type Response = super::PolicyResponse;
2257 type Future = BoxFuture<
2258 tonic::Response<Self::Response>,
2259 tonic::Status,
2260 >;
2261 fn call(
2262 &mut self,
2263 request: tonic::Request<super::NamespaceRequest>,
2264 ) -> Self::Future {
2265 let inner = Arc::clone(&self.0);
2266 let fut = async move {
2267 <T as NamespaceAdmin>::get_namespace_policies(
2268 &inner,
2269 request,
2270 )
2271 .await
2272 };
2273 Box::pin(fut)
2274 }
2275 }
2276 let accept_compression_encodings = self.accept_compression_encodings;
2277 let send_compression_encodings = self.send_compression_encodings;
2278 let max_decoding_message_size = self.max_decoding_message_size;
2279 let max_encoding_message_size = self.max_encoding_message_size;
2280 let inner = self.inner.clone();
2281 let fut = async move {
2282 let method = GetNamespacePoliciesSvc(inner);
2283 let codec = tonic_prost::ProstCodec::default();
2284 let mut grpc = tonic::server::Grpc::new(codec)
2285 .apply_compression_config(
2286 accept_compression_encodings,
2287 send_compression_encodings,
2288 )
2289 .apply_max_message_size_config(
2290 max_decoding_message_size,
2291 max_encoding_message_size,
2292 );
2293 let res = grpc.unary(method, req).await;
2294 Ok(res)
2295 };
2296 Box::pin(fut)
2297 }
2298 "/danube_admin.NamespaceAdmin/CreateNamespace" => {
2299 #[allow(non_camel_case_types)]
2300 struct CreateNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
2301 impl<
2302 T: NamespaceAdmin,
2303 > tonic::server::UnaryService<super::NamespaceRequest>
2304 for CreateNamespaceSvc<T> {
2305 type Response = super::NamespaceResponse;
2306 type Future = BoxFuture<
2307 tonic::Response<Self::Response>,
2308 tonic::Status,
2309 >;
2310 fn call(
2311 &mut self,
2312 request: tonic::Request<super::NamespaceRequest>,
2313 ) -> Self::Future {
2314 let inner = Arc::clone(&self.0);
2315 let fut = async move {
2316 <T as NamespaceAdmin>::create_namespace(&inner, request)
2317 .await
2318 };
2319 Box::pin(fut)
2320 }
2321 }
2322 let accept_compression_encodings = self.accept_compression_encodings;
2323 let send_compression_encodings = self.send_compression_encodings;
2324 let max_decoding_message_size = self.max_decoding_message_size;
2325 let max_encoding_message_size = self.max_encoding_message_size;
2326 let inner = self.inner.clone();
2327 let fut = async move {
2328 let method = CreateNamespaceSvc(inner);
2329 let codec = tonic_prost::ProstCodec::default();
2330 let mut grpc = tonic::server::Grpc::new(codec)
2331 .apply_compression_config(
2332 accept_compression_encodings,
2333 send_compression_encodings,
2334 )
2335 .apply_max_message_size_config(
2336 max_decoding_message_size,
2337 max_encoding_message_size,
2338 );
2339 let res = grpc.unary(method, req).await;
2340 Ok(res)
2341 };
2342 Box::pin(fut)
2343 }
2344 "/danube_admin.NamespaceAdmin/DeleteNamespace" => {
2345 #[allow(non_camel_case_types)]
2346 struct DeleteNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
2347 impl<
2348 T: NamespaceAdmin,
2349 > tonic::server::UnaryService<super::NamespaceRequest>
2350 for DeleteNamespaceSvc<T> {
2351 type Response = super::NamespaceResponse;
2352 type Future = BoxFuture<
2353 tonic::Response<Self::Response>,
2354 tonic::Status,
2355 >;
2356 fn call(
2357 &mut self,
2358 request: tonic::Request<super::NamespaceRequest>,
2359 ) -> Self::Future {
2360 let inner = Arc::clone(&self.0);
2361 let fut = async move {
2362 <T as NamespaceAdmin>::delete_namespace(&inner, request)
2363 .await
2364 };
2365 Box::pin(fut)
2366 }
2367 }
2368 let accept_compression_encodings = self.accept_compression_encodings;
2369 let send_compression_encodings = self.send_compression_encodings;
2370 let max_decoding_message_size = self.max_decoding_message_size;
2371 let max_encoding_message_size = self.max_encoding_message_size;
2372 let inner = self.inner.clone();
2373 let fut = async move {
2374 let method = DeleteNamespaceSvc(inner);
2375 let codec = tonic_prost::ProstCodec::default();
2376 let mut grpc = tonic::server::Grpc::new(codec)
2377 .apply_compression_config(
2378 accept_compression_encodings,
2379 send_compression_encodings,
2380 )
2381 .apply_max_message_size_config(
2382 max_decoding_message_size,
2383 max_encoding_message_size,
2384 );
2385 let res = grpc.unary(method, req).await;
2386 Ok(res)
2387 };
2388 Box::pin(fut)
2389 }
2390 _ => {
2391 Box::pin(async move {
2392 let mut response = http::Response::new(
2393 tonic::body::Body::default(),
2394 );
2395 let headers = response.headers_mut();
2396 headers
2397 .insert(
2398 tonic::Status::GRPC_STATUS,
2399 (tonic::Code::Unimplemented as i32).into(),
2400 );
2401 headers
2402 .insert(
2403 http::header::CONTENT_TYPE,
2404 tonic::metadata::GRPC_CONTENT_TYPE,
2405 );
2406 Ok(response)
2407 })
2408 }
2409 }
2410 }
2411 }
2412 impl<T> Clone for NamespaceAdminServer<T> {
2413 fn clone(&self) -> Self {
2414 let inner = self.inner.clone();
2415 Self {
2416 inner,
2417 accept_compression_encodings: self.accept_compression_encodings,
2418 send_compression_encodings: self.send_compression_encodings,
2419 max_decoding_message_size: self.max_decoding_message_size,
2420 max_encoding_message_size: self.max_encoding_message_size,
2421 }
2422 }
2423 }
2424 pub const SERVICE_NAME: &str = "danube_admin.NamespaceAdmin";
2426 impl<T> tonic::server::NamedService for NamespaceAdminServer<T> {
2427 const NAME: &'static str = SERVICE_NAME;
2428 }
2429}
2430pub mod topic_admin_client {
2432 #![allow(
2433 unused_variables,
2434 dead_code,
2435 missing_docs,
2436 clippy::wildcard_imports,
2437 clippy::let_unit_value,
2438 )]
2439 use tonic::codegen::*;
2440 use tonic::codegen::http::Uri;
2441 #[derive(Debug, Clone)]
2442 pub struct TopicAdminClient<T> {
2443 inner: tonic::client::Grpc<T>,
2444 }
2445 impl TopicAdminClient<tonic::transport::Channel> {
2446 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2448 where
2449 D: TryInto<tonic::transport::Endpoint>,
2450 D::Error: Into<StdError>,
2451 {
2452 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2453 Ok(Self::new(conn))
2454 }
2455 }
2456 impl<T> TopicAdminClient<T>
2457 where
2458 T: tonic::client::GrpcService<tonic::body::Body>,
2459 T::Error: Into<StdError>,
2460 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2461 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2462 {
2463 pub fn new(inner: T) -> Self {
2464 let inner = tonic::client::Grpc::new(inner);
2465 Self { inner }
2466 }
2467 pub fn with_origin(inner: T, origin: Uri) -> Self {
2468 let inner = tonic::client::Grpc::with_origin(inner, origin);
2469 Self { inner }
2470 }
2471 pub fn with_interceptor<F>(
2472 inner: T,
2473 interceptor: F,
2474 ) -> TopicAdminClient<InterceptedService<T, F>>
2475 where
2476 F: tonic::service::Interceptor,
2477 T::ResponseBody: Default,
2478 T: tonic::codegen::Service<
2479 http::Request<tonic::body::Body>,
2480 Response = http::Response<
2481 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2482 >,
2483 >,
2484 <T as tonic::codegen::Service<
2485 http::Request<tonic::body::Body>,
2486 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2487 {
2488 TopicAdminClient::new(InterceptedService::new(inner, interceptor))
2489 }
2490 #[must_use]
2495 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2496 self.inner = self.inner.send_compressed(encoding);
2497 self
2498 }
2499 #[must_use]
2501 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2502 self.inner = self.inner.accept_compressed(encoding);
2503 self
2504 }
2505 #[must_use]
2509 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2510 self.inner = self.inner.max_decoding_message_size(limit);
2511 self
2512 }
2513 #[must_use]
2517 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2518 self.inner = self.inner.max_encoding_message_size(limit);
2519 self
2520 }
2521 pub async fn list_namespace_topics(
2523 &mut self,
2524 request: impl tonic::IntoRequest<super::NamespaceRequest>,
2525 ) -> std::result::Result<
2526 tonic::Response<super::TopicInfoListResponse>,
2527 tonic::Status,
2528 > {
2529 self.inner
2530 .ready()
2531 .await
2532 .map_err(|e| {
2533 tonic::Status::unknown(
2534 format!("Service was not ready: {}", e.into()),
2535 )
2536 })?;
2537 let codec = tonic_prost::ProstCodec::default();
2538 let path = http::uri::PathAndQuery::from_static(
2539 "/danube_admin.TopicAdmin/ListNamespaceTopics",
2540 );
2541 let mut req = request.into_request();
2542 req.extensions_mut()
2543 .insert(
2544 GrpcMethod::new("danube_admin.TopicAdmin", "ListNamespaceTopics"),
2545 );
2546 self.inner.unary(req, path, codec).await
2547 }
2548 pub async fn list_broker_topics(
2549 &mut self,
2550 request: impl tonic::IntoRequest<super::BrokerRequest>,
2551 ) -> std::result::Result<
2552 tonic::Response<super::TopicInfoListResponse>,
2553 tonic::Status,
2554 > {
2555 self.inner
2556 .ready()
2557 .await
2558 .map_err(|e| {
2559 tonic::Status::unknown(
2560 format!("Service was not ready: {}", e.into()),
2561 )
2562 })?;
2563 let codec = tonic_prost::ProstCodec::default();
2564 let path = http::uri::PathAndQuery::from_static(
2565 "/danube_admin.TopicAdmin/ListBrokerTopics",
2566 );
2567 let mut req = request.into_request();
2568 req.extensions_mut()
2569 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListBrokerTopics"));
2570 self.inner.unary(req, path, codec).await
2571 }
2572 pub async fn create_topic(
2573 &mut self,
2574 request: impl tonic::IntoRequest<super::NewTopicRequest>,
2575 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
2576 self.inner
2577 .ready()
2578 .await
2579 .map_err(|e| {
2580 tonic::Status::unknown(
2581 format!("Service was not ready: {}", e.into()),
2582 )
2583 })?;
2584 let codec = tonic_prost::ProstCodec::default();
2585 let path = http::uri::PathAndQuery::from_static(
2586 "/danube_admin.TopicAdmin/CreateTopic",
2587 );
2588 let mut req = request.into_request();
2589 req.extensions_mut()
2590 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "CreateTopic"));
2591 self.inner.unary(req, path, codec).await
2592 }
2593 pub async fn create_partitioned_topic(
2594 &mut self,
2595 request: impl tonic::IntoRequest<super::PartitionedTopicRequest>,
2596 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
2597 self.inner
2598 .ready()
2599 .await
2600 .map_err(|e| {
2601 tonic::Status::unknown(
2602 format!("Service was not ready: {}", e.into()),
2603 )
2604 })?;
2605 let codec = tonic_prost::ProstCodec::default();
2606 let path = http::uri::PathAndQuery::from_static(
2607 "/danube_admin.TopicAdmin/CreatePartitionedTopic",
2608 );
2609 let mut req = request.into_request();
2610 req.extensions_mut()
2611 .insert(
2612 GrpcMethod::new("danube_admin.TopicAdmin", "CreatePartitionedTopic"),
2613 );
2614 self.inner.unary(req, path, codec).await
2615 }
2616 pub async fn delete_topic(
2617 &mut self,
2618 request: impl tonic::IntoRequest<super::TopicRequest>,
2619 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
2620 self.inner
2621 .ready()
2622 .await
2623 .map_err(|e| {
2624 tonic::Status::unknown(
2625 format!("Service was not ready: {}", e.into()),
2626 )
2627 })?;
2628 let codec = tonic_prost::ProstCodec::default();
2629 let path = http::uri::PathAndQuery::from_static(
2630 "/danube_admin.TopicAdmin/DeleteTopic",
2631 );
2632 let mut req = request.into_request();
2633 req.extensions_mut()
2634 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "DeleteTopic"));
2635 self.inner.unary(req, path, codec).await
2636 }
2637 pub async fn unload_topic(
2638 &mut self,
2639 request: impl tonic::IntoRequest<super::TopicRequest>,
2640 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
2641 self.inner
2642 .ready()
2643 .await
2644 .map_err(|e| {
2645 tonic::Status::unknown(
2646 format!("Service was not ready: {}", e.into()),
2647 )
2648 })?;
2649 let codec = tonic_prost::ProstCodec::default();
2650 let path = http::uri::PathAndQuery::from_static(
2651 "/danube_admin.TopicAdmin/UnloadTopic",
2652 );
2653 let mut req = request.into_request();
2654 req.extensions_mut()
2655 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "UnloadTopic"));
2656 self.inner.unary(req, path, codec).await
2657 }
2658 pub async fn list_subscriptions(
2659 &mut self,
2660 request: impl tonic::IntoRequest<super::TopicRequest>,
2661 ) -> std::result::Result<
2662 tonic::Response<super::SubscriptionListResponse>,
2663 tonic::Status,
2664 > {
2665 self.inner
2666 .ready()
2667 .await
2668 .map_err(|e| {
2669 tonic::Status::unknown(
2670 format!("Service was not ready: {}", e.into()),
2671 )
2672 })?;
2673 let codec = tonic_prost::ProstCodec::default();
2674 let path = http::uri::PathAndQuery::from_static(
2675 "/danube_admin.TopicAdmin/ListSubscriptions",
2676 );
2677 let mut req = request.into_request();
2678 req.extensions_mut()
2679 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListSubscriptions"));
2680 self.inner.unary(req, path, codec).await
2681 }
2682 pub async fn unsubscribe(
2683 &mut self,
2684 request: impl tonic::IntoRequest<super::SubscriptionRequest>,
2685 ) -> std::result::Result<
2686 tonic::Response<super::SubscriptionResponse>,
2687 tonic::Status,
2688 > {
2689 self.inner
2690 .ready()
2691 .await
2692 .map_err(|e| {
2693 tonic::Status::unknown(
2694 format!("Service was not ready: {}", e.into()),
2695 )
2696 })?;
2697 let codec = tonic_prost::ProstCodec::default();
2698 let path = http::uri::PathAndQuery::from_static(
2699 "/danube_admin.TopicAdmin/Unsubscribe",
2700 );
2701 let mut req = request.into_request();
2702 req.extensions_mut()
2703 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "Unsubscribe"));
2704 self.inner.unary(req, path, codec).await
2705 }
2706 pub async fn set_subscription_failure_policy(
2707 &mut self,
2708 request: impl tonic::IntoRequest<super::SetSubscriptionFailurePolicyRequest>,
2709 ) -> std::result::Result<
2710 tonic::Response<super::SubscriptionResponse>,
2711 tonic::Status,
2712 > {
2713 self.inner
2714 .ready()
2715 .await
2716 .map_err(|e| {
2717 tonic::Status::unknown(
2718 format!("Service was not ready: {}", e.into()),
2719 )
2720 })?;
2721 let codec = tonic_prost::ProstCodec::default();
2722 let path = http::uri::PathAndQuery::from_static(
2723 "/danube_admin.TopicAdmin/SetSubscriptionFailurePolicy",
2724 );
2725 let mut req = request.into_request();
2726 req.extensions_mut()
2727 .insert(
2728 GrpcMethod::new(
2729 "danube_admin.TopicAdmin",
2730 "SetSubscriptionFailurePolicy",
2731 ),
2732 );
2733 self.inner.unary(req, path, codec).await
2734 }
2735 pub async fn get_subscription_failure_policy(
2736 &mut self,
2737 request: impl tonic::IntoRequest<super::GetSubscriptionFailurePolicyRequest>,
2738 ) -> std::result::Result<
2739 tonic::Response<super::GetSubscriptionFailurePolicyResponse>,
2740 tonic::Status,
2741 > {
2742 self.inner
2743 .ready()
2744 .await
2745 .map_err(|e| {
2746 tonic::Status::unknown(
2747 format!("Service was not ready: {}", e.into()),
2748 )
2749 })?;
2750 let codec = tonic_prost::ProstCodec::default();
2751 let path = http::uri::PathAndQuery::from_static(
2752 "/danube_admin.TopicAdmin/GetSubscriptionFailurePolicy",
2753 );
2754 let mut req = request.into_request();
2755 req.extensions_mut()
2756 .insert(
2757 GrpcMethod::new(
2758 "danube_admin.TopicAdmin",
2759 "GetSubscriptionFailurePolicy",
2760 ),
2761 );
2762 self.inner.unary(req, path, codec).await
2763 }
2764 pub async fn describe_topic(
2765 &mut self,
2766 request: impl tonic::IntoRequest<super::DescribeTopicRequest>,
2767 ) -> std::result::Result<
2768 tonic::Response<super::DescribeTopicResponse>,
2769 tonic::Status,
2770 > {
2771 self.inner
2772 .ready()
2773 .await
2774 .map_err(|e| {
2775 tonic::Status::unknown(
2776 format!("Service was not ready: {}", e.into()),
2777 )
2778 })?;
2779 let codec = tonic_prost::ProstCodec::default();
2780 let path = http::uri::PathAndQuery::from_static(
2781 "/danube_admin.TopicAdmin/DescribeTopic",
2782 );
2783 let mut req = request.into_request();
2784 req.extensions_mut()
2785 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "DescribeTopic"));
2786 self.inner.unary(req, path, codec).await
2787 }
2788 }
2789}
2790pub mod topic_admin_server {
2792 #![allow(
2793 unused_variables,
2794 dead_code,
2795 missing_docs,
2796 clippy::wildcard_imports,
2797 clippy::let_unit_value,
2798 )]
2799 use tonic::codegen::*;
2800 #[async_trait]
2802 pub trait TopicAdmin: std::marker::Send + std::marker::Sync + 'static {
2803 async fn list_namespace_topics(
2805 &self,
2806 request: tonic::Request<super::NamespaceRequest>,
2807 ) -> std::result::Result<
2808 tonic::Response<super::TopicInfoListResponse>,
2809 tonic::Status,
2810 >;
2811 async fn list_broker_topics(
2812 &self,
2813 request: tonic::Request<super::BrokerRequest>,
2814 ) -> std::result::Result<
2815 tonic::Response<super::TopicInfoListResponse>,
2816 tonic::Status,
2817 >;
2818 async fn create_topic(
2819 &self,
2820 request: tonic::Request<super::NewTopicRequest>,
2821 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
2822 async fn create_partitioned_topic(
2823 &self,
2824 request: tonic::Request<super::PartitionedTopicRequest>,
2825 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
2826 async fn delete_topic(
2827 &self,
2828 request: tonic::Request<super::TopicRequest>,
2829 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
2830 async fn unload_topic(
2831 &self,
2832 request: tonic::Request<super::TopicRequest>,
2833 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
2834 async fn list_subscriptions(
2835 &self,
2836 request: tonic::Request<super::TopicRequest>,
2837 ) -> std::result::Result<
2838 tonic::Response<super::SubscriptionListResponse>,
2839 tonic::Status,
2840 >;
2841 async fn unsubscribe(
2842 &self,
2843 request: tonic::Request<super::SubscriptionRequest>,
2844 ) -> std::result::Result<
2845 tonic::Response<super::SubscriptionResponse>,
2846 tonic::Status,
2847 >;
2848 async fn set_subscription_failure_policy(
2849 &self,
2850 request: tonic::Request<super::SetSubscriptionFailurePolicyRequest>,
2851 ) -> std::result::Result<
2852 tonic::Response<super::SubscriptionResponse>,
2853 tonic::Status,
2854 >;
2855 async fn get_subscription_failure_policy(
2856 &self,
2857 request: tonic::Request<super::GetSubscriptionFailurePolicyRequest>,
2858 ) -> std::result::Result<
2859 tonic::Response<super::GetSubscriptionFailurePolicyResponse>,
2860 tonic::Status,
2861 >;
2862 async fn describe_topic(
2863 &self,
2864 request: tonic::Request<super::DescribeTopicRequest>,
2865 ) -> std::result::Result<
2866 tonic::Response<super::DescribeTopicResponse>,
2867 tonic::Status,
2868 >;
2869 }
2870 #[derive(Debug)]
2871 pub struct TopicAdminServer<T> {
2872 inner: Arc<T>,
2873 accept_compression_encodings: EnabledCompressionEncodings,
2874 send_compression_encodings: EnabledCompressionEncodings,
2875 max_decoding_message_size: Option<usize>,
2876 max_encoding_message_size: Option<usize>,
2877 }
2878 impl<T> TopicAdminServer<T> {
2879 pub fn new(inner: T) -> Self {
2880 Self::from_arc(Arc::new(inner))
2881 }
2882 pub fn from_arc(inner: Arc<T>) -> Self {
2883 Self {
2884 inner,
2885 accept_compression_encodings: Default::default(),
2886 send_compression_encodings: Default::default(),
2887 max_decoding_message_size: None,
2888 max_encoding_message_size: None,
2889 }
2890 }
2891 pub fn with_interceptor<F>(
2892 inner: T,
2893 interceptor: F,
2894 ) -> InterceptedService<Self, F>
2895 where
2896 F: tonic::service::Interceptor,
2897 {
2898 InterceptedService::new(Self::new(inner), interceptor)
2899 }
2900 #[must_use]
2902 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2903 self.accept_compression_encodings.enable(encoding);
2904 self
2905 }
2906 #[must_use]
2908 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2909 self.send_compression_encodings.enable(encoding);
2910 self
2911 }
2912 #[must_use]
2916 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2917 self.max_decoding_message_size = Some(limit);
2918 self
2919 }
2920 #[must_use]
2924 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2925 self.max_encoding_message_size = Some(limit);
2926 self
2927 }
2928 }
2929 impl<T, B> tonic::codegen::Service<http::Request<B>> for TopicAdminServer<T>
2930 where
2931 T: TopicAdmin,
2932 B: Body + std::marker::Send + 'static,
2933 B::Error: Into<StdError> + std::marker::Send + 'static,
2934 {
2935 type Response = http::Response<tonic::body::Body>;
2936 type Error = std::convert::Infallible;
2937 type Future = BoxFuture<Self::Response, Self::Error>;
2938 fn poll_ready(
2939 &mut self,
2940 _cx: &mut Context<'_>,
2941 ) -> Poll<std::result::Result<(), Self::Error>> {
2942 Poll::Ready(Ok(()))
2943 }
2944 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2945 match req.uri().path() {
2946 "/danube_admin.TopicAdmin/ListNamespaceTopics" => {
2947 #[allow(non_camel_case_types)]
2948 struct ListNamespaceTopicsSvc<T: TopicAdmin>(pub Arc<T>);
2949 impl<
2950 T: TopicAdmin,
2951 > tonic::server::UnaryService<super::NamespaceRequest>
2952 for ListNamespaceTopicsSvc<T> {
2953 type Response = super::TopicInfoListResponse;
2954 type Future = BoxFuture<
2955 tonic::Response<Self::Response>,
2956 tonic::Status,
2957 >;
2958 fn call(
2959 &mut self,
2960 request: tonic::Request<super::NamespaceRequest>,
2961 ) -> Self::Future {
2962 let inner = Arc::clone(&self.0);
2963 let fut = async move {
2964 <T as TopicAdmin>::list_namespace_topics(&inner, request)
2965 .await
2966 };
2967 Box::pin(fut)
2968 }
2969 }
2970 let accept_compression_encodings = self.accept_compression_encodings;
2971 let send_compression_encodings = self.send_compression_encodings;
2972 let max_decoding_message_size = self.max_decoding_message_size;
2973 let max_encoding_message_size = self.max_encoding_message_size;
2974 let inner = self.inner.clone();
2975 let fut = async move {
2976 let method = ListNamespaceTopicsSvc(inner);
2977 let codec = tonic_prost::ProstCodec::default();
2978 let mut grpc = tonic::server::Grpc::new(codec)
2979 .apply_compression_config(
2980 accept_compression_encodings,
2981 send_compression_encodings,
2982 )
2983 .apply_max_message_size_config(
2984 max_decoding_message_size,
2985 max_encoding_message_size,
2986 );
2987 let res = grpc.unary(method, req).await;
2988 Ok(res)
2989 };
2990 Box::pin(fut)
2991 }
2992 "/danube_admin.TopicAdmin/ListBrokerTopics" => {
2993 #[allow(non_camel_case_types)]
2994 struct ListBrokerTopicsSvc<T: TopicAdmin>(pub Arc<T>);
2995 impl<T: TopicAdmin> tonic::server::UnaryService<super::BrokerRequest>
2996 for ListBrokerTopicsSvc<T> {
2997 type Response = super::TopicInfoListResponse;
2998 type Future = BoxFuture<
2999 tonic::Response<Self::Response>,
3000 tonic::Status,
3001 >;
3002 fn call(
3003 &mut self,
3004 request: tonic::Request<super::BrokerRequest>,
3005 ) -> Self::Future {
3006 let inner = Arc::clone(&self.0);
3007 let fut = async move {
3008 <T as TopicAdmin>::list_broker_topics(&inner, request).await
3009 };
3010 Box::pin(fut)
3011 }
3012 }
3013 let accept_compression_encodings = self.accept_compression_encodings;
3014 let send_compression_encodings = self.send_compression_encodings;
3015 let max_decoding_message_size = self.max_decoding_message_size;
3016 let max_encoding_message_size = self.max_encoding_message_size;
3017 let inner = self.inner.clone();
3018 let fut = async move {
3019 let method = ListBrokerTopicsSvc(inner);
3020 let codec = tonic_prost::ProstCodec::default();
3021 let mut grpc = tonic::server::Grpc::new(codec)
3022 .apply_compression_config(
3023 accept_compression_encodings,
3024 send_compression_encodings,
3025 )
3026 .apply_max_message_size_config(
3027 max_decoding_message_size,
3028 max_encoding_message_size,
3029 );
3030 let res = grpc.unary(method, req).await;
3031 Ok(res)
3032 };
3033 Box::pin(fut)
3034 }
3035 "/danube_admin.TopicAdmin/CreateTopic" => {
3036 #[allow(non_camel_case_types)]
3037 struct CreateTopicSvc<T: TopicAdmin>(pub Arc<T>);
3038 impl<
3039 T: TopicAdmin,
3040 > tonic::server::UnaryService<super::NewTopicRequest>
3041 for CreateTopicSvc<T> {
3042 type Response = super::TopicResponse;
3043 type Future = BoxFuture<
3044 tonic::Response<Self::Response>,
3045 tonic::Status,
3046 >;
3047 fn call(
3048 &mut self,
3049 request: tonic::Request<super::NewTopicRequest>,
3050 ) -> Self::Future {
3051 let inner = Arc::clone(&self.0);
3052 let fut = async move {
3053 <T as TopicAdmin>::create_topic(&inner, request).await
3054 };
3055 Box::pin(fut)
3056 }
3057 }
3058 let accept_compression_encodings = self.accept_compression_encodings;
3059 let send_compression_encodings = self.send_compression_encodings;
3060 let max_decoding_message_size = self.max_decoding_message_size;
3061 let max_encoding_message_size = self.max_encoding_message_size;
3062 let inner = self.inner.clone();
3063 let fut = async move {
3064 let method = CreateTopicSvc(inner);
3065 let codec = tonic_prost::ProstCodec::default();
3066 let mut grpc = tonic::server::Grpc::new(codec)
3067 .apply_compression_config(
3068 accept_compression_encodings,
3069 send_compression_encodings,
3070 )
3071 .apply_max_message_size_config(
3072 max_decoding_message_size,
3073 max_encoding_message_size,
3074 );
3075 let res = grpc.unary(method, req).await;
3076 Ok(res)
3077 };
3078 Box::pin(fut)
3079 }
3080 "/danube_admin.TopicAdmin/CreatePartitionedTopic" => {
3081 #[allow(non_camel_case_types)]
3082 struct CreatePartitionedTopicSvc<T: TopicAdmin>(pub Arc<T>);
3083 impl<
3084 T: TopicAdmin,
3085 > tonic::server::UnaryService<super::PartitionedTopicRequest>
3086 for CreatePartitionedTopicSvc<T> {
3087 type Response = super::TopicResponse;
3088 type Future = BoxFuture<
3089 tonic::Response<Self::Response>,
3090 tonic::Status,
3091 >;
3092 fn call(
3093 &mut self,
3094 request: tonic::Request<super::PartitionedTopicRequest>,
3095 ) -> Self::Future {
3096 let inner = Arc::clone(&self.0);
3097 let fut = async move {
3098 <T as TopicAdmin>::create_partitioned_topic(&inner, request)
3099 .await
3100 };
3101 Box::pin(fut)
3102 }
3103 }
3104 let accept_compression_encodings = self.accept_compression_encodings;
3105 let send_compression_encodings = self.send_compression_encodings;
3106 let max_decoding_message_size = self.max_decoding_message_size;
3107 let max_encoding_message_size = self.max_encoding_message_size;
3108 let inner = self.inner.clone();
3109 let fut = async move {
3110 let method = CreatePartitionedTopicSvc(inner);
3111 let codec = tonic_prost::ProstCodec::default();
3112 let mut grpc = tonic::server::Grpc::new(codec)
3113 .apply_compression_config(
3114 accept_compression_encodings,
3115 send_compression_encodings,
3116 )
3117 .apply_max_message_size_config(
3118 max_decoding_message_size,
3119 max_encoding_message_size,
3120 );
3121 let res = grpc.unary(method, req).await;
3122 Ok(res)
3123 };
3124 Box::pin(fut)
3125 }
3126 "/danube_admin.TopicAdmin/DeleteTopic" => {
3127 #[allow(non_camel_case_types)]
3128 struct DeleteTopicSvc<T: TopicAdmin>(pub Arc<T>);
3129 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
3130 for DeleteTopicSvc<T> {
3131 type Response = super::TopicResponse;
3132 type Future = BoxFuture<
3133 tonic::Response<Self::Response>,
3134 tonic::Status,
3135 >;
3136 fn call(
3137 &mut self,
3138 request: tonic::Request<super::TopicRequest>,
3139 ) -> Self::Future {
3140 let inner = Arc::clone(&self.0);
3141 let fut = async move {
3142 <T as TopicAdmin>::delete_topic(&inner, request).await
3143 };
3144 Box::pin(fut)
3145 }
3146 }
3147 let accept_compression_encodings = self.accept_compression_encodings;
3148 let send_compression_encodings = self.send_compression_encodings;
3149 let max_decoding_message_size = self.max_decoding_message_size;
3150 let max_encoding_message_size = self.max_encoding_message_size;
3151 let inner = self.inner.clone();
3152 let fut = async move {
3153 let method = DeleteTopicSvc(inner);
3154 let codec = tonic_prost::ProstCodec::default();
3155 let mut grpc = tonic::server::Grpc::new(codec)
3156 .apply_compression_config(
3157 accept_compression_encodings,
3158 send_compression_encodings,
3159 )
3160 .apply_max_message_size_config(
3161 max_decoding_message_size,
3162 max_encoding_message_size,
3163 );
3164 let res = grpc.unary(method, req).await;
3165 Ok(res)
3166 };
3167 Box::pin(fut)
3168 }
3169 "/danube_admin.TopicAdmin/UnloadTopic" => {
3170 #[allow(non_camel_case_types)]
3171 struct UnloadTopicSvc<T: TopicAdmin>(pub Arc<T>);
3172 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
3173 for UnloadTopicSvc<T> {
3174 type Response = super::TopicResponse;
3175 type Future = BoxFuture<
3176 tonic::Response<Self::Response>,
3177 tonic::Status,
3178 >;
3179 fn call(
3180 &mut self,
3181 request: tonic::Request<super::TopicRequest>,
3182 ) -> Self::Future {
3183 let inner = Arc::clone(&self.0);
3184 let fut = async move {
3185 <T as TopicAdmin>::unload_topic(&inner, request).await
3186 };
3187 Box::pin(fut)
3188 }
3189 }
3190 let accept_compression_encodings = self.accept_compression_encodings;
3191 let send_compression_encodings = self.send_compression_encodings;
3192 let max_decoding_message_size = self.max_decoding_message_size;
3193 let max_encoding_message_size = self.max_encoding_message_size;
3194 let inner = self.inner.clone();
3195 let fut = async move {
3196 let method = UnloadTopicSvc(inner);
3197 let codec = tonic_prost::ProstCodec::default();
3198 let mut grpc = tonic::server::Grpc::new(codec)
3199 .apply_compression_config(
3200 accept_compression_encodings,
3201 send_compression_encodings,
3202 )
3203 .apply_max_message_size_config(
3204 max_decoding_message_size,
3205 max_encoding_message_size,
3206 );
3207 let res = grpc.unary(method, req).await;
3208 Ok(res)
3209 };
3210 Box::pin(fut)
3211 }
3212 "/danube_admin.TopicAdmin/ListSubscriptions" => {
3213 #[allow(non_camel_case_types)]
3214 struct ListSubscriptionsSvc<T: TopicAdmin>(pub Arc<T>);
3215 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
3216 for ListSubscriptionsSvc<T> {
3217 type Response = super::SubscriptionListResponse;
3218 type Future = BoxFuture<
3219 tonic::Response<Self::Response>,
3220 tonic::Status,
3221 >;
3222 fn call(
3223 &mut self,
3224 request: tonic::Request<super::TopicRequest>,
3225 ) -> Self::Future {
3226 let inner = Arc::clone(&self.0);
3227 let fut = async move {
3228 <T as TopicAdmin>::list_subscriptions(&inner, request).await
3229 };
3230 Box::pin(fut)
3231 }
3232 }
3233 let accept_compression_encodings = self.accept_compression_encodings;
3234 let send_compression_encodings = self.send_compression_encodings;
3235 let max_decoding_message_size = self.max_decoding_message_size;
3236 let max_encoding_message_size = self.max_encoding_message_size;
3237 let inner = self.inner.clone();
3238 let fut = async move {
3239 let method = ListSubscriptionsSvc(inner);
3240 let codec = tonic_prost::ProstCodec::default();
3241 let mut grpc = tonic::server::Grpc::new(codec)
3242 .apply_compression_config(
3243 accept_compression_encodings,
3244 send_compression_encodings,
3245 )
3246 .apply_max_message_size_config(
3247 max_decoding_message_size,
3248 max_encoding_message_size,
3249 );
3250 let res = grpc.unary(method, req).await;
3251 Ok(res)
3252 };
3253 Box::pin(fut)
3254 }
3255 "/danube_admin.TopicAdmin/Unsubscribe" => {
3256 #[allow(non_camel_case_types)]
3257 struct UnsubscribeSvc<T: TopicAdmin>(pub Arc<T>);
3258 impl<
3259 T: TopicAdmin,
3260 > tonic::server::UnaryService<super::SubscriptionRequest>
3261 for UnsubscribeSvc<T> {
3262 type Response = super::SubscriptionResponse;
3263 type Future = BoxFuture<
3264 tonic::Response<Self::Response>,
3265 tonic::Status,
3266 >;
3267 fn call(
3268 &mut self,
3269 request: tonic::Request<super::SubscriptionRequest>,
3270 ) -> Self::Future {
3271 let inner = Arc::clone(&self.0);
3272 let fut = async move {
3273 <T as TopicAdmin>::unsubscribe(&inner, request).await
3274 };
3275 Box::pin(fut)
3276 }
3277 }
3278 let accept_compression_encodings = self.accept_compression_encodings;
3279 let send_compression_encodings = self.send_compression_encodings;
3280 let max_decoding_message_size = self.max_decoding_message_size;
3281 let max_encoding_message_size = self.max_encoding_message_size;
3282 let inner = self.inner.clone();
3283 let fut = async move {
3284 let method = UnsubscribeSvc(inner);
3285 let codec = tonic_prost::ProstCodec::default();
3286 let mut grpc = tonic::server::Grpc::new(codec)
3287 .apply_compression_config(
3288 accept_compression_encodings,
3289 send_compression_encodings,
3290 )
3291 .apply_max_message_size_config(
3292 max_decoding_message_size,
3293 max_encoding_message_size,
3294 );
3295 let res = grpc.unary(method, req).await;
3296 Ok(res)
3297 };
3298 Box::pin(fut)
3299 }
3300 "/danube_admin.TopicAdmin/SetSubscriptionFailurePolicy" => {
3301 #[allow(non_camel_case_types)]
3302 struct SetSubscriptionFailurePolicySvc<T: TopicAdmin>(pub Arc<T>);
3303 impl<
3304 T: TopicAdmin,
3305 > tonic::server::UnaryService<
3306 super::SetSubscriptionFailurePolicyRequest,
3307 > for SetSubscriptionFailurePolicySvc<T> {
3308 type Response = super::SubscriptionResponse;
3309 type Future = BoxFuture<
3310 tonic::Response<Self::Response>,
3311 tonic::Status,
3312 >;
3313 fn call(
3314 &mut self,
3315 request: tonic::Request<
3316 super::SetSubscriptionFailurePolicyRequest,
3317 >,
3318 ) -> Self::Future {
3319 let inner = Arc::clone(&self.0);
3320 let fut = async move {
3321 <T as TopicAdmin>::set_subscription_failure_policy(
3322 &inner,
3323 request,
3324 )
3325 .await
3326 };
3327 Box::pin(fut)
3328 }
3329 }
3330 let accept_compression_encodings = self.accept_compression_encodings;
3331 let send_compression_encodings = self.send_compression_encodings;
3332 let max_decoding_message_size = self.max_decoding_message_size;
3333 let max_encoding_message_size = self.max_encoding_message_size;
3334 let inner = self.inner.clone();
3335 let fut = async move {
3336 let method = SetSubscriptionFailurePolicySvc(inner);
3337 let codec = tonic_prost::ProstCodec::default();
3338 let mut grpc = tonic::server::Grpc::new(codec)
3339 .apply_compression_config(
3340 accept_compression_encodings,
3341 send_compression_encodings,
3342 )
3343 .apply_max_message_size_config(
3344 max_decoding_message_size,
3345 max_encoding_message_size,
3346 );
3347 let res = grpc.unary(method, req).await;
3348 Ok(res)
3349 };
3350 Box::pin(fut)
3351 }
3352 "/danube_admin.TopicAdmin/GetSubscriptionFailurePolicy" => {
3353 #[allow(non_camel_case_types)]
3354 struct GetSubscriptionFailurePolicySvc<T: TopicAdmin>(pub Arc<T>);
3355 impl<
3356 T: TopicAdmin,
3357 > tonic::server::UnaryService<
3358 super::GetSubscriptionFailurePolicyRequest,
3359 > for GetSubscriptionFailurePolicySvc<T> {
3360 type Response = super::GetSubscriptionFailurePolicyResponse;
3361 type Future = BoxFuture<
3362 tonic::Response<Self::Response>,
3363 tonic::Status,
3364 >;
3365 fn call(
3366 &mut self,
3367 request: tonic::Request<
3368 super::GetSubscriptionFailurePolicyRequest,
3369 >,
3370 ) -> Self::Future {
3371 let inner = Arc::clone(&self.0);
3372 let fut = async move {
3373 <T as TopicAdmin>::get_subscription_failure_policy(
3374 &inner,
3375 request,
3376 )
3377 .await
3378 };
3379 Box::pin(fut)
3380 }
3381 }
3382 let accept_compression_encodings = self.accept_compression_encodings;
3383 let send_compression_encodings = self.send_compression_encodings;
3384 let max_decoding_message_size = self.max_decoding_message_size;
3385 let max_encoding_message_size = self.max_encoding_message_size;
3386 let inner = self.inner.clone();
3387 let fut = async move {
3388 let method = GetSubscriptionFailurePolicySvc(inner);
3389 let codec = tonic_prost::ProstCodec::default();
3390 let mut grpc = tonic::server::Grpc::new(codec)
3391 .apply_compression_config(
3392 accept_compression_encodings,
3393 send_compression_encodings,
3394 )
3395 .apply_max_message_size_config(
3396 max_decoding_message_size,
3397 max_encoding_message_size,
3398 );
3399 let res = grpc.unary(method, req).await;
3400 Ok(res)
3401 };
3402 Box::pin(fut)
3403 }
3404 "/danube_admin.TopicAdmin/DescribeTopic" => {
3405 #[allow(non_camel_case_types)]
3406 struct DescribeTopicSvc<T: TopicAdmin>(pub Arc<T>);
3407 impl<
3408 T: TopicAdmin,
3409 > tonic::server::UnaryService<super::DescribeTopicRequest>
3410 for DescribeTopicSvc<T> {
3411 type Response = super::DescribeTopicResponse;
3412 type Future = BoxFuture<
3413 tonic::Response<Self::Response>,
3414 tonic::Status,
3415 >;
3416 fn call(
3417 &mut self,
3418 request: tonic::Request<super::DescribeTopicRequest>,
3419 ) -> Self::Future {
3420 let inner = Arc::clone(&self.0);
3421 let fut = async move {
3422 <T as TopicAdmin>::describe_topic(&inner, request).await
3423 };
3424 Box::pin(fut)
3425 }
3426 }
3427 let accept_compression_encodings = self.accept_compression_encodings;
3428 let send_compression_encodings = self.send_compression_encodings;
3429 let max_decoding_message_size = self.max_decoding_message_size;
3430 let max_encoding_message_size = self.max_encoding_message_size;
3431 let inner = self.inner.clone();
3432 let fut = async move {
3433 let method = DescribeTopicSvc(inner);
3434 let codec = tonic_prost::ProstCodec::default();
3435 let mut grpc = tonic::server::Grpc::new(codec)
3436 .apply_compression_config(
3437 accept_compression_encodings,
3438 send_compression_encodings,
3439 )
3440 .apply_max_message_size_config(
3441 max_decoding_message_size,
3442 max_encoding_message_size,
3443 );
3444 let res = grpc.unary(method, req).await;
3445 Ok(res)
3446 };
3447 Box::pin(fut)
3448 }
3449 _ => {
3450 Box::pin(async move {
3451 let mut response = http::Response::new(
3452 tonic::body::Body::default(),
3453 );
3454 let headers = response.headers_mut();
3455 headers
3456 .insert(
3457 tonic::Status::GRPC_STATUS,
3458 (tonic::Code::Unimplemented as i32).into(),
3459 );
3460 headers
3461 .insert(
3462 http::header::CONTENT_TYPE,
3463 tonic::metadata::GRPC_CONTENT_TYPE,
3464 );
3465 Ok(response)
3466 })
3467 }
3468 }
3469 }
3470 }
3471 impl<T> Clone for TopicAdminServer<T> {
3472 fn clone(&self) -> Self {
3473 let inner = self.inner.clone();
3474 Self {
3475 inner,
3476 accept_compression_encodings: self.accept_compression_encodings,
3477 send_compression_encodings: self.send_compression_encodings,
3478 max_decoding_message_size: self.max_decoding_message_size,
3479 max_encoding_message_size: self.max_encoding_message_size,
3480 }
3481 }
3482 }
3483 pub const SERVICE_NAME: &str = "danube_admin.TopicAdmin";
3485 impl<T> tonic::server::NamedService for TopicAdminServer<T> {
3486 const NAME: &'static str = SERVICE_NAME;
3487 }
3488}
3489pub mod security_admin_client {
3491 #![allow(
3492 unused_variables,
3493 dead_code,
3494 missing_docs,
3495 clippy::wildcard_imports,
3496 clippy::let_unit_value,
3497 )]
3498 use tonic::codegen::*;
3499 use tonic::codegen::http::Uri;
3500 #[derive(Debug, Clone)]
3501 pub struct SecurityAdminClient<T> {
3502 inner: tonic::client::Grpc<T>,
3503 }
3504 impl SecurityAdminClient<tonic::transport::Channel> {
3505 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3507 where
3508 D: TryInto<tonic::transport::Endpoint>,
3509 D::Error: Into<StdError>,
3510 {
3511 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3512 Ok(Self::new(conn))
3513 }
3514 }
3515 impl<T> SecurityAdminClient<T>
3516 where
3517 T: tonic::client::GrpcService<tonic::body::Body>,
3518 T::Error: Into<StdError>,
3519 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3520 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3521 {
3522 pub fn new(inner: T) -> Self {
3523 let inner = tonic::client::Grpc::new(inner);
3524 Self { inner }
3525 }
3526 pub fn with_origin(inner: T, origin: Uri) -> Self {
3527 let inner = tonic::client::Grpc::with_origin(inner, origin);
3528 Self { inner }
3529 }
3530 pub fn with_interceptor<F>(
3531 inner: T,
3532 interceptor: F,
3533 ) -> SecurityAdminClient<InterceptedService<T, F>>
3534 where
3535 F: tonic::service::Interceptor,
3536 T::ResponseBody: Default,
3537 T: tonic::codegen::Service<
3538 http::Request<tonic::body::Body>,
3539 Response = http::Response<
3540 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
3541 >,
3542 >,
3543 <T as tonic::codegen::Service<
3544 http::Request<tonic::body::Body>,
3545 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
3546 {
3547 SecurityAdminClient::new(InterceptedService::new(inner, interceptor))
3548 }
3549 #[must_use]
3554 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3555 self.inner = self.inner.send_compressed(encoding);
3556 self
3557 }
3558 #[must_use]
3560 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3561 self.inner = self.inner.accept_compressed(encoding);
3562 self
3563 }
3564 #[must_use]
3568 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3569 self.inner = self.inner.max_decoding_message_size(limit);
3570 self
3571 }
3572 #[must_use]
3576 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3577 self.inner = self.inner.max_encoding_message_size(limit);
3578 self
3579 }
3580 pub async fn create_role(
3582 &mut self,
3583 request: impl tonic::IntoRequest<super::CreateRoleRequest>,
3584 ) -> std::result::Result<
3585 tonic::Response<super::CreateRoleResponse>,
3586 tonic::Status,
3587 > {
3588 self.inner
3589 .ready()
3590 .await
3591 .map_err(|e| {
3592 tonic::Status::unknown(
3593 format!("Service was not ready: {}", e.into()),
3594 )
3595 })?;
3596 let codec = tonic_prost::ProstCodec::default();
3597 let path = http::uri::PathAndQuery::from_static(
3598 "/danube_admin.SecurityAdmin/CreateRole",
3599 );
3600 let mut req = request.into_request();
3601 req.extensions_mut()
3602 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "CreateRole"));
3603 self.inner.unary(req, path, codec).await
3604 }
3605 pub async fn get_role(
3606 &mut self,
3607 request: impl tonic::IntoRequest<super::GetRoleRequest>,
3608 ) -> std::result::Result<
3609 tonic::Response<super::GetRoleResponse>,
3610 tonic::Status,
3611 > {
3612 self.inner
3613 .ready()
3614 .await
3615 .map_err(|e| {
3616 tonic::Status::unknown(
3617 format!("Service was not ready: {}", e.into()),
3618 )
3619 })?;
3620 let codec = tonic_prost::ProstCodec::default();
3621 let path = http::uri::PathAndQuery::from_static(
3622 "/danube_admin.SecurityAdmin/GetRole",
3623 );
3624 let mut req = request.into_request();
3625 req.extensions_mut()
3626 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "GetRole"));
3627 self.inner.unary(req, path, codec).await
3628 }
3629 pub async fn list_roles(
3630 &mut self,
3631 request: impl tonic::IntoRequest<super::Empty>,
3632 ) -> std::result::Result<
3633 tonic::Response<super::ListRolesResponse>,
3634 tonic::Status,
3635 > {
3636 self.inner
3637 .ready()
3638 .await
3639 .map_err(|e| {
3640 tonic::Status::unknown(
3641 format!("Service was not ready: {}", e.into()),
3642 )
3643 })?;
3644 let codec = tonic_prost::ProstCodec::default();
3645 let path = http::uri::PathAndQuery::from_static(
3646 "/danube_admin.SecurityAdmin/ListRoles",
3647 );
3648 let mut req = request.into_request();
3649 req.extensions_mut()
3650 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "ListRoles"));
3651 self.inner.unary(req, path, codec).await
3652 }
3653 pub async fn delete_role(
3654 &mut self,
3655 request: impl tonic::IntoRequest<super::DeleteRoleRequest>,
3656 ) -> std::result::Result<
3657 tonic::Response<super::DeleteRoleResponse>,
3658 tonic::Status,
3659 > {
3660 self.inner
3661 .ready()
3662 .await
3663 .map_err(|e| {
3664 tonic::Status::unknown(
3665 format!("Service was not ready: {}", e.into()),
3666 )
3667 })?;
3668 let codec = tonic_prost::ProstCodec::default();
3669 let path = http::uri::PathAndQuery::from_static(
3670 "/danube_admin.SecurityAdmin/DeleteRole",
3671 );
3672 let mut req = request.into_request();
3673 req.extensions_mut()
3674 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "DeleteRole"));
3675 self.inner.unary(req, path, codec).await
3676 }
3677 pub async fn create_binding(
3679 &mut self,
3680 request: impl tonic::IntoRequest<super::CreateBindingRequest>,
3681 ) -> std::result::Result<
3682 tonic::Response<super::CreateBindingResponse>,
3683 tonic::Status,
3684 > {
3685 self.inner
3686 .ready()
3687 .await
3688 .map_err(|e| {
3689 tonic::Status::unknown(
3690 format!("Service was not ready: {}", e.into()),
3691 )
3692 })?;
3693 let codec = tonic_prost::ProstCodec::default();
3694 let path = http::uri::PathAndQuery::from_static(
3695 "/danube_admin.SecurityAdmin/CreateBinding",
3696 );
3697 let mut req = request.into_request();
3698 req.extensions_mut()
3699 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "CreateBinding"));
3700 self.inner.unary(req, path, codec).await
3701 }
3702 pub async fn get_binding(
3703 &mut self,
3704 request: impl tonic::IntoRequest<super::GetBindingRequest>,
3705 ) -> std::result::Result<
3706 tonic::Response<super::GetBindingResponse>,
3707 tonic::Status,
3708 > {
3709 self.inner
3710 .ready()
3711 .await
3712 .map_err(|e| {
3713 tonic::Status::unknown(
3714 format!("Service was not ready: {}", e.into()),
3715 )
3716 })?;
3717 let codec = tonic_prost::ProstCodec::default();
3718 let path = http::uri::PathAndQuery::from_static(
3719 "/danube_admin.SecurityAdmin/GetBinding",
3720 );
3721 let mut req = request.into_request();
3722 req.extensions_mut()
3723 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "GetBinding"));
3724 self.inner.unary(req, path, codec).await
3725 }
3726 pub async fn list_bindings(
3727 &mut self,
3728 request: impl tonic::IntoRequest<super::ListBindingsRequest>,
3729 ) -> std::result::Result<
3730 tonic::Response<super::ListBindingsResponse>,
3731 tonic::Status,
3732 > {
3733 self.inner
3734 .ready()
3735 .await
3736 .map_err(|e| {
3737 tonic::Status::unknown(
3738 format!("Service was not ready: {}", e.into()),
3739 )
3740 })?;
3741 let codec = tonic_prost::ProstCodec::default();
3742 let path = http::uri::PathAndQuery::from_static(
3743 "/danube_admin.SecurityAdmin/ListBindings",
3744 );
3745 let mut req = request.into_request();
3746 req.extensions_mut()
3747 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "ListBindings"));
3748 self.inner.unary(req, path, codec).await
3749 }
3750 pub async fn delete_binding(
3751 &mut self,
3752 request: impl tonic::IntoRequest<super::DeleteBindingRequest>,
3753 ) -> std::result::Result<
3754 tonic::Response<super::DeleteBindingResponse>,
3755 tonic::Status,
3756 > {
3757 self.inner
3758 .ready()
3759 .await
3760 .map_err(|e| {
3761 tonic::Status::unknown(
3762 format!("Service was not ready: {}", e.into()),
3763 )
3764 })?;
3765 let codec = tonic_prost::ProstCodec::default();
3766 let path = http::uri::PathAndQuery::from_static(
3767 "/danube_admin.SecurityAdmin/DeleteBinding",
3768 );
3769 let mut req = request.into_request();
3770 req.extensions_mut()
3771 .insert(GrpcMethod::new("danube_admin.SecurityAdmin", "DeleteBinding"));
3772 self.inner.unary(req, path, codec).await
3773 }
3774 }
3775}
3776pub mod security_admin_server {
3778 #![allow(
3779 unused_variables,
3780 dead_code,
3781 missing_docs,
3782 clippy::wildcard_imports,
3783 clippy::let_unit_value,
3784 )]
3785 use tonic::codegen::*;
3786 #[async_trait]
3788 pub trait SecurityAdmin: std::marker::Send + std::marker::Sync + 'static {
3789 async fn create_role(
3791 &self,
3792 request: tonic::Request<super::CreateRoleRequest>,
3793 ) -> std::result::Result<
3794 tonic::Response<super::CreateRoleResponse>,
3795 tonic::Status,
3796 >;
3797 async fn get_role(
3798 &self,
3799 request: tonic::Request<super::GetRoleRequest>,
3800 ) -> std::result::Result<tonic::Response<super::GetRoleResponse>, tonic::Status>;
3801 async fn list_roles(
3802 &self,
3803 request: tonic::Request<super::Empty>,
3804 ) -> std::result::Result<
3805 tonic::Response<super::ListRolesResponse>,
3806 tonic::Status,
3807 >;
3808 async fn delete_role(
3809 &self,
3810 request: tonic::Request<super::DeleteRoleRequest>,
3811 ) -> std::result::Result<
3812 tonic::Response<super::DeleteRoleResponse>,
3813 tonic::Status,
3814 >;
3815 async fn create_binding(
3817 &self,
3818 request: tonic::Request<super::CreateBindingRequest>,
3819 ) -> std::result::Result<
3820 tonic::Response<super::CreateBindingResponse>,
3821 tonic::Status,
3822 >;
3823 async fn get_binding(
3824 &self,
3825 request: tonic::Request<super::GetBindingRequest>,
3826 ) -> std::result::Result<
3827 tonic::Response<super::GetBindingResponse>,
3828 tonic::Status,
3829 >;
3830 async fn list_bindings(
3831 &self,
3832 request: tonic::Request<super::ListBindingsRequest>,
3833 ) -> std::result::Result<
3834 tonic::Response<super::ListBindingsResponse>,
3835 tonic::Status,
3836 >;
3837 async fn delete_binding(
3838 &self,
3839 request: tonic::Request<super::DeleteBindingRequest>,
3840 ) -> std::result::Result<
3841 tonic::Response<super::DeleteBindingResponse>,
3842 tonic::Status,
3843 >;
3844 }
3845 #[derive(Debug)]
3846 pub struct SecurityAdminServer<T> {
3847 inner: Arc<T>,
3848 accept_compression_encodings: EnabledCompressionEncodings,
3849 send_compression_encodings: EnabledCompressionEncodings,
3850 max_decoding_message_size: Option<usize>,
3851 max_encoding_message_size: Option<usize>,
3852 }
3853 impl<T> SecurityAdminServer<T> {
3854 pub fn new(inner: T) -> Self {
3855 Self::from_arc(Arc::new(inner))
3856 }
3857 pub fn from_arc(inner: Arc<T>) -> Self {
3858 Self {
3859 inner,
3860 accept_compression_encodings: Default::default(),
3861 send_compression_encodings: Default::default(),
3862 max_decoding_message_size: None,
3863 max_encoding_message_size: None,
3864 }
3865 }
3866 pub fn with_interceptor<F>(
3867 inner: T,
3868 interceptor: F,
3869 ) -> InterceptedService<Self, F>
3870 where
3871 F: tonic::service::Interceptor,
3872 {
3873 InterceptedService::new(Self::new(inner), interceptor)
3874 }
3875 #[must_use]
3877 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3878 self.accept_compression_encodings.enable(encoding);
3879 self
3880 }
3881 #[must_use]
3883 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3884 self.send_compression_encodings.enable(encoding);
3885 self
3886 }
3887 #[must_use]
3891 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3892 self.max_decoding_message_size = Some(limit);
3893 self
3894 }
3895 #[must_use]
3899 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3900 self.max_encoding_message_size = Some(limit);
3901 self
3902 }
3903 }
3904 impl<T, B> tonic::codegen::Service<http::Request<B>> for SecurityAdminServer<T>
3905 where
3906 T: SecurityAdmin,
3907 B: Body + std::marker::Send + 'static,
3908 B::Error: Into<StdError> + std::marker::Send + 'static,
3909 {
3910 type Response = http::Response<tonic::body::Body>;
3911 type Error = std::convert::Infallible;
3912 type Future = BoxFuture<Self::Response, Self::Error>;
3913 fn poll_ready(
3914 &mut self,
3915 _cx: &mut Context<'_>,
3916 ) -> Poll<std::result::Result<(), Self::Error>> {
3917 Poll::Ready(Ok(()))
3918 }
3919 fn call(&mut self, req: http::Request<B>) -> Self::Future {
3920 match req.uri().path() {
3921 "/danube_admin.SecurityAdmin/CreateRole" => {
3922 #[allow(non_camel_case_types)]
3923 struct CreateRoleSvc<T: SecurityAdmin>(pub Arc<T>);
3924 impl<
3925 T: SecurityAdmin,
3926 > tonic::server::UnaryService<super::CreateRoleRequest>
3927 for CreateRoleSvc<T> {
3928 type Response = super::CreateRoleResponse;
3929 type Future = BoxFuture<
3930 tonic::Response<Self::Response>,
3931 tonic::Status,
3932 >;
3933 fn call(
3934 &mut self,
3935 request: tonic::Request<super::CreateRoleRequest>,
3936 ) -> Self::Future {
3937 let inner = Arc::clone(&self.0);
3938 let fut = async move {
3939 <T as SecurityAdmin>::create_role(&inner, request).await
3940 };
3941 Box::pin(fut)
3942 }
3943 }
3944 let accept_compression_encodings = self.accept_compression_encodings;
3945 let send_compression_encodings = self.send_compression_encodings;
3946 let max_decoding_message_size = self.max_decoding_message_size;
3947 let max_encoding_message_size = self.max_encoding_message_size;
3948 let inner = self.inner.clone();
3949 let fut = async move {
3950 let method = CreateRoleSvc(inner);
3951 let codec = tonic_prost::ProstCodec::default();
3952 let mut grpc = tonic::server::Grpc::new(codec)
3953 .apply_compression_config(
3954 accept_compression_encodings,
3955 send_compression_encodings,
3956 )
3957 .apply_max_message_size_config(
3958 max_decoding_message_size,
3959 max_encoding_message_size,
3960 );
3961 let res = grpc.unary(method, req).await;
3962 Ok(res)
3963 };
3964 Box::pin(fut)
3965 }
3966 "/danube_admin.SecurityAdmin/GetRole" => {
3967 #[allow(non_camel_case_types)]
3968 struct GetRoleSvc<T: SecurityAdmin>(pub Arc<T>);
3969 impl<
3970 T: SecurityAdmin,
3971 > tonic::server::UnaryService<super::GetRoleRequest>
3972 for GetRoleSvc<T> {
3973 type Response = super::GetRoleResponse;
3974 type Future = BoxFuture<
3975 tonic::Response<Self::Response>,
3976 tonic::Status,
3977 >;
3978 fn call(
3979 &mut self,
3980 request: tonic::Request<super::GetRoleRequest>,
3981 ) -> Self::Future {
3982 let inner = Arc::clone(&self.0);
3983 let fut = async move {
3984 <T as SecurityAdmin>::get_role(&inner, request).await
3985 };
3986 Box::pin(fut)
3987 }
3988 }
3989 let accept_compression_encodings = self.accept_compression_encodings;
3990 let send_compression_encodings = self.send_compression_encodings;
3991 let max_decoding_message_size = self.max_decoding_message_size;
3992 let max_encoding_message_size = self.max_encoding_message_size;
3993 let inner = self.inner.clone();
3994 let fut = async move {
3995 let method = GetRoleSvc(inner);
3996 let codec = tonic_prost::ProstCodec::default();
3997 let mut grpc = tonic::server::Grpc::new(codec)
3998 .apply_compression_config(
3999 accept_compression_encodings,
4000 send_compression_encodings,
4001 )
4002 .apply_max_message_size_config(
4003 max_decoding_message_size,
4004 max_encoding_message_size,
4005 );
4006 let res = grpc.unary(method, req).await;
4007 Ok(res)
4008 };
4009 Box::pin(fut)
4010 }
4011 "/danube_admin.SecurityAdmin/ListRoles" => {
4012 #[allow(non_camel_case_types)]
4013 struct ListRolesSvc<T: SecurityAdmin>(pub Arc<T>);
4014 impl<T: SecurityAdmin> tonic::server::UnaryService<super::Empty>
4015 for ListRolesSvc<T> {
4016 type Response = super::ListRolesResponse;
4017 type Future = BoxFuture<
4018 tonic::Response<Self::Response>,
4019 tonic::Status,
4020 >;
4021 fn call(
4022 &mut self,
4023 request: tonic::Request<super::Empty>,
4024 ) -> Self::Future {
4025 let inner = Arc::clone(&self.0);
4026 let fut = async move {
4027 <T as SecurityAdmin>::list_roles(&inner, request).await
4028 };
4029 Box::pin(fut)
4030 }
4031 }
4032 let accept_compression_encodings = self.accept_compression_encodings;
4033 let send_compression_encodings = self.send_compression_encodings;
4034 let max_decoding_message_size = self.max_decoding_message_size;
4035 let max_encoding_message_size = self.max_encoding_message_size;
4036 let inner = self.inner.clone();
4037 let fut = async move {
4038 let method = ListRolesSvc(inner);
4039 let codec = tonic_prost::ProstCodec::default();
4040 let mut grpc = tonic::server::Grpc::new(codec)
4041 .apply_compression_config(
4042 accept_compression_encodings,
4043 send_compression_encodings,
4044 )
4045 .apply_max_message_size_config(
4046 max_decoding_message_size,
4047 max_encoding_message_size,
4048 );
4049 let res = grpc.unary(method, req).await;
4050 Ok(res)
4051 };
4052 Box::pin(fut)
4053 }
4054 "/danube_admin.SecurityAdmin/DeleteRole" => {
4055 #[allow(non_camel_case_types)]
4056 struct DeleteRoleSvc<T: SecurityAdmin>(pub Arc<T>);
4057 impl<
4058 T: SecurityAdmin,
4059 > tonic::server::UnaryService<super::DeleteRoleRequest>
4060 for DeleteRoleSvc<T> {
4061 type Response = super::DeleteRoleResponse;
4062 type Future = BoxFuture<
4063 tonic::Response<Self::Response>,
4064 tonic::Status,
4065 >;
4066 fn call(
4067 &mut self,
4068 request: tonic::Request<super::DeleteRoleRequest>,
4069 ) -> Self::Future {
4070 let inner = Arc::clone(&self.0);
4071 let fut = async move {
4072 <T as SecurityAdmin>::delete_role(&inner, request).await
4073 };
4074 Box::pin(fut)
4075 }
4076 }
4077 let accept_compression_encodings = self.accept_compression_encodings;
4078 let send_compression_encodings = self.send_compression_encodings;
4079 let max_decoding_message_size = self.max_decoding_message_size;
4080 let max_encoding_message_size = self.max_encoding_message_size;
4081 let inner = self.inner.clone();
4082 let fut = async move {
4083 let method = DeleteRoleSvc(inner);
4084 let codec = tonic_prost::ProstCodec::default();
4085 let mut grpc = tonic::server::Grpc::new(codec)
4086 .apply_compression_config(
4087 accept_compression_encodings,
4088 send_compression_encodings,
4089 )
4090 .apply_max_message_size_config(
4091 max_decoding_message_size,
4092 max_encoding_message_size,
4093 );
4094 let res = grpc.unary(method, req).await;
4095 Ok(res)
4096 };
4097 Box::pin(fut)
4098 }
4099 "/danube_admin.SecurityAdmin/CreateBinding" => {
4100 #[allow(non_camel_case_types)]
4101 struct CreateBindingSvc<T: SecurityAdmin>(pub Arc<T>);
4102 impl<
4103 T: SecurityAdmin,
4104 > tonic::server::UnaryService<super::CreateBindingRequest>
4105 for CreateBindingSvc<T> {
4106 type Response = super::CreateBindingResponse;
4107 type Future = BoxFuture<
4108 tonic::Response<Self::Response>,
4109 tonic::Status,
4110 >;
4111 fn call(
4112 &mut self,
4113 request: tonic::Request<super::CreateBindingRequest>,
4114 ) -> Self::Future {
4115 let inner = Arc::clone(&self.0);
4116 let fut = async move {
4117 <T as SecurityAdmin>::create_binding(&inner, request).await
4118 };
4119 Box::pin(fut)
4120 }
4121 }
4122 let accept_compression_encodings = self.accept_compression_encodings;
4123 let send_compression_encodings = self.send_compression_encodings;
4124 let max_decoding_message_size = self.max_decoding_message_size;
4125 let max_encoding_message_size = self.max_encoding_message_size;
4126 let inner = self.inner.clone();
4127 let fut = async move {
4128 let method = CreateBindingSvc(inner);
4129 let codec = tonic_prost::ProstCodec::default();
4130 let mut grpc = tonic::server::Grpc::new(codec)
4131 .apply_compression_config(
4132 accept_compression_encodings,
4133 send_compression_encodings,
4134 )
4135 .apply_max_message_size_config(
4136 max_decoding_message_size,
4137 max_encoding_message_size,
4138 );
4139 let res = grpc.unary(method, req).await;
4140 Ok(res)
4141 };
4142 Box::pin(fut)
4143 }
4144 "/danube_admin.SecurityAdmin/GetBinding" => {
4145 #[allow(non_camel_case_types)]
4146 struct GetBindingSvc<T: SecurityAdmin>(pub Arc<T>);
4147 impl<
4148 T: SecurityAdmin,
4149 > tonic::server::UnaryService<super::GetBindingRequest>
4150 for GetBindingSvc<T> {
4151 type Response = super::GetBindingResponse;
4152 type Future = BoxFuture<
4153 tonic::Response<Self::Response>,
4154 tonic::Status,
4155 >;
4156 fn call(
4157 &mut self,
4158 request: tonic::Request<super::GetBindingRequest>,
4159 ) -> Self::Future {
4160 let inner = Arc::clone(&self.0);
4161 let fut = async move {
4162 <T as SecurityAdmin>::get_binding(&inner, request).await
4163 };
4164 Box::pin(fut)
4165 }
4166 }
4167 let accept_compression_encodings = self.accept_compression_encodings;
4168 let send_compression_encodings = self.send_compression_encodings;
4169 let max_decoding_message_size = self.max_decoding_message_size;
4170 let max_encoding_message_size = self.max_encoding_message_size;
4171 let inner = self.inner.clone();
4172 let fut = async move {
4173 let method = GetBindingSvc(inner);
4174 let codec = tonic_prost::ProstCodec::default();
4175 let mut grpc = tonic::server::Grpc::new(codec)
4176 .apply_compression_config(
4177 accept_compression_encodings,
4178 send_compression_encodings,
4179 )
4180 .apply_max_message_size_config(
4181 max_decoding_message_size,
4182 max_encoding_message_size,
4183 );
4184 let res = grpc.unary(method, req).await;
4185 Ok(res)
4186 };
4187 Box::pin(fut)
4188 }
4189 "/danube_admin.SecurityAdmin/ListBindings" => {
4190 #[allow(non_camel_case_types)]
4191 struct ListBindingsSvc<T: SecurityAdmin>(pub Arc<T>);
4192 impl<
4193 T: SecurityAdmin,
4194 > tonic::server::UnaryService<super::ListBindingsRequest>
4195 for ListBindingsSvc<T> {
4196 type Response = super::ListBindingsResponse;
4197 type Future = BoxFuture<
4198 tonic::Response<Self::Response>,
4199 tonic::Status,
4200 >;
4201 fn call(
4202 &mut self,
4203 request: tonic::Request<super::ListBindingsRequest>,
4204 ) -> Self::Future {
4205 let inner = Arc::clone(&self.0);
4206 let fut = async move {
4207 <T as SecurityAdmin>::list_bindings(&inner, request).await
4208 };
4209 Box::pin(fut)
4210 }
4211 }
4212 let accept_compression_encodings = self.accept_compression_encodings;
4213 let send_compression_encodings = self.send_compression_encodings;
4214 let max_decoding_message_size = self.max_decoding_message_size;
4215 let max_encoding_message_size = self.max_encoding_message_size;
4216 let inner = self.inner.clone();
4217 let fut = async move {
4218 let method = ListBindingsSvc(inner);
4219 let codec = tonic_prost::ProstCodec::default();
4220 let mut grpc = tonic::server::Grpc::new(codec)
4221 .apply_compression_config(
4222 accept_compression_encodings,
4223 send_compression_encodings,
4224 )
4225 .apply_max_message_size_config(
4226 max_decoding_message_size,
4227 max_encoding_message_size,
4228 );
4229 let res = grpc.unary(method, req).await;
4230 Ok(res)
4231 };
4232 Box::pin(fut)
4233 }
4234 "/danube_admin.SecurityAdmin/DeleteBinding" => {
4235 #[allow(non_camel_case_types)]
4236 struct DeleteBindingSvc<T: SecurityAdmin>(pub Arc<T>);
4237 impl<
4238 T: SecurityAdmin,
4239 > tonic::server::UnaryService<super::DeleteBindingRequest>
4240 for DeleteBindingSvc<T> {
4241 type Response = super::DeleteBindingResponse;
4242 type Future = BoxFuture<
4243 tonic::Response<Self::Response>,
4244 tonic::Status,
4245 >;
4246 fn call(
4247 &mut self,
4248 request: tonic::Request<super::DeleteBindingRequest>,
4249 ) -> Self::Future {
4250 let inner = Arc::clone(&self.0);
4251 let fut = async move {
4252 <T as SecurityAdmin>::delete_binding(&inner, request).await
4253 };
4254 Box::pin(fut)
4255 }
4256 }
4257 let accept_compression_encodings = self.accept_compression_encodings;
4258 let send_compression_encodings = self.send_compression_encodings;
4259 let max_decoding_message_size = self.max_decoding_message_size;
4260 let max_encoding_message_size = self.max_encoding_message_size;
4261 let inner = self.inner.clone();
4262 let fut = async move {
4263 let method = DeleteBindingSvc(inner);
4264 let codec = tonic_prost::ProstCodec::default();
4265 let mut grpc = tonic::server::Grpc::new(codec)
4266 .apply_compression_config(
4267 accept_compression_encodings,
4268 send_compression_encodings,
4269 )
4270 .apply_max_message_size_config(
4271 max_decoding_message_size,
4272 max_encoding_message_size,
4273 );
4274 let res = grpc.unary(method, req).await;
4275 Ok(res)
4276 };
4277 Box::pin(fut)
4278 }
4279 _ => {
4280 Box::pin(async move {
4281 let mut response = http::Response::new(
4282 tonic::body::Body::default(),
4283 );
4284 let headers = response.headers_mut();
4285 headers
4286 .insert(
4287 tonic::Status::GRPC_STATUS,
4288 (tonic::Code::Unimplemented as i32).into(),
4289 );
4290 headers
4291 .insert(
4292 http::header::CONTENT_TYPE,
4293 tonic::metadata::GRPC_CONTENT_TYPE,
4294 );
4295 Ok(response)
4296 })
4297 }
4298 }
4299 }
4300 }
4301 impl<T> Clone for SecurityAdminServer<T> {
4302 fn clone(&self) -> Self {
4303 let inner = self.inner.clone();
4304 Self {
4305 inner,
4306 accept_compression_encodings: self.accept_compression_encodings,
4307 send_compression_encodings: self.send_compression_encodings,
4308 max_decoding_message_size: self.max_decoding_message_size,
4309 max_encoding_message_size: self.max_encoding_message_size,
4310 }
4311 }
4312 }
4313 pub const SERVICE_NAME: &str = "danube_admin.SecurityAdmin";
4315 impl<T> tonic::server::NamedService for SecurityAdminServer<T> {
4316 const NAME: &'static str = SERVICE_NAME;
4317 }
4318}