internal VirtualHubData(string id, string name, string resourceType, string location, IDictionary <string, string> tags, string etag, WritableSubResource virtualWan, WritableSubResource vpnGateway, WritableSubResource p2SVpnGateway, WritableSubResource expressRouteGateway, WritableSubResource azureFirewall, WritableSubResource securityPartnerProvider, string addressPrefix, VirtualHubRouteTable routeTable, ProvisioningState?provisioningState, string securityProviderName, IList <VirtualHubRouteTableV2Data> virtualHubRouteTableV2S, string sku, RoutingState?routingState, IReadOnlyList <WritableSubResource> bgpConnections, IReadOnlyList <WritableSubResource> ipConfigurations, long?virtualRouterAsn, IList <string> virtualRouterIPs, bool?allowBranchToBranchTraffic, PreferredRoutingGateway?preferredRoutingGateway) : base(id, name, resourceType, location, tags) { Etag = etag; VirtualWan = virtualWan; VpnGateway = vpnGateway; P2SVpnGateway = p2SVpnGateway; ExpressRouteGateway = expressRouteGateway; AzureFirewall = azureFirewall; SecurityPartnerProvider = securityPartnerProvider; AddressPrefix = addressPrefix; RouteTable = routeTable; ProvisioningState = provisioningState; SecurityProviderName = securityProviderName; VirtualHubRouteTableV2S = virtualHubRouteTableV2S; Sku = sku; RoutingState = routingState; BgpConnections = bgpConnections; IPConfigurations = ipConfigurations; VirtualRouterAsn = virtualRouterAsn; VirtualRouterIPs = virtualRouterIPs; AllowBranchToBranchTraffic = allowBranchToBranchTraffic; PreferredRoutingGateway = preferredRoutingGateway; }
internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) { Optional <string> etag = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; Optional <WritableSubResource> virtualWan = default; Optional <WritableSubResource> vpnGateway = default; Optional <WritableSubResource> p2SVpnGateway = default; Optional <WritableSubResource> expressRouteGateway = default; Optional <WritableSubResource> azureFirewall = default; Optional <WritableSubResource> securityPartnerProvider = default; Optional <string> addressPrefix = default; Optional <VirtualHubRouteTable> routeTable = default; Optional <ProvisioningState> provisioningState = default; Optional <string> securityProviderName = default; Optional <IList <VirtualHubRouteTableV2Data> > virtualHubRouteTableV2s = default; Optional <string> sku = default; Optional <RoutingState> routingState = default; Optional <IReadOnlyList <WritableSubResource> > bgpConnections = default; Optional <IReadOnlyList <WritableSubResource> > ipConfigurations = default; Optional <long> virtualRouterAsn = default; Optional <IList <string> > virtualRouterIps = default; Optional <bool> allowBranchToBranchTraffic = default; Optional <PreferredRoutingGateway> preferredRoutingGateway = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("virtualWan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } virtualWan = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("vpnGateway")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vpnGateway = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("p2SVpnGateway")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } p2SVpnGateway = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("expressRouteGateway")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } expressRouteGateway = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("azureFirewall")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } azureFirewall = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("securityPartnerProvider")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } securityPartnerProvider = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("addressPrefix")) { addressPrefix = property0.Value.GetString(); continue; } if (property0.NameEquals("routeTable")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } routeTable = VirtualHubRouteTable.DeserializeVirtualHubRouteTable(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("securityProviderName")) { securityProviderName = property0.Value.GetString(); continue; } if (property0.NameEquals("virtualHubRouteTableV2s")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualHubRouteTableV2Data> array = new List <VirtualHubRouteTableV2Data>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualHubRouteTableV2Data.DeserializeVirtualHubRouteTableV2Data(item)); } virtualHubRouteTableV2s = array; continue; } if (property0.NameEquals("sku")) { sku = property0.Value.GetString(); continue; } if (property0.NameEquals("routingState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } routingState = new RoutingState(property0.Value.GetString()); continue; } if (property0.NameEquals("bgpConnections")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } bgpConnections = array; continue; } if (property0.NameEquals("ipConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } ipConfigurations = array; continue; } if (property0.NameEquals("virtualRouterAsn")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } virtualRouterAsn = property0.Value.GetInt64(); continue; } if (property0.NameEquals("virtualRouterIps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } virtualRouterIps = array; continue; } if (property0.NameEquals("allowBranchToBranchTraffic")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } allowBranchToBranchTraffic = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("preferredRoutingGateway")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } preferredRoutingGateway = new PreferredRoutingGateway(property0.Value.GetString()); continue; } } continue; } } return(new VirtualHubData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan, vpnGateway, p2SVpnGateway, expressRouteGateway, azureFirewall, securityPartnerProvider, addressPrefix.Value, routeTable.Value, Optional.ToNullable(provisioningState), securityProviderName.Value, Optional.ToList(virtualHubRouteTableV2s), sku.Value, Optional.ToNullable(routingState), Optional.ToList(bgpConnections), Optional.ToList(ipConfigurations), Optional.ToNullable(virtualRouterAsn), Optional.ToList(virtualRouterIps), Optional.ToNullable(allowBranchToBranchTraffic), Optional.ToNullable(preferredRoutingGateway))); }