| | 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 Route : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 88 | 17 | | writer.WriteStartObject(); |
| 88 | 18 | | if (Name != null) |
| | 19 | | { |
| 88 | 20 | | writer.WritePropertyName("name"); |
| 88 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 88 | 23 | | if (Etag != null) |
| | 24 | | { |
| 16 | 25 | | writer.WritePropertyName("etag"); |
| 16 | 26 | | writer.WriteStringValue(Etag); |
| | 27 | | } |
| 88 | 28 | | if (Id != null) |
| | 29 | | { |
| 16 | 30 | | writer.WritePropertyName("id"); |
| 16 | 31 | | writer.WriteStringValue(Id); |
| | 32 | | } |
| 88 | 33 | | writer.WritePropertyName("properties"); |
| 88 | 34 | | writer.WriteStartObject(); |
| 88 | 35 | | if (AddressPrefix != null) |
| | 36 | | { |
| 88 | 37 | | writer.WritePropertyName("addressPrefix"); |
| 88 | 38 | | writer.WriteStringValue(AddressPrefix); |
| | 39 | | } |
| 88 | 40 | | if (NextHopType != null) |
| | 41 | | { |
| 88 | 42 | | writer.WritePropertyName("nextHopType"); |
| 88 | 43 | | writer.WriteStringValue(NextHopType.Value.ToString()); |
| | 44 | | } |
| 88 | 45 | | if (NextHopIpAddress != null) |
| | 46 | | { |
| 40 | 47 | | writer.WritePropertyName("nextHopIpAddress"); |
| 40 | 48 | | writer.WriteStringValue(NextHopIpAddress); |
| | 49 | | } |
| 88 | 50 | | if (ProvisioningState != null) |
| | 51 | | { |
| 16 | 52 | | writer.WritePropertyName("provisioningState"); |
| 16 | 53 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 54 | | } |
| 88 | 55 | | writer.WriteEndObject(); |
| 88 | 56 | | writer.WriteEndObject(); |
| 88 | 57 | | } |
| | 58 | |
|
| | 59 | | internal static Route DeserializeRoute(JsonElement element) |
| | 60 | | { |
| 96 | 61 | | string name = default; |
| 96 | 62 | | string etag = default; |
| 96 | 63 | | string id = default; |
| 96 | 64 | | string addressPrefix = default; |
| 96 | 65 | | RouteNextHopType? nextHopType = default; |
| 96 | 66 | | string nextHopIpAddress = default; |
| 96 | 67 | | ProvisioningState? provisioningState = default; |
| 1152 | 68 | | foreach (var property in element.EnumerateObject()) |
| | 69 | | { |
| 480 | 70 | | if (property.NameEquals("name")) |
| | 71 | | { |
| 96 | 72 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| | 74 | | continue; |
| | 75 | | } |
| 96 | 76 | | name = property.Value.GetString(); |
| 96 | 77 | | continue; |
| | 78 | | } |
| 384 | 79 | | if (property.NameEquals("etag")) |
| | 80 | | { |
| 96 | 81 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| | 83 | | continue; |
| | 84 | | } |
| 96 | 85 | | etag = property.Value.GetString(); |
| 96 | 86 | | continue; |
| | 87 | | } |
| 288 | 88 | | if (property.NameEquals("id")) |
| | 89 | | { |
| 96 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 96 | 94 | | id = property.Value.GetString(); |
| 96 | 95 | | continue; |
| | 96 | | } |
| 192 | 97 | | if (property.NameEquals("properties")) |
| | 98 | | { |
| 1080 | 99 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 100 | | { |
| 444 | 101 | | if (property0.NameEquals("addressPrefix")) |
| | 102 | | { |
| 96 | 103 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 104 | | { |
| | 105 | | continue; |
| | 106 | | } |
| 96 | 107 | | addressPrefix = property0.Value.GetString(); |
| 96 | 108 | | continue; |
| | 109 | | } |
| 348 | 110 | | if (property0.NameEquals("nextHopType")) |
| | 111 | | { |
| 96 | 112 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 113 | | { |
| | 114 | | continue; |
| | 115 | | } |
| 96 | 116 | | nextHopType = new RouteNextHopType(property0.Value.GetString()); |
| 96 | 117 | | continue; |
| | 118 | | } |
| 252 | 119 | | if (property0.NameEquals("nextHopIpAddress")) |
| | 120 | | { |
| 60 | 121 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| | 123 | | continue; |
| | 124 | | } |
| 60 | 125 | | nextHopIpAddress = property0.Value.GetString(); |
| 60 | 126 | | continue; |
| | 127 | | } |
| 192 | 128 | | if (property0.NameEquals("provisioningState")) |
| | 129 | | { |
| 96 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 96 | 134 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 135 | | continue; |
| | 136 | | } |
| | 137 | | } |
| | 138 | | continue; |
| | 139 | | } |
| | 140 | | } |
| 96 | 141 | | return new Route(id, name, etag, addressPrefix, nextHopType, nextHopIpAddress, provisioningState); |
| | 142 | | } |
| | 143 | | } |
| | 144 | | } |