-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate.go
36 lines (29 loc) · 1.05 KB
/
generate.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
package main
import (
"strings"
)
func generateFiberMetric(dotZero string, header string, modelActionMetric string) []string {
metrics := []string{}
fiber := "Currently"
if strings.Contains(header, fiber) {
keyPlusValue := empty
keyPlusValue = strings.Replace(header, fiber, empty, oneOccurance)
keyPlusValue = strings.Replace(keyPlusValue, "\u00A0\u00A0 ", equals, oneOccurance)
keyPlusValue = strings.Replace(keyPlusValue, space, period, oneOccurance)
metric := modelActionMetric + period + keyPlusValue + dotZero
metrics = append(metrics, metric)
}
return metrics
}
func generateNonFiberMetric(
action, dotZero string, flags *flags, modelActionMetric, summary string, tableData [][]string,
) []string {
var metrics []string
lowerSummary := strings.ToLower(strings.Replace(summary, space, period, oneOccurance))
if action == "nat-totals" {
metrics = processNatTotalsAction(tableData, modelActionMetric, dotZero, flags)
} else {
metrics = processGeneralAction(tableData, modelActionMetric, lowerSummary, dotZero, flags)
}
return metrics
}