Skip to content

Commit c39fa87

Browse files
committed
Resolve some review comments
1. Revert version back to 0.8.4 2. For resource group uses the right method to list with paging.
1 parent 9466487 commit c39fa87

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/ResourceManager/CognitiveServices/ChangeLog.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
22-
## Version 0.8.5
2321
* Integrate with Cognitive Services Management SDK version 2.0.0.
2422
* Get-AzureRmCognitiveServicesAccount now can correctly support paging.
2523

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/CognitiveServicesAccount/GetAzureCognitiveServicesAccount.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public override void ExecuteCmdlet()
6363
{
6464
if (string.IsNullOrEmpty(this.ResourceGroupName))
6565
{
66-
var cognitiveServicesAccounts = GetWithPaging(this.CognitiveServicesClient.Accounts.List());
66+
var cognitiveServicesAccounts = GetWithPaging(this.CognitiveServicesClient.Accounts.List(), false);
6767

6868
WriteCognitiveServicesAccountList(cognitiveServicesAccounts);
6969
}
7070
else if (string.IsNullOrEmpty(this.Name))
7171
{
72-
var cognitiveServicesAccounts = GetWithPaging(this.CognitiveServicesClient.Accounts.ListByResourceGroup(this.ResourceGroupName));
72+
var cognitiveServicesAccounts = GetWithPaging(this.CognitiveServicesClient.Accounts.ListByResourceGroup(this.ResourceGroupName), true);
7373
if (cognitiveServicesAccounts == null)
7474
{
7575
WriteWarningWithTimestamp("Received empty accounts list");
@@ -87,13 +87,21 @@ public override void ExecuteCmdlet()
8787
});
8888
}
8989

90-
private IEnumerable<CognitiveServicesAccount> GetWithPaging(IPage<CognitiveServicesAccount> firstPage)
90+
private IEnumerable<CognitiveServicesAccount> GetWithPaging(IPage<CognitiveServicesAccount> firstPage, bool isResourceGroup)
9191
{
9292
var cognitiveServicesAccounts = new List<CognitiveServicesAccount>(firstPage);
9393
IPage<CognitiveServicesAccount> nextPage = null;
9494
for (var nextLink = firstPage.NextPageLink; !string.IsNullOrEmpty(nextLink); nextLink = nextPage.NextPageLink)
9595
{
96-
nextPage = this.CognitiveServicesClient.Accounts.ListNext(nextLink);
96+
if (isResourceGroup)
97+
{
98+
nextPage = this.CognitiveServicesClient.Accounts.ListByResourceGroupNext(nextLink);
99+
}
100+
else
101+
{
102+
nextPage = this.CognitiveServicesClient.Accounts.ListNext(nextLink);
103+
}
104+
97105
cognitiveServicesAccounts.AddRange(nextPage);
98106
}
99107

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
// You can specify all the values or you can default the Build and Revision Numbers
4747
// by using the '*' as shown below:
4848

49-
[assembly: AssemblyVersion("0.8.5")]
50-
[assembly: AssemblyFileVersion("0.8.5")]
49+
[assembly: AssemblyVersion("0.8.4")]
50+
[assembly: AssemblyFileVersion("0.8.4")]

0 commit comments

Comments
 (0)