internal static DataDisk DeserializeDataDisk(JsonElement element)
        {
            int lun = default;
            Optional <string>                name    = default;
            Optional <VirtualHardDisk>       vhd     = default;
            Optional <VirtualHardDisk>       image   = default;
            Optional <CachingTypes>          caching = default;
            Optional <bool>                  writeAcceleratorEnabled = default;
            DiskCreateOptionTypes            createOption            = default;
            Optional <int>                   diskSizeGB        = default;
            Optional <ManagedDiskParameters> managedDisk       = default;
            Optional <bool>                  toBeDetached      = default;
            Optional <long>                  diskIOPSReadWrite = default;
            Optional <long>                  diskMBpsReadWrite = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lun"))
                {
                    lun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vhd"))
                {
                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    writeAcceleratorEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("toBeDetached"))
                {
                    toBeDetached = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("diskIOPSReadWrite"))
                {
                    diskIOPSReadWrite = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("diskMBpsReadWrite"))
                {
                    diskMBpsReadWrite = property.Value.GetInt64();
                    continue;
                }
            }
            return(new DataDisk(lun, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(toBeDetached), Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite)));
        }
        internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOSDisk(JsonElement element)
        {
            Optional <string>           name    = default;
            Optional <CachingTypes>     caching = default;
            Optional <bool>             writeAcceleratorEnabled = default;
            DiskCreateOptionTypes       createOption            = default;
            Optional <DiffDiskSettings> diffDiskSettings        = default;
            Optional <int> diskSizeGB = default;
            Optional <OperatingSystemTypes> osType        = default;
            Optional <VirtualHardDisk>      image         = default;
            Optional <IList <string> >      vhdContainers = default;
            Optional <VirtualMachineScaleSetManagedDiskParameters> managedDisk = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    writeAcceleratorEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diffDiskSettings"))
                {
                    diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("osType"))
                {
                    osType = property.Value.GetString().ToOperatingSystemTypes();
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("vhdContainers"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    vhdContainers = array;
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    managedDisk = VirtualMachineScaleSetManagedDiskParameters.DeserializeVirtualMachineScaleSetManagedDiskParameters(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineScaleSetOSDisk(name.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, diffDiskSettings.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(osType), image.Value, Optional.ToList(vhdContainers), managedDisk.Value));
        }
        internal static DataDisk DeserializeDataDisk(JsonElement element)
        {
            int                   lun     = default;
            string                name    = default;
            VirtualHardDisk       vhd     = default;
            VirtualHardDisk       image   = default;
            CachingTypes?         caching = default;
            bool?                 writeAcceleratorEnabled = default;
            DiskCreateOptionTypes createOption            = default;
            int?                  diskSizeGB        = default;
            ManagedDiskParameters managedDisk       = default;
            bool?                 toBeDetached      = default;
            long?                 diskIOPSReadWrite = default;
            long?                 diskMBpsReadWrite = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lun"))
                {
                    lun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vhd"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    writeAcceleratorEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("toBeDetached"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    toBeDetached = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("diskIOPSReadWrite"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskIOPSReadWrite = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("diskMBpsReadWrite"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskMBpsReadWrite = property.Value.GetInt64();
                    continue;
                }
            }
            return(new DataDisk(lun, name, vhd, image, caching, writeAcceleratorEnabled, createOption, diskSizeGB, managedDisk, toBeDetached, diskIOPSReadWrite, diskMBpsReadWrite));
        }
        internal static OSDisk DeserializeOSDisk(JsonElement element)
        {
            OperatingSystemTypes?  osType             = default;
            DiskEncryptionSettings encryptionSettings = default;
            string                name    = default;
            VirtualHardDisk       vhd     = default;
            VirtualHardDisk       image   = default;
            CachingTypes?         caching = default;
            bool?                 writeAcceleratorEnabled = default;
            DiffDiskSettings      diffDiskSettings        = default;
            DiskCreateOptionTypes createOption            = default;
            int?diskSizeGB = default;
            ManagedDiskParameters managedDisk = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osType = property.Value.GetString().ToOperatingSystemTypes();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    encryptionSettings = DiskEncryptionSettings.DeserializeDiskEncryptionSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vhd"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    writeAcceleratorEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("diffDiskSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
            }
            return(new OSDisk(osType, encryptionSettings, name, vhd, image, caching, writeAcceleratorEnabled, diffDiskSettings, createOption, diskSizeGB, managedDisk));
        }
예제 #5
0
 internal VirtualMachineScaleSetOSDisk(string name, CachingTypes?caching, bool?writeAcceleratorEnabled, DiskCreateOptionTypes createOption, DiffDiskSettings diffDiskSettings, int?diskSizeGB, OperatingSystemTypes?osType, VirtualHardDisk image, IList <string> vhdContainers, VirtualMachineScaleSetManagedDiskParameters managedDisk)
 {
     Name    = name;
     Caching = caching;
     WriteAcceleratorEnabled = writeAcceleratorEnabled;
     CreateOption            = createOption;
     DiffDiskSettings        = diffDiskSettings;
     DiskSizeGB    = diskSizeGB;
     OSType        = osType;
     Image         = image;
     VhdContainers = vhdContainers;
     ManagedDisk   = managedDisk;
 }
예제 #6
0
 public VirtualMachineScaleSetOSDisk(DiskCreateOptionTypes createOption)
 {
     CreateOption  = createOption;
     VhdContainers = new ChangeTrackingList <string>();
 }