2017-02-06 20:54:58 +01:00
|
|
|
package fastly
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
2017-04-10 13:04:14 +02:00
|
|
|
func validateLoggingFormatVersion(v interface{}, k string) (ws []string, errors []error) {
|
2017-02-06 20:54:58 +01:00
|
|
|
value := uint(v.(int))
|
|
|
|
validVersions := map[uint]struct{}{
|
|
|
|
1: {},
|
|
|
|
2: {},
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := validVersions[value]; !ok {
|
|
|
|
errors = append(errors, fmt.Errorf(
|
|
|
|
"%q must be one of ['1', '2']", k))
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2017-04-10 13:04:14 +02:00
|
|
|
|
|
|
|
func validateLoggingMessageType(v interface{}, k string) (ws []string, errors []error) {
|
|
|
|
value := v.(string)
|
|
|
|
validTypes := map[string]struct{}{
|
|
|
|
"classic": {},
|
|
|
|
"loggly": {},
|
|
|
|
"logplex": {},
|
|
|
|
"blank": {},
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := validTypes[value]; !ok {
|
|
|
|
errors = append(errors, fmt.Errorf(
|
|
|
|
"%q must be one of ['classic', 'loggly', 'logplex', 'blank']", k))
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|