public virtual Pageable <GalleryImageVersion> GetAll(CancellationToken cancellationToken = default) { Page <GalleryImageVersion> FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionCollection.GetAll"); scope.Start(); try { var response = _galleryImageVersionsRestClient.ListByGalleryImage(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new GalleryImageVersion(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <GalleryImageVersion> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionCollection.GetAll"); scope.Start(); try { var response = _galleryImageVersionsRestClient.ListByGalleryImageNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new GalleryImageVersion(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }