| | 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 VirtualMachineAgentInstanceView : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (VmAgentVersion != null) |
| | 20 | | { |
| 16 | 21 | | writer.WritePropertyName("vmAgentVersion"); |
| 16 | 22 | | writer.WriteStringValue(VmAgentVersion); |
| | 23 | | } |
| 16 | 24 | | if (ExtensionHandlers != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("extensionHandlers"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in ExtensionHandlers) |
| | 29 | | { |
| 0 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 16 | 34 | | if (Statuses != null) |
| | 35 | | { |
| 16 | 36 | | writer.WritePropertyName("statuses"); |
| 16 | 37 | | writer.WriteStartArray(); |
| 64 | 38 | | foreach (var item in Statuses) |
| | 39 | | { |
| 16 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 16 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 16 | 44 | | writer.WriteEndObject(); |
| 16 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element) |
| | 48 | | { |
| 192 | 49 | | string vmAgentVersion = default; |
| 192 | 50 | | IList<VirtualMachineExtensionHandlerInstanceView> extensionHandlers = default; |
| 192 | 51 | | IList<InstanceViewStatus> statuses = default; |
| 1208 | 52 | | foreach (var property in element.EnumerateObject()) |
| | 53 | | { |
| 412 | 54 | | if (property.NameEquals("vmAgentVersion")) |
| | 55 | | { |
| 192 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 192 | 60 | | vmAgentVersion = property.Value.GetString(); |
| 192 | 61 | | continue; |
| | 62 | | } |
| 220 | 63 | | if (property.NameEquals("extensionHandlers")) |
| | 64 | | { |
| 28 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 66 | | { |
| | 67 | | continue; |
| | 68 | | } |
| 28 | 69 | | List<VirtualMachineExtensionHandlerInstanceView> array = new List<VirtualMachineExtensionHandlerInst |
| 112 | 70 | | foreach (var item in property.Value.EnumerateArray()) |
| | 71 | | { |
| 28 | 72 | | if (item.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| 0 | 74 | | array.Add(null); |
| | 75 | | } |
| | 76 | | else |
| | 77 | | { |
| 28 | 78 | | array.Add(VirtualMachineExtensionHandlerInstanceView.DeserializeVirtualMachineExtensionHandl |
| | 79 | | } |
| | 80 | | } |
| 28 | 81 | | extensionHandlers = array; |
| 28 | 82 | | continue; |
| | 83 | | } |
| 192 | 84 | | if (property.NameEquals("statuses")) |
| | 85 | | { |
| 192 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 192 | 90 | | List<InstanceViewStatus> array = new List<InstanceViewStatus>(); |
| 768 | 91 | | foreach (var item in property.Value.EnumerateArray()) |
| | 92 | | { |
| 192 | 93 | | if (item.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| 0 | 95 | | array.Add(null); |
| | 96 | | } |
| | 97 | | else |
| | 98 | | { |
| 192 | 99 | | array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); |
| | 100 | | } |
| | 101 | | } |
| 192 | 102 | | statuses = array; |
| | 103 | | continue; |
| | 104 | | } |
| | 105 | | } |
| 192 | 106 | | return new VirtualMachineAgentInstanceView(vmAgentVersion, extensionHandlers, statuses); |
| | 107 | | } |
| | 108 | | } |
| | 109 | | } |