public virtual Pageable <EventHubResource> GetAll(int?skip = null, int?top = null, CancellationToken cancellationToken = default) { Page <EventHubResource> FirstPageFunc(int?pageSizeHint) { using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetAll"); scope.Start(); try { var response = _eventHubRestClient.ListByNamespace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skip, top, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new EventHubResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <EventHubResource> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _eventHubClientDiagnostics.CreateScope("EventHubCollection.GetAll"); scope.Start(); try { var response = _eventHubRestClient.ListByNamespaceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skip, top, cancellationToken: cancellationToken); 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.CreateEnumerable(FirstPageFunc, NextPageFunc)); }