| | 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 VirtualMachineScaleSetStorageProfile : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 364 | 18 | | writer.WriteStartObject(); |
| 364 | 19 | | if (ImageReference != null) |
| | 20 | | { |
| 364 | 21 | | writer.WritePropertyName("imageReference"); |
| 364 | 22 | | writer.WriteObjectValue(ImageReference); |
| | 23 | | } |
| 364 | 24 | | if (OsDisk != null) |
| | 25 | | { |
| 132 | 26 | | writer.WritePropertyName("osDisk"); |
| 132 | 27 | | writer.WriteObjectValue(OsDisk); |
| | 28 | | } |
| 364 | 29 | | if (DataDisks != null) |
| | 30 | | { |
| 248 | 31 | | writer.WritePropertyName("dataDisks"); |
| 248 | 32 | | writer.WriteStartArray(); |
| 992 | 33 | | foreach (var item in DataDisks) |
| | 34 | | { |
| 248 | 35 | | writer.WriteObjectValue(item); |
| | 36 | | } |
| 248 | 37 | | writer.WriteEndArray(); |
| | 38 | | } |
| 364 | 39 | | writer.WriteEndObject(); |
| 364 | 40 | | } |
| | 41 | |
|
| | 42 | | internal static VirtualMachineScaleSetStorageProfile DeserializeVirtualMachineScaleSetStorageProfile(JsonElement |
| | 43 | | { |
| 448 | 44 | | ImageReference imageReference = default; |
| 448 | 45 | | VirtualMachineScaleSetOSDisk osDisk = default; |
| 448 | 46 | | IList<VirtualMachineScaleSetDataDisk> dataDisks = default; |
| 3288 | 47 | | foreach (var property in element.EnumerateObject()) |
| | 48 | | { |
| 1196 | 49 | | if (property.NameEquals("imageReference")) |
| | 50 | | { |
| 448 | 51 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 52 | | { |
| | 53 | | continue; |
| | 54 | | } |
| 448 | 55 | | imageReference = ImageReference.DeserializeImageReference(property.Value); |
| 448 | 56 | | continue; |
| | 57 | | } |
| 748 | 58 | | if (property.NameEquals("osDisk")) |
| | 59 | | { |
| 448 | 60 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| | 62 | | continue; |
| | 63 | | } |
| 448 | 64 | | osDisk = VirtualMachineScaleSetOSDisk.DeserializeVirtualMachineScaleSetOSDisk(property.Value); |
| 448 | 65 | | continue; |
| | 66 | | } |
| 300 | 67 | | if (property.NameEquals("dataDisks")) |
| | 68 | | { |
| 300 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 300 | 73 | | List<VirtualMachineScaleSetDataDisk> array = new List<VirtualMachineScaleSetDataDisk>(); |
| 1200 | 74 | | foreach (var item in property.Value.EnumerateArray()) |
| | 75 | | { |
| 300 | 76 | | if (item.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| 0 | 78 | | array.Add(null); |
| | 79 | | } |
| | 80 | | else |
| | 81 | | { |
| 300 | 82 | | array.Add(VirtualMachineScaleSetDataDisk.DeserializeVirtualMachineScaleSetDataDisk(item)); |
| | 83 | | } |
| | 84 | | } |
| 300 | 85 | | dataDisks = array; |
| | 86 | | continue; |
| | 87 | | } |
| | 88 | | } |
| 448 | 89 | | return new VirtualMachineScaleSetStorageProfile(imageReference, osDisk, dataDisks); |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |