| | 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 VirtualMachineExtensionInstanceView : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Type != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("type"); |
| 0 | 27 | | writer.WriteStringValue(Type); |
| | 28 | | } |
| 0 | 29 | | if (TypeHandlerVersion != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("typeHandlerVersion"); |
| 0 | 32 | | writer.WriteStringValue(TypeHandlerVersion); |
| | 33 | | } |
| 0 | 34 | | if (Substatuses != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("substatuses"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in Substatuses) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | if (Statuses != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("statuses"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in Statuses) |
| | 49 | | { |
| 0 | 50 | | writer.WriteObjectValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndObject(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExtensionInstanceView(JsonElement e |
| | 58 | | { |
| 36 | 59 | | string name = default; |
| 36 | 60 | | string type = default; |
| 36 | 61 | | string typeHandlerVersion = default; |
| 36 | 62 | | IList<InstanceViewStatus> substatuses = default; |
| 36 | 63 | | IList<InstanceViewStatus> statuses = default; |
| 312 | 64 | | foreach (var property in element.EnumerateObject()) |
| | 65 | | { |
| 120 | 66 | | if (property.NameEquals("name")) |
| | 67 | | { |
| 36 | 68 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 69 | | { |
| | 70 | | continue; |
| | 71 | | } |
| 36 | 72 | | name = property.Value.GetString(); |
| 36 | 73 | | continue; |
| | 74 | | } |
| 84 | 75 | | if (property.NameEquals("type")) |
| | 76 | | { |
| 28 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 28 | 81 | | type = property.Value.GetString(); |
| 28 | 82 | | continue; |
| | 83 | | } |
| 56 | 84 | | if (property.NameEquals("typeHandlerVersion")) |
| | 85 | | { |
| 28 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 28 | 90 | | typeHandlerVersion = property.Value.GetString(); |
| 28 | 91 | | continue; |
| | 92 | | } |
| 28 | 93 | | if (property.NameEquals("substatuses")) |
| | 94 | | { |
| 0 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | List<InstanceViewStatus> array = new List<InstanceViewStatus>(); |
| 0 | 100 | | foreach (var item in property.Value.EnumerateArray()) |
| | 101 | | { |
| 0 | 102 | | if (item.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| 0 | 104 | | array.Add(null); |
| | 105 | | } |
| | 106 | | else |
| | 107 | | { |
| 0 | 108 | | array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); |
| | 109 | | } |
| | 110 | | } |
| 0 | 111 | | substatuses = array; |
| 0 | 112 | | continue; |
| | 113 | | } |
| 28 | 114 | | if (property.NameEquals("statuses")) |
| | 115 | | { |
| 28 | 116 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 117 | | { |
| | 118 | | continue; |
| | 119 | | } |
| 28 | 120 | | List<InstanceViewStatus> array = new List<InstanceViewStatus>(); |
| 112 | 121 | | foreach (var item in property.Value.EnumerateArray()) |
| | 122 | | { |
| 28 | 123 | | if (item.ValueKind == JsonValueKind.Null) |
| | 124 | | { |
| 0 | 125 | | array.Add(null); |
| | 126 | | } |
| | 127 | | else |
| | 128 | | { |
| 28 | 129 | | array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); |
| | 130 | | } |
| | 131 | | } |
| 28 | 132 | | statuses = array; |
| | 133 | | continue; |
| | 134 | | } |
| | 135 | | } |
| 36 | 136 | | return new VirtualMachineExtensionInstanceView(name, type, typeHandlerVersion, substatuses, statuses); |
| | 137 | | } |
| | 138 | | } |
| | 139 | | } |