2016-09-15 09:57:18 +02:00
|
|
|
package azurerm
|
|
|
|
|
2016-10-20 12:30:30 +02:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/satori/uuid"
|
|
|
|
)
|
2016-09-15 09:57:18 +02:00
|
|
|
|
|
|
|
func validateJsonString(v interface{}, k string) (ws []string, errors []error) {
|
|
|
|
if _, err := normalizeJsonString(v); err != nil {
|
|
|
|
errors = append(errors, fmt.Errorf("%q contains an invalid JSON: %s", k, err))
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2016-10-20 12:30:30 +02:00
|
|
|
|
|
|
|
func validateUUID(v interface{}, k string) (ws []string, errors []error) {
|
|
|
|
if _, err := uuid.FromString(v.(string)); err != nil {
|
|
|
|
errors = append(errors, fmt.Errorf("%q is an invalid UUUID: %s", k, err))
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|