private DeployedApplicationPagedList GetPage(PagedDeployedApplicationQueryDescription queryDescription) { return(this.GetClusterConnection().GetDeployedApplicationPagedListAsync( queryDescription, this.GetTimeout(), this.GetCancellationToken()).Result); }
public GetDeployedApplicationPagedListRequest(IFabricClient fabricClient, PagedDeployedApplicationQueryDescription queryDescription, TimeSpan timeout) : base(fabricClient, timeout) { this.QueryDescription = queryDescription; }
private void ProcessRecordPaged() { var clusterConnection = this.GetClusterConnection(); var queryDescription = new PagedDeployedApplicationQueryDescription(this.NodeName); queryDescription.IncludeHealthState = this.IncludeHealthState; if (this.MaxResults.HasValue) { if (this.GetSinglePage) { queryDescription.MaxResults = this.MaxResults.Value; } else { this.WriteWarning(StringResources.Powershell_MaxResultsIgnored); } } if (this.ApplicationName != null && !string.IsNullOrEmpty(this.ApplicationName.OriginalString)) { queryDescription.ApplicationNameFilter = this.ApplicationName; // defaults null } if (!string.IsNullOrEmpty(this.ContinuationToken)) { queryDescription.ContinuationToken = this.ContinuationToken; // defaults null } try { if (this.GetSinglePage) { var queryResult = this.GetPage(queryDescription); this.WriteObject(this.FormatOutput(queryResult)); // If the user selects the "Verbose" option, then print the continuation token this.WriteVerbose("Continuation Token: " + queryResult.ContinuationToken); } else { // Get all pages bool morePages = true; string currentContinuationToken; while (morePages) { var queryResult = this.GetPage(queryDescription); // Write results to PowerShell foreach (var item in queryResult) { this.WriteObject(this.FormatOutput(item)); } // Continuation token is not added as a PsObject because it breaks the pipeline scenarios // like Get-ServiceFabricApplicationType | Query_Which_Takes_AppType morePages = Helpers.ResultHasMorePages(this, queryResult.ContinuationToken, out currentContinuationToken); // Update continuation token queryDescription.ContinuationToken = currentContinuationToken; } } } catch (AggregateException aggregateException) { aggregateException.Handle((ae) => { this.ThrowTerminatingError( ae, Constants.GetDeployedServiceManifestErrorId, clusterConnection); return(true); }); } }