internal static CreationData DeserializeCreationData(JsonElement element)
        {
            DiskCreateOption              createOption          = default;
            Optional <string>             storageAccountId      = default;
            Optional <ImageDiskReference> imageReference        = default;
            Optional <ImageDiskReference> galleryImageReference = default;
            Optional <string>             sourceUri             = default;
            Optional <string>             sourceResourceId      = default;
            Optional <string>             sourceUniqueId        = default;
            Optional <long> uploadSizeBytes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    storageAccountId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    sourceUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    sourceResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
            }
            return(new CreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes)));
        }
Beispiel #2
0
        internal static CreationData DeserializeCreationData(JsonElement element)
        {
            DiskCreateOption   createOption          = default;
            string             storageAccountId      = default;
            ImageDiskReference imageReference        = default;
            ImageDiskReference galleryImageReference = default;
            string             sourceUri             = default;
            string             sourceResourceId      = default;
            string             sourceUniqueId        = default;
            long?uploadSizeBytes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageAccountId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
            }
            return(new CreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, sourceResourceId, sourceUniqueId, uploadSizeBytes));
        }