Пример #1
0
        internal static VirtualMachineScaleSetManagedDiskParameters DeserializeVirtualMachineScaleSetManagedDiskParameters(JsonElement element)
        {
            Optional <StorageAccountTypes> storageAccountType = default;
            Optional <WritableSubResource> diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskEncryptionSet = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
            }
            return(new VirtualMachineScaleSetManagedDiskParameters(Optional.ToNullable(storageAccountType), diskEncryptionSet));
        }
Пример #2
0
        internal static VirtualMachineScaleSetManagedDiskParameters DeserializeVirtualMachineScaleSetManagedDiskParameters(JsonElement element)
        {
            StorageAccountTypes?storageAccountType = default;
            SubResource         diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineScaleSetManagedDiskParameters(storageAccountType, diskEncryptionSet));
        }
Пример #3
0
        internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonElement element)
        {
            Optional <StorageAccountTypes> storageAccountType = default;
            Optional <SubResource>         diskEncryptionSet  = default;
            Optional <string> id = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("storageAccountType"))
                {
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    diskEncryptionSet = DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
            }
            return(new ManagedDiskParameters(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet.Value));
        }
        internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element)
        {
            int lun = default;
            Optional <SubResource>         snapshot           = default;
            Optional <SubResource>         managedDisk        = default;
            Optional <string>              blobUri            = default;
            Optional <CachingTypes>        caching            = default;
            Optional <int>                 diskSizeGB         = default;
            Optional <StorageAccountTypes> storageAccountType = default;
            Optional <SubResource>         diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lun"))
                {
                    lun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("snapshot"))
                {
                    snapshot = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    managedDisk = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("blobUri"))
                {
                    blobUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
            }
            return(new ImageDataDisk(snapshot.Value, managedDisk.Value, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet.Value, lun));
        }
Пример #5
0
        internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonElement element)
        {
            Optional <StorageAccountTypes>   storageAccountType = default;
            Optional <WritableSubResource>   diskEncryptionSet  = default;
            Optional <VmDiskSecurityProfile> securityProfile    = default;
            Optional <ResourceIdentifier>    id = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskEncryptionSet = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("securityProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    securityProfile = VmDiskSecurityProfile.DeserializeVmDiskSecurityProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
            }
            return(new ManagedDiskParameters(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet, securityProfile.Value));
        }
        internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonElement element)
        {
            Optional <StorageAccountTypes>         storageAccountType = default;
            Optional <DiskEncryptionSetParameters> diskEncryptionSet  = default;
            Optional <string> id = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
            }
            return(new ManagedDiskParameters(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet.Value));
        }
        internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element)
        {
            int lun = default;
            Optional <WritableSubResource> snapshot           = default;
            Optional <WritableSubResource> managedDisk        = default;
            Optional <Uri>                 blobUri            = default;
            Optional <CachingTypes>        caching            = default;
            Optional <int>                 diskSizeGB         = default;
            Optional <StorageAccountTypes> storageAccountType = default;
            Optional <WritableSubResource> diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("lun"))
                {
                    lun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("snapshot"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    snapshot = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("blobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        blobUri = null;
                        continue;
                    }
                    blobUri = new Uri(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("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskEncryptionSet = JsonSerializer.Deserialize <WritableSubResource>(property.Value.ToString());
                    continue;
                }
            }
            return(new ImageDataDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, lun));
        }
        internal static ImageDisk DeserializeImageDisk(JsonElement element)
        {
            SubResource         snapshot           = default;
            SubResource         managedDisk        = default;
            string              blobUri            = default;
            CachingTypes?       caching            = default;
            int?                diskSizeGB         = default;
            StorageAccountTypes?storageAccountType = default;
            SubResource         diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("snapshot"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    snapshot = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    managedDisk = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("blobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    blobUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("caching"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    caching = property.Value.GetString().ToCachingTypes();
                    continue;
                }
                if (property.NameEquals("diskSizeGB"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskSizeGB = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
            }
            return(new ImageDisk(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet));
        }
        internal static ImageDisk DeserializeImageDisk(JsonElement element)
        {
            Optional <SubResource>                 snapshot           = default;
            Optional <SubResource>                 managedDisk        = default;
            Optional <string>                      blobUri            = default;
            Optional <CachingTypes>                caching            = default;
            Optional <int>                         diskSizeGB         = default;
            Optional <StorageAccountTypes>         storageAccountType = default;
            Optional <DiskEncryptionSetParameters> diskEncryptionSet  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("snapshot"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    snapshot = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("managedDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    managedDisk = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("blobUri"))
                {
                    blobUri = 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("storageAccountType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("diskEncryptionSet"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value);
                    continue;
                }
            }
            return(new ImageDisk(snapshot.Value, managedDisk.Value, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet.Value));
        }