ExpressRouteCircuitPeeringResource IOperationSource <ExpressRouteCircuitPeeringResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ExpressRouteCircuitPeeringData.DeserializeExpressRouteCircuitPeeringData(document.RootElement); return(new ExpressRouteCircuitPeeringResource(_client, data)); }
public async Task <Response <ExpressRouteCircuitPeeringData> > GetAsync(string resourceGroupName, string circuitName, string peeringName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (circuitName == null) { throw new ArgumentNullException(nameof(circuitName)); } if (peeringName == null) { throw new ArgumentNullException(nameof(peeringName)); } using var message = CreateGetRequest(resourceGroupName, circuitName, peeringName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ExpressRouteCircuitPeeringData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ExpressRouteCircuitPeeringData.DeserializeExpressRouteCircuitPeeringData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal ExpressRouteCircuitPeering(ArmResource options, ExpressRouteCircuitPeeringData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new ExpressRouteCircuitPeeringsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); _peerExpressRouteCircuitConnectionsRestClient = new PeerExpressRouteCircuitConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); }
internal ExpressRouteCircuitPeering(ArmResource options, ExpressRouteCircuitPeeringData resource) : base(options, new ResourceIdentifier(resource.Id)) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _expressRouteCircuitPeeringsRestClient = new ExpressRouteCircuitPeeringsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); _expressRouteCircuitsRestClient = new ExpressRouteCircuitsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
public async virtual Task <ExpressRouteCircuitPeeringCreateOrUpdateOperation> CreateOrUpdateAsync(string peeringName, ExpressRouteCircuitPeeringData peeringParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (peeringName == null) { throw new ArgumentNullException(nameof(peeringName)); } if (peeringParameters == null) { throw new ArgumentNullException(nameof(peeringParameters)); } using var scope = _clientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.CreateOrUpdate"); scope.Start(); try { var response = await _expressRouteCircuitPeeringsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, peeringParameters, cancellationToken).ConfigureAwait(false); var operation = new ExpressRouteCircuitPeeringCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _expressRouteCircuitPeeringsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, peeringParameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <ExpressRouteCircuitPeeringResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string peeringName, ExpressRouteCircuitPeeringData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _expressRouteCircuitPeeringClientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.CreateOrUpdate"); scope.Start(); try { var response = await _expressRouteCircuitPeeringRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, data, cancellationToken).ConfigureAwait(false); var operation = new NetworkArmOperation <ExpressRouteCircuitPeeringResource>(new ExpressRouteCircuitPeeringOperationSource(Client), _expressRouteCircuitPeeringClientDiagnostics, Pipeline, _expressRouteCircuitPeeringRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ExpressRouteCircuitPeering(ArmClient client, ExpressRouteCircuitPeeringData data) : this(client, new ResourceIdentifier(data.Id)) { HasData = true; _data = data; }
internal static RouteFilterData DeserializeRouteFilterData(JsonElement element) { Optional <ETag> etag = default; Optional <ResourceIdentifier> id = default; Optional <string> name = default; Optional <ResourceType> type = default; Optional <AzureLocation> location = default; Optional <IDictionary <string, string> > tags = default; Optional <IList <RouteFilterRuleData> > rules = default; Optional <IReadOnlyList <ExpressRouteCircuitPeeringData> > peerings = default; Optional <IReadOnlyList <ExpressRouteCircuitPeeringData> > ipv6Peerings = default; Optional <NetworkProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } etag = new ETag(property.Value.GetString()); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new ResourceType(property.Value.GetString()); continue; } if (property.NameEquals("location")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } location = new AzureLocation(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("rules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <RouteFilterRuleData> array = new List <RouteFilterRuleData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(RouteFilterRuleData.DeserializeRouteFilterRuleData(item)); } rules = array; continue; } if (property0.NameEquals("peerings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteCircuitPeeringData> array = new List <ExpressRouteCircuitPeeringData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteCircuitPeeringData.DeserializeExpressRouteCircuitPeeringData(item)); } peerings = array; continue; } if (property0.NameEquals("ipv6Peerings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteCircuitPeeringData> array = new List <ExpressRouteCircuitPeeringData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteCircuitPeeringData.DeserializeExpressRouteCircuitPeeringData(item)); } ipv6Peerings = array; continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new NetworkProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new RouteFilterData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToNullable(etag), Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState))); }
public virtual ExpressRouteCircuitPeeringCreateOrUpdateOperation CreateOrUpdate(string peeringName, ExpressRouteCircuitPeeringData peeringParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (peeringName == null) { throw new ArgumentNullException(nameof(peeringName)); } if (peeringParameters == null) { throw new ArgumentNullException(nameof(peeringParameters)); } using var scope = _clientDiagnostics.CreateScope("ExpressRouteCircuitPeeringContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, peeringName, peeringParameters, cancellationToken); var operation = new ExpressRouteCircuitPeeringCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, peeringName, peeringParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonElement element) { Optional <ExpressRouteCircuitSku> sku = default; Optional <string> etag = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; ResourceIdentifier id = default; Optional <bool> allowClassicOperations = default; Optional <string> circuitProvisioningState = default; Optional <ServiceProviderProvisioningState> serviceProviderProvisioningState = default; Optional <IList <ExpressRouteCircuitAuthorizationData> > authorizations = default; Optional <IList <ExpressRouteCircuitPeeringData> > peerings = default; Optional <string> serviceKey = default; Optional <string> serviceProviderNotes = default; Optional <ExpressRouteCircuitServiceProviderProperties> serviceProviderProperties = default; Optional <SubResource> expressRoutePort = default; Optional <float> bandwidthInGbps = default; Optional <int> stag = default; Optional <ProvisioningState> provisioningState = default; Optional <string> gatewayManagerEtag = default; Optional <bool> globalReachEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = ExpressRouteCircuitSku.DeserializeExpressRouteCircuitSku(property.Value); continue; } if (property.NameEquals("etag")) { etag = 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("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("allowClassicOperations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } allowClassicOperations = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("circuitProvisioningState")) { circuitProvisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("serviceProviderProvisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } serviceProviderProvisioningState = new ServiceProviderProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("authorizations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteCircuitAuthorizationData> array = new List <ExpressRouteCircuitAuthorizationData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteCircuitAuthorizationData.DeserializeExpressRouteCircuitAuthorizationData(item)); } authorizations = array; continue; } if (property0.NameEquals("peerings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteCircuitPeeringData> array = new List <ExpressRouteCircuitPeeringData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteCircuitPeeringData.DeserializeExpressRouteCircuitPeeringData(item)); } peerings = array; continue; } if (property0.NameEquals("serviceKey")) { serviceKey = property0.Value.GetString(); continue; } if (property0.NameEquals("serviceProviderNotes")) { serviceProviderNotes = property0.Value.GetString(); continue; } if (property0.NameEquals("serviceProviderProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } serviceProviderProperties = ExpressRouteCircuitServiceProviderProperties.DeserializeExpressRouteCircuitServiceProviderProperties(property0.Value); continue; } if (property0.NameEquals("expressRoutePort")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } expressRoutePort = SubResource.DeserializeSubResource(property0.Value); continue; } if (property0.NameEquals("bandwidthInGbps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } bandwidthInGbps = property0.Value.GetSingle(); continue; } if (property0.NameEquals("stag")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } stag = property0.Value.GetInt32(); 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("globalReachEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } globalReachEnabled = property0.Value.GetBoolean(); continue; } } continue; } } return(new ExpressRouteCircuitData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), sku.Value, etag.Value, Optional.ToNullable(allowClassicOperations), circuitProvisioningState.Value, Optional.ToNullable(serviceProviderProvisioningState), Optional.ToList(authorizations), Optional.ToList(peerings), serviceKey.Value, serviceProviderNotes.Value, serviceProviderProperties.Value, expressRoutePort.Value, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(stag), Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, Optional.ToNullable(globalReachEnabled))); }
public virtual ArmOperation <ExpressRouteCircuitPeering> CreateOrUpdate(bool waitForCompletion, string peeringName, ExpressRouteCircuitPeeringData peeringParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(peeringName, nameof(peeringName)); Argument.AssertNotNull(peeringParameters, nameof(peeringParameters)); using var scope = _expressRouteCircuitPeeringClientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.CreateOrUpdate"); scope.Start(); try { var response = _expressRouteCircuitPeeringRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, peeringParameters, cancellationToken); var operation = new NetworkArmOperation <ExpressRouteCircuitPeering>(new ExpressRouteCircuitPeeringOperationSource(Client), _expressRouteCircuitPeeringClientDiagnostics, Pipeline, _expressRouteCircuitPeeringRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, peeringParameters).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ExpressRouteCircuitPeeringResource(ArmClient client, ExpressRouteCircuitPeeringData data) : this(client, data.Id) { HasData = true; _data = data; }