Skip to content

Commit

Permalink
createacl -> createacls
Browse files Browse the repository at this point in the history
  • Loading branch information
petedannemann committed Oct 10, 2023
1 parent cd2c1f2 commit 4b68dff
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
10 changes: 4 additions & 6 deletions pkg/admin/brokerclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,19 +736,17 @@ func (c *BrokerAdminClient) GetACLs(
return aclinfos, nil
}

// CreateACL creates an ACL in the cluster.
func (c *BrokerAdminClient) CreateACL(
// CreateACLs creates an ACL in the cluster.
func (c *BrokerAdminClient) CreateACLs(
ctx context.Context,
entry kafka.ACLEntry,
acls []kafka.ACLEntry,
) error {
if c.config.ReadOnly {
return errors.New("Cannot create ACL in read-only mode")
}

req := kafka.CreateACLsRequest{
ACLs: []kafka.ACLEntry{
entry,
},
ACLs: acls,
}
log.Debugf("CreateACLs request: %+v", req)

Expand Down
22 changes: 12 additions & 10 deletions pkg/admin/brokerclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,18 @@ func TestBrokerClientCreateGetACL(t *testing.T) {
}
}()

err = client.CreateACL(
err = client.CreateACLs(
ctx,
kafka.ACLEntry{
Principal: principal,
PermissionType: kafka.ACLPermissionTypeAllow,
Operation: kafka.ACLOperationTypeRead,
ResourceType: kafka.ResourceTypeTopic,
ResourcePatternType: kafka.PatternTypeLiteral,
ResourceName: topicName,
Host: "*",
[]kafka.ACLEntry{
{
Principal: principal,
PermissionType: kafka.ACLPermissionTypeAllow,
Operation: kafka.ACLOperationTypeRead,
ResourceType: kafka.ResourceTypeTopic,
ResourcePatternType: kafka.PatternTypeLiteral,
ResourceName: topicName,
Host: "*",
},
},
)
require.NoError(t, err)
Expand Down Expand Up @@ -670,7 +672,7 @@ func TestBrokerClientCreateACLReadOnly(t *testing.T) {
)
require.NoError(t, err)

err = client.CreateACL(ctx, kafka.ACLEntry{})
err = client.CreateACLs(ctx, []kafka.ACLEntry{})
assert.Equal(t, err, errors.New("Cannot create ACL in read-only mode"))

}
6 changes: 3 additions & 3 deletions pkg/admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ type Client interface {
config kafka.TopicConfig,
) error

// Create ACL creates an ACL in the cluster.
CreateACL(
// Create ACLs creates ACLs in the cluster.
CreateACLs(
ctx context.Context,
entry kafka.ACLEntry,
acls []kafka.ACLEntry,
) error

// AssignPartitions sets the replica broker IDs for one or more partitions in a topic.
Expand Down
4 changes: 2 additions & 2 deletions pkg/admin/zkclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ func (c *ZKAdminClient) GetACLs(
return nil, errors.New("ACLs not yet supported with zk access mode; omit zk addresses to fix.")
}

func (c *ZKAdminClient) CreateACL(
func (c *ZKAdminClient) CreateACLs(
ctx context.Context,
entry kafka.ACLEntry,
acls []kafka.ACLEntry,
) error {
return errors.New("ACLs not yet supported with zk access mode; omit zk addresses to fix.")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/admin/zkclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,6 @@ func TestZkCreateACL(t *testing.T) {
require.NoError(t, err)
defer adminClient.Close()

err = adminClient.CreateACL(ctx, kafka.ACLEntry{})
err = adminClient.CreateACLs(ctx, []kafka.ACLEntry{})
assert.Equal(t, err, errors.New("ACLs not yet supported with zk access mode; omit zk addresses to fix."))
}

0 comments on commit 4b68dff

Please sign in to comment.