| | 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 VirtualHubRouteTableV2 : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 0 | 29 | | if (Id != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("id"); |
| 0 | 32 | | writer.WriteStringValue(Id); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("properties"); |
| 0 | 35 | | writer.WriteStartObject(); |
| 0 | 36 | | if (Routes != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("routes"); |
| 0 | 39 | | writer.WriteStartArray(); |
| 0 | 40 | | foreach (var item in Routes) |
| | 41 | | { |
| 0 | 42 | | writer.WriteObjectValue(item); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndArray(); |
| | 45 | | } |
| 0 | 46 | | if (AttachedConnections != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("attachedConnections"); |
| 0 | 49 | | writer.WriteStartArray(); |
| 0 | 50 | | foreach (var item in AttachedConnections) |
| | 51 | | { |
| 0 | 52 | | writer.WriteStringValue(item); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndArray(); |
| | 55 | | } |
| 0 | 56 | | if (ProvisioningState != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("provisioningState"); |
| 0 | 59 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 60 | | } |
| 0 | 61 | | writer.WriteEndObject(); |
| 0 | 62 | | writer.WriteEndObject(); |
| 0 | 63 | | } |
| | 64 | |
|
| | 65 | | internal static VirtualHubRouteTableV2 DeserializeVirtualHubRouteTableV2(JsonElement element) |
| | 66 | | { |
| 0 | 67 | | string name = default; |
| 0 | 68 | | string etag = default; |
| 0 | 69 | | string id = default; |
| 0 | 70 | | IList<VirtualHubRouteV2> routes = default; |
| 0 | 71 | | IList<string> attachedConnections = default; |
| 0 | 72 | | ProvisioningState? provisioningState = default; |
| 0 | 73 | | foreach (var property in element.EnumerateObject()) |
| | 74 | | { |
| 0 | 75 | | if (property.NameEquals("name")) |
| | 76 | | { |
| 0 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | name = property.Value.GetString(); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("etag")) |
| | 85 | | { |
| 0 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | etag = property.Value.GetString(); |
| 0 | 91 | | continue; |
| | 92 | | } |
| 0 | 93 | | if (property.NameEquals("id")) |
| | 94 | | { |
| 0 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | id = property.Value.GetString(); |
| 0 | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | if (property.NameEquals("properties")) |
| | 103 | | { |
| 0 | 104 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 105 | | { |
| 0 | 106 | | if (property0.NameEquals("routes")) |
| | 107 | | { |
| 0 | 108 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | List<VirtualHubRouteV2> array = new List<VirtualHubRouteV2>(); |
| 0 | 113 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 114 | | { |
| 0 | 115 | | if (item.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| 0 | 117 | | array.Add(null); |
| | 118 | | } |
| | 119 | | else |
| | 120 | | { |
| 0 | 121 | | array.Add(VirtualHubRouteV2.DeserializeVirtualHubRouteV2(item)); |
| | 122 | | } |
| | 123 | | } |
| 0 | 124 | | routes = array; |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property0.NameEquals("attachedConnections")) |
| | 128 | | { |
| 0 | 129 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | List<string> array = new List<string>(); |
| 0 | 134 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 135 | | { |
| 0 | 136 | | if (item.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| 0 | 138 | | array.Add(null); |
| | 139 | | } |
| | 140 | | else |
| | 141 | | { |
| 0 | 142 | | array.Add(item.GetString()); |
| | 143 | | } |
| | 144 | | } |
| 0 | 145 | | attachedConnections = array; |
| 0 | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | if (property0.NameEquals("provisioningState")) |
| | 149 | | { |
| 0 | 150 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 151 | | { |
| | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 155 | | continue; |
| | 156 | | } |
| | 157 | | } |
| | 158 | | continue; |
| | 159 | | } |
| | 160 | | } |
| 0 | 161 | | return new VirtualHubRouteTableV2(id, name, etag, routes, attachedConnections, provisioningState); |
| | 162 | | } |
| | 163 | | } |
| | 164 | | } |