@platformatic/kafka 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +270 -0
- package/dist/apis/admin/alter-client-quotas.d.ts +33 -0
- package/dist/apis/admin/alter-client-quotas.js +64 -0
- package/dist/apis/admin/alter-configs.d.ts +26 -0
- package/dist/apis/admin/alter-configs.js +57 -0
- package/dist/apis/admin/alter-partition-reassignments.d.ts +30 -0
- package/dist/apis/admin/alter-partition-reassignments.js +68 -0
- package/dist/apis/admin/alter-partition.d.ts +39 -0
- package/dist/apis/admin/alter-partition.js +87 -0
- package/dist/apis/admin/alter-replica-log-dirs.d.ts +26 -0
- package/dist/apis/admin/alter-replica-log-dirs.js +55 -0
- package/dist/apis/admin/alter-user-scram-credentials.d.ts +27 -0
- package/dist/apis/admin/alter-user-scram-credentials.js +60 -0
- package/dist/apis/admin/consumer-group-describe.d.ts +41 -0
- package/dist/apis/admin/consumer-group-describe.js +103 -0
- package/dist/apis/admin/create-acls.d.ts +24 -0
- package/dist/apis/admin/create-acls.js +55 -0
- package/dist/apis/admin/create-delegation-token.d.ts +24 -0
- package/dist/apis/admin/create-delegation-token.js +54 -0
- package/dist/apis/admin/create-partitions.d.ts +24 -0
- package/dist/apis/admin/create-partitions.js +54 -0
- package/dist/apis/admin/create-topics.d.ts +42 -0
- package/dist/apis/admin/create-topics.js +86 -0
- package/dist/apis/admin/delete-acls.d.ts +36 -0
- package/dist/apis/admin/delete-acls.js +82 -0
- package/dist/apis/admin/delete-groups.d.ts +14 -0
- package/dist/apis/admin/delete-groups.js +40 -0
- package/dist/apis/admin/delete-records.d.ts +27 -0
- package/dist/apis/admin/delete-records.js +59 -0
- package/dist/apis/admin/delete-topics.d.ts +21 -0
- package/dist/apis/admin/delete-topics.js +50 -0
- package/dist/apis/admin/describe-acls.d.ts +25 -0
- package/dist/apis/admin/describe-acls.js +66 -0
- package/dist/apis/admin/describe-client-quotas.d.ts +30 -0
- package/dist/apis/admin/describe-client-quotas.js +57 -0
- package/dist/apis/admin/describe-cluster.d.ts +23 -0
- package/dist/apis/admin/describe-cluster.js +50 -0
- package/dist/apis/admin/describe-configs.d.ts +38 -0
- package/dist/apis/admin/describe-configs.js +85 -0
- package/dist/apis/admin/describe-delegation-token.d.ts +31 -0
- package/dist/apis/admin/describe-delegation-token.js +62 -0
- package/dist/apis/admin/describe-groups.d.ts +28 -0
- package/dist/apis/admin/describe-groups.js +67 -0
- package/dist/apis/admin/describe-log-dirs.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs.js +75 -0
- package/dist/apis/admin/describe-producers.d.ts +33 -0
- package/dist/apis/admin/describe-producers.js +70 -0
- package/dist/apis/admin/describe-quorum.d.ts +50 -0
- package/dist/apis/admin/describe-quorum.js +116 -0
- package/dist/apis/admin/describe-topic-partitions.d.ts +42 -0
- package/dist/apis/admin/describe-topic-partitions.js +94 -0
- package/dist/apis/admin/describe-transactions.d.ts +24 -0
- package/dist/apis/admin/describe-transactions.js +59 -0
- package/dist/apis/admin/describe-user-scram-credentials.d.ts +26 -0
- package/dist/apis/admin/describe-user-scram-credentials.js +62 -0
- package/dist/apis/admin/envelope.d.ts +10 -0
- package/dist/apis/admin/envelope.js +32 -0
- package/dist/apis/admin/expire-delegation-token.d.ts +11 -0
- package/dist/apis/admin/expire-delegation-token.js +29 -0
- package/dist/apis/admin/incremental-alter-configs.d.ts +27 -0
- package/dist/apis/admin/incremental-alter-configs.js +58 -0
- package/dist/apis/admin/index.d.ts +37 -0
- package/dist/apis/admin/index.js +37 -0
- package/dist/apis/admin/list-groups.d.ts +18 -0
- package/dist/apis/admin/list-groups.js +43 -0
- package/dist/apis/admin/list-partition-reassignments.d.ts +27 -0
- package/dist/apis/admin/list-partition-reassignments.js +56 -0
- package/dist/apis/admin/list-transactions.d.ts +18 -0
- package/dist/apis/admin/list-transactions.js +45 -0
- package/dist/apis/admin/offset-delete.d.ts +26 -0
- package/dist/apis/admin/offset-delete.js +59 -0
- package/dist/apis/admin/renew-delegation-token.d.ts +11 -0
- package/dist/apis/admin/renew-delegation-token.js +29 -0
- package/dist/apis/admin/unregister-broker.d.ts +12 -0
- package/dist/apis/admin/unregister-broker.js +28 -0
- package/dist/apis/admin/update-features.d.ts +23 -0
- package/dist/apis/admin/update-features.js +60 -0
- package/dist/apis/consumer/consumer-group-heartbeat.d.ts +27 -0
- package/dist/apis/consumer/consumer-group-heartbeat.js +70 -0
- package/dist/apis/consumer/fetch.d.ts +46 -0
- package/dist/apis/consumer/fetch.js +121 -0
- package/dist/apis/consumer/heartbeat.d.ts +11 -0
- package/dist/apis/consumer/heartbeat.js +34 -0
- package/dist/apis/consumer/index.d.ts +9 -0
- package/dist/apis/consumer/index.js +9 -0
- package/dist/apis/consumer/join-group.d.ts +27 -0
- package/dist/apis/consumer/join-group.js +71 -0
- package/dist/apis/consumer/leave-group.d.ts +22 -0
- package/dist/apis/consumer/leave-group.js +57 -0
- package/dist/apis/consumer/list-offsets.d.ts +30 -0
- package/dist/apis/consumer/list-offsets.js +68 -0
- package/dist/apis/consumer/offset-commit.d.ts +29 -0
- package/dist/apis/consumer/offset-commit.js +68 -0
- package/dist/apis/consumer/offset-fetch.d.ts +37 -0
- package/dist/apis/consumer/offset-fetch.js +81 -0
- package/dist/apis/consumer/sync-group.d.ts +18 -0
- package/dist/apis/consumer/sync-group.js +49 -0
- package/dist/apis/definitions.d.ts +16 -0
- package/dist/apis/definitions.js +12 -0
- package/dist/apis/enumerations.d.ts +114 -0
- package/dist/apis/enumerations.js +78 -0
- package/dist/apis/index.d.ts +8 -0
- package/dist/apis/index.js +10 -0
- package/dist/apis/metadata/api-versions.d.ts +17 -0
- package/dist/apis/metadata/api-versions.js +41 -0
- package/dist/apis/metadata/find-coordinator.d.ts +19 -0
- package/dist/apis/metadata/find-coordinator.js +50 -0
- package/dist/apis/metadata/index.d.ts +3 -0
- package/dist/apis/metadata/index.js +3 -0
- package/dist/apis/metadata/metadata.d.ts +37 -0
- package/dist/apis/metadata/metadata.js +92 -0
- package/dist/apis/producer/add-offsets-to-txn.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn.js +34 -0
- package/dist/apis/producer/add-partitions-to-txn.d.ts +34 -0
- package/dist/apis/producer/add-partitions-to-txn.js +79 -0
- package/dist/apis/producer/end-txn.d.ts +10 -0
- package/dist/apis/producer/end-txn.js +34 -0
- package/dist/apis/producer/index.d.ts +6 -0
- package/dist/apis/producer/index.js +6 -0
- package/dist/apis/producer/init-producer-id.d.ts +21 -0
- package/dist/apis/producer/init-producer-id.js +38 -0
- package/dist/apis/producer/produce.d.ts +29 -0
- package/dist/apis/producer/produce.js +104 -0
- package/dist/apis/producer/txn-offset-commit.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit.js +77 -0
- package/dist/apis/security/index.d.ts +2 -0
- package/dist/apis/security/index.js +2 -0
- package/dist/apis/security/sasl-authenticate.d.ts +15 -0
- package/dist/apis/security/sasl-authenticate.js +30 -0
- package/dist/apis/security/sasl-handshake.d.ts +10 -0
- package/dist/apis/security/sasl-handshake.js +28 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.d.ts +18 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.js +46 -0
- package/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/apis/telemetry/index.js +3 -0
- package/dist/apis/telemetry/list-client-metrics-resources.d.ts +14 -0
- package/dist/apis/telemetry/list-client-metrics-resources.js +32 -0
- package/dist/apis/telemetry/push-telemetry.d.ts +10 -0
- package/dist/apis/telemetry/push-telemetry.js +36 -0
- package/dist/clients/admin/admin.d.ts +18 -0
- package/dist/clients/admin/admin.js +322 -0
- package/dist/clients/admin/index.d.ts +3 -0
- package/dist/clients/admin/index.js +3 -0
- package/dist/clients/admin/options.d.ts +135 -0
- package/dist/clients/admin/options.js +81 -0
- package/dist/clients/admin/types.d.ts +56 -0
- package/dist/clients/admin/types.js +1 -0
- package/dist/clients/base/base.d.ts +48 -0
- package/dist/clients/base/base.js +242 -0
- package/dist/clients/base/index.d.ts +3 -0
- package/dist/clients/base/index.js +3 -0
- package/dist/clients/base/options.d.ts +115 -0
- package/dist/clients/base/options.js +59 -0
- package/dist/clients/base/types.d.ts +38 -0
- package/dist/clients/base/types.js +1 -0
- package/dist/clients/callbacks.d.ts +8 -0
- package/dist/clients/callbacks.js +42 -0
- package/dist/clients/consumer/consumer.d.ts +33 -0
- package/dist/clients/consumer/consumer.js +767 -0
- package/dist/clients/consumer/index.d.ts +5 -0
- package/dist/clients/consumer/index.js +5 -0
- package/dist/clients/consumer/messages-stream.d.ts +56 -0
- package/dist/clients/consumer/messages-stream.js +404 -0
- package/dist/clients/consumer/options.d.ts +521 -0
- package/dist/clients/consumer/options.js +177 -0
- package/dist/clients/consumer/topics-map.d.ts +8 -0
- package/dist/clients/consumer/topics-map.js +48 -0
- package/dist/clients/consumer/types.d.ts +74 -0
- package/dist/clients/consumer/types.js +11 -0
- package/dist/clients/index.d.ts +6 -0
- package/dist/clients/index.js +6 -0
- package/dist/clients/producer/index.d.ts +3 -0
- package/dist/clients/producer/index.js +3 -0
- package/dist/clients/producer/options.d.ts +122 -0
- package/dist/clients/producer/options.js +47 -0
- package/dist/clients/producer/producer.d.ts +13 -0
- package/dist/clients/producer/producer.js +272 -0
- package/dist/clients/producer/types.d.ts +29 -0
- package/dist/clients/producer/types.js +1 -0
- package/dist/clients/serde.d.ts +40 -0
- package/dist/clients/serde.js +49 -0
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +160 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/network/connection-pool.d.ts +11 -0
- package/dist/network/connection-pool.js +101 -0
- package/dist/network/connection.d.ts +49 -0
- package/dist/network/connection.js +319 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +2 -0
- package/dist/protocol/apis.d.ts +2 -0
- package/dist/protocol/apis.js +191 -0
- package/dist/protocol/compression.d.ts +70 -0
- package/dist/protocol/compression.js +114 -0
- package/dist/protocol/crc32c.d.ts +2 -0
- package/dist/protocol/crc32c.js +83 -0
- package/dist/protocol/definitions.d.ts +12 -0
- package/dist/protocol/definitions.js +11 -0
- package/dist/protocol/dynamic-buffer.d.ts +65 -0
- package/dist/protocol/dynamic-buffer.js +557 -0
- package/dist/protocol/errors.d.ts +8 -0
- package/dist/protocol/errors.js +908 -0
- package/dist/protocol/index.d.ts +14 -0
- package/dist/protocol/index.js +14 -0
- package/dist/protocol/murmur2.d.ts +1 -0
- package/dist/protocol/murmur2.js +55 -0
- package/dist/protocol/reader.d.ts +58 -0
- package/dist/protocol/reader.js +296 -0
- package/dist/protocol/records.d.ts +110 -0
- package/dist/protocol/records.js +149 -0
- package/dist/protocol/sasl/plain.d.ts +3 -0
- package/dist/protocol/sasl/plain.js +3 -0
- package/dist/protocol/sasl/scram-sha.d.ts +28 -0
- package/dist/protocol/sasl/scram-sha.js +104 -0
- package/dist/protocol/varint.d.ts +12 -0
- package/dist/protocol/varint.js +36 -0
- package/dist/protocol/writer.d.ts +48 -0
- package/dist/protocol/writer.js +223 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +127 -0
- package/package.json +75 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface DescribeQuorumRequestPartition {
|
|
5
|
+
partitionIndex: number;
|
|
6
|
+
}
|
|
7
|
+
export interface DescribeQuorumRequestTopic {
|
|
8
|
+
topicName: string;
|
|
9
|
+
partitions: DescribeQuorumRequestPartition[];
|
|
10
|
+
}
|
|
11
|
+
export type DescribeQuorumRequest = Parameters<typeof createRequest>;
|
|
12
|
+
export interface DescribeQuorumResponseVoter {
|
|
13
|
+
replicaId: number;
|
|
14
|
+
replicaDirectoryId: string;
|
|
15
|
+
logEndOffset: bigint;
|
|
16
|
+
lastFetchTimestamp: bigint;
|
|
17
|
+
lastCaughtUpTimestamp: bigint;
|
|
18
|
+
}
|
|
19
|
+
export interface DescribeQuorumResponsePartition {
|
|
20
|
+
partitionIndex: number;
|
|
21
|
+
errorCode: number;
|
|
22
|
+
errorMessage: NullableString;
|
|
23
|
+
leaderId: number;
|
|
24
|
+
leaderEpoch: number;
|
|
25
|
+
highWatermark: bigint;
|
|
26
|
+
currentVoters: DescribeQuorumResponseVoter[];
|
|
27
|
+
observers: DescribeQuorumResponseVoter[];
|
|
28
|
+
}
|
|
29
|
+
export interface DescribeQuorumResponseNodeListener {
|
|
30
|
+
name: string;
|
|
31
|
+
host: string;
|
|
32
|
+
port: number;
|
|
33
|
+
}
|
|
34
|
+
export interface DescribeQuorumResponseTopic {
|
|
35
|
+
topicName: string;
|
|
36
|
+
partitions: DescribeQuorumResponsePartition[];
|
|
37
|
+
}
|
|
38
|
+
export interface DescribeQuorumResponseNode {
|
|
39
|
+
nodeId: number;
|
|
40
|
+
listeners: DescribeQuorumResponseNodeListener[];
|
|
41
|
+
}
|
|
42
|
+
export interface DescribeQuorumResponse {
|
|
43
|
+
errorCode: number;
|
|
44
|
+
errorMessage: NullableString;
|
|
45
|
+
topics: DescribeQuorumResponseTopic[];
|
|
46
|
+
nodes: DescribeQuorumResponseNode[];
|
|
47
|
+
}
|
|
48
|
+
export declare function createRequest(topics: DescribeQuorumRequestTopic[]): Writer;
|
|
49
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeQuorumResponse;
|
|
50
|
+
export declare const api: import("../definitions.ts").API<[topics: DescribeQuorumRequestTopic[]], DescribeQuorumResponse>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeQuorum Request (Version: 2) => [topics] TAG_BUFFER
|
|
6
|
+
topics => topic_name [partitions] TAG_BUFFER
|
|
7
|
+
topic_name => COMPACT_STRING
|
|
8
|
+
partitions => partition_index TAG_BUFFER
|
|
9
|
+
partition_index => INT32
|
|
10
|
+
*/
|
|
11
|
+
export function createRequest(topics) {
|
|
12
|
+
return Writer.create()
|
|
13
|
+
.appendArray(topics, (w, t) => {
|
|
14
|
+
w.appendString(t.topicName).appendArray(t.partitions, (w, p) => {
|
|
15
|
+
w.appendInt32(p.partitionIndex);
|
|
16
|
+
});
|
|
17
|
+
})
|
|
18
|
+
.appendTaggedFields();
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
DescribeQuorum Response (Version: 2) => error_code error_message [topics] [nodes] TAG_BUFFER
|
|
22
|
+
error_code => INT16
|
|
23
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
24
|
+
topics => topic_name [partitions] TAG_BUFFER
|
|
25
|
+
topic_name => COMPACT_STRING
|
|
26
|
+
partitions => partition_index error_code error_message leader_id leader_epoch high_watermark [current_voters] [observers] TAG_BUFFER
|
|
27
|
+
partition_index => INT32
|
|
28
|
+
error_code => INT16
|
|
29
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
30
|
+
leader_id => INT32
|
|
31
|
+
leader_epoch => INT32
|
|
32
|
+
high_watermark => INT64
|
|
33
|
+
current_voters => replica_id replica_directory_id log_end_offset last_fetch_timestamp last_caught_up_timestamp TAG_BUFFER
|
|
34
|
+
replica_id => INT32
|
|
35
|
+
replica_directory_id => UUID
|
|
36
|
+
log_end_offset => INT64
|
|
37
|
+
last_fetch_timestamp => INT64
|
|
38
|
+
last_caught_up_timestamp => INT64
|
|
39
|
+
observers => replica_id replica_directory_id log_end_offset last_fetch_timestamp last_caught_up_timestamp TAG_BUFFER
|
|
40
|
+
replica_id => INT32
|
|
41
|
+
replica_directory_id => UUID
|
|
42
|
+
log_end_offset => INT64
|
|
43
|
+
last_fetch_timestamp => INT64
|
|
44
|
+
last_caught_up_timestamp => INT64
|
|
45
|
+
nodes => node_id [listeners] TAG_BUFFER
|
|
46
|
+
node_id => INT32
|
|
47
|
+
listeners => name host port TAG_BUFFER
|
|
48
|
+
name => COMPACT_STRING
|
|
49
|
+
host => COMPACT_STRING
|
|
50
|
+
port => UINT16
|
|
51
|
+
*/
|
|
52
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
53
|
+
const errors = [];
|
|
54
|
+
const errorCode = reader.readInt16();
|
|
55
|
+
if (errorCode !== 0) {
|
|
56
|
+
errors.push(['', errorCode]);
|
|
57
|
+
}
|
|
58
|
+
const response = {
|
|
59
|
+
errorCode,
|
|
60
|
+
errorMessage: reader.readNullableString(),
|
|
61
|
+
topics: reader.readArray((r, i) => {
|
|
62
|
+
return {
|
|
63
|
+
topicName: r.readString(),
|
|
64
|
+
partitions: r.readArray((r, j) => {
|
|
65
|
+
const partition = {
|
|
66
|
+
partitionIndex: r.readInt32(),
|
|
67
|
+
errorCode: r.readInt16(),
|
|
68
|
+
errorMessage: r.readNullableString(),
|
|
69
|
+
leaderId: r.readInt32(),
|
|
70
|
+
leaderEpoch: r.readInt32(),
|
|
71
|
+
highWatermark: r.readInt64(),
|
|
72
|
+
currentVoters: r.readArray(r => {
|
|
73
|
+
return {
|
|
74
|
+
replicaId: r.readInt32(),
|
|
75
|
+
replicaDirectoryId: r.readUUID(),
|
|
76
|
+
logEndOffset: r.readInt64(),
|
|
77
|
+
lastFetchTimestamp: r.readInt64(),
|
|
78
|
+
lastCaughtUpTimestamp: r.readInt64()
|
|
79
|
+
};
|
|
80
|
+
}),
|
|
81
|
+
observers: r.readArray(r => {
|
|
82
|
+
return {
|
|
83
|
+
replicaId: r.readInt32(),
|
|
84
|
+
replicaDirectoryId: r.readUUID(),
|
|
85
|
+
logEndOffset: r.readInt64(),
|
|
86
|
+
lastFetchTimestamp: r.readInt64(),
|
|
87
|
+
lastCaughtUpTimestamp: r.readInt64()
|
|
88
|
+
};
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
if (partition.errorCode !== 0) {
|
|
92
|
+
errors.push([`/topics/${i}/partitions/${j}`, partition.errorCode]);
|
|
93
|
+
}
|
|
94
|
+
return partition;
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
}),
|
|
98
|
+
nodes: reader.readArray(r => {
|
|
99
|
+
return {
|
|
100
|
+
nodeId: r.readInt32(),
|
|
101
|
+
listeners: r.readArray(r => {
|
|
102
|
+
return {
|
|
103
|
+
name: r.readString(),
|
|
104
|
+
host: r.readString(),
|
|
105
|
+
port: r.readUnsignedInt16()
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
})
|
|
110
|
+
};
|
|
111
|
+
if (errors.length) {
|
|
112
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
113
|
+
}
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
export const api = createAPI(55, 2, createRequest, parseResponse);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface DescribeTopicPartitionsRequestTopic {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DescribeTopicPartitionsRequestCursor {
|
|
8
|
+
topicName: string;
|
|
9
|
+
partitionIndex: number;
|
|
10
|
+
}
|
|
11
|
+
export type DescribeTopicPartitionsRequest = Parameters<typeof createRequest>;
|
|
12
|
+
export interface DescribeTopicPartitionsResponsePartition {
|
|
13
|
+
errorCode: number;
|
|
14
|
+
partitionIndex: number;
|
|
15
|
+
leaderId: number;
|
|
16
|
+
leaderEpoch: number;
|
|
17
|
+
replicaNodes: number[];
|
|
18
|
+
isrNodes: number[];
|
|
19
|
+
eligibleLeaderReplicas: number[];
|
|
20
|
+
lastKnownElr: number[];
|
|
21
|
+
offlineReplicas: number[];
|
|
22
|
+
}
|
|
23
|
+
export interface DescribeTopicPartitionsResponseTopic {
|
|
24
|
+
errorCode: number;
|
|
25
|
+
name: NullableString;
|
|
26
|
+
topicId: string;
|
|
27
|
+
isInternal: boolean;
|
|
28
|
+
partitions: DescribeTopicPartitionsResponsePartition[];
|
|
29
|
+
topicAuthorizedOperations: number;
|
|
30
|
+
}
|
|
31
|
+
export interface DescribeTopicPartitionsResponseCursor {
|
|
32
|
+
topicName: string;
|
|
33
|
+
partitionIndex: number;
|
|
34
|
+
}
|
|
35
|
+
export interface DescribeTopicPartitionsResponse {
|
|
36
|
+
throttleTimeMs: number;
|
|
37
|
+
topics: DescribeTopicPartitionsResponseTopic[];
|
|
38
|
+
nextCursor?: DescribeTopicPartitionsResponseCursor;
|
|
39
|
+
}
|
|
40
|
+
export declare function createRequest(topics: DescribeTopicPartitionsRequestTopic[], responsePartitionLimit: number, cursor?: DescribeTopicPartitionsRequestCursor): Writer;
|
|
41
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeTopicPartitionsResponse;
|
|
42
|
+
export declare const api: import("../definitions.ts").API<[topics: DescribeTopicPartitionsRequestTopic[], responsePartitionLimit: number, cursor?: DescribeTopicPartitionsRequestCursor | undefined], DescribeTopicPartitionsResponse>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeTopicPartitions Request (Version: 0) => [topics] response_partition_limit cursor TAG_BUFFER
|
|
6
|
+
topics => name TAG_BUFFER
|
|
7
|
+
name => COMPACT_STRING
|
|
8
|
+
response_partition_limit => INT32
|
|
9
|
+
cursor => topic_name partition_index TAG_BUFFER
|
|
10
|
+
topic_name => COMPACT_STRING
|
|
11
|
+
partition_index => INT32
|
|
12
|
+
*/
|
|
13
|
+
export function createRequest(topics, responsePartitionLimit, cursor) {
|
|
14
|
+
const writer = Writer.create()
|
|
15
|
+
.appendArray(topics, (w, t) => w.appendString(t.name))
|
|
16
|
+
.appendInt32(responsePartitionLimit);
|
|
17
|
+
if (cursor) {
|
|
18
|
+
writer.appendInt8(1).appendString(cursor.topicName).appendInt32(cursor.partitionIndex).appendTaggedFields();
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
writer.appendInt8(-1);
|
|
22
|
+
}
|
|
23
|
+
return writer.appendTaggedFields();
|
|
24
|
+
}
|
|
25
|
+
/*
|
|
26
|
+
DescribeTopicPartitions Response (Version: 0) => throttle_time_ms [topics] next_cursor TAG_BUFFER
|
|
27
|
+
throttle_time_ms => INT32
|
|
28
|
+
topics => error_code name topic_id is_internal [partitions] topic_authorized_operations TAG_BUFFER
|
|
29
|
+
error_code => INT16
|
|
30
|
+
name => COMPACT_NULLABLE_STRING
|
|
31
|
+
topic_id => UUID
|
|
32
|
+
is_internal => BOOLEAN
|
|
33
|
+
partitions => error_code partition_index leader_id leader_epoch [replica_nodes] [isr_nodes] [eligible_leader_replicas] [last_known_elr] [offline_replicas] TAG_BUFFER
|
|
34
|
+
error_code => INT16
|
|
35
|
+
partition_index => INT32
|
|
36
|
+
leader_id => INT32
|
|
37
|
+
leader_epoch => INT32
|
|
38
|
+
replica_nodes => INT32
|
|
39
|
+
isr_nodes => INT32
|
|
40
|
+
eligible_leader_replicas => INT32
|
|
41
|
+
last_known_elr => INT32
|
|
42
|
+
offline_replicas => INT32
|
|
43
|
+
topic_authorized_operations => INT32
|
|
44
|
+
next_cursor => topic_name partition_index TAG_BUFFER
|
|
45
|
+
topic_name => COMPACT_STRING
|
|
46
|
+
partition_index => INT32
|
|
47
|
+
*/
|
|
48
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
49
|
+
const errors = [];
|
|
50
|
+
const response = {
|
|
51
|
+
throttleTimeMs: reader.readInt32(),
|
|
52
|
+
topics: reader.readArray((r, i) => {
|
|
53
|
+
const errorCode = r.readInt16();
|
|
54
|
+
if (errorCode !== 0) {
|
|
55
|
+
errors.push([`/topics/${i}`, errorCode]);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
errorCode,
|
|
59
|
+
name: r.readNullableString(),
|
|
60
|
+
topicId: r.readUUID(),
|
|
61
|
+
isInternal: r.readBoolean(),
|
|
62
|
+
partitions: r.readArray((r, j) => {
|
|
63
|
+
const errorCode = r.readInt16();
|
|
64
|
+
if (errorCode !== 0) {
|
|
65
|
+
errors.push([`/topics/${i}/partitions/${j}`, errorCode]);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
errorCode,
|
|
69
|
+
partitionIndex: r.readInt32(),
|
|
70
|
+
leaderId: r.readInt32(),
|
|
71
|
+
leaderEpoch: r.readInt32(),
|
|
72
|
+
replicaNodes: r.readArray(r => r.readInt32(), true, false),
|
|
73
|
+
isrNodes: r.readArray(r => r.readInt32(), true, false),
|
|
74
|
+
eligibleLeaderReplicas: r.readArray(r => r.readInt32(), true, false),
|
|
75
|
+
lastKnownElr: r.readArray(r => r.readInt32(), true, false),
|
|
76
|
+
offlineReplicas: r.readArray(r => r.readInt32(), true, false)
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
topicAuthorizedOperations: r.readInt32()
|
|
80
|
+
};
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
if (reader.readInt8() === 1) {
|
|
84
|
+
response.nextCursor = {
|
|
85
|
+
topicName: reader.readString(),
|
|
86
|
+
partitionIndex: reader.readInt32()
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (errors.length) {
|
|
90
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
91
|
+
}
|
|
92
|
+
return response;
|
|
93
|
+
}
|
|
94
|
+
export const api = createAPI(75, 0, createRequest, parseResponse);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export type DescribeTransactionsRequest = Parameters<typeof createRequest>;
|
|
4
|
+
export interface DescribeTransactionsResponseTopic {
|
|
5
|
+
topic: string;
|
|
6
|
+
partitions: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface DescribeTransactionsResponseTransactionState {
|
|
9
|
+
errorCode: number;
|
|
10
|
+
transactionalId: string;
|
|
11
|
+
transactionState: string;
|
|
12
|
+
transactionTimeoutMs: number;
|
|
13
|
+
transactionStartTimeMs: bigint;
|
|
14
|
+
producerId: bigint;
|
|
15
|
+
producerEpoch: number;
|
|
16
|
+
topics: DescribeTransactionsResponseTopic[];
|
|
17
|
+
}
|
|
18
|
+
export interface DescribeTransactionsResponse {
|
|
19
|
+
throttleTimeMs: number;
|
|
20
|
+
transactionStates: DescribeTransactionsResponseTransactionState[];
|
|
21
|
+
}
|
|
22
|
+
export declare function createRequest(transactionalIds: string[]): Writer;
|
|
23
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeTransactionsResponse;
|
|
24
|
+
export declare const api: import("../definitions.ts").API<[transactionalIds: string[]], DescribeTransactionsResponse>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeTransactions Request (Version: 0) => [transactional_ids] TAG_BUFFER
|
|
6
|
+
transactional_ids => COMPACT_STRING
|
|
7
|
+
*/
|
|
8
|
+
export function createRequest(transactionalIds) {
|
|
9
|
+
return Writer.create()
|
|
10
|
+
.appendArray(transactionalIds, (w, t) => w.appendString(t), true, false)
|
|
11
|
+
.appendTaggedFields();
|
|
12
|
+
}
|
|
13
|
+
/*
|
|
14
|
+
DescribeTransactions Response (Version: 0) => throttle_time_ms [transaction_states] TAG_BUFFER
|
|
15
|
+
throttle_time_ms => INT32
|
|
16
|
+
transaction_states => error_code transactional_id transaction_state transaction_timeout_ms transaction_start_time_ms producer_id producer_epoch [topics] TAG_BUFFER
|
|
17
|
+
error_code => INT16
|
|
18
|
+
transactional_id => COMPACT_STRING
|
|
19
|
+
transaction_state => COMPACT_STRING
|
|
20
|
+
transaction_timeout_ms => INT32
|
|
21
|
+
transaction_start_time_ms => INT64
|
|
22
|
+
producer_id => INT64
|
|
23
|
+
producer_epoch => INT16
|
|
24
|
+
topics => topic [partitions] TAG_BUFFER
|
|
25
|
+
topic => COMPACT_STRING
|
|
26
|
+
partitions => INT32
|
|
27
|
+
*/
|
|
28
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
29
|
+
const errors = [];
|
|
30
|
+
const response = {
|
|
31
|
+
throttleTimeMs: reader.readInt32(),
|
|
32
|
+
transactionStates: reader.readArray((r, i) => {
|
|
33
|
+
const state = {
|
|
34
|
+
errorCode: r.readInt16(),
|
|
35
|
+
transactionalId: r.readString(),
|
|
36
|
+
transactionState: r.readString(),
|
|
37
|
+
transactionTimeoutMs: r.readInt32(),
|
|
38
|
+
transactionStartTimeMs: r.readInt64(),
|
|
39
|
+
producerId: r.readInt64(),
|
|
40
|
+
producerEpoch: r.readInt16(),
|
|
41
|
+
topics: r.readArray(r => {
|
|
42
|
+
return {
|
|
43
|
+
topic: r.readString(),
|
|
44
|
+
partitions: r.readArray(r => r.readInt32(), true, false)
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
if (state.errorCode !== 0) {
|
|
49
|
+
errors.push([`/transaction_states/${i}`, state.errorCode]);
|
|
50
|
+
}
|
|
51
|
+
return state;
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
if (errors.length) {
|
|
55
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
56
|
+
}
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
export const api = createAPI(65, 0, createRequest, parseResponse);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface DescribeUserScramCredentialsRequestUser {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export type DescribeUserScramCredentialsRequest = Parameters<typeof createRequest>;
|
|
8
|
+
export interface DescribeUserScramCredentialsResponseResultCredentialInfo {
|
|
9
|
+
mechanism: number;
|
|
10
|
+
iterations: number;
|
|
11
|
+
}
|
|
12
|
+
export interface DescribeUserScramCredentialsResponseResult {
|
|
13
|
+
user: string;
|
|
14
|
+
errorCode: number;
|
|
15
|
+
errorMessage: NullableString;
|
|
16
|
+
credentialInfos: DescribeUserScramCredentialsResponseResultCredentialInfo[];
|
|
17
|
+
}
|
|
18
|
+
export interface DescribeUserScramCredentialsResponse {
|
|
19
|
+
throttleTimeMs: number;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
errorMessage: NullableString;
|
|
22
|
+
results: DescribeUserScramCredentialsResponseResult[];
|
|
23
|
+
}
|
|
24
|
+
export declare function createRequest(users: DescribeUserScramCredentialsRequestUser[]): Writer;
|
|
25
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeUserScramCredentialsResponse;
|
|
26
|
+
export declare const api: import("../definitions.ts").API<[users: DescribeUserScramCredentialsRequestUser[]], DescribeUserScramCredentialsResponse>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeUserScramCredentials Request (Version: 0) => [users] TAG_BUFFER
|
|
6
|
+
users => name TAG_BUFFER
|
|
7
|
+
name => COMPACT_STRING
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(users) {
|
|
10
|
+
return Writer.create()
|
|
11
|
+
.appendArray(users, (w, u) => w.appendString(u.name))
|
|
12
|
+
.appendTaggedFields();
|
|
13
|
+
}
|
|
14
|
+
/*
|
|
15
|
+
DescribeUserScramCredentials Response (Version: 0) => throttle_time_ms error_code error_message [results] TAG_BUFFER
|
|
16
|
+
throttle_time_ms => INT32
|
|
17
|
+
error_code => INT16
|
|
18
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
19
|
+
results => user error_code error_message [credential_infos] TAG_BUFFER
|
|
20
|
+
user => COMPACT_STRING
|
|
21
|
+
error_code => INT16
|
|
22
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
23
|
+
credential_infos => mechanism iterations TAG_BUFFER
|
|
24
|
+
mechanism => INT8
|
|
25
|
+
iterations => INT32
|
|
26
|
+
*/
|
|
27
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
28
|
+
const errors = [];
|
|
29
|
+
const throttleTimeMs = reader.readInt32();
|
|
30
|
+
const errorCode = reader.readInt16();
|
|
31
|
+
if (errorCode !== 0) {
|
|
32
|
+
errors.push(['', errorCode]);
|
|
33
|
+
}
|
|
34
|
+
const response = {
|
|
35
|
+
throttleTimeMs,
|
|
36
|
+
errorCode,
|
|
37
|
+
errorMessage: reader.readNullableString(),
|
|
38
|
+
results: reader.readArray((r, i) => {
|
|
39
|
+
const user = r.readString();
|
|
40
|
+
const errorCode = r.readInt16();
|
|
41
|
+
if (errorCode !== 0) {
|
|
42
|
+
errors.push([`/results/${i}`, errorCode]);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
user,
|
|
46
|
+
errorCode,
|
|
47
|
+
errorMessage: r.readNullableString(),
|
|
48
|
+
credentialInfos: r.readArray(r => {
|
|
49
|
+
return {
|
|
50
|
+
mechanism: r.readInt8(),
|
|
51
|
+
iterations: r.readInt32()
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
if (errors.length) {
|
|
58
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
59
|
+
}
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
export const api = createAPI(50, 0, createRequest, parseResponse);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export type EnvelopeRequest = Parameters<typeof createRequest>;
|
|
4
|
+
export interface EnvelopeResponse {
|
|
5
|
+
responseData: Buffer | null;
|
|
6
|
+
errorCode: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createRequest(requestData: Buffer, requestPrincipal: Buffer | undefined | null, clientHostAddress: Buffer): Writer;
|
|
9
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): EnvelopeResponse;
|
|
10
|
+
export declare const api: import("../definitions.ts").API<[requestData: Buffer<ArrayBufferLike>, requestPrincipal: Buffer<ArrayBufferLike> | null | undefined, clientHostAddress: Buffer<ArrayBufferLike>], EnvelopeResponse>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
Envelope Request (Version: 0) => request_data request_principal client_host_address TAG_BUFFER
|
|
6
|
+
request_data => COMPACT_BYTES
|
|
7
|
+
request_principal => COMPACT_NULLABLE_BYTES
|
|
8
|
+
client_host_address => COMPACT_BYTES
|
|
9
|
+
*/
|
|
10
|
+
export function createRequest(requestData, requestPrincipal, clientHostAddress) {
|
|
11
|
+
return Writer.create()
|
|
12
|
+
.appendBytes(requestData)
|
|
13
|
+
.appendBytes(requestPrincipal)
|
|
14
|
+
.appendBytes(clientHostAddress)
|
|
15
|
+
.appendTaggedFields();
|
|
16
|
+
}
|
|
17
|
+
/*
|
|
18
|
+
Envelope Response (Version: 0) => response_data error_code TAG_BUFFER
|
|
19
|
+
response_data => COMPACT_NULLABLE_BYTES
|
|
20
|
+
error_code => INT16
|
|
21
|
+
*/
|
|
22
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
23
|
+
const response = {
|
|
24
|
+
responseData: reader.readNullableBytes(),
|
|
25
|
+
errorCode: reader.readInt16()
|
|
26
|
+
};
|
|
27
|
+
if (response.errorCode) {
|
|
28
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
29
|
+
}
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
32
|
+
export const api = createAPI(58, 0, createRequest, parseResponse);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export type ExpireDelegationTokenRequest = Parameters<typeof createRequest>;
|
|
4
|
+
export interface ExpireDelegationTokenResponse {
|
|
5
|
+
errorCode: number;
|
|
6
|
+
expiryTimestampMs: bigint;
|
|
7
|
+
throttleTimeMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createRequest(hmac: Buffer, expiryTimePeriodMs: bigint): Writer;
|
|
10
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): ExpireDelegationTokenResponse;
|
|
11
|
+
export declare const api: import("../definitions.ts").API<[hmac: Buffer<ArrayBufferLike>, expiryTimePeriodMs: bigint], ExpireDelegationTokenResponse>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
ExpireDelegationToken Request (Version: 2) => hmac expiry_time_period_ms TAG_BUFFER
|
|
6
|
+
hmac => COMPACT_BYTES
|
|
7
|
+
expiry_time_period_ms => INT64
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(hmac, expiryTimePeriodMs) {
|
|
10
|
+
return Writer.create().appendBytes(hmac).appendInt64(expiryTimePeriodMs).appendTaggedFields();
|
|
11
|
+
}
|
|
12
|
+
/*
|
|
13
|
+
ExpireDelegationToken Response (Version: 2) => error_code expiry_timestamp_ms throttle_time_ms TAG_BUFFER
|
|
14
|
+
error_code => INT16
|
|
15
|
+
expiry_timestamp_ms => INT64
|
|
16
|
+
throttle_time_ms => INT32
|
|
17
|
+
*/
|
|
18
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
19
|
+
const response = {
|
|
20
|
+
errorCode: reader.readInt16(),
|
|
21
|
+
expiryTimestampMs: reader.readInt64(),
|
|
22
|
+
throttleTimeMs: reader.readInt32()
|
|
23
|
+
};
|
|
24
|
+
if (response.errorCode !== 0) {
|
|
25
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
26
|
+
}
|
|
27
|
+
return response;
|
|
28
|
+
}
|
|
29
|
+
export const api = createAPI(40, 2, createRequest, parseResponse);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface IncrementalAlterConfigsRequestConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
configOperation: number;
|
|
7
|
+
value?: NullableString;
|
|
8
|
+
}
|
|
9
|
+
export interface IncrementalAlterConfigsRequestResource {
|
|
10
|
+
resourceType: number;
|
|
11
|
+
resourceName: string;
|
|
12
|
+
configs: IncrementalAlterConfigsRequestConfig[];
|
|
13
|
+
}
|
|
14
|
+
export type IncrementalAlterConfigsRequest = Parameters<typeof createRequest>;
|
|
15
|
+
export interface IncrementalAlterConfigsResponseResult {
|
|
16
|
+
errorCode: number;
|
|
17
|
+
errorMessage: NullableString;
|
|
18
|
+
resourceType: number;
|
|
19
|
+
resourceName: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IncrementalAlterConfigsResponse {
|
|
22
|
+
throttleTimeMs: number;
|
|
23
|
+
responses: IncrementalAlterConfigsResponseResult[];
|
|
24
|
+
}
|
|
25
|
+
export declare function createRequest(resources: IncrementalAlterConfigsRequestResource[], validateOnly: boolean): Writer;
|
|
26
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): IncrementalAlterConfigsResponse;
|
|
27
|
+
export declare const api: import("../definitions.ts").API<[resources: IncrementalAlterConfigsRequestResource[], validateOnly: boolean], IncrementalAlterConfigsResponse>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
IncrementalAlterConfigs Request (Version: 1) => [resources] validate_only TAG_BUFFER
|
|
6
|
+
resources => resource_type resource_name [configs] TAG_BUFFER
|
|
7
|
+
resource_type => INT8
|
|
8
|
+
resource_name => COMPACT_STRING
|
|
9
|
+
configs => name config_operation value TAG_BUFFER
|
|
10
|
+
name => COMPACT_STRING
|
|
11
|
+
config_operation => INT8
|
|
12
|
+
value => COMPACT_NULLABLE_STRING
|
|
13
|
+
validate_only => BOOLEAN
|
|
14
|
+
*/
|
|
15
|
+
export function createRequest(resources, validateOnly) {
|
|
16
|
+
return Writer.create()
|
|
17
|
+
.appendArray(resources, (w, r) => {
|
|
18
|
+
w.appendInt8(r.resourceType)
|
|
19
|
+
.appendString(r.resourceName)
|
|
20
|
+
.appendArray(r.configs, (w, r) => {
|
|
21
|
+
w.appendString(r.name).appendInt8(r.configOperation).appendString(r.value);
|
|
22
|
+
});
|
|
23
|
+
})
|
|
24
|
+
.appendBoolean(validateOnly)
|
|
25
|
+
.appendTaggedFields();
|
|
26
|
+
}
|
|
27
|
+
/*
|
|
28
|
+
IncrementalAlterConfigs Response (Version: 1) => throttle_time_ms [responses] TAG_BUFFER
|
|
29
|
+
throttle_time_ms => INT32
|
|
30
|
+
responses => error_code error_message resource_type resource_name TAG_BUFFER
|
|
31
|
+
error_code => INT16
|
|
32
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
33
|
+
resource_type => INT8
|
|
34
|
+
resource_name => COMPACT_STRING
|
|
35
|
+
*/
|
|
36
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
37
|
+
const errors = [];
|
|
38
|
+
const response = {
|
|
39
|
+
throttleTimeMs: reader.readInt32(),
|
|
40
|
+
responses: reader.readArray((r, i) => {
|
|
41
|
+
const errorCode = r.readInt16();
|
|
42
|
+
if (errorCode !== 0) {
|
|
43
|
+
errors.push([`/responses/${i}`, errorCode]);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
errorCode,
|
|
47
|
+
errorMessage: r.readNullableString(),
|
|
48
|
+
resourceType: r.readInt8(),
|
|
49
|
+
resourceName: r.readString()
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
if (errors.length) {
|
|
54
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
55
|
+
}
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
export const api = createAPI(44, 1, createRequest, parseResponse);
|