| | 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 VirtualMachineInstanceView : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (PlatformUpdateDomain != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("platformUpdateDomain"); |
| 0 | 22 | | writer.WriteNumberValue(PlatformUpdateDomain.Value); |
| | 23 | | } |
| 16 | 24 | | if (PlatformFaultDomain != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("platformFaultDomain"); |
| 0 | 27 | | writer.WriteNumberValue(PlatformFaultDomain.Value); |
| | 28 | | } |
| 16 | 29 | | if (ComputerName != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("computerName"); |
| 0 | 32 | | writer.WriteStringValue(ComputerName); |
| | 33 | | } |
| 16 | 34 | | if (OsName != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("osName"); |
| 0 | 37 | | writer.WriteStringValue(OsName); |
| | 38 | | } |
| 16 | 39 | | if (OsVersion != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("osVersion"); |
| 0 | 42 | | writer.WriteStringValue(OsVersion); |
| | 43 | | } |
| 16 | 44 | | if (HyperVGeneration != null) |
| | 45 | | { |
| 16 | 46 | | writer.WritePropertyName("hyperVGeneration"); |
| 16 | 47 | | writer.WriteStringValue(HyperVGeneration.Value.ToString()); |
| | 48 | | } |
| 16 | 49 | | if (RdpThumbPrint != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("rdpThumbPrint"); |
| 0 | 52 | | writer.WriteStringValue(RdpThumbPrint); |
| | 53 | | } |
| 16 | 54 | | if (VmAgent != null) |
| | 55 | | { |
| 16 | 56 | | writer.WritePropertyName("vmAgent"); |
| 16 | 57 | | writer.WriteObjectValue(VmAgent); |
| | 58 | | } |
| 16 | 59 | | if (MaintenanceRedeployStatus != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("maintenanceRedeployStatus"); |
| 0 | 62 | | writer.WriteObjectValue(MaintenanceRedeployStatus); |
| | 63 | | } |
| 16 | 64 | | if (Disks != null) |
| | 65 | | { |
| 16 | 66 | | writer.WritePropertyName("disks"); |
| 16 | 67 | | writer.WriteStartArray(); |
| 96 | 68 | | foreach (var item in Disks) |
| | 69 | | { |
| 32 | 70 | | writer.WriteObjectValue(item); |
| | 71 | | } |
| 16 | 72 | | writer.WriteEndArray(); |
| | 73 | | } |
| 16 | 74 | | if (Extensions != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("extensions"); |
| 0 | 77 | | writer.WriteStartArray(); |
| 0 | 78 | | foreach (var item in Extensions) |
| | 79 | | { |
| 0 | 80 | | writer.WriteObjectValue(item); |
| | 81 | | } |
| 0 | 82 | | writer.WriteEndArray(); |
| | 83 | | } |
| 16 | 84 | | if (BootDiagnostics != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("bootDiagnostics"); |
| 0 | 87 | | writer.WriteObjectValue(BootDiagnostics); |
| | 88 | | } |
| 16 | 89 | | if (Statuses != null) |
| | 90 | | { |
| 16 | 91 | | writer.WritePropertyName("statuses"); |
| 16 | 92 | | writer.WriteStartArray(); |
| 96 | 93 | | foreach (var item in Statuses) |
| | 94 | | { |
| 32 | 95 | | writer.WriteObjectValue(item); |
| | 96 | | } |
| 16 | 97 | | writer.WriteEndArray(); |
| | 98 | | } |
| 16 | 99 | | writer.WriteEndObject(); |
| 16 | 100 | | } |
| | 101 | |
|
| | 102 | | internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView(JsonElement element) |
| | 103 | | { |
| 168 | 104 | | int? platformUpdateDomain = default; |
| 168 | 105 | | int? platformFaultDomain = default; |
| 168 | 106 | | string computerName = default; |
| 168 | 107 | | string osName = default; |
| 168 | 108 | | string osVersion = default; |
| 168 | 109 | | HyperVGenerationType? hyperVGeneration = default; |
| 168 | 110 | | string rdpThumbPrint = default; |
| 168 | 111 | | VirtualMachineAgentInstanceView vmAgent = default; |
| 168 | 112 | | MaintenanceRedeployStatus maintenanceRedeployStatus = default; |
| 168 | 113 | | IList<DiskInstanceView> disks = default; |
| 168 | 114 | | IList<VirtualMachineExtensionInstanceView> extensions = default; |
| 168 | 115 | | BootDiagnosticsInstanceView bootDiagnostics = default; |
| 168 | 116 | | IList<InstanceViewStatus> statuses = default; |
| 1920 | 117 | | foreach (var property in element.EnumerateObject()) |
| | 118 | | { |
| 792 | 119 | | if (property.NameEquals("platformUpdateDomain")) |
| | 120 | | { |
| 0 | 121 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | platformUpdateDomain = property.Value.GetInt32(); |
| 0 | 126 | | continue; |
| | 127 | | } |
| 792 | 128 | | if (property.NameEquals("platformFaultDomain")) |
| | 129 | | { |
| 0 | 130 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | platformFaultDomain = property.Value.GetInt32(); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 792 | 137 | | if (property.NameEquals("computerName")) |
| | 138 | | { |
| 32 | 139 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 32 | 143 | | computerName = property.Value.GetString(); |
| 32 | 144 | | continue; |
| | 145 | | } |
| 760 | 146 | | if (property.NameEquals("osName")) |
| | 147 | | { |
| 32 | 148 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 32 | 152 | | osName = property.Value.GetString(); |
| 32 | 153 | | continue; |
| | 154 | | } |
| 728 | 155 | | if (property.NameEquals("osVersion")) |
| | 156 | | { |
| 32 | 157 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 32 | 161 | | osVersion = property.Value.GetString(); |
| 32 | 162 | | continue; |
| | 163 | | } |
| 696 | 164 | | if (property.NameEquals("hyperVGeneration")) |
| | 165 | | { |
| 168 | 166 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 168 | 170 | | hyperVGeneration = new HyperVGenerationType(property.Value.GetString()); |
| 168 | 171 | | continue; |
| | 172 | | } |
| 528 | 173 | | if (property.NameEquals("rdpThumbPrint")) |
| | 174 | | { |
| 0 | 175 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | rdpThumbPrint = property.Value.GetString(); |
| 0 | 180 | | continue; |
| | 181 | | } |
| 528 | 182 | | if (property.NameEquals("vmAgent")) |
| | 183 | | { |
| 168 | 184 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 168 | 188 | | vmAgent = VirtualMachineAgentInstanceView.DeserializeVirtualMachineAgentInstanceView(property.Value) |
| 168 | 189 | | continue; |
| | 190 | | } |
| 360 | 191 | | if (property.NameEquals("maintenanceRedeployStatus")) |
| | 192 | | { |
| 0 | 193 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | maintenanceRedeployStatus = MaintenanceRedeployStatus.DeserializeMaintenanceRedeployStatus(property. |
| 0 | 198 | | continue; |
| | 199 | | } |
| 360 | 200 | | if (property.NameEquals("disks")) |
| | 201 | | { |
| 168 | 202 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 168 | 206 | | List<DiskInstanceView> array = new List<DiskInstanceView>(); |
| 800 | 207 | | foreach (var item in property.Value.EnumerateArray()) |
| | 208 | | { |
| 232 | 209 | | if (item.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| 0 | 211 | | array.Add(null); |
| | 212 | | } |
| | 213 | | else |
| | 214 | | { |
| 232 | 215 | | array.Add(DiskInstanceView.DeserializeDiskInstanceView(item)); |
| | 216 | | } |
| | 217 | | } |
| 168 | 218 | | disks = array; |
| 168 | 219 | | continue; |
| | 220 | | } |
| 192 | 221 | | if (property.NameEquals("extensions")) |
| | 222 | | { |
| 12 | 223 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 12 | 227 | | List<VirtualMachineExtensionInstanceView> array = new List<VirtualMachineExtensionInstanceView>(); |
| 48 | 228 | | foreach (var item in property.Value.EnumerateArray()) |
| | 229 | | { |
| 12 | 230 | | if (item.ValueKind == JsonValueKind.Null) |
| | 231 | | { |
| 0 | 232 | | array.Add(null); |
| | 233 | | } |
| | 234 | | else |
| | 235 | | { |
| 12 | 236 | | array.Add(VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanceView |
| | 237 | | } |
| | 238 | | } |
| 12 | 239 | | extensions = array; |
| 12 | 240 | | continue; |
| | 241 | | } |
| 180 | 242 | | if (property.NameEquals("bootDiagnostics")) |
| | 243 | | { |
| 12 | 244 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 12 | 248 | | bootDiagnostics = BootDiagnosticsInstanceView.DeserializeBootDiagnosticsInstanceView(property.Value) |
| 12 | 249 | | continue; |
| | 250 | | } |
| 168 | 251 | | if (property.NameEquals("statuses")) |
| | 252 | | { |
| 168 | 253 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 168 | 257 | | List<InstanceViewStatus> array = new List<InstanceViewStatus>(); |
| 1008 | 258 | | foreach (var item in property.Value.EnumerateArray()) |
| | 259 | | { |
| 336 | 260 | | if (item.ValueKind == JsonValueKind.Null) |
| | 261 | | { |
| 0 | 262 | | array.Add(null); |
| | 263 | | } |
| | 264 | | else |
| | 265 | | { |
| 336 | 266 | | array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); |
| | 267 | | } |
| | 268 | | } |
| 168 | 269 | | statuses = array; |
| | 270 | | continue; |
| | 271 | | } |
| | 272 | | } |
| 168 | 273 | | return new VirtualMachineInstanceView(platformUpdateDomain, platformFaultDomain, computerName, osName, osVer |
| | 274 | | } |
| | 275 | | } |
| | 276 | | } |