public virtual Pageable <Deployment> GetAll(string filter = null, int?top = null, CancellationToken cancellationToken = default) { Page <Deployment> FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("DeploymentCollection.GetAll"); scope.Start(); try { var response = _restClient.GetAtScope(Id, filter, top, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <Deployment> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("DeploymentCollection.GetAll"); scope.Start(); try { var response = _restClient.GetAtScopeNextPage(nextLink, Id, filter, top, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }