1 //! Utility functions.
2 
3 use crate::types::RDKafkaError;
4 use crate::types::RDKafkaError::*;
5 use crate::types::RDKafkaRespErr;
6 use crate::types::RDKafkaRespErr::*;
7 
rd_kafka_resp_err_t_to_rdkafka_error(err: RDKafkaRespErr) -> RDKafkaError8 pub fn rd_kafka_resp_err_t_to_rdkafka_error(err: RDKafkaRespErr) -> RDKafkaError {
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__END => End,
69         RD_KAFKA_RESP_ERR_UNKNOWN => Unknown,
70         RD_KAFKA_RESP_ERR_NO_ERROR => NoError,
71         RD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGE => OffsetOutOfRange,
72         RD_KAFKA_RESP_ERR_INVALID_MSG => InvalidMessage,
73         RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART => UnknownTopicOrPartition,
74         RD_KAFKA_RESP_ERR_INVALID_MSG_SIZE => InvalidMessageSize,
75         RD_KAFKA_RESP_ERR_LEADER_NOT_AVAILABLE => LeaderNotAvailable,
76         RD_KAFKA_RESP_ERR_NOT_LEADER_FOR_PARTITION => NotLeaderForPartition,
77         RD_KAFKA_RESP_ERR_REQUEST_TIMED_OUT => RequestTimedOut,
78         RD_KAFKA_RESP_ERR_BROKER_NOT_AVAILABLE => BrokerNotAvailable,
79         RD_KAFKA_RESP_ERR_REPLICA_NOT_AVAILABLE => ReplicaNotAvailable,
80         RD_KAFKA_RESP_ERR_MSG_SIZE_TOO_LARGE => MessageSizeTooLarge,
81         RD_KAFKA_RESP_ERR_STALE_CTRL_EPOCH => StaleControllerEpoch,
82         RD_KAFKA_RESP_ERR_OFFSET_METADATA_TOO_LARGE => OffsetMetadataTooLarge,
83         RD_KAFKA_RESP_ERR_NETWORK_EXCEPTION => NetworkException,
84         RD_KAFKA_RESP_ERR_COORDINATOR_LOAD_IN_PROGRESS => CoordinatorLoadInProgress,
85         RD_KAFKA_RESP_ERR_COORDINATOR_NOT_AVAILABLE => CoordinatorNotAvailable,
86         RD_KAFKA_RESP_ERR_NOT_COORDINATOR => NotCoordinator,
87         RD_KAFKA_RESP_ERR_TOPIC_EXCEPTION => InvalidTopic,
88         RD_KAFKA_RESP_ERR_RECORD_LIST_TOO_LARGE => MessageBatchTooLarge,
89         RD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS => NotEnoughReplicas,
90         RD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS_AFTER_APPEND => NotEnoughReplicasAfterAppend,
91         RD_KAFKA_RESP_ERR_INVALID_REQUIRED_ACKS => InvalidRequiredAcks,
92         RD_KAFKA_RESP_ERR_ILLEGAL_GENERATION => IllegalGeneration,
93         RD_KAFKA_RESP_ERR_INCONSISTENT_GROUP_PROTOCOL => InconsistentGroupProtocol,
94         RD_KAFKA_RESP_ERR_INVALID_GROUP_ID => InvalidGroupId,
95         RD_KAFKA_RESP_ERR_UNKNOWN_MEMBER_ID => UnknownMemberId,
96         RD_KAFKA_RESP_ERR_INVALID_SESSION_TIMEOUT => InvalidSessionTimeout,
97         RD_KAFKA_RESP_ERR_REBALANCE_IN_PROGRESS => RebalanceInProgress,
98         RD_KAFKA_RESP_ERR_INVALID_COMMIT_OFFSET_SIZE => InvalidCommitOffsetSize,
99         RD_KAFKA_RESP_ERR_TOPIC_AUTHORIZATION_FAILED => TopicAuthorizationFailed,
100         RD_KAFKA_RESP_ERR_GROUP_AUTHORIZATION_FAILED => GroupAuthorizationFailed,
101         RD_KAFKA_RESP_ERR_CLUSTER_AUTHORIZATION_FAILED => ClusterAuthorizationFailed,
102         RD_KAFKA_RESP_ERR_INVALID_TIMESTAMP => InvalidTimestamp,
103         RD_KAFKA_RESP_ERR_UNSUPPORTED_SASL_MECHANISM => UnsupportedSASLMechanism,
104         RD_KAFKA_RESP_ERR_ILLEGAL_SASL_STATE => IllegalSASLState,
105         RD_KAFKA_RESP_ERR_UNSUPPORTED_VERSION => UnsupportedVersion,
106         RD_KAFKA_RESP_ERR_TOPIC_ALREADY_EXISTS => TopicAlreadyExists,
107         RD_KAFKA_RESP_ERR_INVALID_PARTITIONS => InvalidPartitions,
108         RD_KAFKA_RESP_ERR_INVALID_REPLICATION_FACTOR => InvalidReplicationFactor,
109         RD_KAFKA_RESP_ERR_INVALID_REPLICA_ASSIGNMENT => InvalidReplicaAssignment,
110         RD_KAFKA_RESP_ERR_INVALID_CONFIG => InvalidConfig,
111         RD_KAFKA_RESP_ERR_NOT_CONTROLLER => NotController,
112         RD_KAFKA_RESP_ERR_INVALID_REQUEST => InvalidRequest,
113         RD_KAFKA_RESP_ERR_UNSUPPORTED_FOR_MESSAGE_FORMAT => UnsupportedForMessageFormat,
114         RD_KAFKA_RESP_ERR_POLICY_VIOLATION => PolicyViolation,
115         RD_KAFKA_RESP_ERR_OUT_OF_ORDER_SEQUENCE_NUMBER => OutOfOrderSequenceNumber,
116         RD_KAFKA_RESP_ERR_DUPLICATE_SEQUENCE_NUMBER => DuplicateSequenceNumber,
117         RD_KAFKA_RESP_ERR_INVALID_PRODUCER_EPOCH => InvalidProducerEpoch,
118         RD_KAFKA_RESP_ERR_INVALID_TXN_STATE => InvalidTransactionalState,
119         RD_KAFKA_RESP_ERR_INVALID_PRODUCER_ID_MAPPING => InvalidProducerIdMapping,
120         RD_KAFKA_RESP_ERR_INVALID_TRANSACTION_TIMEOUT => InvalidTransactionTimeout,
121         RD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONS => ConcurrentTransactions,
122         RD_KAFKA_RESP_ERR_TRANSACTION_COORDINATOR_FENCED => TransactionCoordinatorFenced,
123         RD_KAFKA_RESP_ERR_TRANSACTIONAL_ID_AUTHORIZATION_FAILED => {
124             TransactionalIdAuthorizationFailed
125         }
126         RD_KAFKA_RESP_ERR_SECURITY_DISABLED => SecurityDisabled,
127         RD_KAFKA_RESP_ERR_OPERATION_NOT_ATTEMPTED => OperationNotAttempted,
128         RD_KAFKA_RESP_ERR_KAFKA_STORAGE_ERROR => KafkaStorageError,
129         RD_KAFKA_RESP_ERR_LOG_DIR_NOT_FOUND => LogDirNotFound,
130         RD_KAFKA_RESP_ERR_SASL_AUTHENTICATION_FAILED => SaslAuthenticationFailed,
131         RD_KAFKA_RESP_ERR_UNKNOWN_PRODUCER_ID => UnknownProducerId,
132         RD_KAFKA_RESP_ERR_REASSIGNMENT_IN_PROGRESS => ReassignmentInProgress,
133         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTH_DISABLED => DelegationTokenAuthDisabled,
134         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_NOT_FOUND => DelegationTokenNotFound,
135         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_OWNER_MISMATCH => DelegationTokenOwnerMismatch,
136         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_REQUEST_NOT_ALLOWED => DelegationTokenRequestNotAllowed,
137         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTHORIZATION_FAILED => {
138             DelegationTokenAuthorizationFailed
139         }
140         RD_KAFKA_RESP_ERR_DELEGATION_TOKEN_EXPIRED => DelegationTokenExpired,
141         RD_KAFKA_RESP_ERR_INVALID_PRINCIPAL_TYPE => InvalidPrincipalType,
142         RD_KAFKA_RESP_ERR_NON_EMPTY_GROUP => NonEmptyGroup,
143         RD_KAFKA_RESP_ERR_GROUP_ID_NOT_FOUND => GroupIdNotFound,
144         RD_KAFKA_RESP_ERR_FETCH_SESSION_ID_NOT_FOUND => FetchSessionIdNotFound,
145         RD_KAFKA_RESP_ERR_INVALID_FETCH_SESSION_EPOCH => InvalidFetchSessionEpoch,
146         RD_KAFKA_RESP_ERR_LISTENER_NOT_FOUND => ListenerNotFound,
147         RD_KAFKA_RESP_ERR_TOPIC_DELETION_DISABLED => TopicDeletionDisabled,
148         RD_KAFKA_RESP_ERR_FENCED_LEADER_EPOCH => FencedLeaderEpoch,
149         RD_KAFKA_RESP_ERR_UNKNOWN_LEADER_EPOCH => UnknownLeaderEpoch,
150         RD_KAFKA_RESP_ERR_UNSUPPORTED_COMPRESSION_TYPE => UnsupportedCompressionType,
151         RD_KAFKA_RESP_ERR_STALE_BROKER_EPOCH => StaleBrokerEpoch,
152         RD_KAFKA_RESP_ERR_OFFSET_NOT_AVAILABLE => OffsetNotAvailable,
153         RD_KAFKA_RESP_ERR_MEMBER_ID_REQUIRED => MemberIdRequired,
154         RD_KAFKA_RESP_ERR_PREFERRED_LEADER_NOT_AVAILABLE => PreferredLeaderNotAvailable,
155         RD_KAFKA_RESP_ERR_GROUP_MAX_SIZE_REACHED => GroupMaxSizeReached,
156         RD_KAFKA_RESP_ERR_FENCED_INSTANCE_ID => FencedInstanceId,
157         RD_KAFKA_RESP_ERR_END_ALL => EndAll,
158     }
159 }
160