internal static ClusterDesiredProperties DeserializeClusterDesiredProperties(JsonElement element) { Optional <WindowsServerSubscription> windowsServerSubscription = default; Optional <DiagnosticLevel> diagnosticLevel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("windowsServerSubscription")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } windowsServerSubscription = new WindowsServerSubscription(property.Value.GetString()); continue; } if (property.NameEquals("diagnosticLevel")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } diagnosticLevel = new DiagnosticLevel(property.Value.GetString()); continue; } } return(new ClusterDesiredProperties(Optional.ToNullable(windowsServerSubscription), Optional.ToNullable(diagnosticLevel))); }
internal static ClusterNode DeserializeClusterNode(JsonElement element) { Optional <string> name = default; Optional <float> id = default; Optional <WindowsServerSubscription> windowsServerSubscription = default; Optional <string> manufacturer = default; Optional <string> model = default; Optional <string> osName = default; Optional <string> osVersion = default; Optional <string> serialNumber = default; Optional <float> coreCount = default; Optional <float> memoryInGiB = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } id = property.Value.GetSingle(); continue; } if (property.NameEquals("windowsServerSubscription")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } windowsServerSubscription = new WindowsServerSubscription(property.Value.GetString()); continue; } if (property.NameEquals("manufacturer")) { manufacturer = property.Value.GetString(); continue; } if (property.NameEquals("model")) { model = property.Value.GetString(); continue; } if (property.NameEquals("osName")) { osName = property.Value.GetString(); continue; } if (property.NameEquals("osVersion")) { osVersion = property.Value.GetString(); continue; } if (property.NameEquals("serialNumber")) { serialNumber = property.Value.GetString(); continue; } if (property.NameEquals("coreCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } coreCount = property.Value.GetSingle(); continue; } if (property.NameEquals("memoryInGiB")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } memoryInGiB = property.Value.GetSingle(); continue; } } return(new ClusterNode(name.Value, Optional.ToNullable(id), Optional.ToNullable(windowsServerSubscription), manufacturer.Value, model.Value, osName.Value, osVersion.Value, serialNumber.Value, Optional.ToNullable(coreCount), Optional.ToNullable(memoryInGiB))); }