| | 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 WindowsConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 8 | 18 | | writer.WriteStartObject(); |
| 8 | 19 | | if (ProvisionVMAgent != null) |
| | 20 | | { |
| 8 | 21 | | writer.WritePropertyName("provisionVMAgent"); |
| 8 | 22 | | writer.WriteBooleanValue(ProvisionVMAgent.Value); |
| | 23 | | } |
| 8 | 24 | | if (EnableAutomaticUpdates != null) |
| | 25 | | { |
| 8 | 26 | | writer.WritePropertyName("enableAutomaticUpdates"); |
| 8 | 27 | | writer.WriteBooleanValue(EnableAutomaticUpdates.Value); |
| | 28 | | } |
| 8 | 29 | | if (TimeZone != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("timeZone"); |
| 0 | 32 | | writer.WriteStringValue(TimeZone); |
| | 33 | | } |
| 8 | 34 | | if (AdditionalUnattendContent != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("additionalUnattendContent"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in AdditionalUnattendContent) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 8 | 44 | | if (WinRM != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("winRM"); |
| 0 | 47 | | writer.WriteObjectValue(WinRM); |
| | 48 | | } |
| 8 | 49 | | writer.WriteEndObject(); |
| 8 | 50 | | } |
| | 51 | |
|
| | 52 | | internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement element) |
| | 53 | | { |
| 856 | 54 | | bool? provisionVMAgent = default; |
| 856 | 55 | | bool? enableAutomaticUpdates = default; |
| 856 | 56 | | string timeZone = default; |
| 856 | 57 | | IList<AdditionalUnattendContent> additionalUnattendContent = default; |
| 856 | 58 | | WinRMConfiguration winRM = default; |
| 5136 | 59 | | foreach (var property in element.EnumerateObject()) |
| | 60 | | { |
| 1712 | 61 | | if (property.NameEquals("provisionVMAgent")) |
| | 62 | | { |
| 856 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 856 | 67 | | provisionVMAgent = property.Value.GetBoolean(); |
| 856 | 68 | | continue; |
| | 69 | | } |
| 856 | 70 | | if (property.NameEquals("enableAutomaticUpdates")) |
| | 71 | | { |
| 856 | 72 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| | 74 | | continue; |
| | 75 | | } |
| 856 | 76 | | enableAutomaticUpdates = property.Value.GetBoolean(); |
| 856 | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | if (property.NameEquals("timeZone")) |
| | 80 | | { |
| 0 | 81 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | timeZone = property.Value.GetString(); |
| 0 | 86 | | continue; |
| | 87 | | } |
| 0 | 88 | | if (property.NameEquals("additionalUnattendContent")) |
| | 89 | | { |
| 0 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | List<AdditionalUnattendContent> array = new List<AdditionalUnattendContent>(); |
| 0 | 95 | | foreach (var item in property.Value.EnumerateArray()) |
| | 96 | | { |
| 0 | 97 | | if (item.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| 0 | 99 | | array.Add(null); |
| | 100 | | } |
| | 101 | | else |
| | 102 | | { |
| 0 | 103 | | array.Add(Models.AdditionalUnattendContent.DeserializeAdditionalUnattendContent(item)); |
| | 104 | | } |
| | 105 | | } |
| 0 | 106 | | additionalUnattendContent = array; |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("winRM")) |
| | 110 | | { |
| 0 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | winRM = WinRMConfiguration.DeserializeWinRMConfiguration(property.Value); |
| | 116 | | continue; |
| | 117 | | } |
| | 118 | | } |
| 856 | 119 | | return new WindowsConfiguration(provisionVMAgent, enableAutomaticUpdates, timeZone, additionalUnattendConten |
| | 120 | | } |
| | 121 | | } |
| | 122 | | } |