#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RoleDefinition {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub permissions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "3")]
pub system: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateRoleRequest {
#[prost(message, optional, tag = "1")]
pub role: ::core::option::Option<RoleDefinition>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateRoleResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetRoleRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetRoleResponse {
#[prost(message, optional, tag = "1")]
pub role: ::core::option::Option<RoleDefinition>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRolesResponse {
#[prost(message, repeated, tag = "1")]
pub roles: ::prost::alloc::vec::Vec<RoleDefinition>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteRoleRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteRoleResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BindingDefinition {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub principal_type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub principal_name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "4")]
pub role_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "5")]
pub scope: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub resource_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateBindingRequest {
#[prost(message, optional, tag = "1")]
pub binding: ::core::option::Option<BindingDefinition>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateBindingResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetBindingRequest {
#[prost(string, tag = "1")]
pub scope: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub resource_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub binding_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetBindingResponse {
#[prost(message, optional, tag = "1")]
pub binding: ::core::option::Option<BindingDefinition>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListBindingsRequest {
#[prost(string, tag = "1")]
pub scope: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub resource_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBindingsResponse {
#[prost(message, repeated, tag = "1")]
pub bindings: ::prost::alloc::vec::Vec<BindingDefinition>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteBindingRequest {
#[prost(string, tag = "1")]
pub scope: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub resource_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub binding_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteBindingResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamespaceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamespaceResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NewTopicRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "DispatchStrategy", tag = "3")]
pub dispatch_strategy: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TopicRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TopicResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PartitionedTopicRequest {
#[prost(string, tag = "1")]
pub base_name: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub partitions: u32,
#[prost(string, optional, tag = "3")]
pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "DispatchStrategy", tag = "4")]
pub dispatch_strategy: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubscriptionRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subscription: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubscriptionResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubscriptionFailurePolicy {
#[prost(uint32, tag = "1")]
pub max_redelivery_count: u32,
#[prost(uint64, tag = "2")]
pub ack_timeout_ms: u64,
#[prost(uint64, tag = "3")]
pub base_redelivery_delay_ms: u64,
#[prost(uint64, tag = "4")]
pub max_redelivery_delay_ms: u64,
#[prost(enumeration = "SubscriptionBackoffStrategy", tag = "5")]
pub backoff_strategy: i32,
#[prost(string, optional, tag = "6")]
pub dead_letter_topic: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration = "SubscriptionPoisonPolicy", tag = "7")]
pub poison_policy: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetSubscriptionFailurePolicyRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subscription: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub failure_policy: ::core::option::Option<SubscriptionFailurePolicy>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSubscriptionFailurePolicyRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subscription: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSubscriptionFailurePolicyResponse {
#[prost(message, optional, tag = "1")]
pub failure_policy: ::core::option::Option<SubscriptionFailurePolicy>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BrokerListResponse {
#[prost(message, repeated, tag = "1")]
pub brokers: ::prost::alloc::vec::Vec<BrokerInfo>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BrokerInfo {
#[prost(string, tag = "1")]
pub broker_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub broker_addr: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub broker_role: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub admin_addr: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub metrics_addr: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub broker_status: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BrokerResponse {
#[prost(string, tag = "1")]
pub leader: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NamespaceListResponse {
#[prost(string, repeated, tag = "1")]
pub namespaces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TopicListResponse {
#[prost(string, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TopicInfo {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub broker_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub delivery: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopicInfoListResponse {
#[prost(message, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<TopicInfo>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BrokerRequest {
#[prost(string, tag = "1")]
pub broker_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PolicyResponse {
#[prost(string, tag = "1")]
pub policies: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubscriptionListResponse {
#[prost(string, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DescribeTopicRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DescribeTopicResponse {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub broker_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub delivery: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "6")]
pub schema_id: ::core::option::Option<u64>,
#[prost(uint32, optional, tag = "7")]
pub schema_version: ::core::option::Option<u32>,
#[prost(string, optional, tag = "8")]
pub schema_type: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "9")]
pub compatibility_mode: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnloadBrokerRequest {
#[prost(string, tag = "1")]
pub broker_id: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub max_parallel: u32,
#[prost(string, repeated, tag = "3")]
pub namespaces_include: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "4")]
pub namespaces_exclude: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "5")]
pub dry_run: bool,
#[prost(uint32, tag = "6")]
pub timeout_seconds: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnloadBrokerResponse {
#[prost(bool, tag = "1")]
pub started: bool,
#[prost(uint32, tag = "2")]
pub total: u32,
#[prost(uint32, tag = "3")]
pub succeeded: u32,
#[prost(uint32, tag = "4")]
pub failed: u32,
#[prost(uint32, tag = "5")]
pub pending: u32,
#[prost(string, repeated, tag = "6")]
pub failed_topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivateBrokerRequest {
#[prost(string, tag = "1")]
pub broker_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivateBrokerResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClusterBalanceRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClusterBalanceResponse {
#[prost(double, tag = "1")]
pub coefficient_of_variation: f64,
#[prost(double, tag = "2")]
pub mean_load: f64,
#[prost(double, tag = "3")]
pub max_load: f64,
#[prost(double, tag = "4")]
pub min_load: f64,
#[prost(double, tag = "5")]
pub std_deviation: f64,
#[prost(uint32, tag = "6")]
pub broker_count: u32,
#[prost(message, repeated, tag = "7")]
pub brokers: ::prost::alloc::vec::Vec<BrokerLoadInfo>,
#[prost(string, tag = "8")]
pub assignment_strategy: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BrokerLoadInfo {
#[prost(uint64, tag = "1")]
pub broker_id: u64,
#[prost(double, tag = "2")]
pub load: f64,
#[prost(uint32, tag = "3")]
pub topic_count: u32,
#[prost(bool, tag = "4")]
pub is_overloaded: bool,
#[prost(bool, tag = "5")]
pub is_underloaded: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RebalanceRequest {
#[prost(bool, tag = "1")]
pub dry_run: bool,
#[prost(uint32, optional, tag = "2")]
pub max_moves: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RebalanceResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(uint32, tag = "2")]
pub moves_executed: u32,
#[prost(message, repeated, tag = "3")]
pub proposed_moves: ::prost::alloc::vec::Vec<ProposedMove>,
#[prost(string, tag = "4")]
pub error_message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProposedMove {
#[prost(string, tag = "1")]
pub topic_name: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub from_broker: u64,
#[prost(uint64, tag = "3")]
pub to_broker: u64,
#[prost(double, tag = "4")]
pub estimated_load: f64,
#[prost(string, tag = "5")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClusterStatusResponse {
#[prost(uint64, tag = "1")]
pub leader_id: u64,
#[prost(uint64, tag = "2")]
pub current_term: u64,
#[prost(uint64, tag = "3")]
pub last_applied: u64,
#[prost(uint64, repeated, tag = "4")]
pub voters: ::prost::alloc::vec::Vec<u64>,
#[prost(uint64, repeated, tag = "5")]
pub learners: ::prost::alloc::vec::Vec<u64>,
#[prost(uint64, tag = "6")]
pub self_node_id: u64,
#[prost(string, tag = "7")]
pub raft_addr: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddNodeRequest {
#[prost(string, tag = "1")]
pub addr: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub node_id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddNodeResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(uint64, tag = "2")]
pub node_id: u64,
#[prost(string, tag = "3")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromoteNodeRequest {
#[prost(uint64, tag = "1")]
pub node_id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromoteNodeResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RemoveNodeRequest {
#[prost(uint64, tag = "1")]
pub node_id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RemoveNodeResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DispatchStrategy {
NonReliable = 0,
Reliable = 1,
}
impl DispatchStrategy {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NonReliable => "NonReliable",
Self::Reliable => "Reliable",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NonReliable" => Some(Self::NonReliable),
"Reliable" => Some(Self::Reliable),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SubscriptionBackoffStrategy {
Fixed = 0,
Exponential = 1,
}
impl SubscriptionBackoffStrategy {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Fixed => "Fixed",
Self::Exponential => "Exponential",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Fixed" => Some(Self::Fixed),
"Exponential" => Some(Self::Exponential),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SubscriptionPoisonPolicy {
DeadLetter = 0,
Block = 1,
Drop = 2,
}
impl SubscriptionPoisonPolicy {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::DeadLetter => "DeadLetter",
Self::Block => "Block",
Self::Drop => "Drop",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DeadLetter" => Some(Self::DeadLetter),
"Block" => Some(Self::Block),
"Drop" => Some(Self::Drop),
_ => None,
}
}
}
pub mod broker_admin_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BrokerAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BrokerAdminClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BrokerAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BrokerAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BrokerAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn list_brokers(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<
tonic::Response<super::BrokerListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/ListBrokers",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListBrokers"));
self.inner.unary(req, path, codec).await
}
pub async fn get_leader_broker(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/GetLeaderBroker",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "GetLeaderBroker"));
self.inner.unary(req, path, codec).await
}
pub async fn list_namespaces(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<
tonic::Response<super::NamespaceListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/ListNamespaces",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListNamespaces"));
self.inner.unary(req, path, codec).await
}
pub async fn unload_broker(
&mut self,
request: impl tonic::IntoRequest<super::UnloadBrokerRequest>,
) -> std::result::Result<
tonic::Response<super::UnloadBrokerResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/UnloadBroker",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "UnloadBroker"));
self.inner.unary(req, path, codec).await
}
pub async fn activate_broker(
&mut self,
request: impl tonic::IntoRequest<super::ActivateBrokerRequest>,
) -> std::result::Result<
tonic::Response<super::ActivateBrokerResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/ActivateBroker",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ActivateBroker"));
self.inner.unary(req, path, codec).await
}
pub async fn get_cluster_balance(
&mut self,
request: impl tonic::IntoRequest<super::ClusterBalanceRequest>,
) -> std::result::Result<
tonic::Response<super::ClusterBalanceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/GetClusterBalance",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.BrokerAdmin", "GetClusterBalance"),
);
self.inner.unary(req, path, codec).await
}
pub async fn trigger_rebalance(
&mut self,
request: impl tonic::IntoRequest<super::RebalanceRequest>,
) -> std::result::Result<
tonic::Response<super::RebalanceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.BrokerAdmin/TriggerRebalance",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.BrokerAdmin", "TriggerRebalance"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod broker_admin_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait BrokerAdmin: std::marker::Send + std::marker::Sync + 'static {
async fn list_brokers(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<
tonic::Response<super::BrokerListResponse>,
tonic::Status,
>;
async fn get_leader_broker(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status>;
async fn list_namespaces(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<
tonic::Response<super::NamespaceListResponse>,
tonic::Status,
>;
async fn unload_broker(
&self,
request: tonic::Request<super::UnloadBrokerRequest>,
) -> std::result::Result<
tonic::Response<super::UnloadBrokerResponse>,
tonic::Status,
>;
async fn activate_broker(
&self,
request: tonic::Request<super::ActivateBrokerRequest>,
) -> std::result::Result<
tonic::Response<super::ActivateBrokerResponse>,
tonic::Status,
>;
async fn get_cluster_balance(
&self,
request: tonic::Request<super::ClusterBalanceRequest>,
) -> std::result::Result<
tonic::Response<super::ClusterBalanceResponse>,
tonic::Status,
>;
async fn trigger_rebalance(
&self,
request: tonic::Request<super::RebalanceRequest>,
) -> std::result::Result<
tonic::Response<super::RebalanceResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct BrokerAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BrokerAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BrokerAdminServer<T>
where
T: BrokerAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/danube_admin.BrokerAdmin/ListBrokers" => {
#[allow(non_camel_case_types)]
struct ListBrokersSvc<T: BrokerAdmin>(pub Arc<T>);
impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
for ListBrokersSvc<T> {
type Response = super::BrokerListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::list_brokers(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListBrokersSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/GetLeaderBroker" => {
#[allow(non_camel_case_types)]
struct GetLeaderBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
for GetLeaderBrokerSvc<T> {
type Response = super::BrokerResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::get_leader_broker(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetLeaderBrokerSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/ListNamespaces" => {
#[allow(non_camel_case_types)]
struct ListNamespacesSvc<T: BrokerAdmin>(pub Arc<T>);
impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
for ListNamespacesSvc<T> {
type Response = super::NamespaceListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::list_namespaces(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListNamespacesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/UnloadBroker" => {
#[allow(non_camel_case_types)]
struct UnloadBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
impl<
T: BrokerAdmin,
> tonic::server::UnaryService<super::UnloadBrokerRequest>
for UnloadBrokerSvc<T> {
type Response = super::UnloadBrokerResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UnloadBrokerRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::unload_broker(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UnloadBrokerSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/ActivateBroker" => {
#[allow(non_camel_case_types)]
struct ActivateBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
impl<
T: BrokerAdmin,
> tonic::server::UnaryService<super::ActivateBrokerRequest>
for ActivateBrokerSvc<T> {
type Response = super::ActivateBrokerResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ActivateBrokerRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::activate_broker(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ActivateBrokerSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/GetClusterBalance" => {
#[allow(non_camel_case_types)]
struct GetClusterBalanceSvc<T: BrokerAdmin>(pub Arc<T>);
impl<
T: BrokerAdmin,
> tonic::server::UnaryService<super::ClusterBalanceRequest>
for GetClusterBalanceSvc<T> {
type Response = super::ClusterBalanceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ClusterBalanceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::get_cluster_balance(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetClusterBalanceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.BrokerAdmin/TriggerRebalance" => {
#[allow(non_camel_case_types)]
struct TriggerRebalanceSvc<T: BrokerAdmin>(pub Arc<T>);
impl<
T: BrokerAdmin,
> tonic::server::UnaryService<super::RebalanceRequest>
for TriggerRebalanceSvc<T> {
type Response = super::RebalanceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RebalanceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrokerAdmin>::trigger_rebalance(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TriggerRebalanceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for BrokerAdminServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "danube_admin.BrokerAdmin";
impl<T> tonic::server::NamedService for BrokerAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod cluster_admin_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ClusterAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ClusterAdminClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ClusterAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ClusterAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ClusterAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn cluster_status(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<
tonic::Response<super::ClusterStatusResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.ClusterAdmin/ClusterStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.ClusterAdmin", "ClusterStatus"));
self.inner.unary(req, path, codec).await
}
pub async fn add_node(
&mut self,
request: impl tonic::IntoRequest<super::AddNodeRequest>,
) -> std::result::Result<
tonic::Response<super::AddNodeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.ClusterAdmin/AddNode",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.ClusterAdmin", "AddNode"));
self.inner.unary(req, path, codec).await
}
pub async fn promote_node(
&mut self,
request: impl tonic::IntoRequest<super::PromoteNodeRequest>,
) -> std::result::Result<
tonic::Response<super::PromoteNodeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.ClusterAdmin/PromoteNode",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.ClusterAdmin", "PromoteNode"));
self.inner.unary(req, path, codec).await
}
pub async fn remove_node(
&mut self,
request: impl tonic::IntoRequest<super::RemoveNodeRequest>,
) -> std::result::Result<
tonic::Response<super::RemoveNodeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.ClusterAdmin/RemoveNode",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.ClusterAdmin", "RemoveNode"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod cluster_admin_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait ClusterAdmin: std::marker::Send + std::marker::Sync + 'static {
async fn cluster_status(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<
tonic::Response<super::ClusterStatusResponse>,
tonic::Status,
>;
async fn add_node(
&self,
request: tonic::Request<super::AddNodeRequest>,
) -> std::result::Result<tonic::Response<super::AddNodeResponse>, tonic::Status>;
async fn promote_node(
&self,
request: tonic::Request<super::PromoteNodeRequest>,
) -> std::result::Result<
tonic::Response<super::PromoteNodeResponse>,
tonic::Status,
>;
async fn remove_node(
&self,
request: tonic::Request<super::RemoveNodeRequest>,
) -> std::result::Result<
tonic::Response<super::RemoveNodeResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ClusterAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ClusterAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ClusterAdminServer<T>
where
T: ClusterAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/danube_admin.ClusterAdmin/ClusterStatus" => {
#[allow(non_camel_case_types)]
struct ClusterStatusSvc<T: ClusterAdmin>(pub Arc<T>);
impl<T: ClusterAdmin> tonic::server::UnaryService<super::Empty>
for ClusterStatusSvc<T> {
type Response = super::ClusterStatusResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ClusterAdmin>::cluster_status(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ClusterStatusSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.ClusterAdmin/AddNode" => {
#[allow(non_camel_case_types)]
struct AddNodeSvc<T: ClusterAdmin>(pub Arc<T>);
impl<
T: ClusterAdmin,
> tonic::server::UnaryService<super::AddNodeRequest>
for AddNodeSvc<T> {
type Response = super::AddNodeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AddNodeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ClusterAdmin>::add_node(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AddNodeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.ClusterAdmin/PromoteNode" => {
#[allow(non_camel_case_types)]
struct PromoteNodeSvc<T: ClusterAdmin>(pub Arc<T>);
impl<
T: ClusterAdmin,
> tonic::server::UnaryService<super::PromoteNodeRequest>
for PromoteNodeSvc<T> {
type Response = super::PromoteNodeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PromoteNodeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ClusterAdmin>::promote_node(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PromoteNodeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.ClusterAdmin/RemoveNode" => {
#[allow(non_camel_case_types)]
struct RemoveNodeSvc<T: ClusterAdmin>(pub Arc<T>);
impl<
T: ClusterAdmin,
> tonic::server::UnaryService<super::RemoveNodeRequest>
for RemoveNodeSvc<T> {
type Response = super::RemoveNodeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RemoveNodeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ClusterAdmin>::remove_node(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RemoveNodeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for ClusterAdminServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "danube_admin.ClusterAdmin";
impl<T> tonic::server::NamedService for ClusterAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod namespace_admin_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct NamespaceAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl NamespaceAdminClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> NamespaceAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> NamespaceAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
NamespaceAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_namespace_topics(
&mut self,
request: impl tonic::IntoRequest<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::TopicListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.NamespaceAdmin/GetNamespaceTopics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.NamespaceAdmin", "GetNamespaceTopics"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_namespace_policies(
&mut self,
request: impl tonic::IntoRequest<super::NamespaceRequest>,
) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.NamespaceAdmin/GetNamespacePolicies",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_admin.NamespaceAdmin",
"GetNamespacePolicies",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn create_namespace(
&mut self,
request: impl tonic::IntoRequest<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::NamespaceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.NamespaceAdmin/CreateNamespace",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.NamespaceAdmin", "CreateNamespace"),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_namespace(
&mut self,
request: impl tonic::IntoRequest<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::NamespaceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.NamespaceAdmin/DeleteNamespace",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.NamespaceAdmin", "DeleteNamespace"),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod namespace_admin_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait NamespaceAdmin: std::marker::Send + std::marker::Sync + 'static {
async fn get_namespace_topics(
&self,
request: tonic::Request<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::TopicListResponse>,
tonic::Status,
>;
async fn get_namespace_policies(
&self,
request: tonic::Request<super::NamespaceRequest>,
) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status>;
async fn create_namespace(
&self,
request: tonic::Request<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::NamespaceResponse>,
tonic::Status,
>;
async fn delete_namespace(
&self,
request: tonic::Request<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::NamespaceResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct NamespaceAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> NamespaceAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for NamespaceAdminServer<T>
where
T: NamespaceAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/danube_admin.NamespaceAdmin/GetNamespaceTopics" => {
#[allow(non_camel_case_types)]
struct GetNamespaceTopicsSvc<T: NamespaceAdmin>(pub Arc<T>);
impl<
T: NamespaceAdmin,
> tonic::server::UnaryService<super::NamespaceRequest>
for GetNamespaceTopicsSvc<T> {
type Response = super::TopicListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NamespaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as NamespaceAdmin>::get_namespace_topics(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetNamespaceTopicsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.NamespaceAdmin/GetNamespacePolicies" => {
#[allow(non_camel_case_types)]
struct GetNamespacePoliciesSvc<T: NamespaceAdmin>(pub Arc<T>);
impl<
T: NamespaceAdmin,
> tonic::server::UnaryService<super::NamespaceRequest>
for GetNamespacePoliciesSvc<T> {
type Response = super::PolicyResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NamespaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as NamespaceAdmin>::get_namespace_policies(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetNamespacePoliciesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.NamespaceAdmin/CreateNamespace" => {
#[allow(non_camel_case_types)]
struct CreateNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
impl<
T: NamespaceAdmin,
> tonic::server::UnaryService<super::NamespaceRequest>
for CreateNamespaceSvc<T> {
type Response = super::NamespaceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NamespaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as NamespaceAdmin>::create_namespace(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateNamespaceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.NamespaceAdmin/DeleteNamespace" => {
#[allow(non_camel_case_types)]
struct DeleteNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
impl<
T: NamespaceAdmin,
> tonic::server::UnaryService<super::NamespaceRequest>
for DeleteNamespaceSvc<T> {
type Response = super::NamespaceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NamespaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as NamespaceAdmin>::delete_namespace(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteNamespaceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for NamespaceAdminServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "danube_admin.NamespaceAdmin";
impl<T> tonic::server::NamedService for NamespaceAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod topic_admin_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TopicAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TopicAdminClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TopicAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TopicAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TopicAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn list_namespace_topics(
&mut self,
request: impl tonic::IntoRequest<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::TopicInfoListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/ListNamespaceTopics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.TopicAdmin", "ListNamespaceTopics"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_broker_topics(
&mut self,
request: impl tonic::IntoRequest<super::BrokerRequest>,
) -> std::result::Result<
tonic::Response<super::TopicInfoListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/ListBrokerTopics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListBrokerTopics"));
self.inner.unary(req, path, codec).await
}
pub async fn create_topic(
&mut self,
request: impl tonic::IntoRequest<super::NewTopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/CreateTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "CreateTopic"));
self.inner.unary(req, path, codec).await
}
pub async fn create_partitioned_topic(
&mut self,
request: impl tonic::IntoRequest<super::PartitionedTopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/CreatePartitionedTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("danube_admin.TopicAdmin", "CreatePartitionedTopic"),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_topic(
&mut self,
request: impl tonic::IntoRequest<super::TopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/DeleteTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "DeleteTopic"));
self.inner.unary(req, path, codec).await
}
pub async fn unload_topic(
&mut self,
request: impl tonic::IntoRequest<super::TopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/UnloadTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "UnloadTopic"));
self.inner.unary(req, path, codec).await
}
pub async fn list_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::TopicRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/ListSubscriptions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListSubscriptions"));
self.inner.unary(req, path, codec).await
}
pub async fn unsubscribe(
&mut self,
request: impl tonic::IntoRequest<super::SubscriptionRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/Unsubscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "Unsubscribe"));
self.inner.unary(req, path, codec).await
}
pub async fn set_subscription_failure_policy(
&mut self,
request: impl tonic::IntoRequest<super::SetSubscriptionFailurePolicyRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/SetSubscriptionFailurePolicy",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_admin.TopicAdmin",
"SetSubscriptionFailurePolicy",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_subscription_failure_policy(
&mut self,
request: impl tonic::IntoRequest<super::GetSubscriptionFailurePolicyRequest>,
) -> std::result::Result<
tonic::Response<super::GetSubscriptionFailurePolicyResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/GetSubscriptionFailurePolicy",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"danube_admin.TopicAdmin",
"GetSubscriptionFailurePolicy",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn describe_topic(
&mut self,
request: impl tonic::IntoRequest<super::DescribeTopicRequest>,
) -> std::result::Result<
tonic::Response<super::DescribeTopicResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.TopicAdmin/DescribeTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.TopicAdmin", "DescribeTopic"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod topic_admin_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait TopicAdmin: std::marker::Send + std::marker::Sync + 'static {
async fn list_namespace_topics(
&self,
request: tonic::Request<super::NamespaceRequest>,
) -> std::result::Result<
tonic::Response<super::TopicInfoListResponse>,
tonic::Status,
>;
async fn list_broker_topics(
&self,
request: tonic::Request<super::BrokerRequest>,
) -> std::result::Result<
tonic::Response<super::TopicInfoListResponse>,
tonic::Status,
>;
async fn create_topic(
&self,
request: tonic::Request<super::NewTopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
async fn create_partitioned_topic(
&self,
request: tonic::Request<super::PartitionedTopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
async fn delete_topic(
&self,
request: tonic::Request<super::TopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
async fn unload_topic(
&self,
request: tonic::Request<super::TopicRequest>,
) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
async fn list_subscriptions(
&self,
request: tonic::Request<super::TopicRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionListResponse>,
tonic::Status,
>;
async fn unsubscribe(
&self,
request: tonic::Request<super::SubscriptionRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionResponse>,
tonic::Status,
>;
async fn set_subscription_failure_policy(
&self,
request: tonic::Request<super::SetSubscriptionFailurePolicyRequest>,
) -> std::result::Result<
tonic::Response<super::SubscriptionResponse>,
tonic::Status,
>;
async fn get_subscription_failure_policy(
&self,
request: tonic::Request<super::GetSubscriptionFailurePolicyRequest>,
) -> std::result::Result<
tonic::Response<super::GetSubscriptionFailurePolicyResponse>,
tonic::Status,
>;
async fn describe_topic(
&self,
request: tonic::Request<super::DescribeTopicRequest>,
) -> std::result::Result<
tonic::Response<super::DescribeTopicResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct TopicAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TopicAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TopicAdminServer<T>
where
T: TopicAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/danube_admin.TopicAdmin/ListNamespaceTopics" => {
#[allow(non_camel_case_types)]
struct ListNamespaceTopicsSvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<super::NamespaceRequest>
for ListNamespaceTopicsSvc<T> {
type Response = super::TopicInfoListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NamespaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::list_namespace_topics(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListNamespaceTopicsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/ListBrokerTopics" => {
#[allow(non_camel_case_types)]
struct ListBrokerTopicsSvc<T: TopicAdmin>(pub Arc<T>);
impl<T: TopicAdmin> tonic::server::UnaryService<super::BrokerRequest>
for ListBrokerTopicsSvc<T> {
type Response = super::TopicInfoListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::BrokerRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::list_broker_topics(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListBrokerTopicsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/CreateTopic" => {
#[allow(non_camel_case_types)]
struct CreateTopicSvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<super::NewTopicRequest>
for CreateTopicSvc<T> {
type Response = super::TopicResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NewTopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::create_topic(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateTopicSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/CreatePartitionedTopic" => {
#[allow(non_camel_case_types)]
struct CreatePartitionedTopicSvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<super::PartitionedTopicRequest>
for CreatePartitionedTopicSvc<T> {
type Response = super::TopicResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PartitionedTopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::create_partitioned_topic(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreatePartitionedTopicSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/DeleteTopic" => {
#[allow(non_camel_case_types)]
struct DeleteTopicSvc<T: TopicAdmin>(pub Arc<T>);
impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
for DeleteTopicSvc<T> {
type Response = super::TopicResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::delete_topic(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteTopicSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/UnloadTopic" => {
#[allow(non_camel_case_types)]
struct UnloadTopicSvc<T: TopicAdmin>(pub Arc<T>);
impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
for UnloadTopicSvc<T> {
type Response = super::TopicResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::unload_topic(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UnloadTopicSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/ListSubscriptions" => {
#[allow(non_camel_case_types)]
struct ListSubscriptionsSvc<T: TopicAdmin>(pub Arc<T>);
impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
for ListSubscriptionsSvc<T> {
type Response = super::SubscriptionListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::list_subscriptions(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSubscriptionsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/Unsubscribe" => {
#[allow(non_camel_case_types)]
struct UnsubscribeSvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<super::SubscriptionRequest>
for UnsubscribeSvc<T> {
type Response = super::SubscriptionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubscriptionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::unsubscribe(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UnsubscribeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/SetSubscriptionFailurePolicy" => {
#[allow(non_camel_case_types)]
struct SetSubscriptionFailurePolicySvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<
super::SetSubscriptionFailurePolicyRequest,
> for SetSubscriptionFailurePolicySvc<T> {
type Response = super::SubscriptionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::SetSubscriptionFailurePolicyRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::set_subscription_failure_policy(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetSubscriptionFailurePolicySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/GetSubscriptionFailurePolicy" => {
#[allow(non_camel_case_types)]
struct GetSubscriptionFailurePolicySvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<
super::GetSubscriptionFailurePolicyRequest,
> for GetSubscriptionFailurePolicySvc<T> {
type Response = super::GetSubscriptionFailurePolicyResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::GetSubscriptionFailurePolicyRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::get_subscription_failure_policy(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSubscriptionFailurePolicySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.TopicAdmin/DescribeTopic" => {
#[allow(non_camel_case_types)]
struct DescribeTopicSvc<T: TopicAdmin>(pub Arc<T>);
impl<
T: TopicAdmin,
> tonic::server::UnaryService<super::DescribeTopicRequest>
for DescribeTopicSvc<T> {
type Response = super::DescribeTopicResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DescribeTopicRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TopicAdmin>::describe_topic(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DescribeTopicSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TopicAdminServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "danube_admin.TopicAdmin";
impl<T> tonic::server::NamedService for TopicAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod security_admin_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct SecurityAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SecurityAdminClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SecurityAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SecurityAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SecurityAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create_role(
&mut self,
request: impl tonic::IntoRequest<super::CreateRoleRequest>,
) -> std::result::Result<
tonic::Response<super::CreateRoleResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/CreateRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "CreateRole"));
self.inner.unary(req, path, codec).await
}
pub async fn get_role(
&mut self,
request: impl tonic::IntoRequest<super::GetRoleRequest>,
) -> std::result::Result<
tonic::Response<super::GetRoleResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/GetRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "GetRole"));
self.inner.unary(req, path, codec).await
}
pub async fn list_roles(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<
tonic::Response<super::ListRolesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/ListRoles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "ListRoles"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_role(
&mut self,
request: impl tonic::IntoRequest<super::DeleteRoleRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteRoleResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/DeleteRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "DeleteRole"));
self.inner.unary(req, path, codec).await
}
pub async fn create_binding(
&mut self,
request: impl tonic::IntoRequest<super::CreateBindingRequest>,
) -> std::result::Result<
tonic::Response<super::CreateBindingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/CreateBinding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "CreateBinding"));
self.inner.unary(req, path, codec).await
}
pub async fn get_binding(
&mut self,
request: impl tonic::IntoRequest<super::GetBindingRequest>,
) -> std::result::Result<
tonic::Response<super::GetBindingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/GetBinding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "GetBinding"));
self.inner.unary(req, path, codec).await
}
pub async fn list_bindings(
&mut self,
request: impl tonic::IntoRequest<super::ListBindingsRequest>,
) -> std::result::Result<
tonic::Response<super::ListBindingsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/ListBindings",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "ListBindings"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_binding(
&mut self,
request: impl tonic::IntoRequest<super::DeleteBindingRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteBindingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/danube_admin.SecurityAdmin/DeleteBinding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("danube_admin.SecurityAdmin", "DeleteBinding"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod security_admin_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait SecurityAdmin: std::marker::Send + std::marker::Sync + 'static {
async fn create_role(
&self,
request: tonic::Request<super::CreateRoleRequest>,
) -> std::result::Result<
tonic::Response<super::CreateRoleResponse>,
tonic::Status,
>;
async fn get_role(
&self,
request: tonic::Request<super::GetRoleRequest>,
) -> std::result::Result<tonic::Response<super::GetRoleResponse>, tonic::Status>;
async fn list_roles(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<
tonic::Response<super::ListRolesResponse>,
tonic::Status,
>;
async fn delete_role(
&self,
request: tonic::Request<super::DeleteRoleRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteRoleResponse>,
tonic::Status,
>;
async fn create_binding(
&self,
request: tonic::Request<super::CreateBindingRequest>,
) -> std::result::Result<
tonic::Response<super::CreateBindingResponse>,
tonic::Status,
>;
async fn get_binding(
&self,
request: tonic::Request<super::GetBindingRequest>,
) -> std::result::Result<
tonic::Response<super::GetBindingResponse>,
tonic::Status,
>;
async fn list_bindings(
&self,
request: tonic::Request<super::ListBindingsRequest>,
) -> std::result::Result<
tonic::Response<super::ListBindingsResponse>,
tonic::Status,
>;
async fn delete_binding(
&self,
request: tonic::Request<super::DeleteBindingRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteBindingResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SecurityAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SecurityAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SecurityAdminServer<T>
where
T: SecurityAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/danube_admin.SecurityAdmin/CreateRole" => {
#[allow(non_camel_case_types)]
struct CreateRoleSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::CreateRoleRequest>
for CreateRoleSvc<T> {
type Response = super::CreateRoleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CreateRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::create_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/GetRole" => {
#[allow(non_camel_case_types)]
struct GetRoleSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::GetRoleRequest>
for GetRoleSvc<T> {
type Response = super::GetRoleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::get_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/ListRoles" => {
#[allow(non_camel_case_types)]
struct ListRolesSvc<T: SecurityAdmin>(pub Arc<T>);
impl<T: SecurityAdmin> tonic::server::UnaryService<super::Empty>
for ListRolesSvc<T> {
type Response = super::ListRolesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::list_roles(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListRolesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/DeleteRole" => {
#[allow(non_camel_case_types)]
struct DeleteRoleSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::DeleteRoleRequest>
for DeleteRoleSvc<T> {
type Response = super::DeleteRoleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::delete_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/CreateBinding" => {
#[allow(non_camel_case_types)]
struct CreateBindingSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::CreateBindingRequest>
for CreateBindingSvc<T> {
type Response = super::CreateBindingResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CreateBindingRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::create_binding(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateBindingSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/GetBinding" => {
#[allow(non_camel_case_types)]
struct GetBindingSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::GetBindingRequest>
for GetBindingSvc<T> {
type Response = super::GetBindingResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetBindingRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::get_binding(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetBindingSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/ListBindings" => {
#[allow(non_camel_case_types)]
struct ListBindingsSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::ListBindingsRequest>
for ListBindingsSvc<T> {
type Response = super::ListBindingsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListBindingsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::list_bindings(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListBindingsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/danube_admin.SecurityAdmin/DeleteBinding" => {
#[allow(non_camel_case_types)]
struct DeleteBindingSvc<T: SecurityAdmin>(pub Arc<T>);
impl<
T: SecurityAdmin,
> tonic::server::UnaryService<super::DeleteBindingRequest>
for DeleteBindingSvc<T> {
type Response = super::DeleteBindingResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteBindingRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SecurityAdmin>::delete_binding(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteBindingSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for SecurityAdminServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "danube_admin.SecurityAdmin";
impl<T> tonic::server::NamedService for SecurityAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}