public virtual AsyncPageable <WebSite> GetWebAppsAsync(string skipToken = null, string filter = null, string top = null, CancellationToken cancellationToken = default) { async Task <Page <WebSite> > FirstPageFunc(int?pageSizeHint) { using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlan.GetWebApps"); scope.Start(); try { var response = await _appServicePlanRestClient.ListWebAppsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, filter, top, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new WebSite(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <WebSite> > NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _appServicePlanClientDiagnostics.CreateScope("AppServicePlan.GetWebApps"); scope.Start(); try { var response = await _appServicePlanRestClient.ListWebAppsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, filter, top, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new WebSite(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }