| | 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 VirtualMachineExtension : 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 (ForceUpdateTag != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("forceUpdateTag"); |
| 0 | 52 | | writer.WriteStringValue(ForceUpdateTag); |
| | 53 | | } |
| 0 | 54 | | if (Publisher != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("publisher"); |
| 0 | 57 | | writer.WriteStringValue(Publisher); |
| | 58 | | } |
| 0 | 59 | | if (TypePropertiesType != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("type"); |
| 0 | 62 | | writer.WriteStringValue(TypePropertiesType); |
| | 63 | | } |
| 0 | 64 | | if (TypeHandlerVersion != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("typeHandlerVersion"); |
| 0 | 67 | | writer.WriteStringValue(TypeHandlerVersion); |
| | 68 | | } |
| 0 | 69 | | if (AutoUpgradeMinorVersion != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("autoUpgradeMinorVersion"); |
| 0 | 72 | | writer.WriteBooleanValue(AutoUpgradeMinorVersion.Value); |
| | 73 | | } |
| 0 | 74 | | if (Settings != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("settings"); |
| 0 | 77 | | writer.WriteObjectValue(Settings); |
| | 78 | | } |
| 0 | 79 | | if (ProtectedSettings != null) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("protectedSettings"); |
| 0 | 82 | | writer.WriteObjectValue(ProtectedSettings); |
| | 83 | | } |
| 0 | 84 | | if (ProvisioningState != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("provisioningState"); |
| 0 | 87 | | writer.WriteStringValue(ProvisioningState); |
| | 88 | | } |
| 0 | 89 | | if (InstanceView != null) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("instanceView"); |
| 0 | 92 | | writer.WriteObjectValue(InstanceView); |
| | 93 | | } |
| 0 | 94 | | writer.WriteEndObject(); |
| 0 | 95 | | writer.WriteEndObject(); |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | internal static VirtualMachineExtension DeserializeVirtualMachineExtension(JsonElement element) |
| | 99 | | { |
| 120 | 100 | | string id = default; |
| 120 | 101 | | string name = default; |
| 120 | 102 | | string type = default; |
| 120 | 103 | | string location = default; |
| 120 | 104 | | IDictionary<string, string> tags = default; |
| 120 | 105 | | string forceUpdateTag = default; |
| 120 | 106 | | string publisher = default; |
| 120 | 107 | | string type0 = default; |
| 120 | 108 | | string typeHandlerVersion = default; |
| 120 | 109 | | bool? autoUpgradeMinorVersion = default; |
| 120 | 110 | | object settings = default; |
| 120 | 111 | | object protectedSettings = default; |
| 120 | 112 | | string provisioningState = default; |
| 120 | 113 | | VirtualMachineExtensionInstanceView instanceView = default; |
| 1232 | 114 | | foreach (var property in element.EnumerateObject()) |
| | 115 | | { |
| 496 | 116 | | if (property.NameEquals("id")) |
| | 117 | | { |
| 120 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 120 | 122 | | id = property.Value.GetString(); |
| 120 | 123 | | continue; |
| | 124 | | } |
| 376 | 125 | | if (property.NameEquals("name")) |
| | 126 | | { |
| 94 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 94 | 131 | | name = property.Value.GetString(); |
| 94 | 132 | | continue; |
| | 133 | | } |
| 282 | 134 | | if (property.NameEquals("type")) |
| | 135 | | { |
| 94 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 94 | 140 | | type = property.Value.GetString(); |
| 94 | 141 | | continue; |
| | 142 | | } |
| 188 | 143 | | if (property.NameEquals("location")) |
| | 144 | | { |
| 94 | 145 | | location = property.Value.GetString(); |
| 94 | 146 | | continue; |
| | 147 | | } |
| 94 | 148 | | if (property.NameEquals("tags")) |
| | 149 | | { |
| 0 | 150 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 151 | | { |
| | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 155 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 156 | | { |
| 0 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| 0 | 159 | | dictionary.Add(property0.Name, null); |
| | 160 | | } |
| | 161 | | else |
| | 162 | | { |
| 0 | 163 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 164 | | } |
| | 165 | | } |
| 0 | 166 | | tags = dictionary; |
| 0 | 167 | | continue; |
| | 168 | | } |
| 94 | 169 | | if (property.NameEquals("properties")) |
| | 170 | | { |
| 1408 | 171 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 172 | | { |
| 610 | 173 | | if (property0.NameEquals("forceUpdateTag")) |
| | 174 | | { |
| 0 | 175 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | forceUpdateTag = property0.Value.GetString(); |
| 0 | 180 | | continue; |
| | 181 | | } |
| 610 | 182 | | if (property0.NameEquals("publisher")) |
| | 183 | | { |
| 94 | 184 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 94 | 188 | | publisher = property0.Value.GetString(); |
| 94 | 189 | | continue; |
| | 190 | | } |
| 516 | 191 | | if (property0.NameEquals("type")) |
| | 192 | | { |
| 94 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 94 | 197 | | type0 = property0.Value.GetString(); |
| 94 | 198 | | continue; |
| | 199 | | } |
| 422 | 200 | | if (property0.NameEquals("typeHandlerVersion")) |
| | 201 | | { |
| 94 | 202 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 94 | 206 | | typeHandlerVersion = property0.Value.GetString(); |
| 94 | 207 | | continue; |
| | 208 | | } |
| 328 | 209 | | if (property0.NameEquals("autoUpgradeMinorVersion")) |
| | 210 | | { |
| 94 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 94 | 215 | | autoUpgradeMinorVersion = property0.Value.GetBoolean(); |
| 94 | 216 | | continue; |
| | 217 | | } |
| 234 | 218 | | if (property0.NameEquals("settings")) |
| | 219 | | { |
| 94 | 220 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| | 222 | | continue; |
| | 223 | | } |
| 94 | 224 | | settings = property0.Value.GetObject(); |
| 94 | 225 | | continue; |
| | 226 | | } |
| 140 | 227 | | if (property0.NameEquals("protectedSettings")) |
| | 228 | | { |
| 0 | 229 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 230 | | { |
| | 231 | | continue; |
| | 232 | | } |
| 0 | 233 | | protectedSettings = property0.Value.GetObject(); |
| 0 | 234 | | continue; |
| | 235 | | } |
| 140 | 236 | | if (property0.NameEquals("provisioningState")) |
| | 237 | | { |
| 94 | 238 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 239 | | { |
| | 240 | | continue; |
| | 241 | | } |
| 94 | 242 | | provisioningState = property0.Value.GetString(); |
| 94 | 243 | | continue; |
| | 244 | | } |
| 46 | 245 | | if (property0.NameEquals("instanceView")) |
| | 246 | | { |
| 0 | 247 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 248 | | { |
| | 249 | | continue; |
| | 250 | | } |
| 0 | 251 | | instanceView = VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanc |
| | 252 | | continue; |
| | 253 | | } |
| | 254 | | } |
| | 255 | | continue; |
| | 256 | | } |
| | 257 | | } |
| 120 | 258 | | return new VirtualMachineExtension(id, name, type, location, tags, forceUpdateTag, publisher, type0, typeHan |
| | 259 | | } |
| | 260 | | } |
| | 261 | | } |