| | 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.Network.Models |
| | 13 | | { |
| | 14 | | public partial class FrontendIPConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 96 | 18 | | writer.WriteStartObject(); |
| 96 | 19 | | if (Name != null) |
| | 20 | | { |
| 96 | 21 | | writer.WritePropertyName("name"); |
| 96 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 96 | 24 | | if (Etag != null) |
| | 25 | | { |
| 16 | 26 | | writer.WritePropertyName("etag"); |
| 16 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 96 | 29 | | if (Type != null) |
| | 30 | | { |
| 16 | 31 | | writer.WritePropertyName("type"); |
| 16 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 96 | 34 | | if (Zones != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("zones"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in Zones) |
| | 39 | | { |
| 0 | 40 | | writer.WriteStringValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 96 | 44 | | if (Id != null) |
| | 45 | | { |
| 16 | 46 | | writer.WritePropertyName("id"); |
| 16 | 47 | | writer.WriteStringValue(Id); |
| | 48 | | } |
| 96 | 49 | | writer.WritePropertyName("properties"); |
| 96 | 50 | | writer.WriteStartObject(); |
| 96 | 51 | | if (InboundNatRules != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("inboundNatRules"); |
| 0 | 54 | | writer.WriteStartArray(); |
| 0 | 55 | | foreach (var item in InboundNatRules) |
| | 56 | | { |
| 0 | 57 | | writer.WriteObjectValue(item); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 96 | 61 | | if (InboundNatPools != null) |
| | 62 | | { |
| 8 | 63 | | writer.WritePropertyName("inboundNatPools"); |
| 8 | 64 | | writer.WriteStartArray(); |
| 32 | 65 | | foreach (var item in InboundNatPools) |
| | 66 | | { |
| 8 | 67 | | writer.WriteObjectValue(item); |
| | 68 | | } |
| 8 | 69 | | writer.WriteEndArray(); |
| | 70 | | } |
| 96 | 71 | | if (OutboundRules != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("outboundRules"); |
| 0 | 74 | | writer.WriteStartArray(); |
| 0 | 75 | | foreach (var item in OutboundRules) |
| | 76 | | { |
| 0 | 77 | | writer.WriteObjectValue(item); |
| | 78 | | } |
| 0 | 79 | | writer.WriteEndArray(); |
| | 80 | | } |
| 96 | 81 | | if (LoadBalancingRules != null) |
| | 82 | | { |
| 8 | 83 | | writer.WritePropertyName("loadBalancingRules"); |
| 8 | 84 | | writer.WriteStartArray(); |
| 32 | 85 | | foreach (var item in LoadBalancingRules) |
| | 86 | | { |
| 8 | 87 | | writer.WriteObjectValue(item); |
| | 88 | | } |
| 8 | 89 | | writer.WriteEndArray(); |
| | 90 | | } |
| 96 | 91 | | if (PrivateIPAddress != null) |
| | 92 | | { |
| 48 | 93 | | writer.WritePropertyName("privateIPAddress"); |
| 48 | 94 | | writer.WriteStringValue(PrivateIPAddress); |
| | 95 | | } |
| 96 | 96 | | if (PrivateIPAllocationMethod != null) |
| | 97 | | { |
| 64 | 98 | | writer.WritePropertyName("privateIPAllocationMethod"); |
| 64 | 99 | | writer.WriteStringValue(PrivateIPAllocationMethod.Value.ToString()); |
| | 100 | | } |
| 96 | 101 | | if (PrivateIPAddressVersion != null) |
| | 102 | | { |
| 16 | 103 | | writer.WritePropertyName("privateIPAddressVersion"); |
| 16 | 104 | | writer.WriteStringValue(PrivateIPAddressVersion.Value.ToString()); |
| | 105 | | } |
| 96 | 106 | | if (Subnet != null) |
| | 107 | | { |
| 56 | 108 | | writer.WritePropertyName("subnet"); |
| 56 | 109 | | writer.WriteObjectValue(Subnet); |
| | 110 | | } |
| 96 | 111 | | if (PublicIPAddress != null) |
| | 112 | | { |
| 40 | 113 | | writer.WritePropertyName("publicIPAddress"); |
| 40 | 114 | | writer.WriteObjectValue(PublicIPAddress); |
| | 115 | | } |
| 96 | 116 | | if (PublicIPPrefix != null) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("publicIPPrefix"); |
| 0 | 119 | | writer.WriteObjectValue(PublicIPPrefix); |
| | 120 | | } |
| 96 | 121 | | if (ProvisioningState != null) |
| | 122 | | { |
| 16 | 123 | | writer.WritePropertyName("provisioningState"); |
| 16 | 124 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 125 | | } |
| 96 | 126 | | writer.WriteEndObject(); |
| 96 | 127 | | writer.WriteEndObject(); |
| 96 | 128 | | } |
| | 129 | |
|
| | 130 | | internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonElement element) |
| | 131 | | { |
| 120 | 132 | | string name = default; |
| 120 | 133 | | string etag = default; |
| 120 | 134 | | string type = default; |
| 120 | 135 | | IList<string> zones = default; |
| 120 | 136 | | string id = default; |
| 120 | 137 | | IList<SubResource> inboundNatRules = default; |
| 120 | 138 | | IList<SubResource> inboundNatPools = default; |
| 120 | 139 | | IList<SubResource> outboundRules = default; |
| 120 | 140 | | IList<SubResource> loadBalancingRules = default; |
| 120 | 141 | | string privateIPAddress = default; |
| 120 | 142 | | IPAllocationMethod? privateIPAllocationMethod = default; |
| 120 | 143 | | IPVersion? privateIPAddressVersion = default; |
| 120 | 144 | | Subnet subnet = default; |
| 120 | 145 | | PublicIPAddress publicIPAddress = default; |
| 120 | 146 | | SubResource publicIPPrefix = default; |
| 120 | 147 | | ProvisioningState? provisioningState = default; |
| 1440 | 148 | | foreach (var property in element.EnumerateObject()) |
| | 149 | | { |
| 600 | 150 | | if (property.NameEquals("name")) |
| | 151 | | { |
| 120 | 152 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| | 154 | | continue; |
| | 155 | | } |
| 120 | 156 | | name = property.Value.GetString(); |
| 120 | 157 | | continue; |
| | 158 | | } |
| 480 | 159 | | if (property.NameEquals("etag")) |
| | 160 | | { |
| 120 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| | 163 | | continue; |
| | 164 | | } |
| 120 | 165 | | etag = property.Value.GetString(); |
| 120 | 166 | | continue; |
| | 167 | | } |
| 360 | 168 | | if (property.NameEquals("type")) |
| | 169 | | { |
| 120 | 170 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 171 | | { |
| | 172 | | continue; |
| | 173 | | } |
| 120 | 174 | | type = property.Value.GetString(); |
| 120 | 175 | | continue; |
| | 176 | | } |
| 240 | 177 | | if (property.NameEquals("zones")) |
| | 178 | | { |
| 0 | 179 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | List<string> array = new List<string>(); |
| 0 | 184 | | foreach (var item in property.Value.EnumerateArray()) |
| | 185 | | { |
| 0 | 186 | | if (item.ValueKind == JsonValueKind.Null) |
| | 187 | | { |
| 0 | 188 | | array.Add(null); |
| | 189 | | } |
| | 190 | | else |
| | 191 | | { |
| 0 | 192 | | array.Add(item.GetString()); |
| | 193 | | } |
| | 194 | | } |
| 0 | 195 | | zones = array; |
| 0 | 196 | | continue; |
| | 197 | | } |
| 240 | 198 | | if (property.NameEquals("id")) |
| | 199 | | { |
| 120 | 200 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| | 202 | | continue; |
| | 203 | | } |
| 120 | 204 | | id = property.Value.GetString(); |
| 120 | 205 | | continue; |
| | 206 | | } |
| 120 | 207 | | if (property.NameEquals("properties")) |
| | 208 | | { |
| 1768 | 209 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 210 | | { |
| 764 | 211 | | if (property0.NameEquals("inboundNatRules")) |
| | 212 | | { |
| 104 | 213 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| | 215 | | continue; |
| | 216 | | } |
| 104 | 217 | | List<SubResource> array = new List<SubResource>(); |
| 624 | 218 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 219 | | { |
| 208 | 220 | | if (item.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| 0 | 222 | | array.Add(null); |
| | 223 | | } |
| | 224 | | else |
| | 225 | | { |
| 208 | 226 | | array.Add(DeserializeSubResource(item)); |
| | 227 | | } |
| | 228 | | } |
| 104 | 229 | | inboundNatRules = array; |
| 104 | 230 | | continue; |
| | 231 | | } |
| 660 | 232 | | if (property0.NameEquals("inboundNatPools")) |
| | 233 | | { |
| 4 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| | 236 | | continue; |
| | 237 | | } |
| 4 | 238 | | List<SubResource> array = new List<SubResource>(); |
| 16 | 239 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 240 | | { |
| 4 | 241 | | if (item.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| 0 | 243 | | array.Add(null); |
| | 244 | | } |
| | 245 | | else |
| | 246 | | { |
| 4 | 247 | | array.Add(DeserializeSubResource(item)); |
| | 248 | | } |
| | 249 | | } |
| 4 | 250 | | inboundNatPools = array; |
| 4 | 251 | | continue; |
| | 252 | | } |
| 656 | 253 | | if (property0.NameEquals("outboundRules")) |
| | 254 | | { |
| 0 | 255 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 256 | | { |
| | 257 | | continue; |
| | 258 | | } |
| 0 | 259 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 260 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 261 | | { |
| 0 | 262 | | if (item.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| 0 | 264 | | array.Add(null); |
| | 265 | | } |
| | 266 | | else |
| | 267 | | { |
| 0 | 268 | | array.Add(DeserializeSubResource(item)); |
| | 269 | | } |
| | 270 | | } |
| 0 | 271 | | outboundRules = array; |
| 0 | 272 | | continue; |
| | 273 | | } |
| 656 | 274 | | if (property0.NameEquals("loadBalancingRules")) |
| | 275 | | { |
| 116 | 276 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| | 278 | | continue; |
| | 279 | | } |
| 116 | 280 | | List<SubResource> array = new List<SubResource>(); |
| 464 | 281 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 282 | | { |
| 116 | 283 | | if (item.ValueKind == JsonValueKind.Null) |
| | 284 | | { |
| 0 | 285 | | array.Add(null); |
| | 286 | | } |
| | 287 | | else |
| | 288 | | { |
| 116 | 289 | | array.Add(DeserializeSubResource(item)); |
| | 290 | | } |
| | 291 | | } |
| 116 | 292 | | loadBalancingRules = array; |
| 116 | 293 | | continue; |
| | 294 | | } |
| 540 | 295 | | if (property0.NameEquals("privateIPAddress")) |
| | 296 | | { |
| 60 | 297 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 298 | | { |
| | 299 | | continue; |
| | 300 | | } |
| 60 | 301 | | privateIPAddress = property0.Value.GetString(); |
| 60 | 302 | | continue; |
| | 303 | | } |
| 480 | 304 | | if (property0.NameEquals("privateIPAllocationMethod")) |
| | 305 | | { |
| 120 | 306 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 307 | | { |
| | 308 | | continue; |
| | 309 | | } |
| 120 | 310 | | privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); |
| 120 | 311 | | continue; |
| | 312 | | } |
| 360 | 313 | | if (property0.NameEquals("privateIPAddressVersion")) |
| | 314 | | { |
| 120 | 315 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 316 | | { |
| | 317 | | continue; |
| | 318 | | } |
| 120 | 319 | | privateIPAddressVersion = new IPVersion(property0.Value.GetString()); |
| 120 | 320 | | continue; |
| | 321 | | } |
| 240 | 322 | | if (property0.NameEquals("subnet")) |
| | 323 | | { |
| 60 | 324 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 325 | | { |
| | 326 | | continue; |
| | 327 | | } |
| 60 | 328 | | subnet = Subnet.DeserializeSubnet(property0.Value); |
| 60 | 329 | | continue; |
| | 330 | | } |
| 180 | 331 | | if (property0.NameEquals("publicIPAddress")) |
| | 332 | | { |
| 60 | 333 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 334 | | { |
| | 335 | | continue; |
| | 336 | | } |
| 60 | 337 | | publicIPAddress = PublicIPAddress.DeserializePublicIPAddress(property0.Value); |
| 60 | 338 | | continue; |
| | 339 | | } |
| 120 | 340 | | if (property0.NameEquals("publicIPPrefix")) |
| | 341 | | { |
| 0 | 342 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 343 | | { |
| | 344 | | continue; |
| | 345 | | } |
| 0 | 346 | | publicIPPrefix = DeserializeSubResource(property0.Value); |
| 0 | 347 | | continue; |
| | 348 | | } |
| 120 | 349 | | if (property0.NameEquals("provisioningState")) |
| | 350 | | { |
| 120 | 351 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 352 | | { |
| | 353 | | continue; |
| | 354 | | } |
| 120 | 355 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 356 | | continue; |
| | 357 | | } |
| | 358 | | } |
| | 359 | | continue; |
| | 360 | | } |
| | 361 | | } |
| 120 | 362 | | return new FrontendIPConfiguration(id, name, etag, type, zones, inboundNatRules, inboundNatPools, outboundRu |
| | 363 | | } |
| | 364 | | } |
| | 365 | | } |