AddLambda adds a given lambda config to the general bucket notification config
(lambdaConfig Config)
| 328 | |
| 329 | // AddLambda adds a given lambda config to the general bucket notification config |
| 330 | func (b *Configuration) AddLambda(lambdaConfig Config) bool { |
| 331 | newLambdaConfig := LambdaConfig{Config: lambdaConfig, Lambda: lambdaConfig.Arn.String()} |
| 332 | for _, n := range b.LambdaConfigs { |
| 333 | if n.Lambda == newLambdaConfig.Arn.String() && newLambdaConfig.Filter == n.Filter { |
| 334 | existingConfig := set.NewStringSet() |
| 335 | for _, v := range n.Events { |
| 336 | existingConfig.Add(string(v)) |
| 337 | } |
| 338 | |
| 339 | newConfig := set.NewStringSet() |
| 340 | for _, v := range lambdaConfig.Events { |
| 341 | newConfig.Add(string(v)) |
| 342 | } |
| 343 | |
| 344 | if !newConfig.Intersection(existingConfig).IsEmpty() { |
| 345 | return false |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | b.LambdaConfigs = append(b.LambdaConfigs, newLambdaConfig) |
| 350 | return true |
| 351 | } |
| 352 | |
| 353 | // RemoveTopicByArn removes all topic configurations that match the exact specified ARN |
| 354 | func (b *Configuration) RemoveTopicByArn(arn Arn) { |
no test coverage detected