| | 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 VirtualMachineScaleSetExtension : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 32 | 18 | | writer.WriteStartObject(); |
| 32 | 19 | | if (Name != null) |
| | 20 | | { |
| 32 | 21 | | writer.WritePropertyName("name"); |
| 32 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 32 | 24 | | if (Type != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("type"); |
| 0 | 27 | | writer.WriteStringValue(Type); |
| | 28 | | } |
| 32 | 29 | | if (Id != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("id"); |
| 0 | 32 | | writer.WriteStringValue(Id); |
| | 33 | | } |
| 32 | 34 | | writer.WritePropertyName("properties"); |
| 32 | 35 | | writer.WriteStartObject(); |
| 32 | 36 | | if (ForceUpdateTag != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("forceUpdateTag"); |
| 0 | 39 | | writer.WriteStringValue(ForceUpdateTag); |
| | 40 | | } |
| 32 | 41 | | if (Publisher != null) |
| | 42 | | { |
| 32 | 43 | | writer.WritePropertyName("publisher"); |
| 32 | 44 | | writer.WriteStringValue(Publisher); |
| | 45 | | } |
| 32 | 46 | | if (TypePropertiesType != null) |
| | 47 | | { |
| 32 | 48 | | writer.WritePropertyName("type"); |
| 32 | 49 | | writer.WriteStringValue(TypePropertiesType); |
| | 50 | | } |
| 32 | 51 | | if (TypeHandlerVersion != null) |
| | 52 | | { |
| 32 | 53 | | writer.WritePropertyName("typeHandlerVersion"); |
| 32 | 54 | | writer.WriteStringValue(TypeHandlerVersion); |
| | 55 | | } |
| 32 | 56 | | if (AutoUpgradeMinorVersion != null) |
| | 57 | | { |
| 32 | 58 | | writer.WritePropertyName("autoUpgradeMinorVersion"); |
| 32 | 59 | | writer.WriteBooleanValue(AutoUpgradeMinorVersion.Value); |
| | 60 | | } |
| 32 | 61 | | if (Settings != null) |
| | 62 | | { |
| 32 | 63 | | writer.WritePropertyName("settings"); |
| 32 | 64 | | writer.WriteObjectValue(Settings); |
| | 65 | | } |
| 32 | 66 | | if (ProtectedSettings != null) |
| | 67 | | { |
| 32 | 68 | | writer.WritePropertyName("protectedSettings"); |
| 32 | 69 | | writer.WriteObjectValue(ProtectedSettings); |
| | 70 | | } |
| 32 | 71 | | if (ProvisioningState != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("provisioningState"); |
| 0 | 74 | | writer.WriteStringValue(ProvisioningState); |
| | 75 | | } |
| 32 | 76 | | if (ProvisionAfterExtensions != null) |
| | 77 | | { |
| 24 | 78 | | writer.WritePropertyName("provisionAfterExtensions"); |
| 24 | 79 | | writer.WriteStartArray(); |
| 80 | 80 | | foreach (var item in ProvisionAfterExtensions) |
| | 81 | | { |
| 16 | 82 | | writer.WriteStringValue(item); |
| | 83 | | } |
| 24 | 84 | | writer.WriteEndArray(); |
| | 85 | | } |
| 32 | 86 | | writer.WriteEndObject(); |
| 32 | 87 | | writer.WriteEndObject(); |
| 32 | 88 | | } |
| | 89 | |
|
| | 90 | | internal static VirtualMachineScaleSetExtension DeserializeVirtualMachineScaleSetExtension(JsonElement element) |
| | 91 | | { |
| 488 | 92 | | string name = default; |
| 488 | 93 | | string type = default; |
| 488 | 94 | | string id = default; |
| 488 | 95 | | string forceUpdateTag = default; |
| 488 | 96 | | string publisher = default; |
| 488 | 97 | | string type0 = default; |
| 488 | 98 | | string typeHandlerVersion = default; |
| 488 | 99 | | bool? autoUpgradeMinorVersion = default; |
| 488 | 100 | | object settings = default; |
| 488 | 101 | | object protectedSettings = default; |
| 488 | 102 | | string provisioningState = default; |
| 488 | 103 | | IList<string> provisionAfterExtensions = default; |
| 3056 | 104 | | foreach (var property in element.EnumerateObject()) |
| | 105 | | { |
| 1040 | 106 | | if (property.NameEquals("name")) |
| | 107 | | { |
| 488 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 488 | 112 | | name = property.Value.GetString(); |
| 488 | 113 | | continue; |
| | 114 | | } |
| 552 | 115 | | if (property.NameEquals("type")) |
| | 116 | | { |
| 32 | 117 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 32 | 121 | | type = property.Value.GetString(); |
| 32 | 122 | | continue; |
| | 123 | | } |
| 520 | 124 | | if (property.NameEquals("id")) |
| | 125 | | { |
| 32 | 126 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| | 128 | | continue; |
| | 129 | | } |
| 32 | 130 | | id = property.Value.GetString(); |
| 32 | 131 | | continue; |
| | 132 | | } |
| 488 | 133 | | if (property.NameEquals("properties")) |
| | 134 | | { |
| 6624 | 135 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 136 | | { |
| 2824 | 137 | | if (property0.NameEquals("forceUpdateTag")) |
| | 138 | | { |
| 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | forceUpdateTag = property0.Value.GetString(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 2824 | 146 | | if (property0.NameEquals("publisher")) |
| | 147 | | { |
| 488 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 488 | 152 | | publisher = property0.Value.GetString(); |
| 488 | 153 | | continue; |
| | 154 | | } |
| 2336 | 155 | | if (property0.NameEquals("type")) |
| | 156 | | { |
| 488 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 488 | 161 | | type0 = property0.Value.GetString(); |
| 488 | 162 | | continue; |
| | 163 | | } |
| 1848 | 164 | | if (property0.NameEquals("typeHandlerVersion")) |
| | 165 | | { |
| 488 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 488 | 170 | | typeHandlerVersion = property0.Value.GetString(); |
| 488 | 171 | | continue; |
| | 172 | | } |
| 1360 | 173 | | if (property0.NameEquals("autoUpgradeMinorVersion")) |
| | 174 | | { |
| 488 | 175 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 176 | | { |
| | 177 | | continue; |
| | 178 | | } |
| 488 | 179 | | autoUpgradeMinorVersion = property0.Value.GetBoolean(); |
| 488 | 180 | | continue; |
| | 181 | | } |
| 872 | 182 | | if (property0.NameEquals("settings")) |
| | 183 | | { |
| 488 | 184 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 488 | 188 | | settings = property0.Value.GetObject(); |
| 488 | 189 | | continue; |
| | 190 | | } |
| 384 | 191 | | if (property0.NameEquals("protectedSettings")) |
| | 192 | | { |
| 0 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | protectedSettings = property0.Value.GetObject(); |
| 0 | 198 | | continue; |
| | 199 | | } |
| 384 | 200 | | if (property0.NameEquals("provisioningState")) |
| | 201 | | { |
| 32 | 202 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 32 | 206 | | provisioningState = property0.Value.GetString(); |
| 32 | 207 | | continue; |
| | 208 | | } |
| 352 | 209 | | if (property0.NameEquals("provisionAfterExtensions")) |
| | 210 | | { |
| 32 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 32 | 215 | | List<string> array = new List<string>(); |
| 112 | 216 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 217 | | { |
| 24 | 218 | | if (item.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| 0 | 220 | | array.Add(null); |
| | 221 | | } |
| | 222 | | else |
| | 223 | | { |
| 24 | 224 | | array.Add(item.GetString()); |
| | 225 | | } |
| | 226 | | } |
| 32 | 227 | | provisionAfterExtensions = array; |
| | 228 | | continue; |
| | 229 | | } |
| | 230 | | } |
| | 231 | | continue; |
| | 232 | | } |
| | 233 | | } |
| 488 | 234 | | return new VirtualMachineScaleSetExtension(id, name, type, forceUpdateTag, publisher, type0, typeHandlerVers |
| | 235 | | } |
| | 236 | | } |
| | 237 | | } |