public virtual AsyncPageable <SubscriptionLongTermRetentionBackup> GetAllAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool?onlyLatestPerDatabase = null, DatabaseState?databaseState = null, CancellationToken cancellationToken = default) { if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } if (longTermRetentionServerName == null) { throw new ArgumentNullException(nameof(longTermRetentionServerName)); } if (longTermRetentionDatabaseName == null) { throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } async Task <Page <SubscriptionLongTermRetentionBackup> > FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupCollection.GetAll"); scope.Start(); try { var response = await _longTermRetentionBackupsRestClient.ListByDatabaseAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackup(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <SubscriptionLongTermRetentionBackup> > NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("SubscriptionLongTermRetentionBackupCollection.GetAll"); scope.Start(); try { var response = await _longTermRetentionBackupsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackup(Parent, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }