public virtual AsyncPageable <PrivateEndpointConnection> GetPrivateEndpointConnectionsAsync(CancellationToken cancellationToken = default) { async Task <Page <PrivateEndpointConnection> > FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("PrivateLinkService.GetPrivateEndpointConnections"); scope.Start(); try { var response = await _restClient.GetPrivateEndpointConnectionsAsync(Id.ResourceGroupName, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <PrivateEndpointConnection> > NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("PrivateLinkService.GetPrivateEndpointConnections"); scope.Start(); try { var response = await _restClient.GetPrivateEndpointConnectionsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }