Skip to content

Commit

Permalink
Add support for DescribeConfigs API v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Lubeck committed Nov 8, 2019
1 parent 983ada5 commit c51d814
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kafka/admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def describe_configs(self, config_resources, include_synonyms=False):
DescribeConfigsRequest[version](resources=topic_resources)
))

elif version == 1:
elif version <= 2:
if len(broker_resources) > 0:
for broker_resource in broker_resources:
try:
Expand Down
38 changes: 36 additions & 2 deletions kafka/protocol/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,28 @@ class DescribeConfigsResponse_v1(Response):
('config_source', Int8)))))))
)

class DescribeConfigsResponse_v2(Response):
API_KEY = 32
API_VERSION = 2
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),
('config_source', Int8),
('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
Expand All @@ -731,8 +753,20 @@ class DescribeConfigsRequest_v1(Request):
('include_synonyms', Boolean)
)

DescribeConfigsRequest = [DescribeConfigsRequest_v0, DescribeConfigsRequest_v1]
DescribeConfigsResponse = [DescribeConfigsResponse_v0, DescribeConfigsResponse_v1]
class DescribeConfigsRequest_v2(Request):
API_KEY = 32
API_VERSION = 2
RESPONSE_TYPE = DescribeConfigsResponse_v2
SCHEMA = DescribeConfigsRequest_v2.SCHEMA

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

class SaslAuthenticateResponse_v0(Response):
API_KEY = 36
Expand Down

0 comments on commit c51d814

Please sign in to comment.