terraform/builtin/providers/pagerduty/structure.go

23 lines
516 B
Go
Raw Normal View History

2016-09-23 21:43:06 +02:00
package pagerduty
// Takes the result of flatmap.Expand for an array of strings
// and returns a []string
func expandStringList(configured []interface{}) []string {
vs := make([]string, 0, len(configured))
for _, v := range configured {
vs = append(vs, string(v.(string)))
}
return vs
}
// Checks if a slice contains a string
func contains(slice []string, item string) bool {
set := make(map[string]struct{}, len(slice))
for _, s := range slice {
set[s] = struct{}{}
}
_, ok := set[item]
return ok
}