|
1 | 1 | from __future__ import absolute_import |
2 | 2 |
|
3 | 3 | from kafka.protocol.api import Request, Response |
4 | | -from kafka.protocol.types import Array, Boolean, Int16, Int32, Schema, String |
| 4 | +from kafka.protocol.types import Array, Boolean, Int16, Int32, Schema, String, BitField |
5 | 5 |
|
6 | 6 |
|
7 | 7 | class MetadataResponse_v0(Response): |
@@ -164,6 +164,36 @@ class MetadataResponse_v7(Response): |
164 | 164 | ) |
165 | 165 |
|
166 | 166 |
|
| 167 | +class MetadataResponse_v8(Response): |
| 168 | + """v8 adds authorized_operations fields""" |
| 169 | + API_KEY = 3 |
| 170 | + API_VERSION = 8 |
| 171 | + SCHEMA = Schema( |
| 172 | + ('throttle_time_ms', Int32), |
| 173 | + ('brokers', Array( |
| 174 | + ('node_id', Int32), |
| 175 | + ('host', String('utf-8')), |
| 176 | + ('port', Int32), |
| 177 | + ('rack', String('utf-8')))), |
| 178 | + ('cluster_id', String('utf-8')), |
| 179 | + ('controller_id', Int32), |
| 180 | + ('topics', Array( |
| 181 | + ('error_code', Int16), |
| 182 | + ('topic', String('utf-8')), |
| 183 | + ('is_internal', Boolean), |
| 184 | + ('partitions', Array( |
| 185 | + ('error_code', Int16), |
| 186 | + ('partition', Int32), |
| 187 | + ('leader', Int32), |
| 188 | + ('leader_epoch', Int32), |
| 189 | + ('replicas', Array(Int32)), |
| 190 | + ('isr', Array(Int32)), |
| 191 | + ('offline_replicas', Array(Int32)))), |
| 192 | + ('authorized_operations', BitField))), |
| 193 | + ('authorized_operations', BitField) |
| 194 | + ) |
| 195 | + |
| 196 | + |
167 | 197 | class MetadataRequest_v0(Request): |
168 | 198 | API_KEY = 3 |
169 | 199 | API_VERSION = 0 |
@@ -245,13 +275,27 @@ class MetadataRequest_v7(Request): |
245 | 275 | NO_TOPICS = [] |
246 | 276 |
|
247 | 277 |
|
| 278 | +class MetadataRequest_v8(Request): |
| 279 | + API_KEY = 3 |
| 280 | + API_VERSION = 8 |
| 281 | + RESPONSE_TYPE = MetadataResponse_v8 |
| 282 | + SCHEMA = Schema( |
| 283 | + ('topics', Array(String('utf-8'))), |
| 284 | + ('allow_auto_topic_creation', Boolean), |
| 285 | + ('include_cluster_authorized_operations', Boolean), |
| 286 | + ('include_topic_authorized_operations', Boolean) |
| 287 | + ) |
| 288 | + ALL_TOPICS = None |
| 289 | + NO_TOPICS = [] |
| 290 | + |
| 291 | + |
248 | 292 | MetadataRequest = [ |
249 | 293 | MetadataRequest_v0, MetadataRequest_v1, MetadataRequest_v2, |
250 | 294 | MetadataRequest_v3, MetadataRequest_v4, MetadataRequest_v5, |
251 | | - MetadataRequest_v6, MetadataRequest_v7, |
| 295 | + MetadataRequest_v6, MetadataRequest_v7, MetadataRequest_v8, |
252 | 296 | ] |
253 | 297 | MetadataResponse = [ |
254 | 298 | MetadataResponse_v0, MetadataResponse_v1, MetadataResponse_v2, |
255 | 299 | MetadataResponse_v3, MetadataResponse_v4, MetadataResponse_v5, |
256 | | - MetadataResponse_v6, MetadataResponse_v7, |
| 300 | + MetadataResponse_v6, MetadataResponse_v7, MetadataResponse_v8, |
257 | 301 | ] |
0 commit comments