-
Notifications
You must be signed in to change notification settings - Fork 2
/
helpers.go
66 lines (58 loc) · 1.75 KB
/
helpers.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
"strings"
)
// There are some WidgetDefinition types that don't even have a
// Request type in their struct (or don't have Q in the Request struct). We want to ignore those, since
// those won't contain a metric anyway.
func CheckIgnoredWidgetDefs(object datadog.WidgetDefinition) bool {
switch {
case object.AlertGraphWidgetDefinition != nil:
return true
case object.AlertValueWidgetDefinition != nil:
return true
case object.ChangeWidgetDefinition != nil:
return true
case object.CheckStatusWidgetDefinition != nil:
return true
case object.EventStreamWidgetDefinition != nil:
return true
case object.EventTimelineWidgetDefinition != nil:
return true
case object.FreeTextWidgetDefinition != nil:
return true
case object.GroupWidgetDefinition != nil:
return true
case object.HostMapWidgetDefinition != nil:
return true
case object.IFrameWidgetDefinition != nil:
return true
case object.ImageWidgetDefinition != nil:
return true
case object.LogStreamWidgetDefinition != nil:
return true
case object.MonitorSummaryWidgetDefinition != nil:
return true
case object.NoteWidgetDefinition != nil:
return true
case object.SLOWidgetDefinition != nil:
return true
case object.ScatterPlotWidgetDefinition != nil:
return true
case object.ServiceMapWidgetDefinition != nil:
return true
case object.ServiceSummaryWidgetDefinition != nil:
return true
}
return false
}
func SearchExpressionsArray(expressionsArray *[]string, searchStr string) []string {
var resultArray []string
for _, expression := range *expressionsArray {
if strings.Contains(expression, searchStr) {
resultArray = append(resultArray, expression)
}
}
return resultArray
}