public virtual Pageable <CdnEndpoint> GetAll(CancellationToken cancellationToken = default) { Page <CdnEndpoint> FirstPageFunc(int?pageSizeHint) { using var scope = _cdnEndpointClientDiagnostics.CreateScope("CdnEndpointCollection.GetAll"); scope.Start(); try { var response = _cdnEndpointRestClient.ListByProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new CdnEndpoint(ArmClient, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <CdnEndpoint> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _cdnEndpointClientDiagnostics.CreateScope("CdnEndpointCollection.GetAll"); scope.Start(); try { var response = _cdnEndpointRestClient.ListByProfileNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new CdnEndpoint(ArmClient, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }