@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,57 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeClientQuotas Request (Version: 1) => [components] strict TAG_BUFFER
|
|
6
|
+
components => entity_type match_type match TAG_BUFFER
|
|
7
|
+
entity_type => COMPACT_STRING
|
|
8
|
+
match_type => INT8
|
|
9
|
+
match => COMPACT_NULLABLE_STRING
|
|
10
|
+
strict => BOOLEAN
|
|
11
|
+
*/
|
|
12
|
+
export function createRequest(components, strict) {
|
|
13
|
+
return Writer.create()
|
|
14
|
+
.appendArray(components, (w, c) => {
|
|
15
|
+
w.appendString(c.entityType).appendInt8(c.matchType).appendString(c.match);
|
|
16
|
+
})
|
|
17
|
+
.appendBoolean(strict)
|
|
18
|
+
.appendTaggedFields();
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
DescribeClientQuotas Response (Version: 1) => throttle_time_ms error_code error_message [entries] TAG_BUFFER
|
|
22
|
+
throttle_time_ms => INT32
|
|
23
|
+
error_code => INT16
|
|
24
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
25
|
+
entries => [entity] [values] TAG_BUFFER
|
|
26
|
+
entity => entity_type entity_name TAG_BUFFER
|
|
27
|
+
entity_type => COMPACT_STRING
|
|
28
|
+
entity_name => COMPACT_NULLABLE_STRING
|
|
29
|
+
values => key value TAG_BUFFER
|
|
30
|
+
key => COMPACT_STRING
|
|
31
|
+
value => FLOAT64
|
|
32
|
+
*/
|
|
33
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
34
|
+
const response = {
|
|
35
|
+
throttleTimeMs: reader.readInt32(),
|
|
36
|
+
errorCode: reader.readInt16(),
|
|
37
|
+
errorMessage: reader.readNullableString(),
|
|
38
|
+
entries: reader.readArray(r => {
|
|
39
|
+
return {
|
|
40
|
+
entity: r.readArray(r => {
|
|
41
|
+
return { entityType: r.readString(), entityName: r.readNullableString() };
|
|
42
|
+
}),
|
|
43
|
+
values: r.readArray(r => {
|
|
44
|
+
return {
|
|
45
|
+
key: r.readString(),
|
|
46
|
+
value: r.readFloat64()
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
if (response.errorCode !== 0) {
|
|
53
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
export const api = createAPI(48, 1, createRequest, parseResponse);
|
|
@@ -0,0 +1,23 @@
|
|
|
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 type DescribeClusterRequest = Parameters<typeof createRequest>;
|
|
5
|
+
export interface DescribeClusterResponseBroker {
|
|
6
|
+
brokerId: number;
|
|
7
|
+
host: string;
|
|
8
|
+
port: number;
|
|
9
|
+
rack: NullableString;
|
|
10
|
+
}
|
|
11
|
+
export interface DescribeClusterResponse {
|
|
12
|
+
throttleTimeMs: number;
|
|
13
|
+
errorCode: number;
|
|
14
|
+
errorMessage: NullableString;
|
|
15
|
+
endpointType: number;
|
|
16
|
+
clusterId: string;
|
|
17
|
+
controllerId: number;
|
|
18
|
+
brokers: DescribeClusterResponseBroker[];
|
|
19
|
+
clusterAuthorizedOperations: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function createRequest(includeClusterAuthorizedOperations: boolean, endpointType: number): Writer;
|
|
22
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeClusterResponse;
|
|
23
|
+
export declare const api: import("../definitions.ts").API<[includeClusterAuthorizedOperations: boolean, endpointType: number], DescribeClusterResponse>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeCluster Request (Version: 1) => include_cluster_authorized_operations endpoint_type TAG_BUFFER
|
|
6
|
+
include_cluster_authorized_operations => BOOLEAN
|
|
7
|
+
endpoint_type => INT8
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(includeClusterAuthorizedOperations, endpointType) {
|
|
10
|
+
return Writer.create().appendBoolean(includeClusterAuthorizedOperations).appendInt8(endpointType).appendTaggedFields();
|
|
11
|
+
}
|
|
12
|
+
/*
|
|
13
|
+
DescribeCluster Response (Version: 1) => throttle_time_ms error_code error_message endpoint_type cluster_id controller_id [brokers] cluster_authorized_operations TAG_BUFFER
|
|
14
|
+
throttle_time_ms => INT32
|
|
15
|
+
error_code => INT16
|
|
16
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
17
|
+
endpoint_type => INT8
|
|
18
|
+
cluster_id => COMPACT_STRING
|
|
19
|
+
controller_id => INT32
|
|
20
|
+
brokers => broker_id host port rack TAG_BUFFER
|
|
21
|
+
broker_id => INT32
|
|
22
|
+
host => COMPACT_STRING
|
|
23
|
+
port => INT32
|
|
24
|
+
rack => COMPACT_NULLABLE_STRING
|
|
25
|
+
cluster_authorized_operations => INT32
|
|
26
|
+
*/
|
|
27
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
28
|
+
const response = {
|
|
29
|
+
throttleTimeMs: reader.readInt32(),
|
|
30
|
+
errorCode: reader.readInt16(),
|
|
31
|
+
errorMessage: reader.readNullableString(),
|
|
32
|
+
endpointType: reader.readInt8(),
|
|
33
|
+
clusterId: reader.readString(),
|
|
34
|
+
controllerId: reader.readInt32(),
|
|
35
|
+
brokers: reader.readArray(r => {
|
|
36
|
+
return {
|
|
37
|
+
brokerId: r.readInt32(),
|
|
38
|
+
host: r.readString(),
|
|
39
|
+
port: r.readInt32(),
|
|
40
|
+
rack: r.readNullableString()
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
43
|
+
clusterAuthorizedOperations: reader.readInt32()
|
|
44
|
+
};
|
|
45
|
+
if (response.errorCode !== 0) {
|
|
46
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
47
|
+
}
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
50
|
+
export const api = createAPI(60, 1, createRequest, parseResponse);
|
|
@@ -0,0 +1,38 @@
|
|
|
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 DescribeConfigsRequestResource {
|
|
5
|
+
resourceType: number;
|
|
6
|
+
resourceName: string;
|
|
7
|
+
configurationKeys: string[];
|
|
8
|
+
}
|
|
9
|
+
export type DescribeConfigsRequest = Parameters<typeof createRequest>;
|
|
10
|
+
export interface DescribeConfigsResponseSynonym {
|
|
11
|
+
name: string;
|
|
12
|
+
value: NullableString;
|
|
13
|
+
source: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DescribeConfigsResponseConfig {
|
|
16
|
+
name: string;
|
|
17
|
+
value: NullableString;
|
|
18
|
+
readOnly: boolean;
|
|
19
|
+
configSource: number;
|
|
20
|
+
isSensitive: boolean;
|
|
21
|
+
synonyms: DescribeConfigsResponseSynonym[];
|
|
22
|
+
configType: number;
|
|
23
|
+
documentation: NullableString;
|
|
24
|
+
}
|
|
25
|
+
export interface DescribeConfigsResponseResult {
|
|
26
|
+
errorCode: number;
|
|
27
|
+
errorMessage: NullableString;
|
|
28
|
+
resourceType: number;
|
|
29
|
+
resourceName: string;
|
|
30
|
+
configs: DescribeConfigsResponseConfig[];
|
|
31
|
+
}
|
|
32
|
+
export interface DescribeConfigsResponse {
|
|
33
|
+
throttleTimeMs: number;
|
|
34
|
+
results: DescribeConfigsResponseResult[];
|
|
35
|
+
}
|
|
36
|
+
export declare function createRequest(resources: DescribeConfigsRequestResource[], includeSynonyms: boolean, includeDocumentation: boolean): Writer;
|
|
37
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeConfigsResponse;
|
|
38
|
+
export declare const api: import("../definitions.ts").API<[resources: DescribeConfigsRequestResource[], includeSynonyms: boolean, includeDocumentation: boolean], DescribeConfigsResponse>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeConfigs Request (Version: 4) => [resources] include_synonyms include_documentation TAG_BUFFER
|
|
6
|
+
resources => resource_type resource_name [configuration_keys] TAG_BUFFER
|
|
7
|
+
resource_type => INT8
|
|
8
|
+
resource_name => COMPACT_STRING
|
|
9
|
+
configuration_keys => COMPACT_STRING
|
|
10
|
+
include_synonyms => BOOLEAN
|
|
11
|
+
include_documentation => BOOLEAN
|
|
12
|
+
*/
|
|
13
|
+
export function createRequest(resources, includeSynonyms, includeDocumentation) {
|
|
14
|
+
return Writer.create()
|
|
15
|
+
.appendArray(resources, (w, r) => {
|
|
16
|
+
w.appendInt8(r.resourceType)
|
|
17
|
+
.appendString(r.resourceName)
|
|
18
|
+
.appendArray(r.configurationKeys, (w, c) => w.appendString(c), true, false);
|
|
19
|
+
})
|
|
20
|
+
.appendBoolean(includeSynonyms)
|
|
21
|
+
.appendBoolean(includeDocumentation)
|
|
22
|
+
.appendTaggedFields();
|
|
23
|
+
}
|
|
24
|
+
/*
|
|
25
|
+
DescribeConfigs Response (Version: 4) => throttle_time_ms [results] TAG_BUFFER
|
|
26
|
+
throttle_time_ms => INT32
|
|
27
|
+
results => error_code error_message resource_type resource_name [configs] TAG_BUFFER
|
|
28
|
+
error_code => INT16
|
|
29
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
30
|
+
resource_type => INT8
|
|
31
|
+
resource_name => COMPACT_STRING
|
|
32
|
+
configs => name value read_only config_source is_sensitive [synonyms] config_type documentation TAG_BUFFER
|
|
33
|
+
name => COMPACT_STRING
|
|
34
|
+
value => COMPACT_NULLABLE_STRING
|
|
35
|
+
read_only => BOOLEAN
|
|
36
|
+
config_source => INT8
|
|
37
|
+
is_sensitive => BOOLEAN
|
|
38
|
+
synonyms => name value source TAG_BUFFER
|
|
39
|
+
name => COMPACT_STRING
|
|
40
|
+
value => COMPACT_NULLABLE_STRING
|
|
41
|
+
source => INT8
|
|
42
|
+
config_type => INT8
|
|
43
|
+
documentation => COMPACT_NULLABLE_STRING
|
|
44
|
+
*/
|
|
45
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
46
|
+
const errors = [];
|
|
47
|
+
const response = {
|
|
48
|
+
throttleTimeMs: reader.readInt32(),
|
|
49
|
+
results: reader.readArray((r, i) => {
|
|
50
|
+
const errorCode = r.readInt16();
|
|
51
|
+
if (errorCode !== 0) {
|
|
52
|
+
errors.push([`/results/${i}`, errorCode]);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
errorCode,
|
|
56
|
+
errorMessage: r.readNullableString(),
|
|
57
|
+
resourceType: r.readInt8(),
|
|
58
|
+
resourceName: r.readString(),
|
|
59
|
+
configs: r.readArray(r => {
|
|
60
|
+
return {
|
|
61
|
+
name: r.readString(),
|
|
62
|
+
value: r.readNullableString(),
|
|
63
|
+
readOnly: r.readBoolean(),
|
|
64
|
+
configSource: r.readInt8(),
|
|
65
|
+
isSensitive: r.readBoolean(),
|
|
66
|
+
synonyms: r.readArray(r => {
|
|
67
|
+
return {
|
|
68
|
+
name: r.readString(),
|
|
69
|
+
value: r.readNullableString(),
|
|
70
|
+
source: r.readInt8()
|
|
71
|
+
};
|
|
72
|
+
}, true, false),
|
|
73
|
+
configType: r.readInt8(),
|
|
74
|
+
documentation: r.readNullableString()
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
if (errors.length) {
|
|
81
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
82
|
+
}
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
export const api = createAPI(32, 4, createRequest, parseResponse);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export interface DescribeDelegationTokenRequestOwner {
|
|
4
|
+
principalType: string;
|
|
5
|
+
principalName: string;
|
|
6
|
+
}
|
|
7
|
+
export type DescribeDelegationTokenRequest = Parameters<typeof createRequest>;
|
|
8
|
+
export interface DescribeDelegationTokenResponseRenewer {
|
|
9
|
+
principalType: string;
|
|
10
|
+
principalName: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DescribeDelegationTokenResponseToken {
|
|
13
|
+
principalType: string;
|
|
14
|
+
principalName: string;
|
|
15
|
+
tokenRequesterPrincipalType: string;
|
|
16
|
+
tokenRequesterPrincipalName: string;
|
|
17
|
+
issueTimestamp: bigint;
|
|
18
|
+
expiryTimestamp: bigint;
|
|
19
|
+
maxTimestamp: bigint;
|
|
20
|
+
tokenId: string;
|
|
21
|
+
hmac: Buffer;
|
|
22
|
+
renewers: DescribeDelegationTokenResponseRenewer[];
|
|
23
|
+
}
|
|
24
|
+
export interface DescribeDelegationTokenResponse {
|
|
25
|
+
errorCode: number;
|
|
26
|
+
tokens: DescribeDelegationTokenResponseToken[];
|
|
27
|
+
throttleTimeMs: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function createRequest(owners: DescribeDelegationTokenRequestOwner[]): Writer;
|
|
30
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeDelegationTokenResponse;
|
|
31
|
+
export declare const api: import("../definitions.ts").API<[owners: DescribeDelegationTokenRequestOwner[]], DescribeDelegationTokenResponse>;
|
|
@@ -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
|
+
DescribeDelegationToken Request (Version: 3) => [owners] TAG_BUFFER
|
|
6
|
+
owners => principal_type principal_name TAG_BUFFER
|
|
7
|
+
principal_type => COMPACT_STRING
|
|
8
|
+
principal_name => COMPACT_STRING
|
|
9
|
+
*/
|
|
10
|
+
export function createRequest(owners) {
|
|
11
|
+
return Writer.create()
|
|
12
|
+
.appendArray(owners, (w, r) => w.appendString(r.principalType).appendString(r.principalName))
|
|
13
|
+
.appendTaggedFields();
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
DescribeDelegationToken Response (Version: 3) => error_code [tokens] throttle_time_ms TAG_BUFFER
|
|
17
|
+
error_code => INT16
|
|
18
|
+
tokens => principal_type principal_name token_requester_principal_type token_requester_principal_name issue_timestamp expiry_timestamp max_timestamp token_id hmac [renewers] TAG_BUFFER
|
|
19
|
+
principal_type => COMPACT_STRING
|
|
20
|
+
principal_name => COMPACT_STRING
|
|
21
|
+
token_requester_principal_type => COMPACT_STRING
|
|
22
|
+
token_requester_principal_name => COMPACT_STRING
|
|
23
|
+
issue_timestamp => INT64
|
|
24
|
+
expiry_timestamp => INT64
|
|
25
|
+
max_timestamp => INT64
|
|
26
|
+
token_id => COMPACT_STRING
|
|
27
|
+
hmac => COMPACT_BYTES
|
|
28
|
+
renewers => principal_type principal_name TAG_BUFFER
|
|
29
|
+
principal_type => COMPACT_STRING
|
|
30
|
+
principal_name => COMPACT_STRING
|
|
31
|
+
throttle_time_ms => INT32
|
|
32
|
+
*/
|
|
33
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
34
|
+
const response = {
|
|
35
|
+
errorCode: reader.readInt16(),
|
|
36
|
+
tokens: reader.readArray(r => {
|
|
37
|
+
return {
|
|
38
|
+
principalType: r.readString(),
|
|
39
|
+
principalName: r.readString(),
|
|
40
|
+
tokenRequesterPrincipalType: r.readString(),
|
|
41
|
+
tokenRequesterPrincipalName: r.readString(),
|
|
42
|
+
issueTimestamp: r.readInt64(),
|
|
43
|
+
expiryTimestamp: r.readInt64(),
|
|
44
|
+
maxTimestamp: r.readInt64(),
|
|
45
|
+
tokenId: r.readString(),
|
|
46
|
+
hmac: r.readBytes(),
|
|
47
|
+
renewers: r.readArray(r => {
|
|
48
|
+
return {
|
|
49
|
+
principalType: r.readString(),
|
|
50
|
+
principalName: r.readString()
|
|
51
|
+
};
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}),
|
|
55
|
+
throttleTimeMs: reader.readInt32()
|
|
56
|
+
};
|
|
57
|
+
if (response.errorCode !== 0) {
|
|
58
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
59
|
+
}
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
export const api = createAPI(41, 3, createRequest, parseResponse);
|
|
@@ -0,0 +1,28 @@
|
|
|
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 type DescribeGroupsRequest = Parameters<typeof createRequest>;
|
|
5
|
+
export interface DescribeGroupsResponseMember {
|
|
6
|
+
memberId: string;
|
|
7
|
+
groupInstanceId: NullableString;
|
|
8
|
+
clientId: string;
|
|
9
|
+
clientHost: string;
|
|
10
|
+
memberMetadata: Buffer;
|
|
11
|
+
memberAssignment: Buffer;
|
|
12
|
+
}
|
|
13
|
+
export interface DescribeGroupsResponseGroup {
|
|
14
|
+
errorCode: number;
|
|
15
|
+
groupId: string;
|
|
16
|
+
groupState: string;
|
|
17
|
+
protocolType: string;
|
|
18
|
+
protocolData: string;
|
|
19
|
+
members: DescribeGroupsResponseMember[];
|
|
20
|
+
authorizedOperations: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DescribeGroupsResponse {
|
|
23
|
+
throttleTimeMs: number;
|
|
24
|
+
groups: DescribeGroupsResponseGroup[];
|
|
25
|
+
}
|
|
26
|
+
export declare function createRequest(groups: string[], includeAuthorizedOperations: boolean): Writer;
|
|
27
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeGroupsResponse;
|
|
28
|
+
export declare const api: import("../definitions.ts").API<[groups: string[], includeAuthorizedOperations: boolean], DescribeGroupsResponse>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeGroups Request (Version: 5) => [groups] include_authorized_operations TAG_BUFFER
|
|
6
|
+
groups => COMPACT_STRING
|
|
7
|
+
include_authorized_operations => BOOLEAN
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(groups, includeAuthorizedOperations) {
|
|
10
|
+
return Writer.create()
|
|
11
|
+
.appendArray(groups, (w, g) => w.appendString(g), true, false)
|
|
12
|
+
.appendBoolean(includeAuthorizedOperations)
|
|
13
|
+
.appendTaggedFields();
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
DescribeGroups Response (Version: 5) => throttle_time_ms [groups] TAG_BUFFER
|
|
17
|
+
throttle_time_ms => INT32
|
|
18
|
+
groups => error_code group_id group_state protocol_type protocol_data [members] authorized_operations TAG_BUFFER
|
|
19
|
+
error_code => INT16
|
|
20
|
+
group_id => COMPACT_STRING
|
|
21
|
+
group_state => COMPACT_STRING
|
|
22
|
+
protocol_type => COMPACT_STRING
|
|
23
|
+
protocol_data => COMPACT_STRING
|
|
24
|
+
members => member_id group_instance_id client_id client_host member_metadata member_assignment TAG_BUFFER
|
|
25
|
+
member_id => COMPACT_STRING
|
|
26
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
27
|
+
client_id => COMPACT_STRING
|
|
28
|
+
client_host => COMPACT_STRING
|
|
29
|
+
member_metadata => COMPACT_BYTES
|
|
30
|
+
member_assignment => COMPACT_BYTES
|
|
31
|
+
authorized_operations => INT32
|
|
32
|
+
*/
|
|
33
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
34
|
+
const errors = [];
|
|
35
|
+
const response = {
|
|
36
|
+
throttleTimeMs: reader.readInt32(),
|
|
37
|
+
groups: reader.readArray((r, i) => {
|
|
38
|
+
const group = {
|
|
39
|
+
errorCode: r.readInt16(),
|
|
40
|
+
groupId: r.readString(),
|
|
41
|
+
groupState: r.readString(),
|
|
42
|
+
protocolType: r.readString(),
|
|
43
|
+
protocolData: r.readString(),
|
|
44
|
+
members: r.readArray(r => {
|
|
45
|
+
return {
|
|
46
|
+
memberId: r.readString(),
|
|
47
|
+
groupInstanceId: r.readNullableString(),
|
|
48
|
+
clientId: r.readString(),
|
|
49
|
+
clientHost: r.readString(),
|
|
50
|
+
memberMetadata: r.readBytes(),
|
|
51
|
+
memberAssignment: r.readBytes()
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
authorizedOperations: r.readInt32()
|
|
55
|
+
};
|
|
56
|
+
if (group.errorCode !== 0) {
|
|
57
|
+
errors.push([`/groups/${i}`, group.errorCode]);
|
|
58
|
+
}
|
|
59
|
+
return group;
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
if (errors.length) {
|
|
63
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
}
|
|
67
|
+
export const api = createAPI(15, 5, createRequest, parseResponse);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export interface DescribeLogDirsRequestTopic {
|
|
4
|
+
name: string;
|
|
5
|
+
partitions: number[];
|
|
6
|
+
}
|
|
7
|
+
export type DescribeLogDirsRequest = Parameters<typeof createRequest>;
|
|
8
|
+
export interface DescribeLogDirsResponsePartition {
|
|
9
|
+
partitionIndex: number;
|
|
10
|
+
partitionSize: bigint;
|
|
11
|
+
offsetLag: bigint;
|
|
12
|
+
isFutureKey: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface DescribeLogDirsResponseTopic {
|
|
15
|
+
name: string;
|
|
16
|
+
partitions: DescribeLogDirsResponsePartition[];
|
|
17
|
+
}
|
|
18
|
+
export interface DescribeLogDirsResponseResult {
|
|
19
|
+
errorCode: number;
|
|
20
|
+
logDir: string;
|
|
21
|
+
topics: DescribeLogDirsResponseTopic[];
|
|
22
|
+
totalBytes: bigint;
|
|
23
|
+
usableBytes: bigint;
|
|
24
|
+
}
|
|
25
|
+
export interface DescribeLogDirsResponse {
|
|
26
|
+
throttleTimeMs: number;
|
|
27
|
+
errorCode: number;
|
|
28
|
+
results: DescribeLogDirsResponseResult[];
|
|
29
|
+
}
|
|
30
|
+
export declare function createRequest(topics: DescribeLogDirsRequestTopic[]): Writer;
|
|
31
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeLogDirsResponse;
|
|
32
|
+
export declare const api: import("../definitions.ts").API<[topics: DescribeLogDirsRequestTopic[]], DescribeLogDirsResponse>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeLogDirs Request (Version: 4) => [topics] TAG_BUFFER
|
|
6
|
+
topics => topic [partitions] TAG_BUFFER
|
|
7
|
+
topic => COMPACT_STRING
|
|
8
|
+
partitions => INT32
|
|
9
|
+
*/
|
|
10
|
+
export function createRequest(topics) {
|
|
11
|
+
return Writer.create()
|
|
12
|
+
.appendArray(topics, (w, t) => {
|
|
13
|
+
w.appendString(t.name).appendArray(t.partitions, (w, p) => w.appendInt32(p), true, false);
|
|
14
|
+
})
|
|
15
|
+
.appendTaggedFields();
|
|
16
|
+
}
|
|
17
|
+
/*
|
|
18
|
+
DescribeLogDirs Response (Version: 4) => throttle_time_ms error_code [results] TAG_BUFFER
|
|
19
|
+
throttle_time_ms => INT32
|
|
20
|
+
error_code => INT16
|
|
21
|
+
results => error_code log_dir [topics] total_bytes usable_bytes TAG_BUFFER
|
|
22
|
+
error_code => INT16
|
|
23
|
+
log_dir => COMPACT_STRING
|
|
24
|
+
topics => name [partitions] TAG_BUFFER
|
|
25
|
+
name => COMPACT_STRING
|
|
26
|
+
partitions => partition_index partition_size offset_lag is_future_key TAG_BUFFER
|
|
27
|
+
partition_index => INT32
|
|
28
|
+
partition_size => INT64
|
|
29
|
+
offset_lag => INT64
|
|
30
|
+
is_future_key => BOOLEAN
|
|
31
|
+
total_bytes => INT64
|
|
32
|
+
usable_bytes => INT64
|
|
33
|
+
*/
|
|
34
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
35
|
+
const errors = [];
|
|
36
|
+
const throttleTimeMs = reader.readInt32();
|
|
37
|
+
const errorCode = reader.readInt16();
|
|
38
|
+
if (errorCode !== 0) {
|
|
39
|
+
errors.push(['', errorCode]);
|
|
40
|
+
}
|
|
41
|
+
const response = {
|
|
42
|
+
throttleTimeMs,
|
|
43
|
+
errorCode,
|
|
44
|
+
results: reader.readArray((r, i) => {
|
|
45
|
+
const errorCode = r.readInt16();
|
|
46
|
+
if (errorCode !== 0) {
|
|
47
|
+
errors.push([`/results/${i}`, errorCode]);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
errorCode,
|
|
51
|
+
logDir: r.readString(),
|
|
52
|
+
topics: r.readArray(reader => {
|
|
53
|
+
return {
|
|
54
|
+
name: reader.readString(),
|
|
55
|
+
partitions: reader.readArray(reader => {
|
|
56
|
+
return {
|
|
57
|
+
partitionIndex: reader.readInt32(),
|
|
58
|
+
partitionSize: reader.readInt64(),
|
|
59
|
+
offsetLag: reader.readInt64(),
|
|
60
|
+
isFutureKey: reader.readBoolean()
|
|
61
|
+
};
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
}),
|
|
65
|
+
totalBytes: r.readInt64(),
|
|
66
|
+
usableBytes: r.readInt64()
|
|
67
|
+
};
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
if (errors.length) {
|
|
71
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
72
|
+
}
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
export const api = createAPI(35, 4, createRequest, parseResponse);
|
|
@@ -0,0 +1,33 @@
|
|
|
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 DescribeProducersRequestTopic {
|
|
5
|
+
name: string;
|
|
6
|
+
partitionIndexes: number[];
|
|
7
|
+
}
|
|
8
|
+
export type DescribeProducersRequest = Parameters<typeof createRequest>;
|
|
9
|
+
export interface DescribeProducersResponsePartitionProducer {
|
|
10
|
+
producerId: bigint;
|
|
11
|
+
producerEpoch: number;
|
|
12
|
+
lastSequence: number;
|
|
13
|
+
lastTimestamp: bigint;
|
|
14
|
+
coordinatorEpoch: number;
|
|
15
|
+
currentTxnStartOffset: bigint;
|
|
16
|
+
}
|
|
17
|
+
export interface DescribeProducersResponsePartition {
|
|
18
|
+
partitionIndex: number;
|
|
19
|
+
errorCode: number;
|
|
20
|
+
errorMessage: NullableString;
|
|
21
|
+
activeProducers: DescribeProducersResponsePartitionProducer[];
|
|
22
|
+
}
|
|
23
|
+
export interface DescribeProducersResponseTopic {
|
|
24
|
+
name: string;
|
|
25
|
+
partitions: DescribeProducersResponsePartition[];
|
|
26
|
+
}
|
|
27
|
+
export interface DescribeProducersResponse {
|
|
28
|
+
throttleTimeMs: number;
|
|
29
|
+
topics: DescribeProducersResponseTopic[];
|
|
30
|
+
}
|
|
31
|
+
export declare function createRequest(topics: DescribeProducersRequestTopic[]): Writer;
|
|
32
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): DescribeProducersResponse;
|
|
33
|
+
export declare const api: import("../definitions.ts").API<[topics: DescribeProducersRequestTopic[]], DescribeProducersResponse>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
DescribeProducers Request (Version: 0) => [topics] TAG_BUFFER
|
|
6
|
+
topics => name [partition_indexes] TAG_BUFFER
|
|
7
|
+
name => COMPACT_STRING
|
|
8
|
+
partition_indexes => INT32
|
|
9
|
+
*/
|
|
10
|
+
export function createRequest(topics) {
|
|
11
|
+
return Writer.create()
|
|
12
|
+
.appendArray(topics, (w, t) => {
|
|
13
|
+
w.appendString(t.name).appendArray(t.partitionIndexes, (w, p) => w.appendInt32(p), true, false);
|
|
14
|
+
})
|
|
15
|
+
.appendTaggedFields();
|
|
16
|
+
}
|
|
17
|
+
/*
|
|
18
|
+
DescribeProducers Response (Version: 0) => throttle_time_ms [topics] TAG_BUFFER
|
|
19
|
+
throttle_time_ms => INT32
|
|
20
|
+
topics => name [partitions] TAG_BUFFER
|
|
21
|
+
name => COMPACT_STRING
|
|
22
|
+
partitions => partition_index error_code error_message [active_producers] TAG_BUFFER
|
|
23
|
+
partition_index => INT32
|
|
24
|
+
error_code => INT16
|
|
25
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
26
|
+
active_producers => producer_id producer_epoch last_sequence last_timestamp coordinator_epoch current_txn_start_offset TAG_BUFFER
|
|
27
|
+
producer_id => INT64
|
|
28
|
+
producer_epoch => INT32
|
|
29
|
+
last_sequence => INT32
|
|
30
|
+
last_timestamp => INT64
|
|
31
|
+
coordinator_epoch => INT32
|
|
32
|
+
current_txn_start_offset => INT64
|
|
33
|
+
*/
|
|
34
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
35
|
+
const errors = [];
|
|
36
|
+
const response = {
|
|
37
|
+
throttleTimeMs: reader.readInt32(),
|
|
38
|
+
topics: reader.readArray(r => {
|
|
39
|
+
return {
|
|
40
|
+
name: r.readString(),
|
|
41
|
+
partitions: reader.readArray((r, i) => {
|
|
42
|
+
const partition = {
|
|
43
|
+
partitionIndex: r.readInt32(),
|
|
44
|
+
errorCode: r.readInt16(),
|
|
45
|
+
errorMessage: r.readNullableString(),
|
|
46
|
+
activeProducers: r.readArray(r => {
|
|
47
|
+
return {
|
|
48
|
+
producerId: r.readInt64(),
|
|
49
|
+
producerEpoch: r.readInt32(),
|
|
50
|
+
lastSequence: r.readInt32(),
|
|
51
|
+
lastTimestamp: r.readInt64(),
|
|
52
|
+
coordinatorEpoch: r.readInt32(),
|
|
53
|
+
currentTxnStartOffset: r.readInt64()
|
|
54
|
+
};
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
if (partition.errorCode !== 0) {
|
|
58
|
+
errors.push([`/partitions/${i}`, partition.errorCode]);
|
|
59
|
+
}
|
|
60
|
+
return partition;
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
if (errors.length) {
|
|
66
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
67
|
+
}
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
export const api = createAPI(61, 0, createRequest, parseResponse);
|