Skip to content

Commit 6756fa3

Browse files
Continued NextPageLink when listing key vaults from ARM API (#17235)
* Continued NextPageLink when listing key vaults from ARM API * fix * Fix version for DnsResolver and add mapping for new modules (#17232) * fix dnsresolver version * add mapping for new modules * remove regex for quota/dnsresolver in mapping rule Co-authored-by: Yabo Hu <[email protected]>
1 parent cf539d1 commit 6756fa3

File tree

39 files changed

+65
-14
lines changed

39 files changed

+65
-14
lines changed

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed NextPageLink deserialization issue for ResourceManager
2223
* Fixed the issue that authorization does not work in Dogfood environment
2324
* Enabled Continue Access Evaluation for MSGraph
2425
* Improved error message when login is blocked by AAD

src/DnsResolver/Az.DnsResolver.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = './Az.DnsResolver.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.1.6'
15+
ModuleVersion = '0.1.0'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'

src/KeyVault/KeyVault/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+
* Continued NextPageLink when listing key vaults from ARM API
2122
* `New-AzKeyVaultManagedHsm`: supported specifying how long a deleted managed hsm is retained by `SoftDeleteRetentionInDays` and enabling purge protection by `EnablePurgeProtection`
2223
* `Update-AzKeyVaultManagedHsm`: supported enabling purge protection by `EnablePurgeProtection`
2324
* `Get-AzKeyVaultManagedHsm`: Supported getting or listing deleted managed HSM(s)

src/KeyVault/KeyVault/Commands/GetAzureKeyVault.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
using System;
1616
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Linq;
1719
using System.Management.Automation;
1820
using Microsoft.Azure.Commands.KeyVault.Helpers;
1921
using Microsoft.Azure.Commands.KeyVault.Models;
@@ -103,7 +105,13 @@ public override void ExecuteCmdlet()
103105
switch (ParameterSetName)
104106
{
105107
case GetVaultParameterSet:
106-
ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName;
108+
List<PSKeyVaultIdentityItem> vaults = new List<PSKeyVaultIdentityItem>();
109+
110+
if (string.IsNullOrWhiteSpace(ResourceGroupName))
111+
{
112+
vaults.AddRange(ListVaults(ResourceGroupName, Tag));
113+
ResourceGroupName = vaults.FirstOrDefault(r => r.VaultName.Equals(VaultName, StringComparison.OrdinalIgnoreCase))?.ResourceGroupName;
114+
}
107115

108116
if (ShouldGetByName(ResourceGroupName, VaultName))
109117
{
@@ -115,7 +123,7 @@ public override void ExecuteCmdlet()
115123
}
116124
else
117125
{
118-
WriteObject(TopLevelWildcardFilter(ResourceGroupName, VaultName, ListVaults(ResourceGroupName, Tag)), true);
126+
WriteObject(TopLevelWildcardFilter(ResourceGroupName, VaultName, vaults), true);
119127
}
120128

121129
break;

src/KeyVault/KeyVault/Models/KeyVaultManagementCmdletBase.cs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ protected List<PSKeyVaultIdentityItem> ListVaults(string resourceGroupName, Hash
141141
if (ShouldListByResourceGroup(resourceGroupName, null))
142142
{
143143
listResult = ListByResourceGroup(resourceGroupName,
144-
new Rest.Azure.OData.ODataQuery<GenericResourceFilter>(
145-
r => r.ResourceType == resourceType));
144+
new Rest.Azure.OData.ODataQuery<GenericResourceFilter>(
145+
r => r.ResourceType == resourceType));
146+
146147
}
147148
else
148149
{
@@ -161,22 +162,36 @@ protected List<PSKeyVaultIdentityItem> ListVaults(string resourceGroupName, Hash
161162
return vaults;
162163
}
163164

164-
public virtual IEnumerable<PSKeyVaultIdentityItem> ListResources(Rest.Azure.OData.ODataQuery<GenericResourceFilter> filter = null, ulong first = ulong.MaxValue, ulong skip = ulong.MinValue)
165+
public virtual IEnumerable<PSKeyVaultIdentityItem> ListResources(Rest.Azure.OData.ODataQuery<GenericResourceFilter> filter = null)
165166
{
166167
IResourceManagementClient armClient = ResourceClient;
167-
168-
return new GenericPageEnumerable<GenericResource>(() => armClient.Resources.List(filter), armClient.Resources.ListNext, first, skip).Select(r => new PSKeyVaultIdentityItem(r));
168+
var response = armClient.Resources.List(filter);
169+
var results = new List<PSKeyVaultIdentityItem>();
170+
results.AddRange(response.Select(r => new PSKeyVaultIdentityItem(r)));
171+
while (!string.IsNullOrEmpty(response.NextPageLink))
172+
{
173+
response = armClient.Resources.ListNext(response.NextPageLink);
174+
results.AddRange(response.Select(r => new PSKeyVaultIdentityItem(r)));
175+
}
176+
return results;
169177
}
170178

171179
private IEnumerable<PSKeyVaultIdentityItem> ListByResourceGroup(
172180
string resourceGroupName,
173-
Rest.Azure.OData.ODataQuery<GenericResourceFilter> filter,
174-
ulong first = ulong.MaxValue,
175-
ulong skip = ulong.MinValue)
181+
Rest.Azure.OData.ODataQuery<GenericResourceFilter> filter)
176182
{
177183
IResourceManagementClient armClient = ResourceClient;
178184

179-
return new GenericPageEnumerable<GenericResource>(() => armClient.ResourceGroups.ListResources(resourceGroupName, filter), armClient.ResourceGroups.ListResourcesNext, first, skip).Select(r => new PSKeyVaultIdentityItem(r));
185+
var response = armClient.ResourceGroups.ListResources(resourceGroupName, filter);
186+
var results = new List<PSKeyVaultIdentityItem>();
187+
results.AddRange(response.Select(r => new PSKeyVaultIdentityItem(r)));
188+
189+
while (!string.IsNullOrEmpty(response.NextPageLink))
190+
{
191+
response = armClient.ResourceGroups.ListResourcesNext(response.NextPageLink);
192+
results.AddRange(response.Select(r => new PSKeyVaultIdentityItem(r)));
193+
}
194+
return results;
180195
}
181196

182197
protected string GetResourceGroupName(string name, bool isHsm = false)

tools/Common.Netcore.Dependencies.targets

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
<ItemGroup>
44
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.23"/>
55
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19"/>
6+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.0.0-preview"/>
7+
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.0.0-preview"/>
8+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.0.0-preview"/>
9+
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.0.0-preview"/>
10+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.0.0-preview"/>
11+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.0.0-preview"/>
12+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.0.0-preview"/>
13+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.0.0-preview"/>
14+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.0.0-preview"/>
15+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.0.0-preview"/>
16+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.0.0-preview"/>
17+
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.0.0-preview"/>
18+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.0.0-preview"/>
19+
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.0.0-preview"/>
20+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.0.0-preview"/>
21+
<PackageReference Include="Microsoft.Azure.PowerShell.Common.Share" Version="1.0.0-preview"/>
22+
<!--
623
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.56-preview"/>
724
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.56-preview"/>
825
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.56-preview"/>
@@ -19,6 +36,7 @@
1936
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.56-preview"/>
2037
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.56-preview"/>
2138
<PackageReference Include="Microsoft.Azure.PowerShell.Common.Share" Version="1.3.56-preview"/>
39+
-->
2240
</ItemGroup>
2341
<ItemGroup>
2442
<PackageReference Include="Azure.Core" Version="1.21.0"/>
@@ -36,7 +54,7 @@
3654
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" PrivateAssets="All" />
3755
</ItemGroup>
3856
<PropertyGroup>
39-
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.56-preview\tools\</StorageToolsPath>
57+
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.0.0-preview\tools\</StorageToolsPath>
4058
</PropertyGroup>
4159
<ItemGroup Condition="'$(OmitJsonPackage)' != 'true'">
4260
<PackageReference Include="Newtonsoft.Json" Version="10.0.3"/>

tools/CreateMappings_rules.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
"group": "Network",
101101
"alias": "Route"
102102
},
103+
{
104+
"group": "DnsResolver",
105+
"alias": "DnsResolver"
106+
},
103107
{
104108
"regex": "Dns",
105109
"group": "Network",
@@ -671,6 +675,10 @@
671675
"alias": "Private DNS",
672676
"module": "PrivateDns"
673677
},
678+
{
679+
"alias": "Quota",
680+
"module": "Quota"
681+
},
674682
{
675683
"regex": "ContainerInstance",
676684
"alias": "ContainerInstance"
@@ -715,4 +723,4 @@
715723
"alias": "Lab Services",
716724
"module": "LabServices"
717725
}
718-
]
726+
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)