vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go
func expandBaseCustomizationIdentitySettings(d *schema.ResourceData, family string) types.BaseCustomizationIdentitySettings {
	var obj types.BaseCustomizationIdentitySettings
	_, windowsExists := d.GetOkExists(cKeyPrefix + "." + "windows_options")
	_, sysprepExists := d.GetOkExists(cKeyPrefix + "." + "windows_sysprep_text")
	switch {
	case family == string(types.VirtualMachineGuestOsFamilyLinuxGuest):
		obj = expandCustomizationLinuxPrep(d)
	case family == string(types.VirtualMachineGuestOsFamilyWindowsGuest) && windowsExists:
		obj = expandCustomizationSysprep(d)
	case family == string(types.VirtualMachineGuestOsFamilyWindowsGuest) && sysprepExists:
		obj = expandCustomizationSysprepText(d)
	default:
		obj = &types.CustomizationIdentitySettings{}
	}
	return obj
}
func expandBaseCustomizationIdentitySettings(d *schema.ResourceData, family string) types.BaseCustomizationIdentitySettings {
	var obj types.BaseCustomizationIdentitySettings
	_, windowsExists := d.GetOkExists(cKeyPrefix + "." + "windows_options")
	_, sysprepExists := d.GetOkExists(cKeyPrefix + "." + "windows_sysprep_text")
	switch {
	case family == string(types.VirtualMachineGuestOsFamilyLinuxGuest):
		obj = expandCustomizationLinuxPrep(d)
	case family == string(types.VirtualMachineGuestOsFamilyWindowsGuest) && windowsExists:
		obj = expandCustomizationSysprep(d)
	case family == string(types.VirtualMachineGuestOsFamilyWindowsGuest) && sysprepExists:
		obj = expandCustomizationSysprepText(d)
	default:
		obj = &types.CustomizationIdentitySettings{}
	}
	return obj
}
// expandBaseCustomizationIdentitySettings returns a
// BaseCustomizationIdentitySettings, depending on what is defined.
//
// Only one of the three types of identity settings can be specified: Linux
// settings (from linux_options), Windows settings (from windows_options), and
// the raw Windows sysprep file (via windows_sysprep_text).