-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathdomain.go
More file actions
30 lines (26 loc) · 1.12 KB
/
domain.go
File metadata and controls
30 lines (26 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package events
import "regexp"
const (
AuthenticationDomain = "Authentication"
DefaultDomain = "General"
ImageScanningDomain = "Image Scanning"
IntegrationDomain = "Integrations"
)
var moduleToDomain = map[*regexp.Regexp]string{
regexp.MustCompile(`^apitoken/creation`): AuthenticationDomain,
regexp.MustCompile(`^apitoken/expiration`): AuthenticationDomain,
regexp.MustCompile(`(^|/)externalbackups(/|$)`): IntegrationDomain,
regexp.MustCompile(`(^|/)cloudsources(/|$)`): IntegrationDomain,
regexp.MustCompile(`(^|/)notifiers(/|$)`): IntegrationDomain,
regexp.MustCompile(`^reprocessor|image/service|detection/service|enrichment`): ImageScanningDomain,
}
// GetDomainFromModule retrieves a domain based on a specific module which will be
// used for administration events.
func GetDomainFromModule(module string) string {
for regex, domain := range moduleToDomain {
if regex.MatchString(module) {
return domain
}
}
return DefaultDomain
}