MCPcopy Create free account
hub / github.com/M2Team/NanaBox / FromVirtualMachineConfiguration

Method FromVirtualMachineConfiguration

NanaBox/NanaBox.Configuration.Parser.cpp:913–1074  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913nlohmann::json NanaBox::FromVirtualMachineConfiguration(
914 NanaBox::VirtualMachineConfiguration const& Value)
915{
916 nlohmann::json Result;
917
918 Result["Version"] = Value.Version;
919
920 Result["GuestType"] = NanaBox::FromGuestType(Value.GuestType);
921
922 Result["Name"] = Value.Name;
923
924 Result["ProcessorCount"] = Value.ProcessorCount;
925
926 Result["MemorySize"] = Value.MemorySize;
927
928 Result["ComPorts"] = NanaBox::FromComPortsConfiguration(Value.ComPorts);
929
930 Result["Gpu"] = NanaBox::FromGpuConfiguration(Value.Gpu);
931
932 if (!Value.NetworkAdapters.empty())
933 {
934 nlohmann::json NetworkAdapters;
935 for (NanaBox::NetworkAdapterConfiguration const& NetworkAdapter
936 : Value.NetworkAdapters)
937 {
938 NetworkAdapters.push_back(
939 NanaBox::FromNetworkAdapterConfiguration(NetworkAdapter));
940 }
941 Result["NetworkAdapters"] = NetworkAdapters;
942 }
943
944 if (!Value.ScsiDevices.empty())
945 {
946 nlohmann::json ScsiDevices;
947 for (NanaBox::ScsiDeviceConfiguration const& ScsiDevice
948 : Value.ScsiDevices)
949 {
950 if (NanaBox::ScsiDeviceType::Unknown == ScsiDevice.Type)
951 {
952 continue;
953 }
954
955 ScsiDevices.push_back(
956 NanaBox::FromScsiDeviceConfiguration(ScsiDevice));
957 }
958 Result["ScsiDevices"] = ScsiDevices;
959 }
960
961 if (Value.SecureBoot)
962 {
963 Result["SecureBoot"] = Value.SecureBoot;
964 }
965
966 if (Value.Tpm)
967 {
968 Result["Tpm"] = Value.Tpm;
969 }
970

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected