(reqBody versionedDecoder)
| 846 | } |
| 847 | |
| 848 | func (mr *MockDescribeConfigsResponse) For(reqBody versionedDecoder) encoderWithHeader { |
| 849 | req := reqBody.(*DescribeConfigsRequest) |
| 850 | res := &DescribeConfigsResponse{ |
| 851 | Version: req.Version, |
| 852 | } |
| 853 | |
| 854 | includeSynonyms := req.Version > 0 |
| 855 | includeSource := req.Version > 0 |
| 856 | |
| 857 | for _, r := range req.Resources { |
| 858 | var configEntries []*ConfigEntry |
| 859 | switch r.Type { |
| 860 | case BrokerResource: |
| 861 | configEntries = append(configEntries, |
| 862 | &ConfigEntry{ |
| 863 | Name: "min.insync.replicas", |
| 864 | Value: "2", |
| 865 | ReadOnly: false, |
| 866 | Default: false, |
| 867 | }, |
| 868 | ) |
| 869 | res.Resources = append(res.Resources, &ResourceResponse{ |
| 870 | Name: r.Name, |
| 871 | Type: r.Type, |
| 872 | Configs: configEntries, |
| 873 | }) |
| 874 | case BrokerLoggerResource: |
| 875 | configEntries = append(configEntries, |
| 876 | &ConfigEntry{ |
| 877 | Name: "kafka.controller.KafkaController", |
| 878 | Value: "DEBUG", |
| 879 | ReadOnly: false, |
| 880 | Default: false, |
| 881 | }, |
| 882 | ) |
| 883 | res.Resources = append(res.Resources, &ResourceResponse{ |
| 884 | Name: r.Name, |
| 885 | Type: r.Type, |
| 886 | Configs: configEntries, |
| 887 | }) |
| 888 | case TopicResource: |
| 889 | maxMessageBytes := &ConfigEntry{ |
| 890 | Name: "max.message.bytes", |
| 891 | Value: "1000000", |
| 892 | ReadOnly: false, |
| 893 | Default: !includeSource, |
| 894 | Sensitive: false, |
| 895 | } |
| 896 | if includeSource { |
| 897 | maxMessageBytes.Source = SourceDefault |
| 898 | } |
| 899 | if includeSynonyms { |
| 900 | maxMessageBytes.Synonyms = []*ConfigSynonym{ |
| 901 | { |
| 902 | ConfigName: "max.message.bytes", |
| 903 | ConfigValue: "500000", |
| 904 | }, |
| 905 | } |
no outgoing calls