| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Network.Models |
| | 12 | | { |
| | 13 | | public partial class GatewayRoute |
| | 14 | | { |
| | 15 | | internal static GatewayRoute DeserializeGatewayRoute(JsonElement element) |
| | 16 | | { |
| 0 | 17 | | string localAddress = default; |
| 0 | 18 | | string network = default; |
| 0 | 19 | | string nextHop = default; |
| 0 | 20 | | string sourcePeer = default; |
| 0 | 21 | | string origin = default; |
| 0 | 22 | | string asPath = default; |
| 0 | 23 | | int? weight = default; |
| 0 | 24 | | foreach (var property in element.EnumerateObject()) |
| | 25 | | { |
| 0 | 26 | | if (property.NameEquals("localAddress")) |
| | 27 | | { |
| 0 | 28 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 29 | | { |
| | 30 | | continue; |
| | 31 | | } |
| 0 | 32 | | localAddress = property.Value.GetString(); |
| 0 | 33 | | continue; |
| | 34 | | } |
| 0 | 35 | | if (property.NameEquals("network")) |
| | 36 | | { |
| 0 | 37 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 38 | | { |
| | 39 | | continue; |
| | 40 | | } |
| 0 | 41 | | network = property.Value.GetString(); |
| 0 | 42 | | continue; |
| | 43 | | } |
| 0 | 44 | | if (property.NameEquals("nextHop")) |
| | 45 | | { |
| 0 | 46 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 47 | | { |
| | 48 | | continue; |
| | 49 | | } |
| 0 | 50 | | nextHop = property.Value.GetString(); |
| 0 | 51 | | continue; |
| | 52 | | } |
| 0 | 53 | | if (property.NameEquals("sourcePeer")) |
| | 54 | | { |
| 0 | 55 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 56 | | { |
| | 57 | | continue; |
| | 58 | | } |
| 0 | 59 | | sourcePeer = property.Value.GetString(); |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("origin")) |
| | 63 | | { |
| 0 | 64 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 65 | | { |
| | 66 | | continue; |
| | 67 | | } |
| 0 | 68 | | origin = property.Value.GetString(); |
| 0 | 69 | | continue; |
| | 70 | | } |
| 0 | 71 | | if (property.NameEquals("asPath")) |
| | 72 | | { |
| 0 | 73 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 74 | | { |
| | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | asPath = property.Value.GetString(); |
| 0 | 78 | | continue; |
| | 79 | | } |
| 0 | 80 | | if (property.NameEquals("weight")) |
| | 81 | | { |
| 0 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | weight = property.Value.GetInt32(); |
| | 87 | | continue; |
| | 88 | | } |
| | 89 | | } |
| 0 | 90 | | return new GatewayRoute(localAddress, network, nextHop, sourcePeer, origin, asPath, weight); |
| | 91 | | } |
| | 92 | | } |
| | 93 | | } |