MCPcopy
hub / github.com/minio/minio-go / AddTopic

Method AddTopic

pkg/notification/notification.go:281–303  ·  view source on GitHub ↗

AddTopic adds a given topic config to the general bucket notification config

(topicConfig Config)

Source from the content-addressed store, hash-verified

279
280// AddTopic adds a given topic config to the general bucket notification config
281func (b *Configuration) AddTopic(topicConfig Config) bool {
282 newTopicConfig := TopicConfig{Config: topicConfig, Topic: topicConfig.Arn.String()}
283 for _, n := range b.TopicConfigs {
284 // If new config matches existing one
285 if n.Topic == newTopicConfig.Arn.String() && newTopicConfig.Filter == n.Filter {
286 existingConfig := set.NewStringSet()
287 for _, v := range n.Events {
288 existingConfig.Add(string(v))
289 }
290
291 newConfig := set.NewStringSet()
292 for _, v := range topicConfig.Events {
293 newConfig.Add(string(v))
294 }
295
296 if !newConfig.Intersection(existingConfig).IsEmpty() {
297 return false
298 }
299 }
300 }
301 b.TopicConfigs = append(b.TopicConfigs, newTopicConfig)
302 return true
303}
304
305// AddQueue adds a given queue config to the general bucket notification config
306func (b *Configuration) AddQueue(queueConfig Config) bool {

Callers 2

testBucketNotificationFunction · 0.95
mainFunction · 0.95

Calls 5

AddMethod · 0.95
IntersectionMethod · 0.95
NewStringSetFunction · 0.92
StringMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected