public virtual Response <IReadOnlyList <ExpressRouteConnection> > GetAll(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteConnectionCollection.GetAll"); scope.Start(); try { var response = _expressRouteConnectionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return(Response.FromValue(response.Value.Value.Select(value => new ExpressRouteConnection(Parent, value)).ToArray() as IReadOnlyList <ExpressRouteConnection>, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Pageable <ExpressRouteConnection> GetAll(CancellationToken cancellationToken = default) { Page <ExpressRouteConnection> FirstPageFunc(int?pageSizeHint) { using var scope = _expressRouteConnectionClientDiagnostics.CreateScope("ExpressRouteConnectionCollection.GetAll"); scope.Start(); try { var response = _expressRouteConnectionRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new ExpressRouteConnection(Client, value)), null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, null)); }