| | 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 EffectiveRoute |
| | 15 | | { |
| | 16 | | internal static EffectiveRoute DeserializeEffectiveRoute(JsonElement element) |
| | 17 | | { |
| 0 | 18 | | string name = default; |
| 0 | 19 | | bool? disableBgpRoutePropagation = default; |
| 0 | 20 | | EffectiveRouteSource? source = default; |
| 0 | 21 | | EffectiveRouteState? state = default; |
| 0 | 22 | | IReadOnlyList<string> addressPrefix = default; |
| 0 | 23 | | IReadOnlyList<string> nextHopIpAddress = default; |
| 0 | 24 | | RouteNextHopType? nextHopType = default; |
| 0 | 25 | | foreach (var property in element.EnumerateObject()) |
| | 26 | | { |
| 0 | 27 | | if (property.NameEquals("name")) |
| | 28 | | { |
| 0 | 29 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 30 | | { |
| | 31 | | continue; |
| | 32 | | } |
| 0 | 33 | | name = property.Value.GetString(); |
| 0 | 34 | | continue; |
| | 35 | | } |
| 0 | 36 | | if (property.NameEquals("disableBgpRoutePropagation")) |
| | 37 | | { |
| 0 | 38 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 39 | | { |
| | 40 | | continue; |
| | 41 | | } |
| 0 | 42 | | disableBgpRoutePropagation = property.Value.GetBoolean(); |
| 0 | 43 | | continue; |
| | 44 | | } |
| 0 | 45 | | if (property.NameEquals("source")) |
| | 46 | | { |
| 0 | 47 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | source = new EffectiveRouteSource(property.Value.GetString()); |
| 0 | 52 | | continue; |
| | 53 | | } |
| 0 | 54 | | if (property.NameEquals("state")) |
| | 55 | | { |
| 0 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 0 | 60 | | state = new EffectiveRouteState(property.Value.GetString()); |
| 0 | 61 | | continue; |
| | 62 | | } |
| 0 | 63 | | if (property.NameEquals("addressPrefix")) |
| | 64 | | { |
| 0 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 66 | | { |
| | 67 | | continue; |
| | 68 | | } |
| 0 | 69 | | List<string> array = new List<string>(); |
| 0 | 70 | | foreach (var item in property.Value.EnumerateArray()) |
| | 71 | | { |
| 0 | 72 | | if (item.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| 0 | 74 | | array.Add(null); |
| | 75 | | } |
| | 76 | | else |
| | 77 | | { |
| 0 | 78 | | array.Add(item.GetString()); |
| | 79 | | } |
| | 80 | | } |
| 0 | 81 | | addressPrefix = array; |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("nextHopIpAddress")) |
| | 85 | | { |
| 0 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | List<string> array = new List<string>(); |
| 0 | 91 | | foreach (var item in property.Value.EnumerateArray()) |
| | 92 | | { |
| 0 | 93 | | if (item.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| 0 | 95 | | array.Add(null); |
| | 96 | | } |
| | 97 | | else |
| | 98 | | { |
| 0 | 99 | | array.Add(item.GetString()); |
| | 100 | | } |
| | 101 | | } |
| 0 | 102 | | nextHopIpAddress = array; |
| 0 | 103 | | continue; |
| | 104 | | } |
| 0 | 105 | | if (property.NameEquals("nextHopType")) |
| | 106 | | { |
| 0 | 107 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 108 | | { |
| | 109 | | continue; |
| | 110 | | } |
| 0 | 111 | | nextHopType = new RouteNextHopType(property.Value.GetString()); |
| | 112 | | continue; |
| | 113 | | } |
| | 114 | | } |
| 0 | 115 | | return new EffectiveRoute(name, disableBgpRoutePropagation, source, state, addressPrefix, nextHopIpAddress, |
| | 116 | | } |
| | 117 | | } |
| | 118 | | } |