// StringInSlice returns a SchemaValidateFunc which tests if the provided value
// is of type string and matches the value of an element in the valid slice
// will test with in lower case if ignoreCase is true
StringInSlice returns a SchemaValidateFunc which tests if the provided value
is of type string and matches the value of an element in the valid slice
will test with in lower case if ignoreCase is true
// StringInSlice returns a SchemaValidateFunc which tests if the provided value // is of type string and matches the value of an element in the valid slice // will test with in lower case if ignoreCase is true
func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateFunc {
	return func(i interface{}, k string) (s []string, es []error) {
		v, ok := i.(string)
		if !ok {
			es = append(es, fmt.Errorf("expected type of %s to be string", k))
			return
		}
		for _, str := range valid {
			if v == str || (ignoreCase && strings.ToLower(v) == strings.ToLower(str)) {
				return
			}
		}
		es = append(es, fmt.Errorf("expected %s to be one of %v, got %s", k, valid, v))
		return
	}
}
func StringInSlice ( valid [ ] string , ignoreCase bool ) schema . SchemaValidateFunc { return func ( i interface { } , k string ) ( s [ ] string , es [ ] error ) { v , ok := i . ( string ) if ! ok { es = append ( es , fmt . Errorf ( " " , k ) ) return } for _ , str := range valid { if v == str || ( ignoreCase && strings . ToLower ( v ) == strings . ToLower ( str ) ) { return } } es = append ( es , fmt . Errorf ( " " , k , valid , v ) ) return } }
StringInSlice returns a SchemaValidateFunc which tests if the provided value
is of type string and matches the value of an element in the valid slice
will test with in lower case if ignoreCase is true
StringInSlice returns a SchemaValidateFunc which tests if the provided value is of type string and matches the value of an element in the valid slice will test with in lower case if ignoreCase is true