internal RestorePointSourceVmDataDisk(int?lun, string name, CachingTypes?caching, int?diskSizeGB, ManagedDiskParameters managedDisk, WritableSubResource diskRestorePoint)
 {
     Lun              = lun;
     Name             = name;
     Caching          = caching;
     DiskSizeGB       = diskSizeGB;
     ManagedDisk      = managedDisk;
     DiskRestorePoint = diskRestorePoint;
 }
 internal RestorePointSourceVmOSDisk(OperatingSystemType?oSType, DiskEncryptionSettings encryptionSettings, string name, CachingTypes?caching, int?diskSizeGB, ManagedDiskParameters managedDisk, WritableSubResource diskRestorePoint)
 {
     OSType             = oSType;
     EncryptionSettings = encryptionSettings;
     Name             = name;
     Caching          = caching;
     DiskSizeGB       = diskSizeGB;
     ManagedDisk      = managedDisk;
     DiskRestorePoint = diskRestorePoint;
 }
예제 #3
0
 internal OSDisk(OperatingSystemTypes?osType, DiskEncryptionSettings encryptionSettings, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingTypes?caching, bool?writeAcceleratorEnabled, DiffDiskSettings diffDiskSettings, DiskCreateOptionTypes createOption, int?diskSizeGB, ManagedDiskParameters managedDisk, DiskDeleteOptionTypes?deleteOption)
 {
     OSType             = osType;
     EncryptionSettings = encryptionSettings;
     Name    = name;
     Vhd     = vhd;
     Image   = image;
     Caching = caching;
     WriteAcceleratorEnabled = writeAcceleratorEnabled;
     DiffDiskSettings        = diffDiskSettings;
     CreateOption            = createOption;
     DiskSizeGB   = diskSizeGB;
     ManagedDisk  = managedDisk;
     DeleteOption = deleteOption;
 }
예제 #4
0
 internal DataDisk(int lun, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingTypes?caching, bool?writeAcceleratorEnabled, DiskCreateOptionTypes createOption, int?diskSizeGB, ManagedDiskParameters managedDisk, bool?toBeDetached, long?diskIopsReadWrite, long?diskMBpsReadWrite, DiskDetachOptionTypes?detachOption, DiskDeleteOptionTypes?deleteOption)
 {
     Lun     = lun;
     Name    = name;
     Vhd     = vhd;
     Image   = image;
     Caching = caching;
     WriteAcceleratorEnabled = writeAcceleratorEnabled;
     CreateOption            = createOption;
     DiskSizeGB        = diskSizeGB;
     ManagedDisk       = managedDisk;
     ToBeDetached      = toBeDetached;
     DiskIopsReadWrite = diskIopsReadWrite;
     DiskMBpsReadWrite = diskMBpsReadWrite;
     DetachOption      = detachOption;
     DeleteOption      = deleteOption;
 }
        internal static RestorePointSourceVmosDisk DeserializeRestorePointSourceVmosDisk(JsonElement element)
        {
            Optional <OperatingSystemType>    osType             = default;
            Optional <DiskEncryptionSettings> encryptionSettings = default;
            Optional <string>                name             = default;
            Optional <CachingTypes>          caching          = default;
            Optional <int>                   diskSizeGB       = default;
            Optional <ManagedDiskParameters> managedDisk      = default;
            Optional <WritableSubResource>   diskRestorePoint = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osType = new OperatingSystemType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    encryptionSettings = DiskEncryptionSettings.DeserializeDiskEncryptionSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("diskRestorePoint"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskRestorePoint = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
            }
            return(new RestorePointSourceVmosDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint));
        }
예제 #6
0
        internal static OSDisk DeserializeOSDisk(JsonElement element)
        {
            Optional <OperatingSystemTypes>   osType             = default;
            Optional <DiskEncryptionSettings> encryptionSettings = default;
            Optional <string>           name    = default;
            Optional <VirtualHardDisk>  vhd     = default;
            Optional <VirtualHardDisk>  image   = default;
            Optional <CachingTypes>     caching = default;
            Optional <bool>             writeAcceleratorEnabled = default;
            Optional <DiffDiskSettings> diffDiskSettings        = default;
            DiskCreateOptionTypes       createOption            = default;
            Optional <int> diskSizeGB = default;
            Optional <ManagedDiskParameters> managedDisk = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osType = property.Value.GetString().ToOperatingSystemTypes();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    encryptionSettings = DiskEncryptionSettings.DeserializeDiskEncryptionSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vhd"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    writeAcceleratorEnabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("diffDiskSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        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)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
            }
            return(new OSDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), diffDiskSettings.Value, createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value));
        }
        internal static RestorePointSourceVMDataDisk DeserializeRestorePointSourceVMDataDisk(JsonElement element)
        {
            Optional <int>                   lun              = default;
            Optional <string>                name             = default;
            Optional <CachingTypes>          caching          = default;
            Optional <int>                   diskSizeGB       = default;
            Optional <ManagedDiskParameters> managedDisk      = default;
            Optional <ApiEntityReference>    diskRestorePoint = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lun"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("diskRestorePoint"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskRestorePoint = ApiEntityReference.DeserializeApiEntityReference(property.Value);
                    continue;
                }
            }
            return(new RestorePointSourceVMDataDisk(Optional.ToNullable(lun), name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value));
        }
        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;
            Optional <DiskDetachOptionTypes> detachOption      = default;
            Optional <DiskDeleteOptionTypes> deleteOption      = 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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("image"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("writeAcceleratorEnabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        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)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("toBeDetached"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    toBeDetached = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("diskIOPSReadWrite"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskIOPSReadWrite = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("diskMBpsReadWrite"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskMBpsReadWrite = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("detachOption"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    detachOption = new DiskDetachOptionTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("deleteOption"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    deleteOption = new DiskDeleteOptionTypes(property.Value.GetString());
                    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), Optional.ToNullable(detachOption), Optional.ToNullable(deleteOption)));
        }
        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));
        }