コード例 #1
0
        internal static EncryptionImages DeserializeEncryptionImages(JsonElement element)
        {
            Optional <OSDiskImageEncryption>            osDiskImage    = default;
            Optional <IList <DataDiskImageEncryption> > dataDiskImages = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osDiskImage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osDiskImage = OSDiskImageEncryption.DeserializeOSDiskImageEncryption(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDiskImages"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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));
        }