| | 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 VirtualMachineScaleSet : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 364 | 18 | | writer.WriteStartObject(); |
| 364 | 19 | | if (Sku != null) |
| | 20 | | { |
| 364 | 21 | | writer.WritePropertyName("sku"); |
| 364 | 22 | | writer.WriteObjectValue(Sku); |
| | 23 | | } |
| 364 | 24 | | if (Plan != null) |
| | 25 | | { |
| 4 | 26 | | writer.WritePropertyName("plan"); |
| 4 | 27 | | writer.WriteObjectValue(Plan); |
| | 28 | | } |
| 364 | 29 | | if (Identity != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("identity"); |
| 0 | 32 | | writer.WriteObjectValue(Identity); |
| | 33 | | } |
| 364 | 34 | | if (Zones != null) |
| | 35 | | { |
| 24 | 36 | | writer.WritePropertyName("zones"); |
| 24 | 37 | | writer.WriteStartArray(); |
| 112 | 38 | | foreach (var item in Zones) |
| | 39 | | { |
| 32 | 40 | | writer.WriteStringValue(item); |
| | 41 | | } |
| 24 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 364 | 44 | | if (Id != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("id"); |
| 0 | 47 | | writer.WriteStringValue(Id); |
| | 48 | | } |
| 364 | 49 | | if (Name != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("name"); |
| 0 | 52 | | writer.WriteStringValue(Name); |
| | 53 | | } |
| 364 | 54 | | if (Type != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("type"); |
| 0 | 57 | | writer.WriteStringValue(Type); |
| | 58 | | } |
| 364 | 59 | | writer.WritePropertyName("location"); |
| 364 | 60 | | writer.WriteStringValue(Location); |
| 364 | 61 | | if (Tags != null) |
| | 62 | | { |
| 364 | 63 | | writer.WritePropertyName("tags"); |
| 364 | 64 | | writer.WriteStartObject(); |
| 2184 | 65 | | foreach (var item in Tags) |
| | 66 | | { |
| 728 | 67 | | writer.WritePropertyName(item.Key); |
| 728 | 68 | | writer.WriteStringValue(item.Value); |
| | 69 | | } |
| 364 | 70 | | writer.WriteEndObject(); |
| | 71 | | } |
| 364 | 72 | | writer.WritePropertyName("properties"); |
| 364 | 73 | | writer.WriteStartObject(); |
| 364 | 74 | | if (UpgradePolicy != null) |
| | 75 | | { |
| 364 | 76 | | writer.WritePropertyName("upgradePolicy"); |
| 364 | 77 | | writer.WriteObjectValue(UpgradePolicy); |
| | 78 | | } |
| 364 | 79 | | if (AutomaticRepairsPolicy != null) |
| | 80 | | { |
| 32 | 81 | | writer.WritePropertyName("automaticRepairsPolicy"); |
| 32 | 82 | | writer.WriteObjectValue(AutomaticRepairsPolicy); |
| | 83 | | } |
| 364 | 84 | | if (VirtualMachineProfile != null) |
| | 85 | | { |
| 364 | 86 | | writer.WritePropertyName("virtualMachineProfile"); |
| 364 | 87 | | writer.WriteObjectValue(VirtualMachineProfile); |
| | 88 | | } |
| 364 | 89 | | if (ProvisioningState != null) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("provisioningState"); |
| 0 | 92 | | writer.WriteStringValue(ProvisioningState); |
| | 93 | | } |
| 364 | 94 | | if (Overprovision != null) |
| | 95 | | { |
| 364 | 96 | | writer.WritePropertyName("overprovision"); |
| 364 | 97 | | writer.WriteBooleanValue(Overprovision.Value); |
| | 98 | | } |
| 364 | 99 | | if (DoNotRunExtensionsOnOverprovisionedVMs != null) |
| | 100 | | { |
| 0 | 101 | | writer.WritePropertyName("doNotRunExtensionsOnOverprovisionedVMs"); |
| 0 | 102 | | writer.WriteBooleanValue(DoNotRunExtensionsOnOverprovisionedVMs.Value); |
| | 103 | | } |
| 364 | 104 | | if (UniqueId != null) |
| | 105 | | { |
| 0 | 106 | | writer.WritePropertyName("uniqueId"); |
| 0 | 107 | | writer.WriteStringValue(UniqueId); |
| | 108 | | } |
| 364 | 109 | | if (SinglePlacementGroup != null) |
| | 110 | | { |
| 0 | 111 | | writer.WritePropertyName("singlePlacementGroup"); |
| 0 | 112 | | writer.WriteBooleanValue(SinglePlacementGroup.Value); |
| | 113 | | } |
| 364 | 114 | | if (ZoneBalance != null) |
| | 115 | | { |
| 0 | 116 | | writer.WritePropertyName("zoneBalance"); |
| 0 | 117 | | writer.WriteBooleanValue(ZoneBalance.Value); |
| | 118 | | } |
| 364 | 119 | | if (PlatformFaultDomainCount != null) |
| | 120 | | { |
| 0 | 121 | | writer.WritePropertyName("platformFaultDomainCount"); |
| 0 | 122 | | writer.WriteNumberValue(PlatformFaultDomainCount.Value); |
| | 123 | | } |
| 364 | 124 | | if (ProximityPlacementGroup != null) |
| | 125 | | { |
| 8 | 126 | | writer.WritePropertyName("proximityPlacementGroup"); |
| 8 | 127 | | writer.WriteObjectValue(ProximityPlacementGroup); |
| | 128 | | } |
| 364 | 129 | | if (AdditionalCapabilities != null) |
| | 130 | | { |
| 8 | 131 | | writer.WritePropertyName("additionalCapabilities"); |
| 8 | 132 | | writer.WriteObjectValue(AdditionalCapabilities); |
| | 133 | | } |
| 364 | 134 | | if (ScaleInPolicy != null) |
| | 135 | | { |
| 0 | 136 | | writer.WritePropertyName("scaleInPolicy"); |
| 0 | 137 | | writer.WriteObjectValue(ScaleInPolicy); |
| | 138 | | } |
| 364 | 139 | | writer.WriteEndObject(); |
| 364 | 140 | | writer.WriteEndObject(); |
| 364 | 141 | | } |
| | 142 | |
|
| | 143 | | internal static VirtualMachineScaleSet DeserializeVirtualMachineScaleSet(JsonElement element) |
| | 144 | | { |
| 448 | 145 | | Sku sku = default; |
| 448 | 146 | | Plan plan = default; |
| 448 | 147 | | VirtualMachineScaleSetIdentity identity = default; |
| 448 | 148 | | IList<string> zones = default; |
| 448 | 149 | | string id = default; |
| 448 | 150 | | string name = default; |
| 448 | 151 | | string type = default; |
| 448 | 152 | | string location = default; |
| 448 | 153 | | IDictionary<string, string> tags = default; |
| 448 | 154 | | UpgradePolicy upgradePolicy = default; |
| 448 | 155 | | AutomaticRepairsPolicy automaticRepairsPolicy = default; |
| 448 | 156 | | VirtualMachineScaleSetVMProfile virtualMachineProfile = default; |
| 448 | 157 | | string provisioningState = default; |
| 448 | 158 | | bool? overprovision = default; |
| 448 | 159 | | bool? doNotRunExtensionsOnOverprovisionedVMs = default; |
| 448 | 160 | | string uniqueId = default; |
| 448 | 161 | | bool? singlePlacementGroup = default; |
| 448 | 162 | | bool? zoneBalance = default; |
| 448 | 163 | | int? platformFaultDomainCount = default; |
| 448 | 164 | | SubResource proximityPlacementGroup = default; |
| 448 | 165 | | AdditionalCapabilities additionalCapabilities = default; |
| 448 | 166 | | ScaleInPolicy scaleInPolicy = default; |
| 7240 | 167 | | foreach (var property in element.EnumerateObject()) |
| | 168 | | { |
| 3172 | 169 | | if (property.NameEquals("sku")) |
| | 170 | | { |
| 448 | 171 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 172 | | { |
| | 173 | | continue; |
| | 174 | | } |
| 448 | 175 | | sku = Sku.DeserializeSku(property.Value); |
| 448 | 176 | | continue; |
| | 177 | | } |
| 2724 | 178 | | if (property.NameEquals("plan")) |
| | 179 | | { |
| 0 | 180 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 181 | | { |
| | 182 | | continue; |
| | 183 | | } |
| 0 | 184 | | plan = Plan.DeserializePlan(property.Value); |
| 0 | 185 | | continue; |
| | 186 | | } |
| 2724 | 187 | | if (property.NameEquals("identity")) |
| | 188 | | { |
| 0 | 189 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| | 191 | | continue; |
| | 192 | | } |
| 0 | 193 | | identity = VirtualMachineScaleSetIdentity.DeserializeVirtualMachineScaleSetIdentity(property.Value); |
| 0 | 194 | | continue; |
| | 195 | | } |
| 2724 | 196 | | if (property.NameEquals("zones")) |
| | 197 | | { |
| 36 | 198 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| | 200 | | continue; |
| | 201 | | } |
| 36 | 202 | | List<string> array = new List<string>(); |
| 168 | 203 | | foreach (var item in property.Value.EnumerateArray()) |
| | 204 | | { |
| 48 | 205 | | if (item.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| 0 | 207 | | array.Add(null); |
| | 208 | | } |
| | 209 | | else |
| | 210 | | { |
| 48 | 211 | | array.Add(item.GetString()); |
| | 212 | | } |
| | 213 | | } |
| 36 | 214 | | zones = array; |
| 36 | 215 | | continue; |
| | 216 | | } |
| 2688 | 217 | | if (property.NameEquals("id")) |
| | 218 | | { |
| 448 | 219 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 448 | 223 | | id = property.Value.GetString(); |
| 448 | 224 | | continue; |
| | 225 | | } |
| 2240 | 226 | | if (property.NameEquals("name")) |
| | 227 | | { |
| 448 | 228 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| | 230 | | continue; |
| | 231 | | } |
| 448 | 232 | | name = property.Value.GetString(); |
| 448 | 233 | | continue; |
| | 234 | | } |
| 1792 | 235 | | if (property.NameEquals("type")) |
| | 236 | | { |
| 448 | 237 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 238 | | { |
| | 239 | | continue; |
| | 240 | | } |
| 448 | 241 | | type = property.Value.GetString(); |
| 448 | 242 | | continue; |
| | 243 | | } |
| 1344 | 244 | | if (property.NameEquals("location")) |
| | 245 | | { |
| 448 | 246 | | location = property.Value.GetString(); |
| 448 | 247 | | continue; |
| | 248 | | } |
| 896 | 249 | | if (property.NameEquals("tags")) |
| | 250 | | { |
| 448 | 251 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 252 | | { |
| | 253 | | continue; |
| | 254 | | } |
| 448 | 255 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 2688 | 256 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 257 | | { |
| 896 | 258 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 259 | | { |
| 0 | 260 | | dictionary.Add(property0.Name, null); |
| | 261 | | } |
| | 262 | | else |
| | 263 | | { |
| 896 | 264 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 265 | | } |
| | 266 | | } |
| 448 | 267 | | tags = dictionary; |
| 448 | 268 | | continue; |
| | 269 | | } |
| 448 | 270 | | if (property.NameEquals("properties")) |
| | 271 | | { |
| 7512 | 272 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 273 | | { |
| 3308 | 274 | | if (property0.NameEquals("upgradePolicy")) |
| | 275 | | { |
| 448 | 276 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| | 278 | | continue; |
| | 279 | | } |
| 448 | 280 | | upgradePolicy = UpgradePolicy.DeserializeUpgradePolicy(property0.Value); |
| 448 | 281 | | continue; |
| | 282 | | } |
| 2860 | 283 | | if (property0.NameEquals("automaticRepairsPolicy")) |
| | 284 | | { |
| 40 | 285 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 286 | | { |
| | 287 | | continue; |
| | 288 | | } |
| 40 | 289 | | automaticRepairsPolicy = AutomaticRepairsPolicy.DeserializeAutomaticRepairsPolicy(property0. |
| 40 | 290 | | continue; |
| | 291 | | } |
| 2820 | 292 | | if (property0.NameEquals("virtualMachineProfile")) |
| | 293 | | { |
| 448 | 294 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 295 | | { |
| | 296 | | continue; |
| | 297 | | } |
| 448 | 298 | | virtualMachineProfile = VirtualMachineScaleSetVMProfile.DeserializeVirtualMachineScaleSetVMP |
| 448 | 299 | | continue; |
| | 300 | | } |
| 2372 | 301 | | if (property0.NameEquals("provisioningState")) |
| | 302 | | { |
| 448 | 303 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 304 | | { |
| | 305 | | continue; |
| | 306 | | } |
| 448 | 307 | | provisioningState = property0.Value.GetString(); |
| 448 | 308 | | continue; |
| | 309 | | } |
| 1924 | 310 | | if (property0.NameEquals("overprovision")) |
| | 311 | | { |
| 448 | 312 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 313 | | { |
| | 314 | | continue; |
| | 315 | | } |
| 448 | 316 | | overprovision = property0.Value.GetBoolean(); |
| 448 | 317 | | continue; |
| | 318 | | } |
| 1476 | 319 | | if (property0.NameEquals("doNotRunExtensionsOnOverprovisionedVMs")) |
| | 320 | | { |
| 448 | 321 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 322 | | { |
| | 323 | | continue; |
| | 324 | | } |
| 448 | 325 | | doNotRunExtensionsOnOverprovisionedVMs = property0.Value.GetBoolean(); |
| 448 | 326 | | continue; |
| | 327 | | } |
| 1028 | 328 | | if (property0.NameEquals("uniqueId")) |
| | 329 | | { |
| 448 | 330 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 331 | | { |
| | 332 | | continue; |
| | 333 | | } |
| 448 | 334 | | uniqueId = property0.Value.GetString(); |
| 448 | 335 | | continue; |
| | 336 | | } |
| 580 | 337 | | if (property0.NameEquals("singlePlacementGroup")) |
| | 338 | | { |
| 448 | 339 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 340 | | { |
| | 341 | | continue; |
| | 342 | | } |
| 448 | 343 | | singlePlacementGroup = property0.Value.GetBoolean(); |
| 448 | 344 | | continue; |
| | 345 | | } |
| 132 | 346 | | if (property0.NameEquals("zoneBalance")) |
| | 347 | | { |
| 12 | 348 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 349 | | { |
| | 350 | | continue; |
| | 351 | | } |
| 12 | 352 | | zoneBalance = property0.Value.GetBoolean(); |
| 12 | 353 | | continue; |
| | 354 | | } |
| 120 | 355 | | if (property0.NameEquals("platformFaultDomainCount")) |
| | 356 | | { |
| 96 | 357 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 358 | | { |
| | 359 | | continue; |
| | 360 | | } |
| 96 | 361 | | platformFaultDomainCount = property0.Value.GetInt32(); |
| 96 | 362 | | continue; |
| | 363 | | } |
| 24 | 364 | | if (property0.NameEquals("proximityPlacementGroup")) |
| | 365 | | { |
| 12 | 366 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 367 | | { |
| | 368 | | continue; |
| | 369 | | } |
| 12 | 370 | | proximityPlacementGroup = SubResource.DeserializeSubResource(property0.Value); |
| 12 | 371 | | continue; |
| | 372 | | } |
| 12 | 373 | | if (property0.NameEquals("additionalCapabilities")) |
| | 374 | | { |
| 12 | 375 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 376 | | { |
| | 377 | | continue; |
| | 378 | | } |
| 12 | 379 | | additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0. |
| 12 | 380 | | continue; |
| | 381 | | } |
| 0 | 382 | | if (property0.NameEquals("scaleInPolicy")) |
| | 383 | | { |
| 0 | 384 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 385 | | { |
| | 386 | | continue; |
| | 387 | | } |
| 0 | 388 | | scaleInPolicy = ScaleInPolicy.DeserializeScaleInPolicy(property0.Value); |
| | 389 | | continue; |
| | 390 | | } |
| | 391 | | } |
| | 392 | | continue; |
| | 393 | | } |
| | 394 | | } |
| 448 | 395 | | return new VirtualMachineScaleSet(id, name, type, location, tags, sku, plan, identity, zones, upgradePolicy, |
| | 396 | | } |
| | 397 | | } |
| | 398 | | } |