MCPcopy
hub / github.com/IBM/sarama / IncrementalAlterConfig

Method IncrementalAlterConfig

admin.go:1008–1063  ·  view source on GitHub ↗
(resourceType ConfigResourceType, name string, entries map[string]IncrementalAlterConfigsEntry, validateOnly bool)

Source from the content-addressed store, hash-verified

1006}
1007
1008func (ca *clusterAdmin) IncrementalAlterConfig(resourceType ConfigResourceType, name string, entries map[string]IncrementalAlterConfigsEntry, validateOnly bool) error {
1009 var resources []*IncrementalAlterConfigsResource
1010 resources = append(resources, &IncrementalAlterConfigsResource{
1011 Type: resourceType,
1012 Name: name,
1013 ConfigEntries: entries,
1014 })
1015
1016 request := &IncrementalAlterConfigsRequest{
1017 Resources: resources,
1018 ValidateOnly: validateOnly,
1019 }
1020
1021 if ca.conf.Version.IsAtLeast(V2_4_0_0) {
1022 request.Version = 1
1023 }
1024
1025 var (
1026 b *Broker
1027 err error
1028 )
1029
1030 // AlterConfig of broker/broker logger must be sent to the broker in question
1031 if dependsOnSpecificNode(&ConfigResource{Name: name, Type: resourceType}) {
1032 var id int64
1033 id, err = strconv.ParseInt(name, 10, 32)
1034 if err != nil {
1035 return err
1036 }
1037 b, err = ca.findBroker(int32(id))
1038 } else {
1039 b, err = ca.findAnyBroker()
1040 }
1041 if err != nil {
1042 return err
1043 }
1044
1045 _ = b.Open(ca.client.Config())
1046 rsp, err := b.IncrementalAlterConfigs(request)
1047 if err != nil {
1048 return err
1049 }
1050
1051 for _, rspResource := range rsp.Resources {
1052 if rspResource.Name == name {
1053 if rspResource.ErrorCode != int16(ErrNoError) {
1054 err = KError(rspResource.ErrorCode)
1055 if rspResource.ErrorMsg != "" {
1056 err = fmt.Errorf("%w: %s", err, rspResource.ErrorMsg)
1057 }
1058 return err
1059 }
1060 }
1061 }
1062 return nil
1063}
1064
1065func (ca *clusterAdmin) CreateACL(resource Resource, acl Acl) error {

Callers

nothing calls this directly

Calls 9

findBrokerMethod · 0.95
findAnyBrokerMethod · 0.95
dependsOnSpecificNodeFunction · 0.85
KErrorTypeAlias · 0.85
IsAtLeastMethod · 0.80
OpenMethod · 0.80
ConfigMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected