internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData(JsonElement element) { Optional <ExtendedLocation> extendedLocation = default; Optional <string> kind = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <string> uuid = default; Optional <string> vCenterId = default; Optional <string> moRefId = default; Optional <string> inventoryItemId = default; Optional <string> moName = default; Optional <int> memorySizeMB = default; Optional <int> numCPUs = default; Optional <int> numCoresPerSocket = default; Optional <OSType> osType = default; Optional <string> osName = default; Optional <string> folderPath = default; Optional <IReadOnlyList <NetworkInterface> > networkInterfaces = default; Optional <IReadOnlyList <VirtualDisk> > disks = default; Optional <string> customResourceName = default; Optional <string> toolsVersionStatus = default; Optional <string> toolsVersion = default; Optional <FirmwareType> firmwareType = default; Optional <IReadOnlyList <ResourceStatus> > statuses = default; Optional <string> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("uuid")) { uuid = property0.Value.GetString(); continue; } if (property0.NameEquals("vCenterId")) { vCenterId = property0.Value.GetString(); continue; } if (property0.NameEquals("moRefId")) { moRefId = property0.Value.GetString(); continue; } if (property0.NameEquals("inventoryItemId")) { inventoryItemId = property0.Value.GetString(); continue; } if (property0.NameEquals("moName")) { moName = property0.Value.GetString(); continue; } if (property0.NameEquals("memorySizeMB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } memorySizeMB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("numCPUs")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } numCPUs = property0.Value.GetInt32(); continue; } if (property0.NameEquals("numCoresPerSocket")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } numCoresPerSocket = property0.Value.GetInt32(); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = new OSType(property0.Value.GetString()); continue; } if (property0.NameEquals("osName")) { osName = property0.Value.GetString(); continue; } if (property0.NameEquals("folderPath")) { folderPath = property0.Value.GetString(); continue; } if (property0.NameEquals("networkInterfaces")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterface> array = new List <NetworkInterface>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(NetworkInterface.DeserializeNetworkInterface(item)); } networkInterfaces = array; continue; } if (property0.NameEquals("disks")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualDisk> array = new List <VirtualDisk>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualDisk.DeserializeVirtualDisk(item)); } disks = array; continue; } if (property0.NameEquals("customResourceName")) { customResourceName = property0.Value.GetString(); continue; } if (property0.NameEquals("toolsVersionStatus")) { toolsVersionStatus = property0.Value.GetString(); continue; } if (property0.NameEquals("toolsVersion")) { toolsVersion = property0.Value.GetString(); continue; } if (property0.NameEquals("firmwareType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } firmwareType = new FirmwareType(property0.Value.GetString()); continue; } if (property0.NameEquals("statuses")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ResourceStatus> array = new List <ResourceStatus>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ResourceStatus.DeserializeResourceStatus(item)); } statuses = array; continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } } continue; } } return(new VirtualMachineTemplateData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCPUs), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(osType), osName.Value, folderPath.Value, Optional.ToList(networkInterfaces), Optional.ToList(disks), customResourceName.Value, toolsVersionStatus.Value, toolsVersion.Value, Optional.ToNullable(firmwareType), Optional.ToList(statuses), provisioningState.Value)); }
internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTemplateData(JsonElement element) { ExtendedLocation extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <string> inventoryItemId = default; Optional <string> uuid = default; Optional <string> vmmServerId = default; Optional <OSType> osType = default; Optional <string> osName = default; Optional <string> computerName = default; Optional <int> memoryMB = default; Optional <int> cpuCount = default; Optional <LimitCpuForMigration> limitCpuForMigration = default; Optional <DynamicMemoryEnabled> dynamicMemoryEnabled = default; Optional <IsCustomizable> isCustomizable = default; Optional <int> dynamicMemoryMaxMB = default; Optional <int> dynamicMemoryMinMB = default; Optional <string> isHighlyAvailable = default; Optional <int> generation = default; Optional <IReadOnlyList <NetworkInterfaces> > networkInterfaces = default; Optional <IReadOnlyList <VirtualDisk> > disks = default; Optional <string> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation")) { extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = new AzureLocation(property.Value.GetString()); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new ResourceType(property.Value.GetString()); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("inventoryItemId")) { inventoryItemId = property0.Value.GetString(); continue; } if (property0.NameEquals("uuid")) { uuid = property0.Value.GetString(); continue; } if (property0.NameEquals("vmmServerId")) { vmmServerId = property0.Value.GetString(); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = new OSType(property0.Value.GetString()); continue; } if (property0.NameEquals("osName")) { osName = property0.Value.GetString(); continue; } if (property0.NameEquals("computerName")) { computerName = property0.Value.GetString(); continue; } if (property0.NameEquals("memoryMB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } memoryMB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("cpuCount")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } cpuCount = property0.Value.GetInt32(); continue; } if (property0.NameEquals("limitCpuForMigration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } limitCpuForMigration = new LimitCpuForMigration(property0.Value.GetString()); continue; } if (property0.NameEquals("dynamicMemoryEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } dynamicMemoryEnabled = new DynamicMemoryEnabled(property0.Value.GetString()); continue; } if (property0.NameEquals("isCustomizable")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } isCustomizable = new IsCustomizable(property0.Value.GetString()); continue; } if (property0.NameEquals("dynamicMemoryMaxMB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } dynamicMemoryMaxMB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("dynamicMemoryMinMB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } dynamicMemoryMinMB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("isHighlyAvailable")) { isHighlyAvailable = property0.Value.GetString(); continue; } if (property0.NameEquals("generation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } generation = property0.Value.GetInt32(); continue; } if (property0.NameEquals("networkInterfaces")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterfaces> array = new List <NetworkInterfaces>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(Models.NetworkInterfaces.DeserializeNetworkInterfaces(item)); } networkInterfaces = array; continue; } if (property0.NameEquals("disks")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualDisk> array = new List <VirtualDisk>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualDisk.DeserializeVirtualDisk(item)); } disks = array; continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } } continue; } } return(new ScVmmVirtualMachineTemplateData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, Optional.ToNullable(osType), osName.Value, computerName.Value, Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(isCustomizable), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value, Optional.ToNullable(generation), Optional.ToList(networkInterfaces), Optional.ToList(disks), provisioningState.Value)); }