vsphere/resource_vsphere_storage_drs_vm_override.go
func expandStorageDrsVMConfigInfo(d *schema.ResourceData, vm *object.VirtualMachine) (*types.StorageDrsVmConfigInfo, error) {
	enabled, err := structure.GetBoolStringPtr(d, "sdrs_enabled")
	if err != nil {
		return nil, fmt.Errorf("error parsing field \"sdrs_enabled\": %s", err)
	}
	intraVMAffinity, err := structure.GetBoolStringPtr(d, "sdrs_intra_vm_affinity")
	if err != nil {
		return nil, fmt.Errorf("error parsing field \"sdrs_intra_vm_affinity\": %s", err)
	}

	obj := &types.StorageDrsVmConfigInfo{
		Behavior:        d.Get("sdrs_automation_level").(string),
		Enabled:         enabled,
		IntraVmAffinity: intraVMAffinity,
		Vm:              types.NewReference(vm.Reference()),
	}

	return obj, nil
}
func expandStorageDrsVMConfigInfo(d *schema.ResourceData, vm *object.VirtualMachine) (*types.StorageDrsVmConfigInfo, error) {
	enabled, err := structure.GetBoolStringPtr(d, "sdrs_enabled")
	if err != nil {
		return nil, fmt.Errorf("error parsing field \"sdrs_enabled\": %s", err)
	}
	intraVMAffinity, err := structure.GetBoolStringPtr(d, "sdrs_intra_vm_affinity")
	if err != nil {
		return nil, fmt.Errorf("error parsing field \"sdrs_intra_vm_affinity\": %s", err)
	}

	obj := &types.StorageDrsVmConfigInfo{
		Behavior:        d.Get("sdrs_automation_level").(string),
		Enabled:         enabled,
		IntraVmAffinity: intraVMAffinity,
		Vm:              types.NewReference(vm.Reference()),
	}

	return obj, nil
}
// expandStorageDrsVMConfigInfo reads certain ResourceData keys and returns a
// StorageDrsVmConfigInfo.