public virtual Pageable <EventHubAuthorizationRuleResource> GetAll(CancellationToken cancellationToken = default) { Page <EventHubAuthorizationRuleResource> FirstPageFunc(int?pageSizeHint) { using var scope = _eventHubAuthorizationRuleEventHubsClientDiagnostics.CreateScope("EventHubAuthorizationRuleCollection.GetAll"); scope.Start(); try { var response = _eventHubAuthorizationRuleEventHubsRestClient.ListAuthorizationRules(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new EventHubAuthorizationRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <EventHubAuthorizationRuleResource> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _eventHubAuthorizationRuleEventHubsClientDiagnostics.CreateScope("EventHubAuthorizationRuleCollection.GetAll"); scope.Start(); try { var response = _eventHubAuthorizationRuleEventHubsRestClient.ListAuthorizationRulesNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new EventHubAuthorizationRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }