github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/azurerm/validators.go (about)

     1  package azurerm
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/satori/uuid"
     7  )
     8  
     9  func validateJsonString(v interface{}, k string) (ws []string, errors []error) {
    10  	if _, err := normalizeJsonString(v); err != nil {
    11  		errors = append(errors, fmt.Errorf("%q contains an invalid JSON: %s", k, err))
    12  	}
    13  	return
    14  }
    15  
    16  func validateUUID(v interface{}, k string) (ws []string, errors []error) {
    17  	if _, err := uuid.FromString(v.(string)); err != nil {
    18  		errors = append(errors, fmt.Errorf("%q is an invalid UUUID: %s", k, err))
    19  	}
    20  	return
    21  }