public virtual AsyncPageable <EventHubResource> GetAllAsync(int?skip = null, int?top = null, CancellationToken cancellationToken = default) { async Task <Page <EventHubResource> > FirstPageFunc(int?pageSizeHint) { using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetAll"); scope.Start(); try { var response = await _eventHubRestClient.ListByNamespaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skip, top, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new EventHubResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <EventHubResource> > NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetAll"); scope.Start(); try { var response = await _eventHubRestClient.ListByNamespaceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skip, top, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new EventHubResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }