| | 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 VirtualMachineScaleSetVM : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (InstanceId != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("instanceId"); |
| 0 | 22 | | writer.WriteStringValue(InstanceId); |
| | 23 | | } |
| 0 | 24 | | if (Sku != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("sku"); |
| 0 | 27 | | writer.WriteObjectValue(Sku); |
| | 28 | | } |
| 0 | 29 | | if (Plan != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("plan"); |
| 0 | 32 | | writer.WriteObjectValue(Plan); |
| | 33 | | } |
| 0 | 34 | | if (Resources != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("resources"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in Resources) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | if (Zones != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("zones"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in Zones) |
| | 49 | | { |
| 0 | 50 | | writer.WriteStringValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | if (Id != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("id"); |
| 0 | 57 | | writer.WriteStringValue(Id); |
| | 58 | | } |
| 0 | 59 | | if (Name != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("name"); |
| 0 | 62 | | writer.WriteStringValue(Name); |
| | 63 | | } |
| 0 | 64 | | if (Type != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("type"); |
| 0 | 67 | | writer.WriteStringValue(Type); |
| | 68 | | } |
| 0 | 69 | | writer.WritePropertyName("location"); |
| 0 | 70 | | writer.WriteStringValue(Location); |
| 0 | 71 | | if (Tags != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("tags"); |
| 0 | 74 | | writer.WriteStartObject(); |
| 0 | 75 | | foreach (var item in Tags) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName(item.Key); |
| 0 | 78 | | writer.WriteStringValue(item.Value); |
| | 79 | | } |
| 0 | 80 | | writer.WriteEndObject(); |
| | 81 | | } |
| 0 | 82 | | writer.WritePropertyName("properties"); |
| 0 | 83 | | writer.WriteStartObject(); |
| 0 | 84 | | if (LatestModelApplied != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("latestModelApplied"); |
| 0 | 87 | | writer.WriteBooleanValue(LatestModelApplied.Value); |
| | 88 | | } |
| 0 | 89 | | if (VmId != null) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("vmId"); |
| 0 | 92 | | writer.WriteStringValue(VmId); |
| | 93 | | } |
| 0 | 94 | | if (InstanceView != null) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName("instanceView"); |
| 0 | 97 | | writer.WriteObjectValue(InstanceView); |
| | 98 | | } |
| 0 | 99 | | if (HardwareProfile != null) |
| | 100 | | { |
| 0 | 101 | | writer.WritePropertyName("hardwareProfile"); |
| 0 | 102 | | writer.WriteObjectValue(HardwareProfile); |
| | 103 | | } |
| 0 | 104 | | if (StorageProfile != null) |
| | 105 | | { |
| 0 | 106 | | writer.WritePropertyName("storageProfile"); |
| 0 | 107 | | writer.WriteObjectValue(StorageProfile); |
| | 108 | | } |
| 0 | 109 | | if (AdditionalCapabilities != null) |
| | 110 | | { |
| 0 | 111 | | writer.WritePropertyName("additionalCapabilities"); |
| 0 | 112 | | writer.WriteObjectValue(AdditionalCapabilities); |
| | 113 | | } |
| 0 | 114 | | if (OsProfile != null) |
| | 115 | | { |
| 0 | 116 | | writer.WritePropertyName("osProfile"); |
| 0 | 117 | | writer.WriteObjectValue(OsProfile); |
| | 118 | | } |
| 0 | 119 | | if (NetworkProfile != null) |
| | 120 | | { |
| 0 | 121 | | writer.WritePropertyName("networkProfile"); |
| 0 | 122 | | writer.WriteObjectValue(NetworkProfile); |
| | 123 | | } |
| 0 | 124 | | if (NetworkProfileConfiguration != null) |
| | 125 | | { |
| 0 | 126 | | writer.WritePropertyName("networkProfileConfiguration"); |
| 0 | 127 | | writer.WriteObjectValue(NetworkProfileConfiguration); |
| | 128 | | } |
| 0 | 129 | | if (DiagnosticsProfile != null) |
| | 130 | | { |
| 0 | 131 | | writer.WritePropertyName("diagnosticsProfile"); |
| 0 | 132 | | writer.WriteObjectValue(DiagnosticsProfile); |
| | 133 | | } |
| 0 | 134 | | if (AvailabilitySet != null) |
| | 135 | | { |
| 0 | 136 | | writer.WritePropertyName("availabilitySet"); |
| 0 | 137 | | writer.WriteObjectValue(AvailabilitySet); |
| | 138 | | } |
| 0 | 139 | | if (ProvisioningState != null) |
| | 140 | | { |
| 0 | 141 | | writer.WritePropertyName("provisioningState"); |
| 0 | 142 | | writer.WriteStringValue(ProvisioningState); |
| | 143 | | } |
| 0 | 144 | | if (LicenseType != null) |
| | 145 | | { |
| 0 | 146 | | writer.WritePropertyName("licenseType"); |
| 0 | 147 | | writer.WriteStringValue(LicenseType); |
| | 148 | | } |
| 0 | 149 | | if (ModelDefinitionApplied != null) |
| | 150 | | { |
| 0 | 151 | | writer.WritePropertyName("modelDefinitionApplied"); |
| 0 | 152 | | writer.WriteStringValue(ModelDefinitionApplied); |
| | 153 | | } |
| 0 | 154 | | if (ProtectionPolicy != null) |
| | 155 | | { |
| 0 | 156 | | writer.WritePropertyName("protectionPolicy"); |
| 0 | 157 | | writer.WriteObjectValue(ProtectionPolicy); |
| | 158 | | } |
| 0 | 159 | | writer.WriteEndObject(); |
| 0 | 160 | | writer.WriteEndObject(); |
| 0 | 161 | | } |
| | 162 | |
|
| | 163 | | internal static VirtualMachineScaleSetVM DeserializeVirtualMachineScaleSetVM(JsonElement element) |
| | 164 | | { |
| 88 | 165 | | string instanceId = default; |
| 88 | 166 | | Sku sku = default; |
| 88 | 167 | | Plan plan = default; |
| 88 | 168 | | IList<VirtualMachineExtension> resources = default; |
| 88 | 169 | | IList<string> zones = default; |
| 88 | 170 | | string id = default; |
| 88 | 171 | | string name = default; |
| 88 | 172 | | string type = default; |
| 88 | 173 | | string location = default; |
| 88 | 174 | | IDictionary<string, string> tags = default; |
| 88 | 175 | | bool? latestModelApplied = default; |
| 88 | 176 | | string vmId = default; |
| 88 | 177 | | VirtualMachineScaleSetVMInstanceView instanceView = default; |
| 88 | 178 | | HardwareProfile hardwareProfile = default; |
| 88 | 179 | | StorageProfile storageProfile = default; |
| 88 | 180 | | AdditionalCapabilities additionalCapabilities = default; |
| 88 | 181 | | OSProfile osProfile = default; |
| 88 | 182 | | NetworkProfile networkProfile = default; |
| 88 | 183 | | VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default; |
| 88 | 184 | | DiagnosticsProfile diagnosticsProfile = default; |
| 88 | 185 | | SubResource availabilitySet = default; |
| 88 | 186 | | string provisioningState = default; |
| 88 | 187 | | string licenseType = default; |
| 88 | 188 | | string modelDefinitionApplied = default; |
| 88 | 189 | | VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default; |
| 1856 | 190 | | foreach (var property in element.EnumerateObject()) |
| | 191 | | { |
| 840 | 192 | | if (property.NameEquals("instanceId")) |
| | 193 | | { |
| 88 | 194 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 88 | 198 | | instanceId = property.Value.GetString(); |
| 88 | 199 | | continue; |
| | 200 | | } |
| 752 | 201 | | if (property.NameEquals("sku")) |
| | 202 | | { |
| 88 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 88 | 207 | | sku = Sku.DeserializeSku(property.Value); |
| 88 | 208 | | continue; |
| | 209 | | } |
| 664 | 210 | | if (property.NameEquals("plan")) |
| | 211 | | { |
| 0 | 212 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 213 | | { |
| | 214 | | continue; |
| | 215 | | } |
| 0 | 216 | | plan = Plan.DeserializePlan(property.Value); |
| 0 | 217 | | continue; |
| | 218 | | } |
| 664 | 219 | | if (property.NameEquals("resources")) |
| | 220 | | { |
| 88 | 221 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 222 | | { |
| | 223 | | continue; |
| | 224 | | } |
| 88 | 225 | | List<VirtualMachineExtension> array = new List<VirtualMachineExtension>(); |
| 352 | 226 | | foreach (var item in property.Value.EnumerateArray()) |
| | 227 | | { |
| 88 | 228 | | if (item.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| 0 | 230 | | array.Add(null); |
| | 231 | | } |
| | 232 | | else |
| | 233 | | { |
| 88 | 234 | | array.Add(VirtualMachineExtension.DeserializeVirtualMachineExtension(item)); |
| | 235 | | } |
| | 236 | | } |
| 88 | 237 | | resources = array; |
| 88 | 238 | | continue; |
| | 239 | | } |
| 576 | 240 | | if (property.NameEquals("zones")) |
| | 241 | | { |
| 48 | 242 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 243 | | { |
| | 244 | | continue; |
| | 245 | | } |
| 48 | 246 | | List<string> array = new List<string>(); |
| 192 | 247 | | foreach (var item in property.Value.EnumerateArray()) |
| | 248 | | { |
| 48 | 249 | | if (item.ValueKind == JsonValueKind.Null) |
| | 250 | | { |
| 0 | 251 | | array.Add(null); |
| | 252 | | } |
| | 253 | | else |
| | 254 | | { |
| 48 | 255 | | array.Add(item.GetString()); |
| | 256 | | } |
| | 257 | | } |
| 48 | 258 | | zones = array; |
| 48 | 259 | | continue; |
| | 260 | | } |
| 528 | 261 | | if (property.NameEquals("id")) |
| | 262 | | { |
| 88 | 263 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 264 | | { |
| | 265 | | continue; |
| | 266 | | } |
| 88 | 267 | | id = property.Value.GetString(); |
| 88 | 268 | | continue; |
| | 269 | | } |
| 440 | 270 | | if (property.NameEquals("name")) |
| | 271 | | { |
| 88 | 272 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 273 | | { |
| | 274 | | continue; |
| | 275 | | } |
| 88 | 276 | | name = property.Value.GetString(); |
| 88 | 277 | | continue; |
| | 278 | | } |
| 352 | 279 | | if (property.NameEquals("type")) |
| | 280 | | { |
| 88 | 281 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 282 | | { |
| | 283 | | continue; |
| | 284 | | } |
| 88 | 285 | | type = property.Value.GetString(); |
| 88 | 286 | | continue; |
| | 287 | | } |
| 264 | 288 | | if (property.NameEquals("location")) |
| | 289 | | { |
| 88 | 290 | | location = property.Value.GetString(); |
| 88 | 291 | | continue; |
| | 292 | | } |
| 176 | 293 | | if (property.NameEquals("tags")) |
| | 294 | | { |
| 88 | 295 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 296 | | { |
| | 297 | | continue; |
| | 298 | | } |
| 88 | 299 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 528 | 300 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 301 | | { |
| 176 | 302 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 303 | | { |
| 0 | 304 | | dictionary.Add(property0.Name, null); |
| | 305 | | } |
| | 306 | | else |
| | 307 | | { |
| 176 | 308 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 309 | | } |
| | 310 | | } |
| 88 | 311 | | tags = dictionary; |
| 88 | 312 | | continue; |
| | 313 | | } |
| 88 | 314 | | if (property.NameEquals("properties")) |
| | 315 | | { |
| 1824 | 316 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 317 | | { |
| 824 | 318 | | if (property0.NameEquals("latestModelApplied")) |
| | 319 | | { |
| 88 | 320 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 321 | | { |
| | 322 | | continue; |
| | 323 | | } |
| 88 | 324 | | latestModelApplied = property0.Value.GetBoolean(); |
| 88 | 325 | | continue; |
| | 326 | | } |
| 736 | 327 | | if (property0.NameEquals("vmId")) |
| | 328 | | { |
| 88 | 329 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 330 | | { |
| | 331 | | continue; |
| | 332 | | } |
| 88 | 333 | | vmId = property0.Value.GetString(); |
| 88 | 334 | | continue; |
| | 335 | | } |
| 648 | 336 | | if (property0.NameEquals("instanceView")) |
| | 337 | | { |
| 16 | 338 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 339 | | { |
| | 340 | | continue; |
| | 341 | | } |
| 16 | 342 | | instanceView = VirtualMachineScaleSetVMInstanceView.DeserializeVirtualMachineScaleSetVMInsta |
| 16 | 343 | | continue; |
| | 344 | | } |
| 632 | 345 | | if (property0.NameEquals("hardwareProfile")) |
| | 346 | | { |
| 88 | 347 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 348 | | { |
| | 349 | | continue; |
| | 350 | | } |
| 88 | 351 | | hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value); |
| 88 | 352 | | continue; |
| | 353 | | } |
| 544 | 354 | | if (property0.NameEquals("storageProfile")) |
| | 355 | | { |
| 88 | 356 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 357 | | { |
| | 358 | | continue; |
| | 359 | | } |
| 88 | 360 | | storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value); |
| 88 | 361 | | continue; |
| | 362 | | } |
| 456 | 363 | | if (property0.NameEquals("additionalCapabilities")) |
| | 364 | | { |
| 16 | 365 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 366 | | { |
| | 367 | | continue; |
| | 368 | | } |
| 16 | 369 | | additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0. |
| 16 | 370 | | continue; |
| | 371 | | } |
| 440 | 372 | | if (property0.NameEquals("osProfile")) |
| | 373 | | { |
| 88 | 374 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 375 | | { |
| | 376 | | continue; |
| | 377 | | } |
| 88 | 378 | | osProfile = OSProfile.DeserializeOSProfile(property0.Value); |
| 88 | 379 | | continue; |
| | 380 | | } |
| 352 | 381 | | if (property0.NameEquals("networkProfile")) |
| | 382 | | { |
| 88 | 383 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 384 | | { |
| | 385 | | continue; |
| | 386 | | } |
| 88 | 387 | | networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value); |
| 88 | 388 | | continue; |
| | 389 | | } |
| 264 | 390 | | if (property0.NameEquals("networkProfileConfiguration")) |
| | 391 | | { |
| 88 | 392 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 393 | | { |
| | 394 | | continue; |
| | 395 | | } |
| 88 | 396 | | networkProfileConfiguration = VirtualMachineScaleSetVMNetworkProfileConfiguration.Deserializ |
| 88 | 397 | | continue; |
| | 398 | | } |
| 176 | 399 | | if (property0.NameEquals("diagnosticsProfile")) |
| | 400 | | { |
| 0 | 401 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 402 | | { |
| | 403 | | continue; |
| | 404 | | } |
| 0 | 405 | | diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property0.Value); |
| 0 | 406 | | continue; |
| | 407 | | } |
| 176 | 408 | | if (property0.NameEquals("availabilitySet")) |
| | 409 | | { |
| 0 | 410 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 411 | | { |
| | 412 | | continue; |
| | 413 | | } |
| 0 | 414 | | availabilitySet = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 415 | | continue; |
| | 416 | | } |
| 176 | 417 | | if (property0.NameEquals("provisioningState")) |
| | 418 | | { |
| 88 | 419 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 420 | | { |
| | 421 | | continue; |
| | 422 | | } |
| 88 | 423 | | provisioningState = property0.Value.GetString(); |
| 88 | 424 | | continue; |
| | 425 | | } |
| 88 | 426 | | if (property0.NameEquals("licenseType")) |
| | 427 | | { |
| 0 | 428 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 429 | | { |
| | 430 | | continue; |
| | 431 | | } |
| 0 | 432 | | licenseType = property0.Value.GetString(); |
| 0 | 433 | | continue; |
| | 434 | | } |
| 88 | 435 | | if (property0.NameEquals("modelDefinitionApplied")) |
| | 436 | | { |
| 88 | 437 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 438 | | { |
| | 439 | | continue; |
| | 440 | | } |
| 88 | 441 | | modelDefinitionApplied = property0.Value.GetString(); |
| 88 | 442 | | continue; |
| | 443 | | } |
| 0 | 444 | | if (property0.NameEquals("protectionPolicy")) |
| | 445 | | { |
| 0 | 446 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 447 | | { |
| | 448 | | continue; |
| | 449 | | } |
| 0 | 450 | | protectionPolicy = VirtualMachineScaleSetVMProtectionPolicy.DeserializeVirtualMachineScaleSe |
| | 451 | | continue; |
| | 452 | | } |
| | 453 | | } |
| | 454 | | continue; |
| | 455 | | } |
| | 456 | | } |
| 88 | 457 | | return new VirtualMachineScaleSetVM(id, name, type, location, tags, instanceId, sku, plan, resources, zones, |
| | 458 | | } |
| | 459 | | } |
| | 460 | | } |