Skip to content

Commit 77b2459

Browse files
author
Jure Zvelc
committed
Add support for RD_KAFKA_RESOURCE_TRANSACTIONAL_ID in adminapi
1 parent d0d8341 commit 77b2459

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

kafka/adminapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ const (
493493
ResourceUnknown ResourceType = C.RD_KAFKA_RESOURCE_UNKNOWN
494494
// ResourceAny - match any resource type (DescribeConfigs)
495495
ResourceAny ResourceType = C.RD_KAFKA_RESOURCE_ANY
496+
// ResourceTransactionalID - Transactional ID
497+
ResourceTransactionalID ResourceType = C.RD_KAFKA_RESOURCE_TRANSACTIONAL_ID
496498
// ResourceTopic - Topic
497499
ResourceTopic ResourceType = C.RD_KAFKA_RESOURCE_TOPIC
498500
// ResourceGroup - Group
@@ -512,6 +514,8 @@ func ResourceTypeFromString(typeString string) (ResourceType, error) {
512514
switch strings.ToUpper(typeString) {
513515
case "ANY":
514516
return ResourceAny, nil
517+
case "TRANSACTIONAL_ID":
518+
return ResourceTransactionalID, nil
515519
case "TOPIC":
516520
return ResourceTopic, nil
517521
case "GROUP":

kafka/integration_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,15 @@ func (its *IntegrationTestSuite) TestAdminACLs() {
21432143
Operation: ACLOperationRead,
21442144
PermissionType: ACLPermissionTypeAllow,
21452145
},
2146+
{
2147+
Type: ResourceTransactionalID,
2148+
Name: group,
2149+
ResourcePatternType: ResourcePatternTypePrefixed,
2150+
Principal: "User:test-user-2",
2151+
Host: "*",
2152+
Operation: ACLOperationAll,
2153+
PermissionType: ACLPermissionTypeAllow,
2154+
},
21462155
{
21472156
Type: ResourceTopic,
21482157
Name: topic,
@@ -2213,7 +2222,7 @@ func (its *IntegrationTestSuite) TestAdminACLs() {
22132222
if err != nil {
22142223
t.Fatalf("CreateACLs() failed: %s", err)
22152224
}
2216-
expectedCreateACLs = []CreateACLResult{{Error: noError}, {Error: noError}, {Error: noError}}
2225+
expectedCreateACLs = []CreateACLResult{{Error: noError}, {Error: noError}, {Error: noError}, {Error: noError}}
22172226
checkExpectedResult(expectedCreateACLs, resultCreateACLs)
22182227
}
22192228

0 commit comments

Comments
 (0)