| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class GalleryImageVersionStorageProfile : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (Source != null) |
| | 20 | | { |
| 16 | 21 | | writer.WritePropertyName("source"); |
| 16 | 22 | | writer.WriteObjectValue(Source); |
| | 23 | | } |
| 16 | 24 | | if (OsDiskImage != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("osDiskImage"); |
| 0 | 27 | | writer.WriteObjectValue(OsDiskImage); |
| | 28 | | } |
| 16 | 29 | | if (DataDiskImages != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("dataDiskImages"); |
| 0 | 32 | | writer.WriteStartArray(); |
| 0 | 33 | | foreach (var item in DataDiskImages) |
| | 34 | | { |
| 0 | 35 | | writer.WriteObjectValue(item); |
| | 36 | | } |
| 0 | 37 | | writer.WriteEndArray(); |
| | 38 | | } |
| 16 | 39 | | writer.WriteEndObject(); |
| 16 | 40 | | } |
| | 41 | |
|
| | 42 | | internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement eleme |
| | 43 | | { |
| 24 | 44 | | GalleryArtifactVersionSource source = default; |
| 24 | 45 | | GalleryDiskImage osDiskImage = default; |
| 24 | 46 | | IList<GalleryDataDiskImage> dataDiskImages = default; |
| 144 | 47 | | foreach (var property in element.EnumerateObject()) |
| | 48 | | { |
| 48 | 49 | | if (property.NameEquals("source")) |
| | 50 | | { |
| 24 | 51 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 52 | | { |
| | 53 | | continue; |
| | 54 | | } |
| 24 | 55 | | source = GalleryArtifactVersionSource.DeserializeGalleryArtifactVersionSource(property.Value); |
| 24 | 56 | | continue; |
| | 57 | | } |
| 24 | 58 | | if (property.NameEquals("osDiskImage")) |
| | 59 | | { |
| 24 | 60 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| | 62 | | continue; |
| | 63 | | } |
| 24 | 64 | | osDiskImage = GalleryDiskImage.DeserializeGalleryDiskImage(property.Value); |
| 24 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("dataDiskImages")) |
| | 68 | | { |
| 0 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | List<GalleryDataDiskImage> array = new List<GalleryDataDiskImage>(); |
| 0 | 74 | | foreach (var item in property.Value.EnumerateArray()) |
| | 75 | | { |
| 0 | 76 | | if (item.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| 0 | 78 | | array.Add(null); |
| | 79 | | } |
| | 80 | | else |
| | 81 | | { |
| 0 | 82 | | array.Add(GalleryDataDiskImage.DeserializeGalleryDataDiskImage(item)); |
| | 83 | | } |
| | 84 | | } |
| 0 | 85 | | dataDiskImages = array; |
| | 86 | | continue; |
| | 87 | | } |
| | 88 | | } |
| 24 | 89 | | return new GalleryImageVersionStorageProfile(source, osDiskImage, dataDiskImages); |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |