internal static RestorePointSourceVmStorageProfile DeserializeRestorePointSourceVmStorageProfile(JsonElement element)
        {
            Optional <RestorePointSourceVmOSDisk> osDisk = default;
            Optional <IReadOnlyList <RestorePointSourceVmDataDisk> > dataDisks = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osDisk = RestorePointSourceVmOSDisk.DeserializeRestorePointSourceVmOSDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDisks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <RestorePointSourceVmDataDisk> array = new List <RestorePointSourceVmDataDisk>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(RestorePointSourceVmDataDisk.DeserializeRestorePointSourceVmDataDisk(item));
                    }
                    dataDisks = array;
                    continue;
                }
            }
            return(new RestorePointSourceVmStorageProfile(osDisk.Value, Optional.ToList(dataDisks)));
        }
Example #2
0
 internal RestorePointSourceVmStorageProfile(RestorePointSourceVmOSDisk osDisk, IReadOnlyList <RestorePointSourceVmDataDisk> dataDisks)
 {
     OSDisk    = osDisk;
     DataDisks = dataDisks;
 }