| | 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 RoutingConfiguration : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (AssociatedRouteTable != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("associatedRouteTable"); |
| 0 | 21 | | writer.WriteObjectValue(AssociatedRouteTable); |
| | 22 | | } |
| 0 | 23 | | if (PropagatedRouteTables != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("propagatedRouteTables"); |
| 0 | 26 | | writer.WriteObjectValue(PropagatedRouteTables); |
| | 27 | | } |
| 0 | 28 | | if (VnetRoutes != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("vnetRoutes"); |
| 0 | 31 | | writer.WriteObjectValue(VnetRoutes); |
| | 32 | | } |
| 0 | 33 | | writer.WriteEndObject(); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | internal static RoutingConfiguration DeserializeRoutingConfiguration(JsonElement element) |
| | 37 | | { |
| 0 | 38 | | SubResource associatedRouteTable = default; |
| 0 | 39 | | PropagatedRouteTable propagatedRouteTables = default; |
| 0 | 40 | | VnetRoute vnetRoutes = default; |
| 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 0 | 43 | | if (property.NameEquals("associatedRouteTable")) |
| | 44 | | { |
| 0 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | associatedRouteTable = SubResource.DeserializeSubResource(property.Value); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("propagatedRouteTables")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | propagatedRouteTables = PropagatedRouteTable.DeserializePropagatedRouteTable(property.Value); |
| 0 | 59 | | continue; |
| | 60 | | } |
| 0 | 61 | | if (property.NameEquals("vnetRoutes")) |
| | 62 | | { |
| 0 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | vnetRoutes = VnetRoute.DeserializeVnetRoute(property.Value); |
| | 68 | | continue; |
| | 69 | | } |
| | 70 | | } |
| 0 | 71 | | return new RoutingConfiguration(associatedRouteTable, propagatedRouteTables, vnetRoutes); |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |