CloudMonitoring: switch from ApplyRoute to AuthMiddleware (#40787)

This commit is contained in:
Isabella Siu
2021-10-26 10:17:12 -04:00
committed by GitHub
parent 2c3b35df64
commit 8ee3afa4c3
5 changed files with 117 additions and 62 deletions

View File

@@ -0,0 +1,26 @@
package cloudmonitoring
import (
"strings"
)
func reverse(s string) string {
chars := []rune(s)
for i, j := 0, len(chars)-1; i < j; i, j = i+1, j-1 {
chars[i], chars[j] = chars[j], chars[i]
}
return string(chars)
}
func toSnakeCase(str string) string {
return strings.ToLower(matchAllCap.ReplaceAllString(str, "${1}_${2}"))
}
func containsLabel(labels []string, newLabel string) bool {
for _, val := range labels {
if val == newLabel {
return true
}
}
return false
}