public virtual Pageable <AppServicePlanResource> GetAll(CancellationToken cancellationToken = default) { Page <AppServicePlanResource> FirstPageFunc(int?pageSizeHint) { using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlanCollection.GetAll"); scope.Start(); try { var response = _appServicePlanRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new AppServicePlanResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <AppServicePlanResource> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlanCollection.GetAll"); scope.Start(); try { var response = _appServicePlanRestClient.ListByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new AppServicePlanResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }