internal ExpressRouteCircuitPeeringData(string id, string name, string etag, string type, ExpressRoutePeeringType?peeringType, ExpressRoutePeeringState?state, int?azureASN, long?peerASN, string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, string primaryAzurePort, string secondaryAzurePort, string sharedKey, int?vlanId, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, ExpressRouteCircuitStats stats, ProvisioningState?provisioningState, string gatewayManagerEtag, string lastModifiedBy, WritableSubResource routeFilter, IPv6ExpressRouteCircuitPeeringConfig iPv6PeeringConfig, Resources.Models.SubResource expressRouteConnection, IList <ExpressRouteCircuitConnectionData> connections, IReadOnlyList <PeerExpressRouteCircuitConnectionData> peeredConnections) : base(id) { Name = name; Etag = etag; Type = type; PeeringType = peeringType; State = state; AzureASN = azureASN; PeerASN = peerASN; PrimaryPeerAddressPrefix = primaryPeerAddressPrefix; SecondaryPeerAddressPrefix = secondaryPeerAddressPrefix; PrimaryAzurePort = primaryAzurePort; SecondaryAzurePort = secondaryAzurePort; SharedKey = sharedKey; VlanId = vlanId; MicrosoftPeeringConfig = microsoftPeeringConfig; Stats = stats; ProvisioningState = provisioningState; GatewayManagerEtag = gatewayManagerEtag; LastModifiedBy = lastModifiedBy; RouteFilter = routeFilter; IPv6PeeringConfig = iPv6PeeringConfig; ExpressRouteConnection = expressRouteConnection; Connections = connections; PeeredConnections = peeredConnections; }
public async Task <ExpressRouteCircuit> UpdateDefaultExpressRouteCircuitWithIpv6MicrosoftPeering(Resources.ResourceGroup resourceGroup, string circuitName) { var iPv6Peering = new IPv6ExpressRouteCircuitPeeringConfig() { PrimaryPeerAddressPrefix = ExpressRouteTests.MS_PrimaryPrefix_V6, SecondaryPeerAddressPrefix = ExpressRouteTests.MS_SecondaryPrefix_V6, MicrosoftPeeringConfig = new ExpressRouteCircuitPeeringConfig() { AdvertisedPublicPrefixes = { ExpressRouteTests.MS_PublicPrefix_V6 }, LegacyMode = Convert.ToInt32(true) }, }; var peering = new ExpressRouteCircuitPeeringData() { Name = ExpressRoutePeeringType.MicrosoftPeering.ToString(), PeeringType = ExpressRoutePeeringType.MicrosoftPeering, PeerASN = Convert.ToInt32(ExpressRouteTests.MS_PeerASN), VlanId = Convert.ToInt32(ExpressRouteTests.MS_VlanId), IPv6PeeringConfig = iPv6Peering }; var circuitCollection = resourceGroup.GetExpressRouteCircuits(); Operation <ExpressRouteCircuitPeering> peerOperation = await circuitCollection.Get(circuitName).Value.GetExpressRouteCircuitPeerings().CreateOrUpdateAsync(true, ExpressRouteTests.Peering_Microsoft, peering); Response <ExpressRouteCircuitPeering> peerResponse = await peerOperation.WaitForCompletionAsync(); Assert.AreEqual("Succeeded", peerResponse.Value.Data.ProvisioningState.ToString()); Response <ExpressRouteCircuit> getCircuitResponse = await circuitCollection.GetAsync(circuitName); return(getCircuitResponse); }
internal ExpressRouteCrossConnectionPeeringData(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, ExpressRoutePeeringType?peeringType, ExpressRoutePeeringState?state, int?azureASN, long?peerASN, string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, string primaryAzurePort, string secondaryAzurePort, string sharedKey, int?vlanId, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, NetworkProvisioningState?provisioningState, string gatewayManagerEtag, string lastModifiedBy, IPv6ExpressRouteCircuitPeeringConfig iPv6PeeringConfig) : base(id, name, resourceType) { Etag = etag; PeeringType = peeringType; State = state; AzureASN = azureASN; PeerASN = peerASN; PrimaryPeerAddressPrefix = primaryPeerAddressPrefix; SecondaryPeerAddressPrefix = secondaryPeerAddressPrefix; PrimaryAzurePort = primaryAzurePort; SecondaryAzurePort = secondaryAzurePort; SharedKey = sharedKey; VlanId = vlanId; MicrosoftPeeringConfig = microsoftPeeringConfig; ProvisioningState = provisioningState; GatewayManagerEtag = gatewayManagerEtag; LastModifiedBy = lastModifiedBy; IPv6PeeringConfig = iPv6PeeringConfig; }
internal static ExpressRouteCrossConnectionPeeringData DeserializeExpressRouteCrossConnectionPeeringData(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> id = default; Optional <ExpressRoutePeeringType> peeringType = default; Optional <ExpressRoutePeeringState> state = default; Optional <int> azureASN = default; Optional <long> peerASN = default; Optional <string> primaryPeerAddressPrefix = default; Optional <string> secondaryPeerAddressPrefix = default; Optional <string> primaryAzurePort = default; Optional <string> secondaryAzurePort = default; Optional <string> sharedKey = default; Optional <int> vlanId = default; Optional <ExpressRouteCircuitPeeringConfig> microsoftPeeringConfig = default; Optional <ProvisioningState> provisioningState = default; Optional <string> gatewayManagerEtag = default; Optional <string> lastModifiedBy = default; Optional <IPv6ExpressRouteCircuitPeeringConfig> ipv6PeeringConfig = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("peeringType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } peeringType = new ExpressRoutePeeringType(property0.Value.GetString()); continue; } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } state = new ExpressRoutePeeringState(property0.Value.GetString()); continue; } if (property0.NameEquals("azureASN")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } azureASN = property0.Value.GetInt32(); continue; } if (property0.NameEquals("peerASN")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } peerASN = property0.Value.GetInt64(); continue; } if (property0.NameEquals("primaryPeerAddressPrefix")) { primaryPeerAddressPrefix = property0.Value.GetString(); continue; } if (property0.NameEquals("secondaryPeerAddressPrefix")) { secondaryPeerAddressPrefix = property0.Value.GetString(); continue; } if (property0.NameEquals("primaryAzurePort")) { primaryAzurePort = property0.Value.GetString(); continue; } if (property0.NameEquals("secondaryAzurePort")) { secondaryAzurePort = property0.Value.GetString(); continue; } if (property0.NameEquals("sharedKey")) { sharedKey = property0.Value.GetString(); continue; } if (property0.NameEquals("vlanId")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vlanId = property0.Value.GetInt32(); continue; } if (property0.NameEquals("microsoftPeeringConfig")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } microsoftPeeringConfig = ExpressRouteCircuitPeeringConfig.DeserializeExpressRouteCircuitPeeringConfig(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("gatewayManagerEtag")) { gatewayManagerEtag = property0.Value.GetString(); continue; } if (property0.NameEquals("lastModifiedBy")) { lastModifiedBy = property0.Value.GetString(); continue; } if (property0.NameEquals("ipv6PeeringConfig")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } ipv6PeeringConfig = IPv6ExpressRouteCircuitPeeringConfig.DeserializeIPv6ExpressRouteCircuitPeeringConfig(property0.Value); continue; } } continue; } } return(new ExpressRouteCrossConnectionPeeringData(id.Value, name.Value, etag.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, ipv6PeeringConfig.Value)); }
internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPeeringData(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> type = default; Optional <string> id = default; Optional <ExpressRoutePeeringType> peeringType = default; Optional <ExpressRoutePeeringState> state = default; Optional <int> azureASN = default; Optional <long> peerASN = default; Optional <string> primaryPeerAddressPrefix = default; Optional <string> secondaryPeerAddressPrefix = default; Optional <string> primaryAzurePort = default; Optional <string> secondaryAzurePort = default; Optional <string> sharedKey = default; Optional <int> vlanId = default; Optional <ExpressRouteCircuitPeeringConfig> microsoftPeeringConfig = default; Optional <ExpressRouteCircuitStats> stats = default; Optional <ProvisioningState> provisioningState = default; Optional <string> gatewayManagerEtag = default; Optional <string> lastModifiedBy = default; Optional <WritableSubResource> routeFilter = default; Optional <IPv6ExpressRouteCircuitPeeringConfig> ipv6PeeringConfig = default; Optional <Resources.Models.SubResource> expressRouteConnection = default; Optional <IList <ExpressRouteCircuitConnectionData> > connections = default; Optional <IReadOnlyList <PeerExpressRouteCircuitConnectionData> > peeredConnections = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("peeringType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } peeringType = new ExpressRoutePeeringType(property0.Value.GetString()); continue; } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } state = new ExpressRoutePeeringState(property0.Value.GetString()); continue; } if (property0.NameEquals("azureASN")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } azureASN = property0.Value.GetInt32(); continue; } if (property0.NameEquals("peerASN")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } peerASN = property0.Value.GetInt64(); continue; } if (property0.NameEquals("primaryPeerAddressPrefix")) { primaryPeerAddressPrefix = property0.Value.GetString(); continue; } if (property0.NameEquals("secondaryPeerAddressPrefix")) { secondaryPeerAddressPrefix = property0.Value.GetString(); continue; } if (property0.NameEquals("primaryAzurePort")) { primaryAzurePort = property0.Value.GetString(); continue; } if (property0.NameEquals("secondaryAzurePort")) { secondaryAzurePort = property0.Value.GetString(); continue; } if (property0.NameEquals("sharedKey")) { sharedKey = property0.Value.GetString(); continue; } if (property0.NameEquals("vlanId")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vlanId = property0.Value.GetInt32(); continue; } if (property0.NameEquals("microsoftPeeringConfig")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } microsoftPeeringConfig = ExpressRouteCircuitPeeringConfig.DeserializeExpressRouteCircuitPeeringConfig(property0.Value); continue; } if (property0.NameEquals("stats")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } stats = ExpressRouteCircuitStats.DeserializeExpressRouteCircuitStats(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("gatewayManagerEtag")) { gatewayManagerEtag = property0.Value.GetString(); continue; } if (property0.NameEquals("lastModifiedBy")) { lastModifiedBy = property0.Value.GetString(); continue; } if (property0.NameEquals("routeFilter")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } routeFilter = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("ipv6PeeringConfig")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } ipv6PeeringConfig = IPv6ExpressRouteCircuitPeeringConfig.DeserializeIPv6ExpressRouteCircuitPeeringConfig(property0.Value); continue; } if (property0.NameEquals("expressRouteConnection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } expressRouteConnection = JsonSerializer.Deserialize <Resources.Models.SubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("connections")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteCircuitConnectionData> array = new List <ExpressRouteCircuitConnectionData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteCircuitConnectionData.DeserializeExpressRouteCircuitConnectionData(item)); } connections = array; continue; } if (property0.NameEquals("peeredConnections")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <PeerExpressRouteCircuitConnectionData> array = new List <PeerExpressRouteCircuitConnectionData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(PeerExpressRouteCircuitConnectionData.DeserializePeerExpressRouteCircuitConnectionData(item)); } peeredConnections = array; continue; } } continue; } } return(new ExpressRouteCircuitPeeringData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, stats.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, routeFilter, ipv6PeeringConfig.Value, expressRouteConnection, Optional.ToList(connections), Optional.ToList(peeredConnections))); }