public virtual Response <IReadOnlyList <RecommendedAction> > GetAll(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("RecommendedActionCollection.GetAll"); scope.Start(); try { var response = _databaseRecommendedActionsRestClient.ListByDatabaseAdvisor(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return(Response.FromValue(response.Value.Select(value => new RecommendedAction(Parent, value)).ToArray() as IReadOnlyList <RecommendedAction>, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Pageable <RecommendedAction> GetAll(CancellationToken cancellationToken = default) { Page <RecommendedAction> FirstPageFunc(int?pageSizeHint) { using var scope = _recommendedActionDatabaseRecommendedActionsClientDiagnostics.CreateScope("RecommendedActionCollection.GetAll"); scope.Start(); try { var response = _recommendedActionDatabaseRecommendedActionsRestClient.ListByDatabaseAdvisor(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Select(value => new RecommendedAction(ArmClient, value)), null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, null)); }