From 776a6309c4e3fd530ebbade18025468396e0f41a Mon Sep 17 00:00:00 2001 From: Dominic Evans Date: Tue, 1 Aug 2023 17:01:21 +0100 Subject: [PATCH] fix(proto): return Version field from version() fn Signed-off-by: Dominic Evans --- acl_create_response.go | 2 +- add_offsets_to_txn_request.go | 2 +- add_offsets_to_txn_response.go | 2 +- add_partitions_to_txn_request.go | 2 +- add_partitions_to_txn_response.go | 2 +- alter_client_quotas_request.go | 2 +- alter_client_quotas_response.go | 2 +- alter_configs_request.go | 2 +- alter_configs_response.go | 2 +- consumer_metadata_request.go | 2 +- consumer_metadata_response.go | 2 +- create_partitions_request.go | 2 +- create_partitions_response.go | 2 +- delete_groups_request.go | 2 +- delete_groups_response.go | 2 +- delete_offsets_request.go | 2 +- delete_offsets_response.go | 2 +- delete_records_request.go | 2 +- delete_records_response.go | 2 +- describe_client_quotas_request.go | 2 +- describe_client_quotas_response.go | 2 +- end_txn_request.go | 2 +- end_txn_response.go | 2 +- incremental_alter_configs_request.go | 2 +- incremental_alter_configs_response.go | 2 +- leave_group_request.go | 11 +++++++---- list_groups_request.go | 2 +- list_groups_response.go | 2 +- sasl_handshake_response.go | 2 +- txn_offset_commit_request.go | 2 +- txn_offset_commit_response.go | 2 +- 31 files changed, 37 insertions(+), 34 deletions(-) diff --git a/acl_create_response.go b/acl_create_response.go index dd18080309..630b1ccf1f 100644 --- a/acl_create_response.go +++ b/acl_create_response.go @@ -53,7 +53,7 @@ func (c *CreateAclsResponse) key() int16 { } func (c *CreateAclsResponse) version() int16 { - return 0 + return c.Version } func (c *CreateAclsResponse) headerVersion() int16 { diff --git a/add_offsets_to_txn_request.go b/add_offsets_to_txn_request.go index 1942e9ef0b..fe6f773bb2 100644 --- a/add_offsets_to_txn_request.go +++ b/add_offsets_to_txn_request.go @@ -46,7 +46,7 @@ func (a *AddOffsetsToTxnRequest) key() int16 { } func (a *AddOffsetsToTxnRequest) version() int16 { - return 0 + return a.Version } func (a *AddOffsetsToTxnRequest) headerVersion() int16 { diff --git a/add_offsets_to_txn_response.go b/add_offsets_to_txn_response.go index 11bbc507fc..8df6f1ca64 100644 --- a/add_offsets_to_txn_response.go +++ b/add_offsets_to_txn_response.go @@ -38,7 +38,7 @@ func (a *AddOffsetsToTxnResponse) key() int16 { } func (a *AddOffsetsToTxnResponse) version() int16 { - return 0 + return a.Version } func (a *AddOffsetsToTxnResponse) headerVersion() int16 { diff --git a/add_partitions_to_txn_request.go b/add_partitions_to_txn_request.go index 39ee285505..61d7b4fde9 100644 --- a/add_partitions_to_txn_request.go +++ b/add_partitions_to_txn_request.go @@ -70,7 +70,7 @@ func (a *AddPartitionsToTxnRequest) key() int16 { } func (a *AddPartitionsToTxnRequest) version() int16 { - return 0 + return a.Version } func (a *AddPartitionsToTxnRequest) headerVersion() int16 { diff --git a/add_partitions_to_txn_response.go b/add_partitions_to_txn_response.go index 0de3dd2658..2c38c57d16 100644 --- a/add_partitions_to_txn_response.go +++ b/add_partitions_to_txn_response.go @@ -77,7 +77,7 @@ func (a *AddPartitionsToTxnResponse) key() int16 { } func (a *AddPartitionsToTxnResponse) version() int16 { - return 0 + return a.Version } func (a *AddPartitionsToTxnResponse) headerVersion() int16 { diff --git a/alter_client_quotas_request.go b/alter_client_quotas_request.go index 3139e0cfbf..a7fa0cbd13 100644 --- a/alter_client_quotas_request.go +++ b/alter_client_quotas_request.go @@ -183,7 +183,7 @@ func (a *AlterClientQuotasRequest) key() int16 { } func (a *AlterClientQuotasRequest) version() int16 { - return 0 + return a.Version } func (a *AlterClientQuotasRequest) headerVersion() int16 { diff --git a/alter_client_quotas_response.go b/alter_client_quotas_response.go index bd24fd4c4b..cce997cae2 100644 --- a/alter_client_quotas_response.go +++ b/alter_client_quotas_response.go @@ -134,7 +134,7 @@ func (a *AlterClientQuotasResponse) key() int16 { } func (a *AlterClientQuotasResponse) version() int16 { - return 0 + return a.Version } func (a *AlterClientQuotasResponse) headerVersion() int16 { diff --git a/alter_configs_request.go b/alter_configs_request.go index 9bdc60fd9c..cf51beb67d 100644 --- a/alter_configs_request.go +++ b/alter_configs_request.go @@ -115,7 +115,7 @@ func (a *AlterConfigsRequest) key() int16 { } func (a *AlterConfigsRequest) version() int16 { - return 0 + return a.Version } func (a *AlterConfigsRequest) headerVersion() int16 { diff --git a/alter_configs_response.go b/alter_configs_response.go index a51923e4bf..72ffcc9f73 100644 --- a/alter_configs_response.go +++ b/alter_configs_response.go @@ -105,7 +105,7 @@ func (a *AlterConfigsResponse) key() int16 { } func (a *AlterConfigsResponse) version() int16 { - return 0 + return a.Version } func (a *AlterConfigsResponse) headerVersion() int16 { diff --git a/consumer_metadata_request.go b/consumer_metadata_request.go index 7c64765510..3bef616d27 100644 --- a/consumer_metadata_request.go +++ b/consumer_metadata_request.go @@ -27,7 +27,7 @@ func (r *ConsumerMetadataRequest) key() int16 { } func (r *ConsumerMetadataRequest) version() int16 { - return 0 + return r.Version } func (r *ConsumerMetadataRequest) headerVersion() int16 { diff --git a/consumer_metadata_response.go b/consumer_metadata_response.go index dad89f90d9..a8e95b2ce6 100644 --- a/consumer_metadata_response.go +++ b/consumer_metadata_response.go @@ -71,7 +71,7 @@ func (r *ConsumerMetadataResponse) key() int16 { } func (r *ConsumerMetadataResponse) version() int16 { - return 0 + return r.Version } func (r *ConsumerMetadataResponse) headerVersion() int16 { diff --git a/create_partitions_request.go b/create_partitions_request.go index 9160e1e573..68435d639a 100644 --- a/create_partitions_request.go +++ b/create_partitions_request.go @@ -65,7 +65,7 @@ func (r *CreatePartitionsRequest) key() int16 { } func (r *CreatePartitionsRequest) version() int16 { - return 0 + return r.Version } func (r *CreatePartitionsRequest) headerVersion() int16 { diff --git a/create_partitions_response.go b/create_partitions_response.go index da06fc4601..b9695ae535 100644 --- a/create_partitions_response.go +++ b/create_partitions_response.go @@ -61,7 +61,7 @@ func (r *CreatePartitionsResponse) key() int16 { } func (r *CreatePartitionsResponse) version() int16 { - return 0 + return r.Version } func (r *CreatePartitionsResponse) headerVersion() int16 { diff --git a/delete_groups_request.go b/delete_groups_request.go index de2a62ee7e..2158370d5b 100644 --- a/delete_groups_request.go +++ b/delete_groups_request.go @@ -19,7 +19,7 @@ func (r *DeleteGroupsRequest) key() int16 { } func (r *DeleteGroupsRequest) version() int16 { - return 0 + return r.Version } func (r *DeleteGroupsRequest) headerVersion() int16 { diff --git a/delete_groups_response.go b/delete_groups_response.go index 3eba3a5ea2..2d77ed2b22 100644 --- a/delete_groups_response.go +++ b/delete_groups_response.go @@ -63,7 +63,7 @@ func (r *DeleteGroupsResponse) key() int16 { } func (r *DeleteGroupsResponse) version() int16 { - return 0 + return r.Version } func (r *DeleteGroupsResponse) headerVersion() int16 { diff --git a/delete_offsets_request.go b/delete_offsets_request.go index e0e51f8cb8..06b864d18f 100644 --- a/delete_offsets_request.go +++ b/delete_offsets_request.go @@ -73,7 +73,7 @@ func (r *DeleteOffsetsRequest) key() int16 { } func (r *DeleteOffsetsRequest) version() int16 { - return 0 + return r.Version } func (r *DeleteOffsetsRequest) headerVersion() int16 { diff --git a/delete_offsets_response.go b/delete_offsets_response.go index 2397f1cee7..86c6c51f68 100644 --- a/delete_offsets_response.go +++ b/delete_offsets_response.go @@ -101,7 +101,7 @@ func (r *DeleteOffsetsResponse) key() int16 { } func (r *DeleteOffsetsResponse) version() int16 { - return 0 + return r.Version } func (r *DeleteOffsetsResponse) headerVersion() int16 { diff --git a/delete_records_request.go b/delete_records_request.go index 49e2e10219..687b042ad8 100644 --- a/delete_records_request.go +++ b/delete_records_request.go @@ -75,7 +75,7 @@ func (d *DeleteRecordsRequest) key() int16 { } func (d *DeleteRecordsRequest) version() int16 { - return 0 + return d.Version } func (d *DeleteRecordsRequest) headerVersion() int16 { diff --git a/delete_records_response.go b/delete_records_response.go index 6f79b2fc06..cb287524c0 100644 --- a/delete_records_response.go +++ b/delete_records_response.go @@ -77,7 +77,7 @@ func (d *DeleteRecordsResponse) key() int16 { } func (d *DeleteRecordsResponse) version() int16 { - return 0 + return d.Version } func (d *DeleteRecordsResponse) headerVersion() int16 { diff --git a/describe_client_quotas_request.go b/describe_client_quotas_request.go index a1f4490c76..8869145c37 100644 --- a/describe_client_quotas_request.go +++ b/describe_client_quotas_request.go @@ -130,7 +130,7 @@ func (d *DescribeClientQuotasRequest) key() int16 { } func (d *DescribeClientQuotasRequest) version() int16 { - return 0 + return d.Version } func (d *DescribeClientQuotasRequest) headerVersion() int16 { diff --git a/describe_client_quotas_response.go b/describe_client_quotas_response.go index 4ef3f985e5..e9bf658adb 100644 --- a/describe_client_quotas_response.go +++ b/describe_client_quotas_response.go @@ -224,7 +224,7 @@ func (d *DescribeClientQuotasResponse) key() int16 { } func (d *DescribeClientQuotasResponse) version() int16 { - return 0 + return d.Version } func (d *DescribeClientQuotasResponse) headerVersion() int16 { diff --git a/end_txn_request.go b/end_txn_request.go index e1646336e4..e0e3872c69 100644 --- a/end_txn_request.go +++ b/end_txn_request.go @@ -43,7 +43,7 @@ func (a *EndTxnRequest) key() int16 { } func (a *EndTxnRequest) version() int16 { - return 0 + return a.Version } func (r *EndTxnRequest) headerVersion() int16 { diff --git a/end_txn_response.go b/end_txn_response.go index 7f3e009361..7fcfb04067 100644 --- a/end_txn_response.go +++ b/end_txn_response.go @@ -37,7 +37,7 @@ func (e *EndTxnResponse) key() int16 { } func (e *EndTxnResponse) version() int16 { - return 0 + return e.Version } func (r *EndTxnResponse) headerVersion() int16 { diff --git a/incremental_alter_configs_request.go b/incremental_alter_configs_request.go index cefba6715e..b1b490a282 100644 --- a/incremental_alter_configs_request.go +++ b/incremental_alter_configs_request.go @@ -162,7 +162,7 @@ func (a *IncrementalAlterConfigsRequest) key() int16 { } func (a *IncrementalAlterConfigsRequest) version() int16 { - return 0 + return a.Version } func (a *IncrementalAlterConfigsRequest) headerVersion() int16 { diff --git a/incremental_alter_configs_response.go b/incremental_alter_configs_response.go index c92792c3c7..3a2df2f606 100644 --- a/incremental_alter_configs_response.go +++ b/incremental_alter_configs_response.go @@ -55,7 +55,7 @@ func (a *IncrementalAlterConfigsResponse) key() int16 { } func (a *IncrementalAlterConfigsResponse) version() int16 { - return 0 + return a.Version } func (a *IncrementalAlterConfigsResponse) headerVersion() int16 { diff --git a/leave_group_request.go b/leave_group_request.go index 54cc6afc7f..7dc5005a10 100644 --- a/leave_group_request.go +++ b/leave_group_request.go @@ -86,9 +86,12 @@ func (r *LeaveGroupRequest) isValidVersion() bool { } func (r *LeaveGroupRequest) requiredVersion() KafkaVersion { - switch r.Version { - case 1, 2, 3: - return V2_3_0_0 + switch { + case r.Version >= 2: + return V2_0_0_0 + case r.Version >= 1: + return V1_0_0_0 + default: + return V0_9_0_0 } - return V0_9_0_0 } diff --git a/list_groups_request.go b/list_groups_request.go index 48af65a3ed..8c99c7dc4a 100644 --- a/list_groups_request.go +++ b/list_groups_request.go @@ -17,7 +17,7 @@ func (r *ListGroupsRequest) key() int16 { } func (r *ListGroupsRequest) version() int16 { - return 0 + return r.Version } func (r *ListGroupsRequest) headerVersion() int16 { diff --git a/list_groups_response.go b/list_groups_response.go index 738675819e..a02c58decc 100644 --- a/list_groups_response.go +++ b/list_groups_response.go @@ -62,7 +62,7 @@ func (r *ListGroupsResponse) key() int16 { } func (r *ListGroupsResponse) version() int16 { - return 0 + return r.Version } func (r *ListGroupsResponse) headerVersion() int16 { diff --git a/sasl_handshake_response.go b/sasl_handshake_response.go index 0b17c7c688..bbada975d2 100644 --- a/sasl_handshake_response.go +++ b/sasl_handshake_response.go @@ -31,7 +31,7 @@ func (r *SaslHandshakeResponse) key() int16 { } func (r *SaslHandshakeResponse) version() int16 { - return 0 + return r.Version } func (r *SaslHandshakeResponse) headerVersion() int16 { diff --git a/txn_offset_commit_request.go b/txn_offset_commit_request.go index f79a7c38ca..9a1cffca76 100644 --- a/txn_offset_commit_request.go +++ b/txn_offset_commit_request.go @@ -89,7 +89,7 @@ func (a *TxnOffsetCommitRequest) key() int16 { } func (a *TxnOffsetCommitRequest) version() int16 { - return 0 + return a.Version } func (a *TxnOffsetCommitRequest) headerVersion() int16 { diff --git a/txn_offset_commit_response.go b/txn_offset_commit_response.go index 5df5e445d3..8248b801ff 100644 --- a/txn_offset_commit_response.go +++ b/txn_offset_commit_response.go @@ -76,7 +76,7 @@ func (a *TxnOffsetCommitResponse) key() int16 { } func (a *TxnOffsetCommitResponse) version() int16 { - return 0 + return a.Version } func (a *TxnOffsetCommitResponse) headerVersion() int16 {