@platformatic/kafka 1.17.0 → 1.18.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/dist/apis/admin/alter-client-quotas-v1.d.ts +11 -5
- package/dist/apis/admin/alter-client-quotas-v1.js +3 -1
- package/dist/apis/admin/describe-client-quotas-v0.d.ts +12 -6
- package/dist/apis/admin/describe-client-quotas-v0.js +1 -0
- package/dist/apis/callbacks.d.ts +1 -0
- package/dist/apis/callbacks.js +15 -1
- package/dist/apis/consumer/consumer-group-heartbeat-v0.d.ts +1 -1
- package/dist/apis/consumer/consumer-group-heartbeat-v0.js +8 -10
- package/dist/apis/enumerations.d.ts +18 -1
- package/dist/apis/enumerations.js +8 -0
- package/dist/clients/admin/admin.d.ts +9 -1
- package/dist/clients/admin/admin.js +136 -2
- package/dist/clients/admin/options.d.ts +149 -0
- package/dist/clients/admin/options.js +109 -1
- package/dist/clients/admin/types.d.ts +19 -0
- package/dist/clients/base/base.js +3 -1
- package/dist/clients/consumer/consumer.d.ts +5 -1
- package/dist/clients/consumer/consumer.js +328 -22
- package/dist/clients/consumer/messages-stream.d.ts +14 -0
- package/dist/clients/consumer/messages-stream.js +63 -9
- package/dist/clients/consumer/options.d.ts +77 -2
- package/dist/clients/consumer/options.js +19 -1
- package/dist/clients/consumer/types.d.ts +10 -3
- package/dist/clients/metrics.d.ts +10 -3
- package/dist/diagnostic.d.ts +9 -2
- package/dist/diagnostic.js +11 -2
- package/dist/protocol/reader.d.ts +1 -0
- package/dist/protocol/reader.js +6 -0
- package/dist/symbols.d.ts +2 -0
- package/dist/symbols.js +2 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
2
|
import { type Reader } from '../../protocol/reader.ts';
|
|
3
3
|
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
import { type ClientQuotaEntityType, type ClientQuotaKey } from '../enumerations.ts';
|
|
4
5
|
export interface AlterClientQuotasRequestEntity {
|
|
5
|
-
entityType:
|
|
6
|
-
entityName
|
|
6
|
+
entityType: ClientQuotaEntityType;
|
|
7
|
+
entityName?: NullableString;
|
|
7
8
|
}
|
|
8
|
-
export interface
|
|
9
|
-
key:
|
|
9
|
+
export interface AlterClientQuotaRequestOpAddition {
|
|
10
|
+
key: ClientQuotaKey;
|
|
10
11
|
value: number;
|
|
11
|
-
remove:
|
|
12
|
+
remove: false;
|
|
13
|
+
}
|
|
14
|
+
export interface AlterClientQuotaRequestOpRemoval {
|
|
15
|
+
key: ClientQuotaKey;
|
|
16
|
+
remove: true;
|
|
12
17
|
}
|
|
18
|
+
export type AlterClientQuotasRequestOp = AlterClientQuotaRequestOpAddition | AlterClientQuotaRequestOpRemoval;
|
|
13
19
|
export interface AlterClientQuotasRequestEntry {
|
|
14
20
|
entities: AlterClientQuotasRequestEntity[];
|
|
15
21
|
ops: AlterClientQuotasRequestOp[];
|
|
@@ -19,7 +19,9 @@ export function createRequest(entries, validateOnly) {
|
|
|
19
19
|
w.appendArray(e.entities, (w, e) => {
|
|
20
20
|
w.appendString(e.entityType).appendString(e.entityName);
|
|
21
21
|
}).appendArray(e.ops, (w, o) => {
|
|
22
|
-
w.appendString(o.key)
|
|
22
|
+
w.appendString(o.key)
|
|
23
|
+
.appendFloat64(o.value ?? 0)
|
|
24
|
+
.appendBoolean(o.remove);
|
|
23
25
|
});
|
|
24
26
|
})
|
|
25
27
|
.appendBoolean(validateOnly)
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
2
|
import { type Reader } from '../../protocol/reader.ts';
|
|
3
3
|
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { type ClientQuotaEntityType, type ClientQuotaKey, type ClientQuotaMatchTypes } from '../enumerations.ts';
|
|
5
|
+
export interface DescribeClientQuotasRequestMatchComponent {
|
|
6
|
+
entityType: ClientQuotaEntityType;
|
|
7
|
+
matchType: typeof ClientQuotaMatchTypes.EXACT;
|
|
8
|
+
match: string;
|
|
8
9
|
}
|
|
10
|
+
export interface DescribeClientQuotasRequestSpecialComponent {
|
|
11
|
+
entityType: ClientQuotaEntityType;
|
|
12
|
+
matchType: typeof ClientQuotaMatchTypes.DEFAULT | typeof ClientQuotaMatchTypes.ANY;
|
|
13
|
+
}
|
|
14
|
+
export type DescribeClientQuotasRequestComponent = DescribeClientQuotasRequestMatchComponent | DescribeClientQuotasRequestSpecialComponent;
|
|
9
15
|
export type DescribeClientQuotasRequest = Parameters<typeof createRequest>;
|
|
10
16
|
export interface DescribeClientQuotasResponseValue {
|
|
11
|
-
key:
|
|
17
|
+
key: ClientQuotaKey;
|
|
12
18
|
value: number;
|
|
13
19
|
}
|
|
14
20
|
export interface DescribeClientQuotasResponseEntity {
|
|
15
|
-
entityType:
|
|
21
|
+
entityType: ClientQuotaEntityType;
|
|
16
22
|
entityName: NullableString;
|
|
17
23
|
}
|
|
18
24
|
export interface DescribeClientQuotasResponseEntry {
|
|
@@ -12,6 +12,7 @@ import { createAPI } from "../definitions.js";
|
|
|
12
12
|
export function createRequest(components, strict) {
|
|
13
13
|
return Writer.create()
|
|
14
14
|
.appendArray(components, (w, c) => {
|
|
15
|
+
// @ts-ignore - TS complains that 'match' is not available in all variants of DescribeClientQuotasRequestComponent
|
|
15
16
|
w.appendString(c.entityType).appendInt8(c.matchType).appendString(c.match);
|
|
16
17
|
})
|
|
17
18
|
.appendBoolean(strict)
|
package/dist/apis/callbacks.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export type CallbackWithPromise<ReturnType> = Callback<ReturnType> & {
|
|
|
7
7
|
};
|
|
8
8
|
export declare function createPromisifiedCallback<ReturnType>(): CallbackWithPromise<ReturnType>;
|
|
9
9
|
export declare function runConcurrentCallbacks<ReturnType>(errorMessage: string, collection: unknown[] | Set<unknown> | Map<unknown, unknown>, operation: (item: any, cb: Callback<ReturnType>) => void, callback: Callback<ReturnType[]>): void;
|
|
10
|
+
export declare function createTimeoutCallback<ReturnType>(callback: Callback<ReturnType>, timeout: number, errorMessage: string): Callback<ReturnType>;
|
package/dist/apis/callbacks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MultipleErrors } from "../errors.js";
|
|
1
|
+
import { MultipleErrors, TimeoutError } from "../errors.js";
|
|
2
2
|
import { PromiseWithResolvers } from "../utils.js";
|
|
3
3
|
export const kCallbackPromise = Symbol('plt.kafka.callbackPromise');
|
|
4
4
|
// This is only meaningful for testing
|
|
@@ -45,3 +45,17 @@ export function runConcurrentCallbacks(errorMessage, collection, operation, call
|
|
|
45
45
|
operation(item, operationCallback.bind(null, i++));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
export function createTimeoutCallback(callback, timeout, errorMessage) {
|
|
49
|
+
let timeoutFired = false;
|
|
50
|
+
const timeoutHandle = setTimeout(() => {
|
|
51
|
+
timeoutFired = true;
|
|
52
|
+
callback(new TimeoutError(errorMessage), undefined);
|
|
53
|
+
}, timeout);
|
|
54
|
+
return (error, result) => {
|
|
55
|
+
if (timeoutFired) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
clearTimeout(timeoutHandle);
|
|
59
|
+
callback(error, result);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -20,7 +20,7 @@ export interface ConsumerGroupHeartbeatResponse {
|
|
|
20
20
|
memberId: NullableString;
|
|
21
21
|
memberEpoch: number;
|
|
22
22
|
heartbeatIntervalMs: number;
|
|
23
|
-
assignment: ConsumerGroupHeartbeatResponseAssignment
|
|
23
|
+
assignment: ConsumerGroupHeartbeatResponseAssignment | null;
|
|
24
24
|
}
|
|
25
25
|
export declare function createRequest(groupId: string, memberId: string, memberEpoch: number, instanceId: NullableString, rackId: NullableString, rebalanceTimeoutMs: number, subscribedTopicNames: string[] | null, serverAssignor: NullableString, topicPartitions: ConsumerGroupHeartbeatRequestTopicPartition[]): Writer;
|
|
26
26
|
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): ConsumerGroupHeartbeatResponse;
|
|
@@ -51,16 +51,14 @@ export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
|
51
51
|
memberId: reader.readNullableString(),
|
|
52
52
|
memberEpoch: reader.readInt32(),
|
|
53
53
|
heartbeatIntervalMs: reader.readInt32(),
|
|
54
|
-
assignment: reader.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
})
|
|
54
|
+
assignment: reader.readNullableStruct(() => ({
|
|
55
|
+
topicPartitions: reader.readArray(r => {
|
|
56
|
+
return {
|
|
57
|
+
topicId: r.readUUID(),
|
|
58
|
+
partitions: r.readArray(r => r.readInt32(), true, false)
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
}))
|
|
64
62
|
};
|
|
65
63
|
if (response.errorCode !== 0) {
|
|
66
64
|
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
@@ -20,6 +20,12 @@ export declare const ProduceAcks: {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const allowedProduceAcks: number[];
|
|
22
22
|
export type ProduceAck = keyof typeof ProduceAcks;
|
|
23
|
+
export declare const GroupProtocols: {
|
|
24
|
+
readonly CLASSIC: "classic";
|
|
25
|
+
readonly CONSUMER: "consumer";
|
|
26
|
+
};
|
|
27
|
+
export declare const allowedGroupProtocols: ("consumer" | "classic")[];
|
|
28
|
+
export type GroupProtocol = keyof typeof GroupProtocols;
|
|
23
29
|
export declare const FetchIsolationLevels: {
|
|
24
30
|
READ_UNCOMMITTED: number;
|
|
25
31
|
READ_COMMITTED: number;
|
|
@@ -101,7 +107,18 @@ export declare const ClientQuotaMatchTypes: {
|
|
|
101
107
|
readonly DEFAULT: 1;
|
|
102
108
|
readonly ANY: 2;
|
|
103
109
|
};
|
|
104
|
-
export type ClientQuotaMatchType = keyof typeof ClientQuotaMatchTypes;
|
|
110
|
+
export type ClientQuotaMatchType = (typeof ClientQuotaMatchTypes)[keyof typeof ClientQuotaMatchTypes];
|
|
111
|
+
export declare const ClientQuotaEntityTypes: {
|
|
112
|
+
readonly CLIENT_ID: "client-id";
|
|
113
|
+
readonly USER: "user";
|
|
114
|
+
};
|
|
115
|
+
export type ClientQuotaEntityType = (typeof ClientQuotaEntityTypes)[keyof typeof ClientQuotaEntityTypes];
|
|
116
|
+
export declare const ClientQuotaKeys: {
|
|
117
|
+
readonly PRODUCER_BYTE_RATE: "producer_byte_rate";
|
|
118
|
+
readonly CONSUMER_BYTE_RATE: "consumer_byte_rate";
|
|
119
|
+
readonly REQUEST_PERCENTAGE: "request_percentage";
|
|
120
|
+
};
|
|
121
|
+
export type ClientQuotaKey = (typeof ClientQuotaKeys)[keyof typeof ClientQuotaKeys];
|
|
105
122
|
export declare const ScramMechanisms: {
|
|
106
123
|
readonly UNKNOWN: 0;
|
|
107
124
|
readonly SCRAM_SHA_256: 1;
|
|
@@ -17,6 +17,8 @@ export const ProduceAcks = {
|
|
|
17
17
|
};
|
|
18
18
|
export const allowedProduceAcks = Object.values(ProduceAcks);
|
|
19
19
|
// Consumer API
|
|
20
|
+
export const GroupProtocols = { CLASSIC: 'classic', CONSUMER: 'consumer' };
|
|
21
|
+
export const allowedGroupProtocols = Object.values(GroupProtocols);
|
|
20
22
|
// ./consumer/fetch.ts
|
|
21
23
|
export const FetchIsolationLevels = { READ_UNCOMMITTED: 0, READ_COMMITTED: 1 };
|
|
22
24
|
export const allowedFetchIsolationLevels = Object.values(FetchIsolationLevels);
|
|
@@ -68,6 +70,12 @@ export const ConfigTypes = {
|
|
|
68
70
|
export const IncrementalAlterConfigTypes = { SET: 0, DELETE: 1, APPEND: 2, SUBTRACT: 3 };
|
|
69
71
|
// ./admin/*-client-quotas.ts
|
|
70
72
|
export const ClientQuotaMatchTypes = { EXACT: 0, DEFAULT: 1, ANY: 2 };
|
|
73
|
+
export const ClientQuotaEntityTypes = { CLIENT_ID: 'client-id', USER: 'user' };
|
|
74
|
+
export const ClientQuotaKeys = {
|
|
75
|
+
PRODUCER_BYTE_RATE: 'producer_byte_rate',
|
|
76
|
+
CONSUMER_BYTE_RATE: 'consumer_byte_rate',
|
|
77
|
+
REQUEST_PERCENTAGE: 'request_percentage'
|
|
78
|
+
};
|
|
71
79
|
// ./admin/*-scram-credentials.ts
|
|
72
80
|
export const ScramMechanisms = { UNKNOWN: 0, SCRAM_SHA_256: 1, SCRAM_SHA_512: 2 };
|
|
73
81
|
// ./admin/describe-cluster.ts
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type AlterClientQuotasResponseEntries } from '../../apis/admin/alter-client-quotas-v1.ts';
|
|
2
|
+
import { type DescribeClientQuotasResponseEntry } from '../../apis/admin/describe-client-quotas-v0.ts';
|
|
1
3
|
import { type CallbackWithPromise } from '../../apis/callbacks.ts';
|
|
2
4
|
import { type Callback } from '../../apis/definitions.ts';
|
|
3
5
|
import { Base } from '../base/base.ts';
|
|
4
|
-
import { type AdminOptions, type CreatedTopic, type CreateTopicsOptions, type DeleteGroupsOptions, type DeleteTopicsOptions, type DescribeGroupsOptions, type Group, type GroupBase, type ListGroupsOptions, type ListTopicsOptions } from './types.ts';
|
|
6
|
+
import { type AdminOptions, type AlterClientQuotasOptions, type BrokerLogDirDescription, type CreatedTopic, type CreateTopicsOptions, type DeleteGroupsOptions, type DeleteTopicsOptions, type DescribeClientQuotasOptions, type DescribeGroupsOptions, type DescribeLogDirsOptions, type Group, type GroupBase, type ListGroupsOptions, type ListTopicsOptions } from './types.ts';
|
|
5
7
|
export declare class Admin extends Base<AdminOptions> {
|
|
6
8
|
#private;
|
|
7
9
|
constructor(options: AdminOptions);
|
|
@@ -17,4 +19,10 @@ export declare class Admin extends Base<AdminOptions> {
|
|
|
17
19
|
describeGroups(options: DescribeGroupsOptions): Promise<Map<string, Group>>;
|
|
18
20
|
deleteGroups(options: DeleteGroupsOptions, callback: CallbackWithPromise<void>): void;
|
|
19
21
|
deleteGroups(options: DeleteGroupsOptions): Promise<void>;
|
|
22
|
+
describeClientQuotas(options: DescribeClientQuotasOptions, callback: CallbackWithPromise<DescribeClientQuotasResponseEntry[]>): void;
|
|
23
|
+
describeClientQuotas(options: DescribeClientQuotasOptions): Promise<DescribeClientQuotasResponseEntry[]>;
|
|
24
|
+
alterClientQuotas(options: AlterClientQuotasOptions, callback: CallbackWithPromise<AlterClientQuotasResponseEntries[]>): void;
|
|
25
|
+
alterClientQuotas(options: AlterClientQuotasOptions): Promise<AlterClientQuotasResponseEntries[]>;
|
|
26
|
+
describeLogDirs(options: DescribeLogDirsOptions, callback: CallbackWithPromise<BrokerLogDirDescription[]>): void;
|
|
27
|
+
describeLogDirs(options: DescribeLogDirsOptions): Promise<BrokerLogDirDescription[]>;
|
|
20
28
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createPromisifiedCallback, kCallbackPromise, runConcurrentCallbacks } from "../../apis/callbacks.js";
|
|
2
2
|
import { FindCoordinatorKeyTypes } from "../../apis/enumerations.js";
|
|
3
|
-
import { adminGroupsChannel, adminTopicsChannel, createDiagnosticContext } from "../../diagnostic.js";
|
|
3
|
+
import { adminClientQuotasChannel, adminGroupsChannel, adminLogDirsChannel, adminTopicsChannel, createDiagnosticContext } from "../../diagnostic.js";
|
|
4
|
+
import { MultipleErrors } from "../../errors.js";
|
|
4
5
|
import { Reader } from "../../protocol/reader.js";
|
|
5
6
|
import { Base, kAfterCreate, kCheckNotClosed, kGetApi, kGetBootstrapConnection, kGetConnection, kMetadata, kOptions, kPerformDeduplicated, kPerformWithRetry, kValidateOptions } from "../base/base.js";
|
|
6
|
-
import { createTopicsOptionsValidator, deleteGroupsOptionsValidator, deleteTopicsOptionsValidator, describeGroupsOptionsValidator, listGroupsOptionsValidator, listTopicsOptionsValidator } from "./options.js";
|
|
7
|
+
import { alterClientQuotasOptionsValidator, createTopicsOptionsValidator, deleteGroupsOptionsValidator, deleteTopicsOptionsValidator, describeClientQuotasOptionsValidator, describeGroupsOptionsValidator, describeLogDirsOptionsValidator, listGroupsOptionsValidator, listTopicsOptionsValidator } from "./options.js";
|
|
7
8
|
export class Admin extends Base {
|
|
8
9
|
constructor(options) {
|
|
9
10
|
super(options);
|
|
@@ -106,6 +107,52 @@ export class Admin extends Base {
|
|
|
106
107
|
adminGroupsChannel.traceCallback(this.#deleteGroups, 1, createDiagnosticContext({ client: this, operation: 'deleteGroups', options }), this, options, callback);
|
|
107
108
|
return callback[kCallbackPromise];
|
|
108
109
|
}
|
|
110
|
+
describeClientQuotas(options, callback) {
|
|
111
|
+
if (!callback) {
|
|
112
|
+
callback = createPromisifiedCallback();
|
|
113
|
+
}
|
|
114
|
+
if (this[kCheckNotClosed](callback)) {
|
|
115
|
+
return callback[kCallbackPromise];
|
|
116
|
+
}
|
|
117
|
+
const validationError = this[kValidateOptions](options, describeClientQuotasOptionsValidator, '/options', false);
|
|
118
|
+
if (validationError) {
|
|
119
|
+
callback(validationError, undefined);
|
|
120
|
+
return callback[kCallbackPromise];
|
|
121
|
+
}
|
|
122
|
+
adminClientQuotasChannel.traceCallback(this.#describeClientQuotas, 1, createDiagnosticContext({ client: this, operation: 'describeClientQuotas', options }), this, options, callback);
|
|
123
|
+
return callback[kCallbackPromise];
|
|
124
|
+
}
|
|
125
|
+
alterClientQuotas(options, callback) {
|
|
126
|
+
if (!callback) {
|
|
127
|
+
callback = createPromisifiedCallback();
|
|
128
|
+
}
|
|
129
|
+
if (this[kCheckNotClosed](callback)) {
|
|
130
|
+
return callback[kCallbackPromise];
|
|
131
|
+
}
|
|
132
|
+
const validationError = this[kValidateOptions](options, alterClientQuotasOptionsValidator, '/options', false);
|
|
133
|
+
if (validationError) {
|
|
134
|
+
callback(validationError, undefined);
|
|
135
|
+
return callback[kCallbackPromise];
|
|
136
|
+
}
|
|
137
|
+
adminClientQuotasChannel.traceCallback(this.#alterClientQuotas, 1, createDiagnosticContext({ client: this, operation: 'alterClientQuotas', options }), this, options, callback);
|
|
138
|
+
return callback[kCallbackPromise];
|
|
139
|
+
}
|
|
140
|
+
describeLogDirs(options, callback) {
|
|
141
|
+
if (!callback) {
|
|
142
|
+
callback = createPromisifiedCallback();
|
|
143
|
+
}
|
|
144
|
+
/* c8 ignore next 3 - Hard to test */
|
|
145
|
+
if (this[kCheckNotClosed](callback)) {
|
|
146
|
+
return callback[kCallbackPromise];
|
|
147
|
+
}
|
|
148
|
+
const validationError = this[kValidateOptions](options, describeLogDirsOptionsValidator, '/options', false);
|
|
149
|
+
if (validationError) {
|
|
150
|
+
callback(validationError, undefined);
|
|
151
|
+
return callback[kCallbackPromise];
|
|
152
|
+
}
|
|
153
|
+
adminLogDirsChannel.traceCallback(this.#describeLogDirs, 1, createDiagnosticContext({ client: this, operation: 'describeLogDirs', options }), this, options, callback);
|
|
154
|
+
return callback[kCallbackPromise];
|
|
155
|
+
}
|
|
109
156
|
#listTopics(options, callback) {
|
|
110
157
|
const includeInternals = options.includeInternals ?? false;
|
|
111
158
|
this[kPerformDeduplicated]('metadata', deduplicateCallback => {
|
|
@@ -410,4 +457,91 @@ export class Admin extends Base {
|
|
|
410
457
|
callback(null, response);
|
|
411
458
|
}, 0);
|
|
412
459
|
}
|
|
460
|
+
#describeClientQuotas(options, callback) {
|
|
461
|
+
this[kPerformWithRetry]('describeClientQuotas', retryCallback => {
|
|
462
|
+
this[kGetBootstrapConnection]((error, connection) => {
|
|
463
|
+
if (error) {
|
|
464
|
+
retryCallback(error, undefined);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
this[kGetApi]('DescribeClientQuotas', (error, api) => {
|
|
468
|
+
if (error) {
|
|
469
|
+
retryCallback(error, undefined);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
api(connection, options.components, options.strict ?? false, retryCallback);
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
}, (error, response) => {
|
|
476
|
+
if (error) {
|
|
477
|
+
callback(new MultipleErrors('Describing client quotas failed.', [error]), undefined);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
callback(null, response.entries);
|
|
481
|
+
}, 0);
|
|
482
|
+
}
|
|
483
|
+
#alterClientQuotas(options, callback) {
|
|
484
|
+
this[kPerformWithRetry]('alterClientQuotas', retryCallback => {
|
|
485
|
+
this[kGetBootstrapConnection]((error, connection) => {
|
|
486
|
+
if (error) {
|
|
487
|
+
retryCallback(error, undefined);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
this[kGetApi]('AlterClientQuotas', (error, api) => {
|
|
491
|
+
if (error) {
|
|
492
|
+
retryCallback(error, undefined);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
api(connection, options.entries, options.validateOnly ?? false, retryCallback);
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
}, (error, response) => {
|
|
499
|
+
if (error) {
|
|
500
|
+
callback(new MultipleErrors('Altering client quotas failed.', [error]), undefined);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
callback(null, response.entries);
|
|
504
|
+
}, 0);
|
|
505
|
+
}
|
|
506
|
+
#describeLogDirs(options, callback) {
|
|
507
|
+
this[kMetadata]({ topics: [] }, (error, metadata) => {
|
|
508
|
+
/* c8 ignore next 4 - Hard to test */
|
|
509
|
+
if (error) {
|
|
510
|
+
callback(error, undefined);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
runConcurrentCallbacks('Describing log dirs failed.', metadata.brokers, ([id, broker], concurrentCallback) => {
|
|
514
|
+
this[kGetConnection](broker, (error, connection) => {
|
|
515
|
+
if (error) {
|
|
516
|
+
concurrentCallback(error, undefined);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
this[kPerformWithRetry]('describeLogDirs', retryCallback => {
|
|
520
|
+
this[kGetApi]('DescribeLogDirs', (error, api) => {
|
|
521
|
+
if (error) {
|
|
522
|
+
retryCallback(error, undefined);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
api(connection, options.topics, retryCallback);
|
|
526
|
+
});
|
|
527
|
+
}, (error, response) => {
|
|
528
|
+
if (error) {
|
|
529
|
+
concurrentCallback(error, undefined);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
concurrentCallback(null, {
|
|
533
|
+
broker: id,
|
|
534
|
+
throttleTimeMs: response.throttleTimeMs,
|
|
535
|
+
results: response.results.map(result => ({
|
|
536
|
+
logDir: result.logDir,
|
|
537
|
+
topics: result.topics,
|
|
538
|
+
totalBytes: result.totalBytes,
|
|
539
|
+
usableBytes: result.usableBytes
|
|
540
|
+
}))
|
|
541
|
+
});
|
|
542
|
+
}, 0);
|
|
543
|
+
});
|
|
544
|
+
}, callback);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
413
547
|
}
|
|
@@ -132,6 +132,146 @@ export declare const deleteGroupsOptionsSchema: {
|
|
|
132
132
|
required: string[];
|
|
133
133
|
additionalProperties: boolean;
|
|
134
134
|
};
|
|
135
|
+
export declare const describeClientQuotasOptionsSchema: {
|
|
136
|
+
type: string;
|
|
137
|
+
properties: {
|
|
138
|
+
components: {
|
|
139
|
+
type: string;
|
|
140
|
+
items: {
|
|
141
|
+
type: string;
|
|
142
|
+
properties: {
|
|
143
|
+
entityType: {
|
|
144
|
+
type: string;
|
|
145
|
+
minLength: number;
|
|
146
|
+
};
|
|
147
|
+
matchType: {
|
|
148
|
+
type: string;
|
|
149
|
+
enum: (0 | 1 | 2)[];
|
|
150
|
+
};
|
|
151
|
+
match: {
|
|
152
|
+
type: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
required: string[];
|
|
156
|
+
additionalProperties: boolean;
|
|
157
|
+
};
|
|
158
|
+
minItems: number;
|
|
159
|
+
};
|
|
160
|
+
strict: {
|
|
161
|
+
type: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
required: string[];
|
|
165
|
+
additionalProperties: boolean;
|
|
166
|
+
};
|
|
167
|
+
export declare const alterClientQuotasOptionsSchema: {
|
|
168
|
+
type: string;
|
|
169
|
+
properties: {
|
|
170
|
+
entries: {
|
|
171
|
+
type: string;
|
|
172
|
+
items: {
|
|
173
|
+
type: string;
|
|
174
|
+
properties: {
|
|
175
|
+
entities: {
|
|
176
|
+
type: string;
|
|
177
|
+
items: {
|
|
178
|
+
type: string;
|
|
179
|
+
properties: {
|
|
180
|
+
entityType: {
|
|
181
|
+
type: string;
|
|
182
|
+
minLength: number;
|
|
183
|
+
};
|
|
184
|
+
entityName: {
|
|
185
|
+
type: string[];
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
required: string[];
|
|
189
|
+
additionalProperties: boolean;
|
|
190
|
+
};
|
|
191
|
+
minItems: number;
|
|
192
|
+
};
|
|
193
|
+
ops: {
|
|
194
|
+
type: string;
|
|
195
|
+
items: {
|
|
196
|
+
oneOf: ({
|
|
197
|
+
type: string;
|
|
198
|
+
properties: {
|
|
199
|
+
key: {
|
|
200
|
+
type: string;
|
|
201
|
+
minLength: number;
|
|
202
|
+
};
|
|
203
|
+
value: {
|
|
204
|
+
type: string;
|
|
205
|
+
};
|
|
206
|
+
remove: {
|
|
207
|
+
type: string;
|
|
208
|
+
const: boolean;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
required: string[];
|
|
212
|
+
additionalProperties: boolean;
|
|
213
|
+
} | {
|
|
214
|
+
type: string;
|
|
215
|
+
properties: {
|
|
216
|
+
key: {
|
|
217
|
+
type: string;
|
|
218
|
+
minLength: number;
|
|
219
|
+
};
|
|
220
|
+
remove: {
|
|
221
|
+
type: string;
|
|
222
|
+
const: boolean;
|
|
223
|
+
};
|
|
224
|
+
value?: undefined;
|
|
225
|
+
};
|
|
226
|
+
required: string[];
|
|
227
|
+
additionalProperties: boolean;
|
|
228
|
+
})[];
|
|
229
|
+
};
|
|
230
|
+
minItems: number;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
required: string[];
|
|
234
|
+
additionalProperties: boolean;
|
|
235
|
+
};
|
|
236
|
+
minItems: number;
|
|
237
|
+
};
|
|
238
|
+
validateOnly: {
|
|
239
|
+
type: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
required: string[];
|
|
243
|
+
additionalProperties: boolean;
|
|
244
|
+
};
|
|
245
|
+
export declare const describeLogDirsOptionsSchema: {
|
|
246
|
+
type: string;
|
|
247
|
+
properties: {
|
|
248
|
+
topics: {
|
|
249
|
+
type: string;
|
|
250
|
+
items: {
|
|
251
|
+
type: string;
|
|
252
|
+
properties: {
|
|
253
|
+
name: {
|
|
254
|
+
type: string;
|
|
255
|
+
minLength: number;
|
|
256
|
+
};
|
|
257
|
+
partitions: {
|
|
258
|
+
type: string;
|
|
259
|
+
items: {
|
|
260
|
+
type: string;
|
|
261
|
+
minimum: number;
|
|
262
|
+
};
|
|
263
|
+
minItems: number;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
required: string[];
|
|
267
|
+
additionalProperties: boolean;
|
|
268
|
+
};
|
|
269
|
+
minItems: number;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
required: string[];
|
|
273
|
+
additionalProperties: boolean;
|
|
274
|
+
};
|
|
135
275
|
export declare const createTopicsOptionsValidator: import("ajv").ValidateFunction<{
|
|
136
276
|
[x: string]: {};
|
|
137
277
|
}>;
|
|
@@ -146,3 +286,12 @@ export declare const describeGroupsOptionsValidator: import("ajv").ValidateFunct
|
|
|
146
286
|
export declare const deleteGroupsOptionsValidator: import("ajv").ValidateFunction<{
|
|
147
287
|
[x: string]: {};
|
|
148
288
|
}>;
|
|
289
|
+
export declare const describeClientQuotasOptionsValidator: import("ajv").ValidateFunction<{
|
|
290
|
+
[x: string]: {};
|
|
291
|
+
}>;
|
|
292
|
+
export declare const alterClientQuotasOptionsValidator: import("ajv").ValidateFunction<{
|
|
293
|
+
[x: string]: {};
|
|
294
|
+
}>;
|
|
295
|
+
export declare const describeLogDirsOptionsValidator: import("ajv").ValidateFunction<{
|
|
296
|
+
[x: string]: {};
|
|
297
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConsumerGroupStates } from "../../apis/enumerations.js";
|
|
1
|
+
import { ClientQuotaMatchTypes, ConsumerGroupStates } from "../../apis/enumerations.js";
|
|
2
2
|
import { ajv, listErrorMessage } from "../../utils.js";
|
|
3
3
|
import { idProperty } from "../base/options.js";
|
|
4
4
|
export const groupsProperties = {
|
|
@@ -83,9 +83,117 @@ export const deleteGroupsOptionsSchema = {
|
|
|
83
83
|
required: ['groups'],
|
|
84
84
|
additionalProperties: false
|
|
85
85
|
};
|
|
86
|
+
export const describeClientQuotasOptionsSchema = {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: {
|
|
89
|
+
components: {
|
|
90
|
+
type: 'array',
|
|
91
|
+
items: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
entityType: { type: 'string', minLength: 1 },
|
|
95
|
+
matchType: { type: 'number', enum: Object.values(ClientQuotaMatchTypes) },
|
|
96
|
+
match: { type: 'string' }
|
|
97
|
+
},
|
|
98
|
+
required: ['entityType', 'matchType'],
|
|
99
|
+
additionalProperties: false
|
|
100
|
+
},
|
|
101
|
+
minItems: 1
|
|
102
|
+
},
|
|
103
|
+
strict: { type: 'boolean' }
|
|
104
|
+
},
|
|
105
|
+
required: ['components'],
|
|
106
|
+
additionalProperties: false
|
|
107
|
+
};
|
|
108
|
+
export const alterClientQuotasOptionsSchema = {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
entries: {
|
|
112
|
+
type: 'array',
|
|
113
|
+
items: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
entities: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
entityType: { type: 'string', minLength: 1 },
|
|
122
|
+
entityName: { type: ['string', 'null'] }
|
|
123
|
+
},
|
|
124
|
+
required: ['entityType'],
|
|
125
|
+
additionalProperties: false
|
|
126
|
+
},
|
|
127
|
+
minItems: 1
|
|
128
|
+
},
|
|
129
|
+
ops: {
|
|
130
|
+
type: 'array',
|
|
131
|
+
items: {
|
|
132
|
+
oneOf: [
|
|
133
|
+
{
|
|
134
|
+
type: 'object',
|
|
135
|
+
properties: {
|
|
136
|
+
key: { type: 'string', minLength: 1 },
|
|
137
|
+
value: { type: 'number' },
|
|
138
|
+
remove: { type: 'boolean', const: false }
|
|
139
|
+
},
|
|
140
|
+
required: ['key', 'value', 'remove'],
|
|
141
|
+
additionalProperties: false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: 'object',
|
|
145
|
+
properties: {
|
|
146
|
+
key: { type: 'string', minLength: 1 },
|
|
147
|
+
remove: { type: 'boolean', const: true }
|
|
148
|
+
},
|
|
149
|
+
required: ['key', 'remove'],
|
|
150
|
+
additionalProperties: false
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
minItems: 1
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: ['entities', 'ops'],
|
|
158
|
+
additionalProperties: false
|
|
159
|
+
},
|
|
160
|
+
minItems: 1
|
|
161
|
+
},
|
|
162
|
+
validateOnly: { type: 'boolean' }
|
|
163
|
+
},
|
|
164
|
+
required: ['entries'],
|
|
165
|
+
additionalProperties: false
|
|
166
|
+
};
|
|
167
|
+
export const describeLogDirsOptionsSchema = {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
topics: {
|
|
171
|
+
type: 'array',
|
|
172
|
+
items: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
name: { type: 'string', minLength: 1 },
|
|
176
|
+
partitions: {
|
|
177
|
+
type: 'array',
|
|
178
|
+
items: { type: 'number', minimum: 0 },
|
|
179
|
+
minItems: 1
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
required: ['name', 'partitions'],
|
|
183
|
+
additionalProperties: false
|
|
184
|
+
},
|
|
185
|
+
minItems: 1
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
required: ['topics'],
|
|
189
|
+
additionalProperties: false
|
|
190
|
+
};
|
|
86
191
|
export const createTopicsOptionsValidator = ajv.compile(createTopicOptionsSchema);
|
|
87
192
|
export const listTopicsOptionsValidator = ajv.compile(listTopicOptionsSchema);
|
|
88
193
|
export const deleteTopicsOptionsValidator = ajv.compile(deleteTopicOptionsSchema);
|
|
89
194
|
export const listGroupsOptionsValidator = ajv.compile(listGroupsOptionsSchema);
|
|
90
195
|
export const describeGroupsOptionsValidator = ajv.compile(describeGroupsOptionsSchema);
|
|
91
196
|
export const deleteGroupsOptionsValidator = ajv.compile(deleteGroupsOptionsSchema);
|
|
197
|
+
export const describeClientQuotasOptionsValidator = ajv.compile(describeClientQuotasOptionsSchema);
|
|
198
|
+
export const alterClientQuotasOptionsValidator = ajv.compile(alterClientQuotasOptionsSchema);
|
|
199
|
+
export const describeLogDirsOptionsValidator = ajv.compile(describeLogDirsOptionsSchema);
|