示例#1
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;
 }
        internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSetDataDisk(JsonElement element)
        {
            Optional <string> name = default;
            int lun = default;
            Optional <CachingTypes> caching = default;
            Optional <bool>         writeAcceleratorEnabled = default;
            DiskCreateOptionTypes   createOption            = default;
            Optional <int>          diskSizeGB = default;
            Optional <VirtualMachineScaleSetManagedDiskParameters> managedDisk = default;
            Optional <long> diskIOPSReadWrite = default;
            Optional <long> diskMBpsReadWrite = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lun"))
                {
                    lun = property.Value.GetInt32();
                    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 = VirtualMachineScaleSetManagedDiskParameters.DeserializeVirtualMachineScaleSetManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("diskIOPSReadWrite"))
                {
                    diskIOPSReadWrite = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("diskMBpsReadWrite"))
                {
                    diskMBpsReadWrite = property.Value.GetInt64();
                    continue;
                }
            }
            return(new VirtualMachineScaleSetDataDisk(name.Value, lun, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite)));
        }