public virtual Pageable <TopLevelDomain> GetAll(CancellationToken cancellationToken = default) { Page <TopLevelDomain> FirstPageFunc(int?pageSizeHint) { using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainCollection.GetAll"); scope.Start(); try { var response = _topLevelDomainRestClient.List(Id.SubscriptionId, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new TopLevelDomain(ArmClient, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <TopLevelDomain> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainCollection.GetAll"); scope.Start(); try { var response = _topLevelDomainRestClient.ListNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new TopLevelDomain(ArmClient, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }