public async virtual Task <Response <ExpressRouteCrossConnection> > GetAsync(string crossConnectionName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("ExpressRouteCrossConnectionCollection.Get");
            scope.Start();
            try
            {
                if (crossConnectionName == null)
                {
                    throw new ArgumentNullException(nameof(crossConnectionName));
                }

                var response = await _restClient.GetAsync(Id.ResourceGroupName, crossConnectionName, cancellationToken : cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new ExpressRouteCrossConnection(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 2
0
        public virtual async Task <Response <ExpressRouteCrossConnection> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _expressRouteCrossConnectionClientDiagnostics.CreateScope("ExpressRouteCrossConnection.Get");
            scope.Start();
            try
            {
                var response = await _expressRouteCrossConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ExpressRouteCrossConnection(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }