|   |  | 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 VirtualMachineExtensionImage : IUtf8JsonSerializable | 
|   |  | 15 |  |     { | 
|   |  | 16 |  |         void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | 
|   |  | 17 |  |         { | 
|   | 0 | 18 |  |             writer.WriteStartObject(); | 
|   | 0 | 19 |  |             if (Id != null) | 
|   |  | 20 |  |             { | 
|   | 0 | 21 |  |                 writer.WritePropertyName("id"); | 
|   | 0 | 22 |  |                 writer.WriteStringValue(Id); | 
|   |  | 23 |  |             } | 
|   | 0 | 24 |  |             if (Name != null) | 
|   |  | 25 |  |             { | 
|   | 0 | 26 |  |                 writer.WritePropertyName("name"); | 
|   | 0 | 27 |  |                 writer.WriteStringValue(Name); | 
|   |  | 28 |  |             } | 
|   | 0 | 29 |  |             if (Type != null) | 
|   |  | 30 |  |             { | 
|   | 0 | 31 |  |                 writer.WritePropertyName("type"); | 
|   | 0 | 32 |  |                 writer.WriteStringValue(Type); | 
|   |  | 33 |  |             } | 
|   | 0 | 34 |  |             writer.WritePropertyName("location"); | 
|   | 0 | 35 |  |             writer.WriteStringValue(Location); | 
|   | 0 | 36 |  |             if (Tags != null) | 
|   |  | 37 |  |             { | 
|   | 0 | 38 |  |                 writer.WritePropertyName("tags"); | 
|   | 0 | 39 |  |                 writer.WriteStartObject(); | 
|   | 0 | 40 |  |                 foreach (var item in Tags) | 
|   |  | 41 |  |                 { | 
|   | 0 | 42 |  |                     writer.WritePropertyName(item.Key); | 
|   | 0 | 43 |  |                     writer.WriteStringValue(item.Value); | 
|   |  | 44 |  |                 } | 
|   | 0 | 45 |  |                 writer.WriteEndObject(); | 
|   |  | 46 |  |             } | 
|   | 0 | 47 |  |             writer.WritePropertyName("properties"); | 
|   | 0 | 48 |  |             writer.WriteStartObject(); | 
|   | 0 | 49 |  |             if (OperatingSystem != null) | 
|   |  | 50 |  |             { | 
|   | 0 | 51 |  |                 writer.WritePropertyName("operatingSystem"); | 
|   | 0 | 52 |  |                 writer.WriteStringValue(OperatingSystem); | 
|   |  | 53 |  |             } | 
|   | 0 | 54 |  |             if (ComputeRole != null) | 
|   |  | 55 |  |             { | 
|   | 0 | 56 |  |                 writer.WritePropertyName("computeRole"); | 
|   | 0 | 57 |  |                 writer.WriteStringValue(ComputeRole); | 
|   |  | 58 |  |             } | 
|   | 0 | 59 |  |             if (HandlerSchema != null) | 
|   |  | 60 |  |             { | 
|   | 0 | 61 |  |                 writer.WritePropertyName("handlerSchema"); | 
|   | 0 | 62 |  |                 writer.WriteStringValue(HandlerSchema); | 
|   |  | 63 |  |             } | 
|   | 0 | 64 |  |             if (VmScaleSetEnabled != null) | 
|   |  | 65 |  |             { | 
|   | 0 | 66 |  |                 writer.WritePropertyName("vmScaleSetEnabled"); | 
|   | 0 | 67 |  |                 writer.WriteBooleanValue(VmScaleSetEnabled.Value); | 
|   |  | 68 |  |             } | 
|   | 0 | 69 |  |             if (SupportsMultipleExtensions != null) | 
|   |  | 70 |  |             { | 
|   | 0 | 71 |  |                 writer.WritePropertyName("supportsMultipleExtensions"); | 
|   | 0 | 72 |  |                 writer.WriteBooleanValue(SupportsMultipleExtensions.Value); | 
|   |  | 73 |  |             } | 
|   | 0 | 74 |  |             writer.WriteEndObject(); | 
|   | 0 | 75 |  |             writer.WriteEndObject(); | 
|   | 0 | 76 |  |         } | 
|   |  | 77 |  |  | 
|   |  | 78 |  |         internal static VirtualMachineExtensionImage DeserializeVirtualMachineExtensionImage(JsonElement element) | 
|   |  | 79 |  |         { | 
|   | 76 | 80 |  |             string id = default; | 
|   | 76 | 81 |  |             string name = default; | 
|   | 76 | 82 |  |             string type = default; | 
|   | 76 | 83 |  |             string location = default; | 
|   | 76 | 84 |  |             IDictionary<string, string> tags = default; | 
|   | 76 | 85 |  |             string operatingSystem = default; | 
|   | 76 | 86 |  |             string computeRole = default; | 
|   | 76 | 87 |  |             string handlerSchema = default; | 
|   | 76 | 88 |  |             bool? vmScaleSetEnabled = default; | 
|   | 76 | 89 |  |             bool? supportsMultipleExtensions = default; | 
|   | 616 | 90 |  |             foreach (var property in element.EnumerateObject()) | 
|   |  | 91 |  |             { | 
|   | 232 | 92 |  |                 if (property.NameEquals("id")) | 
|   |  | 93 |  |                 { | 
|   | 76 | 94 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 95 |  |                     { | 
|   |  | 96 |  |                         continue; | 
|   |  | 97 |  |                     } | 
|   | 76 | 98 |  |                     id = property.Value.GetString(); | 
|   | 76 | 99 |  |                     continue; | 
|   |  | 100 |  |                 } | 
|   | 156 | 101 |  |                 if (property.NameEquals("name")) | 
|   |  | 102 |  |                 { | 
|   | 76 | 103 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 104 |  |                     { | 
|   |  | 105 |  |                         continue; | 
|   |  | 106 |  |                     } | 
|   | 76 | 107 |  |                     name = property.Value.GetString(); | 
|   | 76 | 108 |  |                     continue; | 
|   |  | 109 |  |                 } | 
|   | 80 | 110 |  |                 if (property.NameEquals("type")) | 
|   |  | 111 |  |                 { | 
|   | 0 | 112 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 113 |  |                     { | 
|   |  | 114 |  |                         continue; | 
|   |  | 115 |  |                     } | 
|   | 0 | 116 |  |                     type = property.Value.GetString(); | 
|   | 0 | 117 |  |                     continue; | 
|   |  | 118 |  |                 } | 
|   | 80 | 119 |  |                 if (property.NameEquals("location")) | 
|   |  | 120 |  |                 { | 
|   | 76 | 121 |  |                     location = property.Value.GetString(); | 
|   | 76 | 122 |  |                     continue; | 
|   |  | 123 |  |                 } | 
|   | 4 | 124 |  |                 if (property.NameEquals("tags")) | 
|   |  | 125 |  |                 { | 
|   | 0 | 126 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 127 |  |                     { | 
|   |  | 128 |  |                         continue; | 
|   |  | 129 |  |                     } | 
|   | 0 | 130 |  |                     Dictionary<string, string> dictionary = new Dictionary<string, string>(); | 
|   | 0 | 131 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 132 |  |                     { | 
|   | 0 | 133 |  |                         if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 134 |  |                         { | 
|   | 0 | 135 |  |                             dictionary.Add(property0.Name, null); | 
|   |  | 136 |  |                         } | 
|   |  | 137 |  |                         else | 
|   |  | 138 |  |                         { | 
|   | 0 | 139 |  |                             dictionary.Add(property0.Name, property0.Value.GetString()); | 
|   |  | 140 |  |                         } | 
|   |  | 141 |  |                     } | 
|   | 0 | 142 |  |                     tags = dictionary; | 
|   | 0 | 143 |  |                     continue; | 
|   |  | 144 |  |                 } | 
|   | 4 | 145 |  |                 if (property.NameEquals("properties")) | 
|   |  | 146 |  |                 { | 
|   | 56 | 147 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 148 |  |                     { | 
|   | 24 | 149 |  |                         if (property0.NameEquals("operatingSystem")) | 
|   |  | 150 |  |                         { | 
|   | 4 | 151 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 152 |  |                             { | 
|   |  | 153 |  |                                 continue; | 
|   |  | 154 |  |                             } | 
|   | 4 | 155 |  |                             operatingSystem = property0.Value.GetString(); | 
|   | 4 | 156 |  |                             continue; | 
|   |  | 157 |  |                         } | 
|   | 20 | 158 |  |                         if (property0.NameEquals("computeRole")) | 
|   |  | 159 |  |                         { | 
|   | 4 | 160 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 161 |  |                             { | 
|   |  | 162 |  |                                 continue; | 
|   |  | 163 |  |                             } | 
|   | 4 | 164 |  |                             computeRole = property0.Value.GetString(); | 
|   | 4 | 165 |  |                             continue; | 
|   |  | 166 |  |                         } | 
|   | 16 | 167 |  |                         if (property0.NameEquals("handlerSchema")) | 
|   |  | 168 |  |                         { | 
|   | 0 | 169 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 170 |  |                             { | 
|   |  | 171 |  |                                 continue; | 
|   |  | 172 |  |                             } | 
|   | 0 | 173 |  |                             handlerSchema = property0.Value.GetString(); | 
|   | 0 | 174 |  |                             continue; | 
|   |  | 175 |  |                         } | 
|   | 16 | 176 |  |                         if (property0.NameEquals("vmScaleSetEnabled")) | 
|   |  | 177 |  |                         { | 
|   | 4 | 178 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 179 |  |                             { | 
|   |  | 180 |  |                                 continue; | 
|   |  | 181 |  |                             } | 
|   | 4 | 182 |  |                             vmScaleSetEnabled = property0.Value.GetBoolean(); | 
|   | 4 | 183 |  |                             continue; | 
|   |  | 184 |  |                         } | 
|   | 12 | 185 |  |                         if (property0.NameEquals("supportsMultipleExtensions")) | 
|   |  | 186 |  |                         { | 
|   | 4 | 187 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 188 |  |                             { | 
|   |  | 189 |  |                                 continue; | 
|   |  | 190 |  |                             } | 
|   | 4 | 191 |  |                             supportsMultipleExtensions = property0.Value.GetBoolean(); | 
|   |  | 192 |  |                             continue; | 
|   |  | 193 |  |                         } | 
|   |  | 194 |  |                     } | 
|   |  | 195 |  |                     continue; | 
|   |  | 196 |  |                 } | 
|   |  | 197 |  |             } | 
|   | 76 | 198 |  |             return new VirtualMachineExtensionImage(id, name, type, location, tags, operatingSystem, computeRole, handle | 
|   |  | 199 |  |         } | 
|   |  | 200 |  |     } | 
|   |  | 201 |  | } |