Skip to content

Added AlterConfigs and DescribeConfigs apis, fix #1326 #1472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion kafka/protocol/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import

from kafka.protocol.api import Request, Response
from kafka.protocol.types import Array, Boolean, Bytes, Int16, Int32, Schema, String
from kafka.protocol.types import Array, Boolean, Bytes, Int8, Int16, Int32, Schema, String


class ApiVersionResponse_v0(Response):
Expand Down Expand Up @@ -310,6 +310,101 @@ class SaslHandShakeRequest_v1(Request):
SaslHandShakeRequest = [SaslHandShakeRequest_v0, SaslHandShakeRequest_v1]
SaslHandShakeResponse = [SaslHandShakeResponse_v0, SaslHandShakeResponse_v1]

class AlterConfigsResponse_v0(Response):
API_KEY = 33
API_VERSION = 0
SCHEMA = Schema(
('throttle_time_ms', Int32),
('resources', Array(
('error_code', Int16),
('error_message', String('utf-8')),
('resource_type', Int8),
('resource_name', String('utf-8'))))
)

class AlterConfigsRequest_v0(Request):
API_KEY = 33
API_VERSION = 0
RESPONSE_TYPE = AlterConfigsResponse_v0
SCHEMA = Schema(
('resources', Array(
('resource_type', Int8),
('resource_name', String('utf-8')),
('config_entries', Array(
('config_name', String('utf-8')),
('config_value', String('utf-8')))))),
('validate_only', Boolean)
)

AlterConfigsRequest = [AlterConfigsRequest_v0]
AlterConfigsResponse = [AlterConfigsResponse_v0]


class DescribeConfigsResponse_v0(Response):
API_KEY = 32
API_VERSION = 0
SCHEMA = Schema(
('throttle_time_ms', Int32),
('resources', Array(
('error_code', Int16),
('error_message', String('utf-8')),
('resource_type', Int8),
('resource_name', String('utf-8')),
('config_entries', Array(
('config_names', String('utf-8')),
('config_value', String('utf-8')),
('read_only', Boolean),
('is_default', Boolean),
('is_sensitive', Boolean)))))
)

class DescribeConfigsResponse_v1(Response):
API_KEY = 32
API_VERSION = 1
SCHEMA = Schema(
('throttle_time_ms', Int32),
('resources', Array(
('error_code', Int16),
('error_message', String('utf-8')),
('resource_type', Int8),
('resource_name', String('utf-8')),
('config_entries', Array(
('config_names', String('utf-8')),
('config_value', String('utf-8')),
('read_only', Boolean),
('is_default', Boolean),
('is_sensitive', Boolean),
('config_synonyms', Array(
('config_name', String('utf-8')),
('config_value', String('utf-8')),
('config_source', Int8)))))))
)

class DescribeConfigsRequest_v0(Request):
API_KEY = 32
API_VERSION = 0
RESPONSE_TYPE = DescribeConfigsResponse_v0
SCHEMA = Schema(
('resources', Array(
('resource_type', Int8),
('resource_name', String('utf-8')),
('config_names', Array(String('utf-8')))))
)

class DescribeConfigsRequest_v1(Request):
API_KEY = 32
API_VERSION = 1
RESPONSE_TYPE = DescribeConfigsResponse_v1
SCHEMA = Schema(
('resources', Array(
('resource_type', Int8),
('resource_name', String('utf-8')),
('config_names', Array(String('utf-8'))))),
('include_synonyms', Boolean)
)

DescribeConfigsRequest = [DescribeConfigsRequest_v0, DescribeConfigsRequest_v1]
DescribeConfigsResponse = [DescribeConfigsResponse_v0, DescribeConfigsResponse_v1]

class SaslAuthenticateResponse_v0(Request):
API_KEY = 36
Expand Down