MCPcopy Index your code
hub / github.com/redpanda-data/console / GetTopicConfigs

Method GetTopicConfigs

backend/pkg/console/topic_config.go:122–145  ·  view source on GitHub ↗

GetTopicConfigs calls GetTopicsConfigs for a single Topic and returns a single response

(ctx context.Context, topicName string, configNames []string)

Source from the content-addressed store, hash-verified

120
121// GetTopicConfigs calls GetTopicsConfigs for a single Topic and returns a single response
122func (s *Service) GetTopicConfigs(ctx context.Context, topicName string, configNames []string) (*TopicConfig, *rest.Error) {
123 response, err := s.GetTopicsConfigs(ctx, []string{topicName}, configNames)
124 if err != nil {
125 return nil, &rest.Error{
126 Err: err,
127 Status: http.StatusInternalServerError,
128 Message: fmt.Sprintf("Failed to get topic's config: %v", err.Error()),
129 IsSilent: false,
130 }
131 }
132
133 if val, exists := response[topicName]; exists {
134 if val.Error != nil && val.Error.Code == kerr.UnknownTopicOrPartition.Code {
135 return nil, &rest.Error{
136 Err: errors.New("the requested topic does not exist"),
137 Status: http.StatusNotFound,
138 Message: fmt.Sprintf("Could not fetch topic config because the requested topic '%v' does not exist.", topicName),
139 IsSilent: false,
140 }
141 }
142 }
143
144 return response[topicName], nil
145}
146
147// GetTopicsConfigs fetches all topic config options for the given set of topic names and config names and converts
148// that information so that it is handy to use. Provide an empty array for configNames to describe all config entries.

Callers 1

TestGetTopicConfigsMethod · 0.95

Calls 2

GetTopicsConfigsMethod · 0.95
ErrorMethod · 0.45

Tested by 1

TestGetTopicConfigsMethod · 0.76