Esempio n. 1
0
        private void GetAllQueryResultPages(IClusterConnection clusterConnection)
        {
            var queryDescription = this.GetQueryDescription(false);

            // If the results do not fit a message,
            // GetNodeListAsync returns a page of results and continuation token.
            // Keep getting data until all nodes are received.
            bool   morePages = true;
            string currentContinuationToken = this.ContinuationToken;

            while (morePages)
            {
                // Updates the continuation token to get the next page
                queryDescription.ContinuationToken = currentContinuationToken;

                var queryResult = clusterConnection.GetNodeListAsync(
                    queryDescription,
                    this.GetTimeout(),
                    this.GetCancellationToken()).Result;

                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-ServiceFabricNode | Get-ServiceFabricNodeHealth
                morePages = Helpers.ResultHasMorePages(this, queryResult.ContinuationToken, out currentContinuationToken);
            }
        }
Esempio n. 2
0
        private void GetResultsWithPagedQuery(IClusterConnection clusterConnection)
        {
            var queryDescription = this.GetQueryDescription(true);

            var queryResult = clusterConnection.GetNodeListAsync(
                queryDescription,
                this.GetTimeout(),
                this.GetCancellationToken()).Result;

            // Continuation token is not added as a PsObject because it breaks the pipeline scenarios
            // like Get-ServiceFabricNode | Get-ServiceFabricNodeHealth
            this.WriteObject(this.FormatOutput(queryResult));

            // If the user selects the "Verbose" option, then print the continuation token
            this.WriteVerbose("Continuation Token: " + queryResult.ContinuationToken);
        }