| | 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 HubRouteTable : 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 (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (Routes != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("routes"); |
| 0 | 44 | | writer.WriteStartArray(); |
| 0 | 45 | | foreach (var item in Routes) |
| | 46 | | { |
| 0 | 47 | | writer.WriteObjectValue(item); |
| | 48 | | } |
| 0 | 49 | | writer.WriteEndArray(); |
| | 50 | | } |
| 0 | 51 | | if (Labels != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("labels"); |
| 0 | 54 | | writer.WriteStartArray(); |
| 0 | 55 | | foreach (var item in Labels) |
| | 56 | | { |
| 0 | 57 | | writer.WriteStringValue(item); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 0 | 61 | | if (AssociatedConnections != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("associatedConnections"); |
| 0 | 64 | | writer.WriteStartArray(); |
| 0 | 65 | | foreach (var item in AssociatedConnections) |
| | 66 | | { |
| 0 | 67 | | writer.WriteObjectValue(item); |
| | 68 | | } |
| 0 | 69 | | writer.WriteEndArray(); |
| | 70 | | } |
| 0 | 71 | | if (PropagatingConnections != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("propagatingConnections"); |
| 0 | 74 | | writer.WriteStartArray(); |
| 0 | 75 | | foreach (var item in PropagatingConnections) |
| | 76 | | { |
| 0 | 77 | | writer.WriteObjectValue(item); |
| | 78 | | } |
| 0 | 79 | | writer.WriteEndArray(); |
| | 80 | | } |
| 0 | 81 | | if (ProvisioningState != null) |
| | 82 | | { |
| 0 | 83 | | writer.WritePropertyName("provisioningState"); |
| 0 | 84 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 85 | | } |
| 0 | 86 | | writer.WriteEndObject(); |
| 0 | 87 | | writer.WriteEndObject(); |
| 0 | 88 | | } |
| | 89 | |
|
| | 90 | | internal static HubRouteTable DeserializeHubRouteTable(JsonElement element) |
| | 91 | | { |
| 0 | 92 | | string name = default; |
| 0 | 93 | | string etag = default; |
| 0 | 94 | | string type = default; |
| 0 | 95 | | string id = default; |
| 0 | 96 | | IList<HubRoute> routes = default; |
| 0 | 97 | | IList<string> labels = default; |
| 0 | 98 | | IList<SubResource> associatedConnections = default; |
| 0 | 99 | | IList<SubResource> propagatingConnections = default; |
| 0 | 100 | | ProvisioningState? provisioningState = default; |
| 0 | 101 | | foreach (var property in element.EnumerateObject()) |
| | 102 | | { |
| 0 | 103 | | if (property.NameEquals("name")) |
| | 104 | | { |
| 0 | 105 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | name = property.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("etag")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | etag = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | if (property.NameEquals("type")) |
| | 122 | | { |
| 0 | 123 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 124 | | { |
| | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | type = property.Value.GetString(); |
| 0 | 128 | | continue; |
| | 129 | | } |
| 0 | 130 | | if (property.NameEquals("id")) |
| | 131 | | { |
| 0 | 132 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 133 | | { |
| | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | id = property.Value.GetString(); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("properties")) |
| | 140 | | { |
| 0 | 141 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 142 | | { |
| 0 | 143 | | if (property0.NameEquals("routes")) |
| | 144 | | { |
| 0 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | List<HubRoute> array = new List<HubRoute>(); |
| 0 | 150 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 151 | | { |
| 0 | 152 | | if (item.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| 0 | 154 | | array.Add(null); |
| | 155 | | } |
| | 156 | | else |
| | 157 | | { |
| 0 | 158 | | array.Add(HubRoute.DeserializeHubRoute(item)); |
| | 159 | | } |
| | 160 | | } |
| 0 | 161 | | routes = array; |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property0.NameEquals("labels")) |
| | 165 | | { |
| 0 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | List<string> array = new List<string>(); |
| 0 | 171 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 172 | | { |
| 0 | 173 | | if (item.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | array.Add(null); |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 0 | 179 | | array.Add(item.GetString()); |
| | 180 | | } |
| | 181 | | } |
| 0 | 182 | | labels = array; |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property0.NameEquals("associatedConnections")) |
| | 186 | | { |
| 0 | 187 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 192 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 193 | | { |
| 0 | 194 | | if (item.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| 0 | 196 | | array.Add(null); |
| | 197 | | } |
| | 198 | | else |
| | 199 | | { |
| 0 | 200 | | array.Add(DeserializeSubResource(item)); |
| | 201 | | } |
| | 202 | | } |
| 0 | 203 | | associatedConnections = array; |
| 0 | 204 | | continue; |
| | 205 | | } |
| 0 | 206 | | if (property0.NameEquals("propagatingConnections")) |
| | 207 | | { |
| 0 | 208 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 209 | | { |
| | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 213 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 214 | | { |
| 0 | 215 | | if (item.ValueKind == JsonValueKind.Null) |
| | 216 | | { |
| 0 | 217 | | array.Add(null); |
| | 218 | | } |
| | 219 | | else |
| | 220 | | { |
| 0 | 221 | | array.Add(DeserializeSubResource(item)); |
| | 222 | | } |
| | 223 | | } |
| 0 | 224 | | propagatingConnections = array; |
| 0 | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | if (property0.NameEquals("provisioningState")) |
| | 228 | | { |
| 0 | 229 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 230 | | { |
| | 231 | | continue; |
| | 232 | | } |
| 0 | 233 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 234 | | continue; |
| | 235 | | } |
| | 236 | | } |
| | 237 | | continue; |
| | 238 | | } |
| | 239 | | } |
| 0 | 240 | | return new HubRouteTable(id, name, etag, type, routes, labels, associatedConnections, propagatingConnections |
| | 241 | | } |
| | 242 | | } |
| | 243 | | } |