internal static EncryptionImages DeserializeEncryptionImages(JsonElement element)
        {
            Optional <DiskImageEncryption> osDiskImage = default;
            Optional <IList <DataDiskImageEncryption> > dataDiskImages = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osDiskImage"))
                {
                    osDiskImage = DiskImageEncryption.DeserializeDiskImageEncryption(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDiskImages"))
                {
                    List <DataDiskImageEncryption> array = new List <DataDiskImageEncryption>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DataDiskImageEncryption.DeserializeDataDiskImageEncryption(item));
                    }
                    dataDiskImages = array;
                    continue;
                }
            }
            return(new EncryptionImages(osDiskImage.Value, Optional.ToList(dataDiskImages)));
        }
示例#2
0
        internal static EncryptionImages DeserializeEncryptionImages(JsonElement element)
        {
            DiskImageEncryption             osDiskImage    = default;
            IList <DataDiskImageEncryption> dataDiskImages = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osDiskImage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osDiskImage = DiskImageEncryption.DeserializeDiskImageEncryption(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDiskImages"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <DataDiskImageEncryption> array = new List <DataDiskImageEncryption>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(DataDiskImageEncryption.DeserializeDataDiskImageEncryption(item));
                        }
                    }
                    dataDiskImages = array;
                    continue;
                }
            }
            return(new EncryptionImages(osDiskImage, dataDiskImages));
        }