vsphere/internal/helper/structure/structure_helper.go
func NormalizeValue(v interface{}) interface{} {
	v = DeRef(v)
	if v == nil {
		return nil
	}
	k := reflect.TypeOf(v).Kind()
	switch {
	case k >= reflect.Int8 && k <= reflect.Uint64:
		v = reflect.ValueOf(v).Convert(reflect.TypeOf(int(0))).Interface()
	case k == reflect.Float32:
		v = reflect.ValueOf(v).Convert(reflect.TypeOf(float64(0))).Interface()
	}
	return v
}
func NormalizeValue(v interface{}) interface{} {
	v = DeRef(v)
	if v == nil {
		return nil
	}
	k := reflect.TypeOf(v).Kind()
	switch {
	case k >= reflect.Int8 && k <= reflect.Uint64:
		v = reflect.ValueOf(v).Convert(reflect.TypeOf(int(0))).Interface()
	case k == reflect.Float32:
		v = reflect.ValueOf(v).Convert(reflect.TypeOf(float64(0))).Interface()
	}
	return v
}
func NormalizeValue ( v interface { } ) interface { } { v = DeRef ( v ) if v == nil { return nil } k := reflect . TypeOf ( v ) . Kind ( ) switch { case k >= reflect . Int8 && k <= reflect . Uint64 : v = reflect . ValueOf ( v ) . Convert ( reflect . TypeOf ( int ( 0 ) ) ) . Interface ( ) case k == reflect . Float32 : v = reflect . ValueOf ( v ) . Convert ( reflect . TypeOf ( float64 ( 0 ) ) ) . Interface ( ) } return v }
// NormalizeValue converts a value to something that is suitable to be set in a
// ResourceData and can be useful in situations where there is not access to
// normal helper/schema functionality, but you still need saved fields to
// behave in the same way.
//
// Specifically, this will run the value through DeRef to dereference any
// pointers first, and then convert numeric primitives, if necessary.
NormalizeValue converts a value to something that is suitable to be set in a ResourceData and can be useful in situations where there is not access to normal helper / schema functionality but you still need saved fields to behave in the same way . Specifically this will run the value through DeRef to dereference any pointers first and then convert numeric primitives if necessary .