public virtual AsyncPageable <ConnectionMonitor> GetAllAsync(CancellationToken cancellationToken = default) { async Task <Page <ConnectionMonitor> > FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("ConnectionMonitorCollection.GetAll"); scope.Start(); try { var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new ConnectionMonitor(Parent, value)), null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null)); }