Skip to content

Commit 4e7f42b

Browse files
authored
Parsing Skip token for next call (#21600)
* Parsing Skip token for next call * Change log
1 parent 2d6db97 commit 4e7f42b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Billing/Billing/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed skip token for Consumption PriceSheet cmdlet
2122

2223
## Version 2.0.1
2324
* Fixed pagination for `Get-AzConsumptionPriceSheet` cmdlet

src/Billing/Consumption/Cmdlets/GetAzureRmConsumptionPriceSheet.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ public override void ExecuteCmdlet()
6868
expand, skipToken, numberToFetch);
6969
UpdateResult(result, priceSheet);
7070
nextLink = priceSheet?.NextLink;
71+
72+
if (!string.IsNullOrWhiteSpace(nextLink))
73+
{
74+
string queryString = new Uri(nextLink).Query;
75+
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);
76+
77+
if (queryDictionary.AllKeys.Contains("skipToken"))
78+
{
79+
skipToken = queryDictionary["skipToken"];
80+
}
81+
}
7182
} while (!this.Top.HasValue && !string.IsNullOrWhiteSpace(nextLink));
7283
}
7384
else
@@ -77,6 +88,17 @@ public override void ExecuteCmdlet()
7788
priceSheet = ConsumptionManagementClient.PriceSheet.Get(expand, skipToken, numberToFetch);
7889
UpdateResult(result, priceSheet);
7990
nextLink = priceSheet?.NextLink;
91+
92+
if (!string.IsNullOrWhiteSpace(nextLink))
93+
{
94+
string queryString = new Uri(nextLink).Query;
95+
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);
96+
97+
if (queryDictionary.AllKeys.Contains("skipToken"))
98+
{
99+
skipToken = queryDictionary["skipToken"];
100+
}
101+
}
80102
} while (!this.Top.HasValue && !string.IsNullOrWhiteSpace(nextLink));
81103
}
82104
}

0 commit comments

Comments
 (0)