diff --git a/docs/ACLs.md b/docs/ACLs.md index 6addfd8..d886f0b 100644 --- a/docs/ACLs.md +++ b/docs/ACLs.md @@ -33,11 +33,8 @@ The Kafka client interface requires the following permissions: | Operation | Permission | Resource Type | Description | |----------------------------|-------------|---------------|--------------------------------------------------------------------| | **Brokers()** | DESCRIBE | Cluster | Allows fetching metadata of brokers. | -| **Topics()** | DESCRIBE | Topic | Allows listing and describing available topics. | -| **Partitions()** | DESCRIBE | Topic | Allows describing partitions within a topic. | | **GetOffset()** | DESCRIBE/READ | Topic | Allows fetching offsets for specific topic partitions. | | **Leader()** | DESCRIBE | Topic | Allows describing the leader broker for a partition in a topic. | -| **Replicas()** | DESCRIBE | Topic | Allows retrieving replica details for a partition in a topic. | | **RefreshMetadata()** | DESCRIBE | Topic | Allows refreshing metadata for specific topics. | ### Kafka Admin Permissions @@ -65,6 +62,7 @@ kafka-acls --bootstrap-server kafka-broker:9092 \ --operation DESCRIBE --cluster ``` + ### Topic Level ACLs To allow the application to describe topics, fetch offsets, and perform operations on partitions, apply the following ACLs for topics: @@ -76,7 +74,7 @@ kafka-acls --bootstrap-server kafka-broker:9092 \ --operation READ --topic '*' ``` -### Group Level ACLs +### Group Level ACLs The following ACLs allow kafka-lag-go to list and fetch offsets for consumer groups: ```bash diff --git a/pkg/kafka/test_utils.go b/pkg/kafka/test_utils.go index a12d35e..cab29b7 100644 --- a/pkg/kafka/test_utils.go +++ b/pkg/kafka/test_utils.go @@ -32,12 +32,6 @@ func (m *MockKafkaClient) Topics() ([]string, error) { return args.Get(0).([]string), args.Error(1) } -// Partitions mocks the Partitions method. -func (m *MockKafkaClient) Partitions(topic string) ([]int32, error) { - args := m.Called(topic) - return args.Get(0).([]int32), args.Error(1) -} - // GetOffset mocks the GetOffset method. func (m *MockKafkaClient) GetOffset(topic string, partition int32, time int64) (int64, error) { args := m.Called(topic, partition, time) @@ -49,12 +43,6 @@ func (m *MockKafkaClient) Leader(topic string, partition int32) (*sarama.Broker, return args.Get(0).(*sarama.Broker), args.Error(1) } -// Replicas mocks the Replicas method. -func (m *MockKafkaClient) Replicas(topic string, partition int32) ([]int32, error) { - args := m.Called(topic, partition) - return args.Get(0).([]int32), args.Error(1) -} - // RefreshMetadata mocks the RefreshMetadata method. func (m *MockKafkaClient) RefreshMetadata(topics ...string) error { args := m.Called(topics) diff --git a/pkg/structs/structs.go b/pkg/structs/structs.go index 38ff01b..2c4db2c 100644 --- a/pkg/structs/structs.go +++ b/pkg/structs/structs.go @@ -9,11 +9,8 @@ import ( type KafkaClient interface { //Brokers() []KafkaBrokerInterface Brokers() []*sarama.Broker - Topics() ([]string, error) - Partitions(topic string) ([]int32, error) GetOffset(topic string, partition int32, time int64) (int64, error) Leader(topic string, partition int32) (*sarama.Broker, error) - Replicas(topic string, partition int32) ([]int32, error) RefreshMetadata(topics ...string) error Close() error } @@ -88,14 +85,6 @@ func (s *SaramaKafkaClient) Brokers() []*sarama.Broker { return s.Client.Brokers() } -func (s *SaramaKafkaClient) Topics() ([]string, error) { - return s.Client.Topics() -} - -func (s *SaramaKafkaClient) Partitions(topic string) ([]int32, error) { - return s.Client.Partitions(topic) -} - // Close closes the sarama.Client and implements the Close method for KafkaClient. func (s *SaramaKafkaClient) Close() error { return s.Client.Close() @@ -111,11 +100,6 @@ func (s *SaramaKafkaClient) Leader(topic string, partition int32) (*sarama.Broke return s.Client.Leader(topic, partition) } -// Replicas implements KafkaClient.Replicas -func (s *SaramaKafkaClient) Replicas(topic string, partition int32) ([]int32, error) { - return s.Client.Replicas(topic, partition) -} - // Implement the missing RefreshMetadata method func (s *SaramaKafkaClient) RefreshMetadata(topics ...string) error { return s.Client.RefreshMetadata(topics...)