Skip to content

Commit

Permalink
Updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sciclon2 committed Sep 8, 2024
1 parent 097a55b commit 77bc471
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
6 changes: 2 additions & 4 deletions docs/ACLs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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
Expand Down
12 changes: 0 additions & 12 deletions pkg/kafka/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
16 changes: 0 additions & 16 deletions pkg/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()
Expand All @@ -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...)
Expand Down

0 comments on commit 77bc471

Please sign in to comment.