public async virtual Task <Response <ExpressRouteConnection> > GetAsync(string connectionName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteConnectionContainer.Get"); scope.Start(); try { if (connectionName == null) { throw new ArgumentNullException(nameof(connectionName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, connectionName, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ExpressRouteConnection(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ExpressRouteConnection> > GetAsync(string connectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName)); using var scope = _expressRouteConnectionClientDiagnostics.CreateScope("ExpressRouteConnectionCollection.Get"); scope.Start(); try { var response = await _expressRouteConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ExpressRouteConnection(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <ExpressRouteConnection> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _expressRouteConnectionClientDiagnostics.CreateScope("ExpressRouteConnection.Get"); scope.Start(); try { var response = await _expressRouteConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _expressRouteConnectionClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ExpressRouteConnection(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }