1use crate::types::RDKafkaErrorCode;
4use crate::types::RDKafkaErrorCode::*;
5use crate::types::RDKafkaRespErr;
6use crate::types::RDKafkaRespErr::*;
7
8pub fn rd_kafka_resp_err_t_to_rdkafka_error(err: RDKafkaRespErr) -> RDKafkaErrorCode {
9 match err {
10 RD_KAFKA_RESP_ERR__BEGIN => Begin,
11 RD_KAFKA_RESP_ERR__BAD_MSG => BadMessage,
12 RD_KAFKA_RESP_ERR__BAD_COMPRESSION => BadCompression,
13 RD_KAFKA_RESP_ERR__DESTROY => BrokerDestroy,
14 RD_KAFKA_RESP_ERR__FAIL => Fail,
15 RD_KAFKA_RESP_ERR__TRANSPORT => BrokerTransportFailure,
16 RD_KAFKA_RESP_ERR__CRIT_SYS_RESOURCE => CriticalSystemResource,
17 RD_KAFKA_RESP_ERR__RESOLVE => Resolve,
18 RD_KAFKA_RESP_ERR__MSG_TIMED_OUT => MessageTimedOut,
19 RD_KAFKA_RESP_ERR__PARTITION_EOF => PartitionEOF,
20 RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION => UnknownPartition,
21 RD_KAFKA_RESP_ERR__FS => FileSystem,
22 RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC => UnknownTopic,
23 RD_KAFKA_RESP_ERR__ALL_BROKERS_DOWN => AllBrokersDown,
24 RD_KAFKA_RESP_ERR__INVALID_ARG => InvalidArgument,
25 RD_KAFKA_RESP_ERR__TIMED_OUT => OperationTimedOut,
26 RD_KAFKA_RESP_ERR__QUEUE_FULL => QueueFull,
27 RD_KAFKA_RESP_ERR__ISR_INSUFF => ISRInsufficient,
28 RD_KAFKA_RESP_ERR__NODE_UPDATE => NodeUpdate,
29 RD_KAFKA_RESP_ERR__SSL => SSL,
30 RD_KAFKA_RESP_ERR__WAIT_COORD => WaitingForCoordinator,
31 RD_KAFKA_RESP_ERR__UNKNOWN_GROUP => UnknownGroup,
32 RD_KAFKA_RESP_ERR__IN_PROGRESS => InProgress,
33 RD_KAFKA_RESP_ERR__PREV_IN_PROGRESS => PreviousInProgress,
34 RD_KAFKA_RESP_ERR__EXISTING_SUBSCRIPTION => ExistingSubscription,
35 RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS => AssignPartitions,
36 RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS => RevokePartitions,
37 RD_KAFKA_RESP_ERR__CONFLICT => Conflict,
38 RD_KAFKA_RESP_ERR__STATE => State,
39 RD_KAFKA_RESP_ERR__UNKNOWN_PROTOCOL => UnknownProtocol,
40 RD_KAFKA_RESP_ERR__NOT_IMPLEMENTED => NotImplemented,
41 RD_KAFKA_RESP_ERR__AUTHENTICATION => Authentication,
42 RD_KAFKA_RESP_ERR__NO_OFFSET => NoOffset,
43 RD_KAFKA_RESP_ERR__OUTDATED => Outdated,
44 RD_KAFKA_RESP_ERR__TIMED_OUT_QUEUE => TimedOutQueue,
45 RD_KAFKA_RESP_ERR__UNSUPPORTED_FEATURE => UnsupportedFeature,
46 RD_KAFKA_RESP_ERR__WAIT_CACHE => WaitCache,
47 RD_KAFKA_RESP_ERR__INTR => Interrupted,
48 RD_KAFKA_RESP_ERR__KEY_SERIALIZATION => KeySerialization,
49 RD_KAFKA_RESP_ERR__VALUE_SERIALIZATION => ValueSerialization,
50 RD_KAFKA_RESP_ERR__KEY_DESERIALIZATION => KeyDeserialization,
51 RD_KAFKA_RESP_ERR__VALUE_DESERIALIZATION => ValueDeserialization,
52 RD_KAFKA_RESP_ERR__PARTIAL => Partial,
53 RD_KAFKA_RESP_ERR__READ_ONLY => ReadOnly,
54 RD_KAFKA_RESP_ERR__NOENT => NoEnt,
55 RD_KAFKA_RESP_ERR__UNDERFLOW => Underflow,
56 RD_KAFKA_RESP_ERR__INVALID_TYPE => InvalidType,
57 RD_KAFKA_RESP_ERR__RETRY => Retry,
58 RD_KAFKA_RESP_ERR__PURGE_QUEUE => PurgeQueue,
59 RD_KAFKA_RESP_ERR__PURGE_INFLIGHT => PurgeInflight,
60 RD_KAFKA_RESP_ERR__FATAL => Fatal,
61 RD_KAFKA_RESP_ERR__INCONSISTENT => Inconsistent,
62 RD_KAFKA_RESP_ERR__GAPLESS_GUARANTEE => GaplessGuarantee,
63 RD_KAFKA_RESP_ERR__MAX_POLL_EXCEEDED => PollExceeded,
64 RD_KAFKA_RESP_ERR__UNKNOWN_BROKER => UnknownBroker,
65 RD_KAFKA_RESP_ERR__NOT_CONFIGURED => NotConfigured,
66 RD_KAFKA_RESP_ERR__FENCED => Fenced,
67 RD_KAFKA_RESP_ERR__APPLICATION => Application,
68 RD_KAFKA_RESP_ERR__ASSIGNMENT_LOST => AssignmentLost,
69 RD_KAFKA_RESP_ERR__NOOP => Noop,
70 RD_KAFKA_RESP_ERR__AUTO_OFFSET_RESET => AutoOffsetReset,
71 RD_KAFKA_RESP_ERR__LOG_TRUNCATION => LogTruncation,
72 RD_KAFKA_RESP_ERR__INVALID_DIFFERENT_RECORD => InvalidDifferentRecord,
73 RD_KAFKA_RESP_ERR__END => End,
74 RD_KAFKA_RESP_ERR_UNKNOWN => Unknown,
75 RD_KAFKA_RESP_ERR_NO_ERROR => NoError,
76 RD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGE => OffsetOutOfRange,
77 RD_KAFKA_RESP_ERR_INVALID_MSG => InvalidMessage,
78 RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART => UnknownTopicOrPartition,
79 RD_KAFKA_RESP_ERR_INVALID_MSG_SIZE => InvalidMessageSize,
80 RD_KAFKA_RESP_ERR_LEADER_NOT_AVAILABLE => LeaderNotAvailable,
81 RD_KAFKA_RESP_ERR_NOT_LEADER_FOR_PARTITION => NotLeaderForPartition,
82 RD_KAFKA_RESP_ERR_REQUEST_TIMED_OUT => RequestTimedOut,
83 RD_KAFKA_RESP_ERR_BROKER_NOT_AVAILABLE => BrokerNotAvailable,
84 RD_KAFKA_RESP_ERR_REPLICA_NOT_AVAILABLE => ReplicaNotAvailable,
85 RD_KAFKA_RESP_ERR_MSG_SIZE_TOO_LARGE => MessageSizeTooLarge,
86 RD_KAFKA_RESP_ERR_STALE_CTRL_EPOCH => StaleControllerEpoch,
87 RD_KAFKA_RESP_ERR_OFFSET_METADATA_TOO_LARGE => OffsetMetadataTooLarge,
88 RD_KAFKA_RESP_ERR_NETWORK_EXCEPTION => NetworkException,
89 RD_KAFKA_RESP_ERR_COORDINATOR_LOAD_IN_PROGRESS => CoordinatorLoadInProgress,
90 RD_KAFKA_RESP_ERR_COORDINATOR_NOT_AVAILABLE => CoordinatorNotAvailable,
91 RD_KAFKA_RESP_ERR_NOT_COORDINATOR => NotCoordinator,
92 RD_KAFKA_RESP_ERR_TOPIC_EXCEPTION => InvalidTopic,
93 RD_KAFKA_RESP_ERR_RECORD_LIST_TOO_LARGE => MessageBatchTooLarge,
94 RD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS => NotEnoughReplicas,
95 RD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS_AFTER_APPEND => NotEnoughReplicasAfterAppend,
96 RD_KAFKA_RESP_ERR_INVALID_REQUIRED_ACKS => InvalidRequiredAcks,
97 RD_KAFKA_RESP_ERR_ILLEGAL_GENERATION => IllegalGeneration,
98 RD_KAFKA_RESP_ERR_INCONSISTENT_GROUP_PROTOCOL => InconsistentGroupProtocol,
99 RD_KAFKA_RESP_ERR_INVALID_GROUP_ID => InvalidGroupId,
100 RD_KAFKA_RESP_ERR_UNKNOWN_MEMBER_ID => UnknownMemberId,
101 RD_KAFKA_RESP_ERR_INVALID_SESSION_TIMEOUT => InvalidSessionTimeout,
102 RD_KAFKA_RESP_ERR_REBALANCE_IN_PROGRESS => RebalanceInProgress,
103 RD_KAFKA_RESP_ERR_INVALID_COMMIT_OFFSET_SIZE => InvalidCommitOffsetSize,
104 RD_KAFKA_RESP_ERR_TOPIC_AUTHORIZATION_FAILED => TopicAuthorizationFailed,
105 RD_KAFKA_RESP_ERR_GROUP_AUTHORIZATION_FAILED => GroupAuthorizationFailed,
106 RD_KAFKA_RESP_ERR_CLUSTER_AUTHORIZATION_FAILED => ClusterAuthorizationFailed,
107 RD_KAFKA_RESP_ERR_INVALID_TIMESTAMP => InvalidTimestamp,
108 RD_KAFKA_RESP_ERR_UNSUPPORTED_SASL_MECHANISM => UnsupportedSASLMechanism,
109 RD_KAFKA_RESP_ERR_ILLEGAL_SASL_STATE => IllegalSASLState,
110 RD_KAFKA_RESP_ERR_UNSUPPORTED_VERSION => UnsupportedVersion,
111 RD_KAFKA_RESP_ERR_TOPIC_ALREADY_EXISTS => TopicAlreadyExists,
112 RD_KAFKA_RESP_ERR_INVALID_PARTITIONS => InvalidPartitions,
113 RD_KAFKA_RESP_ERR_INVALID_REPLICATION_FACTOR => InvalidReplicationFactor,
114 RD_KAFKA_RESP_ERR_INVALID_REPLICA_ASSIGNMENT => InvalidReplicaAssignment,
115 RD_KAFKA_RESP_ERR_INVALID_CONFIG => InvalidConfig,
116 RD_KAFKA_RESP_ERR_NOT_CONTROLLER => NotController,
117 RD_KAFKA_RESP_ERR_INVALID_REQUEST => InvalidRequest,
118 RD_KAFKA_RESP_ERR_UNSUPPORTED_FOR_MESSAGE_FORMAT => UnsupportedForMessageFormat,
119 RD_KAFKA_RESP_ERR_POLICY_VIOLATION => PolicyViolation,
120 RD_KAFKA_RESP_ERR_OUT_OF_ORDER_SEQUENCE_NUMBER => OutOfOrderSequenceNumber,
121 RD_KAFKA_RESP_ERR_DUPLICATE_SEQUENCE_NUMBER => DuplicateSequenceNumber,
122 RD_KAFKA_RESP_ERR_INVALID_PRODUCER_EPOCH => InvalidProducerEpoch,
123 RD_KAFKA_RESP_ERR_INVALID_TXN_STATE => InvalidTransactionalState,
124 RD_KAFKA_RESP_ERR_INVALID_PRODUCER_ID_MAPPING => InvalidProducerIdMapping,
125 RD_KAFKA_RESP_ERR_INVALID_TRANSACTION_TIMEOUT => InvalidTransactionTimeout,
126 RD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONS => ConcurrentTransactions,
127 RD_KAFKA_RESP_ERR_TRANSACTION_COORDINATOR_FENCED => TransactionCoordinatorFenced,
128 RD_KAFKA_RESP_ERR_TRANSACTIONAL_ID_AUTHORIZATION_FAILED => {
129 TransactionalIdAuthorizationFailed
130 }
131 RD_KAFKA_RESP_ERR_SECURITY_DISABLED => SecurityDisabled,
132 RD_KAFKA_RESP_ERR_OPERATION_NOT_ATTEMPTED => OperationNotAttempted,
133 RD_KAFKA_RESP_ERR_KAFKA_STORAGE_ERROR => KafkaStorageError,
134 RD_KAFKA_RESP_ERR_LOG_DIR_NOT_FOUND => LogDirNotFound,
135 RD_KAFKA_RESP_ERR_SASL_AUTHENTICATION_FAILED => SaslAuthenticationFailed,
136 RD_KAFKA_RESP_ERR_UNKNOWN_PRODUCER_ID => UnknownProducerId,
137 RD_KAFKA_RESP_ERR_REASSIGNMENT_IN_PROGRESS => ReassignmentInProgress,
138 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTH_DISABLED => DelegationTokenAuthDisabled,
139 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_NOT_FOUND => DelegationTokenNotFound,
140 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_OWNER_MISMATCH => DelegationTokenOwnerMismatch,
141 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_REQUEST_NOT_ALLOWED => DelegationTokenRequestNotAllowed,
142 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTHORIZATION_FAILED => {
143 DelegationTokenAuthorizationFailed
144 }
145 RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_EXPIRED => DelegationTokenExpired,
146 RD_KAFKA_RESP_ERR_INVALID_PRINCIPAL_TYPE => InvalidPrincipalType,
147 RD_KAFKA_RESP_ERR_NON_EMPTY_GROUP => NonEmptyGroup,
148 RD_KAFKA_RESP_ERR_GROUP_ID_NOT_FOUND => GroupIdNotFound,
149 RD_KAFKA_RESP_ERR_FETCH_SESSION_ID_NOT_FOUND => FetchSessionIdNotFound,
150 RD_KAFKA_RESP_ERR_INVALID_FETCH_SESSION_EPOCH => InvalidFetchSessionEpoch,
151 RD_KAFKA_RESP_ERR_LISTENER_NOT_FOUND => ListenerNotFound,
152 RD_KAFKA_RESP_ERR_TOPIC_DELETION_DISABLED => TopicDeletionDisabled,
153 RD_KAFKA_RESP_ERR_FENCED_LEADER_EPOCH => FencedLeaderEpoch,
154 RD_KAFKA_RESP_ERR_UNKNOWN_LEADER_EPOCH => UnknownLeaderEpoch,
155 RD_KAFKA_RESP_ERR_UNSUPPORTED_COMPRESSION_TYPE => UnsupportedCompressionType,
156 RD_KAFKA_RESP_ERR_STALE_BROKER_EPOCH => StaleBrokerEpoch,
157 RD_KAFKA_RESP_ERR_OFFSET_NOT_AVAILABLE => OffsetNotAvailable,
158 RD_KAFKA_RESP_ERR_MEMBER_ID_REQUIRED => MemberIdRequired,
159 RD_KAFKA_RESP_ERR_PREFERRED_LEADER_NOT_AVAILABLE => PreferredLeaderNotAvailable,
160 RD_KAFKA_RESP_ERR_GROUP_MAX_SIZE_REACHED => GroupMaxSizeReached,
161 RD_KAFKA_RESP_ERR_FENCED_INSTANCE_ID => FencedInstanceId,
162 RD_KAFKA_RESP_ERR_ELIGIBLE_LEADERS_NOT_AVAILABLE => EligibleLeadersNotAvailable,
163 RD_KAFKA_RESP_ERR_ELECTION_NOT_NEEDED => ElectionNotNeeded,
164 RD_KAFKA_RESP_ERR_NO_REASSIGNMENT_IN_PROGRESS => NoReassignmentInProgress,
165 RD_KAFKA_RESP_ERR_GROUP_SUBSCRIBED_TO_TOPIC => GroupSubscribedToTopic,
166 RD_KAFKA_RESP_ERR_INVALID_RECORD => InvalidRecord,
167 RD_KAFKA_RESP_ERR_UNSTABLE_OFFSET_COMMIT => UnstableOffsetCommit,
168 RD_KAFKA_RESP_ERR_THROTTLING_QUOTA_EXCEEDED => ThrottlingQuotaExceeded,
169 RD_KAFKA_RESP_ERR_PRODUCER_FENCED => ProducerFenced,
170 RD_KAFKA_RESP_ERR_RESOURCE_NOT_FOUND => ResourceNotFound,
171 RD_KAFKA_RESP_ERR_DUPLICATE_RESOURCE => DuplicateResource,
172 RD_KAFKA_RESP_ERR_UNACCEPTABLE_CREDENTIAL => UnacceptableCredential,
173 RD_KAFKA_RESP_ERR_INCONSISTENT_VOTER_SET => InconsistentVoterSet,
174 RD_KAFKA_RESP_ERR_INVALID_UPDATE_VERSION => InvalidUpdateVersion,
175 RD_KAFKA_RESP_ERR_FEATURE_UPDATE_FAILED => FeatureUpdateFailed,
176 RD_KAFKA_RESP_ERR_PRINCIPAL_DESERIALIZATION_FAILURE => PrincipalDeserializationFailure,
177 RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_ID => UnknownTopicId,
178 RD_KAFKA_RESP_ERR_FENCED_MEMBER_EPOCH => FencedMemberEpoch,
179 RD_KAFKA_RESP_ERR_UNRELEASED_INSTANCE_ID => UnreleasedInstanceId,
180 RD_KAFKA_RESP_ERR_UNSUPPORTED_ASSIGNOR => UnsupportedAssignor,
181 RD_KAFKA_RESP_ERR_STALE_MEMBER_EPOCH => StaleMemberEpoch,
182 RD_KAFKA_RESP_ERR_UNKNOWN_SUBSCRIPTION_ID => UnknownSubscriptionId,
183 RD_KAFKA_RESP_ERR_TELEMETRY_TOO_LARGE => TelemetryTooLarge,
184 RD_KAFKA_RESP_ERR_END_ALL => EndAll,
185 }
186}