mod translate;
use core::fmt;
pub(crate) use translate::translate_terminal;
use super::ConsumerGroupDescription;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DescribeConsumerGroupsDeliveryStatus {
NotSent,
PossiblySent,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ConsumerGroupBrokerError {
pub(super) code: i16,
pub(super) message: Option<String>,
pub(super) message_truncated: bool,
}
impl ConsumerGroupBrokerError {
pub fn into_parts(self) -> (i16, Option<String>, bool) {
(self.code, self.message, self.message_truncated)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ConsumerGroupDescriptionError {
Broker(ConsumerGroupBrokerError),
Operation(DescribeConsumerGroupsFailure),
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ConsumerGroupDescriptionResult {
pub(super) group_id: String,
pub(super) result: Result<ConsumerGroupDescription, ConsumerGroupDescriptionError>,
}
impl ConsumerGroupDescriptionResult {
pub fn into_parts(
self,
) -> (
String,
Result<ConsumerGroupDescription, ConsumerGroupDescriptionError>,
) {
(self.group_id, self.result)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DescribeConsumerGroupsBatch {
pub(super) throttle_time_ms: u32,
pub(super) groups: Vec<ConsumerGroupDescriptionResult>,
}
impl DescribeConsumerGroupsBatch {
pub fn into_parts(self) -> (u32, Vec<ConsumerGroupDescriptionResult>) {
(self.throttle_time_ms, self.groups)
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DescribeConsumerGroupsFailureKind {
DeadlineElapsed,
DriverRejected,
Transport,
ResponseTooLarge,
Compatibility,
InvalidResponse,
NotAttempted,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct DescribeConsumerGroupsFailure {
pub(super) kind: DescribeConsumerGroupsFailureKind,
pub(super) delivery: DescribeConsumerGroupsDeliveryStatus,
}
impl DescribeConsumerGroupsFailure {
pub const fn kind(self) -> DescribeConsumerGroupsFailureKind {
self.kind
}
pub const fn delivery(self) -> DescribeConsumerGroupsDeliveryStatus {
self.delivery
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum DescribeConsumerGroupsOutcome {
Groups(DescribeConsumerGroupsBatch),
Failed(DescribeConsumerGroupsFailure),
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DescribeConsumerGroupsObserverError {
AlreadyObserved,
Stale,
}
impl fmt::Display for DescribeConsumerGroupsObserverError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(match self {
Self::AlreadyObserved => "DescribeConsumerGroups result was already observed",
Self::Stale => "DescribeConsumerGroups observer is stale",
})
}
}
impl std::error::Error for DescribeConsumerGroupsObserverError {}