Skip to content

Commit

Permalink
Merge pull request #58 from Sergey-Kizimov/delete-acl
Browse files Browse the repository at this point in the history
Fix ACL deletion
  • Loading branch information
marshmallory authored May 23, 2023
2 parents 7bcd534 + e8df00e commit 70d8cb1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/clients/kafka/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,20 @@ func Delete(ctx context.Context, cl *kadm.Client, accessControlList *AccessContr
rpt, _ := kmsg.ParseACLResourcePatternType(strings.ToLower(accessControlList.ResourcePatternTypeFilter))

b := kadm.ACLBuilder{}
ab := b.Topics(accessControlList.ResourceName).Allow(accessControlList.ResourcePrincipal).AllowHosts(accessControlList.ResourceHost).Operations(ao[0]).ResourcePatternType(rpt)
ab := b.Allow(accessControlList.ResourcePrincipal).AllowHosts(accessControlList.ResourceHost).Operations(ao[0]).ResourcePatternType(rpt)

switch accessControlList.ResourceType {
case "Topic":
ab = ab.Topics(accessControlList.ResourceName)
case "Group":
ab = ab.Groups(accessControlList.ResourceName)
case "TransactionalID":
ab = ab.TransactionalIDs(accessControlList.ResourceName)
case "Cluster":
ab = ab.Clusters()
case "Any":
ab = ab.AnyResource(accessControlList.ResourceName)
}

resp, err := cl.DeleteACLs(ctx, ab)
if err != nil {
Expand Down

0 comments on commit 70d8cb1

Please sign in to comment.