AddTopic adds a given topic config to the general bucket notification config
(topicConfig Config)
| 279 | |
| 280 | // AddTopic adds a given topic config to the general bucket notification config |
| 281 | func (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 |
| 306 | func (b *Configuration) AddQueue(queueConfig Config) bool { |
no test coverage detected