| | 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 VirtualHub : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Etag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("etag"); |
| 0 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 0 | 24 | | if (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 0 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 0 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 0 | 39 | | if (Location != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("location"); |
| 0 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 0 | 44 | | if (Tags != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("tags"); |
| 0 | 47 | | writer.WriteStartObject(); |
| 0 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName(item.Key); |
| 0 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 0 | 55 | | writer.WritePropertyName("properties"); |
| 0 | 56 | | writer.WriteStartObject(); |
| 0 | 57 | | if (VirtualWan != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("virtualWan"); |
| 0 | 60 | | writer.WriteObjectValue(VirtualWan); |
| | 61 | | } |
| 0 | 62 | | if (VpnGateway != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("vpnGateway"); |
| 0 | 65 | | writer.WriteObjectValue(VpnGateway); |
| | 66 | | } |
| 0 | 67 | | if (P2SVpnGateway != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("p2SVpnGateway"); |
| 0 | 70 | | writer.WriteObjectValue(P2SVpnGateway); |
| | 71 | | } |
| 0 | 72 | | if (ExpressRouteGateway != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("expressRouteGateway"); |
| 0 | 75 | | writer.WriteObjectValue(ExpressRouteGateway); |
| | 76 | | } |
| 0 | 77 | | if (AzureFirewall != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("azureFirewall"); |
| 0 | 80 | | writer.WriteObjectValue(AzureFirewall); |
| | 81 | | } |
| 0 | 82 | | if (SecurityPartnerProvider != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("securityPartnerProvider"); |
| 0 | 85 | | writer.WriteObjectValue(SecurityPartnerProvider); |
| | 86 | | } |
| 0 | 87 | | if (VirtualNetworkConnections != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("virtualNetworkConnections"); |
| 0 | 90 | | writer.WriteStartArray(); |
| 0 | 91 | | foreach (var item in VirtualNetworkConnections) |
| | 92 | | { |
| 0 | 93 | | writer.WriteObjectValue(item); |
| | 94 | | } |
| 0 | 95 | | writer.WriteEndArray(); |
| | 96 | | } |
| 0 | 97 | | if (AddressPrefix != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("addressPrefix"); |
| 0 | 100 | | writer.WriteStringValue(AddressPrefix); |
| | 101 | | } |
| 0 | 102 | | if (RouteTable != null) |
| | 103 | | { |
| 0 | 104 | | writer.WritePropertyName("routeTable"); |
| 0 | 105 | | writer.WriteObjectValue(RouteTable); |
| | 106 | | } |
| 0 | 107 | | if (ProvisioningState != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("provisioningState"); |
| 0 | 110 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 111 | | } |
| 0 | 112 | | if (SecurityProviderName != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("securityProviderName"); |
| 0 | 115 | | writer.WriteStringValue(SecurityProviderName); |
| | 116 | | } |
| 0 | 117 | | if (VirtualHubRouteTableV2S != null) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName("virtualHubRouteTableV2s"); |
| 0 | 120 | | writer.WriteStartArray(); |
| 0 | 121 | | foreach (var item in VirtualHubRouteTableV2S) |
| | 122 | | { |
| 0 | 123 | | writer.WriteObjectValue(item); |
| | 124 | | } |
| 0 | 125 | | writer.WriteEndArray(); |
| | 126 | | } |
| 0 | 127 | | if (Sku != null) |
| | 128 | | { |
| 0 | 129 | | writer.WritePropertyName("sku"); |
| 0 | 130 | | writer.WriteStringValue(Sku); |
| | 131 | | } |
| 0 | 132 | | writer.WriteEndObject(); |
| 0 | 133 | | writer.WriteEndObject(); |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | internal static VirtualHub DeserializeVirtualHub(JsonElement element) |
| | 137 | | { |
| 0 | 138 | | string etag = default; |
| 0 | 139 | | string id = default; |
| 0 | 140 | | string name = default; |
| 0 | 141 | | string type = default; |
| 0 | 142 | | string location = default; |
| 0 | 143 | | IDictionary<string, string> tags = default; |
| 0 | 144 | | SubResource virtualWan = default; |
| 0 | 145 | | SubResource vpnGateway = default; |
| 0 | 146 | | SubResource p2SVpnGateway = default; |
| 0 | 147 | | SubResource expressRouteGateway = default; |
| 0 | 148 | | SubResource azureFirewall = default; |
| 0 | 149 | | SubResource securityPartnerProvider = default; |
| 0 | 150 | | IList<HubVirtualNetworkConnection> virtualNetworkConnections = default; |
| 0 | 151 | | string addressPrefix = default; |
| 0 | 152 | | VirtualHubRouteTable routeTable = default; |
| 0 | 153 | | ProvisioningState? provisioningState = default; |
| 0 | 154 | | string securityProviderName = default; |
| 0 | 155 | | IList<VirtualHubRouteTableV2> virtualHubRouteTableV2s = default; |
| 0 | 156 | | string sku = default; |
| 0 | 157 | | foreach (var property in element.EnumerateObject()) |
| | 158 | | { |
| 0 | 159 | | if (property.NameEquals("etag")) |
| | 160 | | { |
| 0 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | etag = property.Value.GetString(); |
| 0 | 166 | | continue; |
| | 167 | | } |
| 0 | 168 | | if (property.NameEquals("id")) |
| | 169 | | { |
| 0 | 170 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 171 | | { |
| | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | id = property.Value.GetString(); |
| 0 | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | if (property.NameEquals("name")) |
| | 178 | | { |
| 0 | 179 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | name = property.Value.GetString(); |
| 0 | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | if (property.NameEquals("type")) |
| | 187 | | { |
| 0 | 188 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 189 | | { |
| | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | type = property.Value.GetString(); |
| 0 | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | if (property.NameEquals("location")) |
| | 196 | | { |
| 0 | 197 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 198 | | { |
| | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | location = property.Value.GetString(); |
| 0 | 202 | | continue; |
| | 203 | | } |
| 0 | 204 | | if (property.NameEquals("tags")) |
| | 205 | | { |
| 0 | 206 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 207 | | { |
| | 208 | | continue; |
| | 209 | | } |
| 0 | 210 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 211 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 212 | | { |
| 0 | 213 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| 0 | 215 | | dictionary.Add(property0.Name, null); |
| | 216 | | } |
| | 217 | | else |
| | 218 | | { |
| 0 | 219 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 220 | | } |
| | 221 | | } |
| 0 | 222 | | tags = dictionary; |
| 0 | 223 | | continue; |
| | 224 | | } |
| 0 | 225 | | if (property.NameEquals("properties")) |
| | 226 | | { |
| 0 | 227 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 228 | | { |
| 0 | 229 | | if (property0.NameEquals("virtualWan")) |
| | 230 | | { |
| 0 | 231 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 232 | | { |
| | 233 | | continue; |
| | 234 | | } |
| 0 | 235 | | virtualWan = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 236 | | continue; |
| | 237 | | } |
| 0 | 238 | | if (property0.NameEquals("vpnGateway")) |
| | 239 | | { |
| 0 | 240 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 241 | | { |
| | 242 | | continue; |
| | 243 | | } |
| 0 | 244 | | vpnGateway = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 245 | | continue; |
| | 246 | | } |
| 0 | 247 | | if (property0.NameEquals("p2SVpnGateway")) |
| | 248 | | { |
| 0 | 249 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 250 | | { |
| | 251 | | continue; |
| | 252 | | } |
| 0 | 253 | | p2SVpnGateway = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 254 | | continue; |
| | 255 | | } |
| 0 | 256 | | if (property0.NameEquals("expressRouteGateway")) |
| | 257 | | { |
| 0 | 258 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 259 | | { |
| | 260 | | continue; |
| | 261 | | } |
| 0 | 262 | | expressRouteGateway = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 263 | | continue; |
| | 264 | | } |
| 0 | 265 | | if (property0.NameEquals("azureFirewall")) |
| | 266 | | { |
| 0 | 267 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 268 | | { |
| | 269 | | continue; |
| | 270 | | } |
| 0 | 271 | | azureFirewall = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | if (property0.NameEquals("securityPartnerProvider")) |
| | 275 | | { |
| 0 | 276 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| | 278 | | continue; |
| | 279 | | } |
| 0 | 280 | | securityPartnerProvider = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 281 | | continue; |
| | 282 | | } |
| 0 | 283 | | if (property0.NameEquals("virtualNetworkConnections")) |
| | 284 | | { |
| 0 | 285 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 286 | | { |
| | 287 | | continue; |
| | 288 | | } |
| 0 | 289 | | List<HubVirtualNetworkConnection> array = new List<HubVirtualNetworkConnection>(); |
| 0 | 290 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 291 | | { |
| 0 | 292 | | if (item.ValueKind == JsonValueKind.Null) |
| | 293 | | { |
| 0 | 294 | | array.Add(null); |
| | 295 | | } |
| | 296 | | else |
| | 297 | | { |
| 0 | 298 | | array.Add(HubVirtualNetworkConnection.DeserializeHubVirtualNetworkConnection(item)); |
| | 299 | | } |
| | 300 | | } |
| 0 | 301 | | virtualNetworkConnections = array; |
| 0 | 302 | | continue; |
| | 303 | | } |
| 0 | 304 | | if (property0.NameEquals("addressPrefix")) |
| | 305 | | { |
| 0 | 306 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 307 | | { |
| | 308 | | continue; |
| | 309 | | } |
| 0 | 310 | | addressPrefix = property0.Value.GetString(); |
| 0 | 311 | | continue; |
| | 312 | | } |
| 0 | 313 | | if (property0.NameEquals("routeTable")) |
| | 314 | | { |
| 0 | 315 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 316 | | { |
| | 317 | | continue; |
| | 318 | | } |
| 0 | 319 | | routeTable = VirtualHubRouteTable.DeserializeVirtualHubRouteTable(property0.Value); |
| 0 | 320 | | continue; |
| | 321 | | } |
| 0 | 322 | | if (property0.NameEquals("provisioningState")) |
| | 323 | | { |
| 0 | 324 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 325 | | { |
| | 326 | | continue; |
| | 327 | | } |
| 0 | 328 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 329 | | continue; |
| | 330 | | } |
| 0 | 331 | | if (property0.NameEquals("securityProviderName")) |
| | 332 | | { |
| 0 | 333 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 334 | | { |
| | 335 | | continue; |
| | 336 | | } |
| 0 | 337 | | securityProviderName = property0.Value.GetString(); |
| 0 | 338 | | continue; |
| | 339 | | } |
| 0 | 340 | | if (property0.NameEquals("virtualHubRouteTableV2s")) |
| | 341 | | { |
| 0 | 342 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 343 | | { |
| | 344 | | continue; |
| | 345 | | } |
| 0 | 346 | | List<VirtualHubRouteTableV2> array = new List<VirtualHubRouteTableV2>(); |
| 0 | 347 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 348 | | { |
| 0 | 349 | | if (item.ValueKind == JsonValueKind.Null) |
| | 350 | | { |
| 0 | 351 | | array.Add(null); |
| | 352 | | } |
| | 353 | | else |
| | 354 | | { |
| 0 | 355 | | array.Add(VirtualHubRouteTableV2.DeserializeVirtualHubRouteTableV2(item)); |
| | 356 | | } |
| | 357 | | } |
| 0 | 358 | | virtualHubRouteTableV2s = array; |
| 0 | 359 | | continue; |
| | 360 | | } |
| 0 | 361 | | if (property0.NameEquals("sku")) |
| | 362 | | { |
| 0 | 363 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 364 | | { |
| | 365 | | continue; |
| | 366 | | } |
| 0 | 367 | | sku = property0.Value.GetString(); |
| | 368 | | continue; |
| | 369 | | } |
| | 370 | | } |
| | 371 | | continue; |
| | 372 | | } |
| | 373 | | } |
| 0 | 374 | | return new VirtualHub(id, name, type, location, tags, etag, virtualWan, vpnGateway, p2SVpnGateway, expressRo |
| | 375 | | } |
| | 376 | | } |
| | 377 | | } |