public virtual Pageable <ArmDeploymentResource> GetAll(string filter = null, int?top = null, CancellationToken cancellationToken = default) { Page <ArmDeploymentResource> FirstPageFunc(int?pageSizeHint) { using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetAll"); scope.Start(); try { var response = _armDeploymentDeploymentsRestClient.ListAtScope(Id, filter, top, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new ArmDeploymentResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <ArmDeploymentResource> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetAll"); scope.Start(); try { var response = _armDeploymentDeploymentsRestClient.ListAtScopeNextPage(nextLink, Id, filter, top, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new ArmDeploymentResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }