public virtual AsyncPageable <RunCommandDocumentBase> GetAllAsync(CancellationToken cancellationToken = default) { async Task <Page <RunCommandDocumentBase> > FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineRunCommandVirtualMachine.GetAll"); scope.Start(); try { var response = await _restClient.GetAllAsync(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 <RunCommandDocumentBase> > NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineRunCommandVirtualMachine.GetAll"); scope.Start(); try { var response = await _restClient.GetAllNextPageAsync(nextLink, 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)); }