| | 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 VirtualMachineScaleSetOSDisk : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 132 | 18 | | writer.WriteStartObject(); |
| 132 | 19 | | if (Name != null) |
| | 20 | | { |
| 116 | 21 | | writer.WritePropertyName("name"); |
| 116 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 132 | 24 | | if (Caching != null) |
| | 25 | | { |
| 132 | 26 | | writer.WritePropertyName("caching"); |
| 132 | 27 | | writer.WriteStringValue(Caching.Value.ToSerialString()); |
| | 28 | | } |
| 132 | 29 | | if (WriteAcceleratorEnabled != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("writeAcceleratorEnabled"); |
| 0 | 32 | | writer.WriteBooleanValue(WriteAcceleratorEnabled.Value); |
| | 33 | | } |
| 132 | 34 | | writer.WritePropertyName("createOption"); |
| 132 | 35 | | writer.WriteStringValue(CreateOption.ToString()); |
| 132 | 36 | | if (DiffDiskSettings != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("diffDiskSettings"); |
| 0 | 39 | | writer.WriteObjectValue(DiffDiskSettings); |
| | 40 | | } |
| 132 | 41 | | if (DiskSizeGB != null) |
| | 42 | | { |
| 16 | 43 | | writer.WritePropertyName("diskSizeGB"); |
| 16 | 44 | | writer.WriteNumberValue(DiskSizeGB.Value); |
| | 45 | | } |
| 132 | 46 | | if (OsType != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("osType"); |
| 0 | 49 | | writer.WriteStringValue(OsType.Value.ToSerialString()); |
| | 50 | | } |
| 132 | 51 | | if (Image != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("image"); |
| 0 | 54 | | writer.WriteObjectValue(Image); |
| | 55 | | } |
| 132 | 56 | | if (VhdContainers != null) |
| | 57 | | { |
| 116 | 58 | | writer.WritePropertyName("vhdContainers"); |
| 116 | 59 | | writer.WriteStartArray(); |
| 464 | 60 | | foreach (var item in VhdContainers) |
| | 61 | | { |
| 116 | 62 | | writer.WriteStringValue(item); |
| | 63 | | } |
| 116 | 64 | | writer.WriteEndArray(); |
| | 65 | | } |
| 132 | 66 | | if (ManagedDisk != null) |
| | 67 | | { |
| 8 | 68 | | writer.WritePropertyName("managedDisk"); |
| 8 | 69 | | writer.WriteObjectValue(ManagedDisk); |
| | 70 | | } |
| 132 | 71 | | writer.WriteEndObject(); |
| 132 | 72 | | } |
| | 73 | |
|
| | 74 | | internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOSDisk(JsonElement element) |
| | 75 | | { |
| 448 | 76 | | string name = default; |
| 448 | 77 | | CachingTypes? caching = default; |
| 448 | 78 | | bool? writeAcceleratorEnabled = default; |
| 448 | 79 | | DiskCreateOptionTypes createOption = default; |
| 448 | 80 | | DiffDiskSettings diffDiskSettings = default; |
| 448 | 81 | | int? diskSizeGB = default; |
| 448 | 82 | | OperatingSystemTypes? osType = default; |
| 448 | 83 | | VirtualHardDisk image = default; |
| 448 | 84 | | IList<string> vhdContainers = default; |
| 448 | 85 | | VirtualMachineScaleSetManagedDiskParameters managedDisk = default; |
| 4480 | 86 | | foreach (var property in element.EnumerateObject()) |
| | 87 | | { |
| 1792 | 88 | | if (property.NameEquals("name")) |
| | 89 | | { |
| 148 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 148 | 94 | | name = property.Value.GetString(); |
| 148 | 95 | | continue; |
| | 96 | | } |
| 1644 | 97 | | if (property.NameEquals("caching")) |
| | 98 | | { |
| 448 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 448 | 103 | | caching = property.Value.GetString().ToCachingTypes(); |
| 448 | 104 | | continue; |
| | 105 | | } |
| 1196 | 106 | | if (property.NameEquals("writeAcceleratorEnabled")) |
| | 107 | | { |
| 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | writeAcceleratorEnabled = property.Value.GetBoolean(); |
| 0 | 113 | | continue; |
| | 114 | | } |
| 1196 | 115 | | if (property.NameEquals("createOption")) |
| | 116 | | { |
| 448 | 117 | | createOption = new DiskCreateOptionTypes(property.Value.GetString()); |
| 448 | 118 | | continue; |
| | 119 | | } |
| 748 | 120 | | if (property.NameEquals("diffDiskSettings")) |
| | 121 | | { |
| 0 | 122 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value); |
| 0 | 127 | | continue; |
| | 128 | | } |
| 748 | 129 | | if (property.NameEquals("diskSizeGB")) |
| | 130 | | { |
| 300 | 131 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 132 | | { |
| | 133 | | continue; |
| | 134 | | } |
| 300 | 135 | | diskSizeGB = property.Value.GetInt32(); |
| 300 | 136 | | continue; |
| | 137 | | } |
| 448 | 138 | | if (property.NameEquals("osType")) |
| | 139 | | { |
| 0 | 140 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 141 | | { |
| | 142 | | continue; |
| | 143 | | } |
| 0 | 144 | | osType = property.Value.GetString().ToOperatingSystemTypes(); |
| 0 | 145 | | continue; |
| | 146 | | } |
| 448 | 147 | | if (property.NameEquals("image")) |
| | 148 | | { |
| 0 | 149 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 0 | 153 | | image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); |
| 0 | 154 | | continue; |
| | 155 | | } |
| 448 | 156 | | if (property.NameEquals("vhdContainers")) |
| | 157 | | { |
| 148 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 148 | 162 | | List<string> array = new List<string>(); |
| 592 | 163 | | foreach (var item in property.Value.EnumerateArray()) |
| | 164 | | { |
| 148 | 165 | | if (item.ValueKind == JsonValueKind.Null) |
| | 166 | | { |
| 0 | 167 | | array.Add(null); |
| | 168 | | } |
| | 169 | | else |
| | 170 | | { |
| 148 | 171 | | array.Add(item.GetString()); |
| | 172 | | } |
| | 173 | | } |
| 148 | 174 | | vhdContainers = array; |
| 148 | 175 | | continue; |
| | 176 | | } |
| 300 | 177 | | if (property.NameEquals("managedDisk")) |
| | 178 | | { |
| 300 | 179 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 300 | 183 | | managedDisk = VirtualMachineScaleSetManagedDiskParameters.DeserializeVirtualMachineScaleSetManagedDi |
| | 184 | | continue; |
| | 185 | | } |
| | 186 | | } |
| 448 | 187 | | return new VirtualMachineScaleSetOSDisk(name, caching, writeAcceleratorEnabled, createOption, diffDiskSettin |
| | 188 | | } |
| | 189 | | } |
| | 190 | | } |