Skip to content

Commit

Permalink
Parsing Skip token for next call (#21600)
Browse files Browse the repository at this point in the history
* Parsing Skip token for next call

* Change log
  • Loading branch information
ampravinr authored Apr 20, 2023
1 parent 2d6db97 commit 4e7f42b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Billing/Billing/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed skip token for Consumption PriceSheet cmdlet

## Version 2.0.1
* Fixed pagination for `Get-AzConsumptionPriceSheet` cmdlet
Expand Down
22 changes: 22 additions & 0 deletions src/Billing/Consumption/Cmdlets/GetAzureRmConsumptionPriceSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public override void ExecuteCmdlet()
expand, skipToken, numberToFetch);
UpdateResult(result, priceSheet);
nextLink = priceSheet?.NextLink;

if (!string.IsNullOrWhiteSpace(nextLink))
{
string queryString = new Uri(nextLink).Query;
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);

if (queryDictionary.AllKeys.Contains("skipToken"))
{
skipToken = queryDictionary["skipToken"];
}
}
} while (!this.Top.HasValue && !string.IsNullOrWhiteSpace(nextLink));
}
else
Expand All @@ -77,6 +88,17 @@ public override void ExecuteCmdlet()
priceSheet = ConsumptionManagementClient.PriceSheet.Get(expand, skipToken, numberToFetch);
UpdateResult(result, priceSheet);
nextLink = priceSheet?.NextLink;

if (!string.IsNullOrWhiteSpace(nextLink))
{
string queryString = new Uri(nextLink).Query;
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);

if (queryDictionary.AllKeys.Contains("skipToken"))
{
skipToken = queryDictionary["skipToken"];
}
}
} while (!this.Top.HasValue && !string.IsNullOrWhiteSpace(nextLink));
}
}
Expand Down

0 comments on commit 4e7f42b

Please sign in to comment.