| 1074 | } |
| 1075 | |
| 1076 | NanaBox::VirtualMachineConfiguration NanaBox::ToVirtualMachineConfiguration( |
| 1077 | nlohmann::json const& Value) |
| 1078 | { |
| 1079 | NanaBox::VirtualMachineConfiguration Result; |
| 1080 | |
| 1081 | Result.Version = static_cast<std::uint32_t>(Mile::Json::ToUInt64( |
| 1082 | Mile::Json::GetSubKey(Value, "Version"))); |
| 1083 | |
| 1084 | Result.GuestType = NanaBox::ToGuestType( |
| 1085 | Mile::Json::GetSubKey(Value, "GuestType")); |
| 1086 | |
| 1087 | Result.Name = Mile::Json::ToString( |
| 1088 | Mile::Json::GetSubKey(Value, "Name"), |
| 1089 | Result.Name); |
| 1090 | |
| 1091 | Result.ProcessorCount = static_cast<std::uint32_t>(Mile::Json::ToUInt64( |
| 1092 | Mile::Json::GetSubKey(Value, "ProcessorCount"))); |
| 1093 | |
| 1094 | Result.MemorySize = static_cast<std::uint32_t>(Mile::Json::ToUInt64( |
| 1095 | Mile::Json::GetSubKey(Value, "MemorySize"))); |
| 1096 | |
| 1097 | Result.ComPorts = NanaBox::ToComPortsConfiguration( |
| 1098 | Mile::Json::GetSubKey(Value, "ComPorts")); |
| 1099 | |
| 1100 | Result.Gpu = NanaBox::ToGpuConfiguration( |
| 1101 | Mile::Json::GetSubKey(Value, "Gpu")); |
| 1102 | |
| 1103 | for (nlohmann::json const& NetworkAdapter : Mile::Json::ToArray( |
| 1104 | Mile::Json::GetSubKey(Value, "NetworkAdapters"))) |
| 1105 | { |
| 1106 | Result.NetworkAdapters.push_back( |
| 1107 | NanaBox::ToNetworkAdapterConfiguration(NetworkAdapter)); |
| 1108 | } |
| 1109 | |
| 1110 | for (nlohmann::json const& ScsiDevice : Mile::Json::ToArray( |
| 1111 | Mile::Json::GetSubKey(Value, "ScsiDevices"))) |
| 1112 | { |
| 1113 | NanaBox::ScsiDeviceConfiguration Current = |
| 1114 | NanaBox::ToScsiDeviceConfiguration(ScsiDevice); |
| 1115 | |
| 1116 | if (NanaBox::ScsiDeviceType::Unknown == Current.Type) |
| 1117 | { |
| 1118 | continue; |
| 1119 | } |
| 1120 | |
| 1121 | if (Current.Path.empty() && |
| 1122 | Current.Type != NanaBox::ScsiDeviceType::VirtualImage) |
| 1123 | { |
| 1124 | continue; |
| 1125 | } |
| 1126 | |
| 1127 | Result.ScsiDevices.push_back(Current); |
| 1128 | } |
| 1129 | |
| 1130 | Result.SecureBoot = Mile::Json::ToBoolean( |
| 1131 | Mile::Json::GetSubKey(Value, "SecureBoot"), |
| 1132 | Result.SecureBoot); |
| 1133 |
nothing calls this directly
no outgoing calls
no test coverage detected