public async virtual Task <Response <ExpressRouteCircuitPeering> > GetAsync(string peeringName, CancellationToken cancellationToken = default) { if (peeringName == null) { throw new ArgumentNullException(nameof(peeringName)); } using var scope = _clientDiagnostics.CreateScope("ExpressRouteCircuitPeeringCollection.Get"); scope.Start(); try { var response = await _expressRouteCircuitPeeringsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peeringName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ExpressRouteCircuitPeering(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <ExpressRouteCircuitPeering> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteCircuitPeering.Get"); scope.Start(); try { var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ExpressRouteCircuitPeering(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }