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

Method AddLambda

pkg/notification/notification.go:330–351  ·  view source on GitHub ↗

AddLambda adds a given lambda config to the general bucket notification config

(lambdaConfig Config)

Source from the content-addressed store, hash-verified

328
329// AddLambda adds a given lambda config to the general bucket notification config
330func (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
354func (b *Configuration) RemoveTopicByArn(arn Arn) {

Callers 1

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