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