Now I'm making a kafka service broker and want to create a new user when provisioning by using golang. I've checked all kafka library of Go, But didn't find any way to create a user(principal). It seems that two method below from Shopify/Sarama may be possible way, but I have no idea how to use it and could not find a sample code.
//AlterConfigsRequest is an alter config request type
type AlterConfigsRequest struct {
Resources []*AlterConfigsResource
ValidateOnly bool
}
//AlterConfigsResource is an alter config resource type
type AlterConfigsResource struct {
Type ConfigResourceType
Name string
ConfigEntries map[string]*string
}
What I want to do is:
bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[iterations=8192,password=myusername-secret],SCRAM-SHA-512=[password=myusername-secret]' --entity-type users --entity-name myusername
Is it possible to call kafka-rest-api to create a user? what is the best solution?