Skip to content

Commit e4b8c56

Browse files
author
Maddie Clayton
authored
Merge pull request #7074 from deathly809/Network1.5.0
[Azure Stack][Admin] Network for Azure Stack 1.5.0
2 parents 895931b + 2717bda commit e4b8c56

19 files changed

+868
-463
lines changed

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Azs.Network.Admin.psd1

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Licensed under the MIT License. See License.txt in the project root for license
1717
RootModule = 'Azs.Network.Admin.psm1'
1818

1919
# Version number of this module.
20-
ModuleVersion = '0.1.1'
20+
ModuleVersion = '0.2.0'
2121

2222
# Supported PSEditions
2323
# CompatiblePSEditions = @()
@@ -38,7 +38,7 @@ Licensed under the MIT License. See License.txt in the project root for license
3838
Description = 'Network Admin Client'
3939

4040
# Minimum version of the Windows PowerShell engine required by this module
41-
# PowerShellVersion = ''
41+
PowerShellVersion = '5.0'
4242

4343
# Name of the Windows PowerShell host required by this module
4444
# PowerShellHostName = ''
@@ -56,8 +56,8 @@ Licensed under the MIT License. See License.txt in the project root for license
5656
# ProcessorArchitecture = ''
5757

5858
# Modules that must be imported into the global environment prior to importing this module
59-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; RequiredVersion = '3.4.1'; },
60-
@{ModuleName = 'AzureRM.Resources'; RequiredVersion = '4.4.1'; })
59+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.5.1'; },
60+
@{ModuleName = 'AzureRM.Resources'; ModuleVersion = '6.0.2'; })
6161

6262
# Assemblies that must be loaded prior to importing this module
6363
# RequiredAssemblies = @()
@@ -106,19 +106,28 @@ Licensed under the MIT License. See License.txt in the project root for license
106106
PSData = @{
107107

108108
# Tags applied to this module. These help with module discovery in online galleries.
109-
# Tags = @()
109+
Tags = @('AzureStack', 'Azure Stack', 'Admin', 'Networking', 'Azure Stack Networking', 'NRP')
110110

111111
# A URL to the license for this module.
112-
# LicenseUri = ''
112+
LicenseUri = 'https://aka.ms/azps-license'
113113

114114
# A URL to the main website for this project.
115-
# ProjectUri = ''
115+
ProjectUri = 'https://github.com/Azure/azure-powershell'
116116

117117
# A URL to an icon representing this module.
118118
# IconUri = ''
119119

120120
# ReleaseNotes of this module
121-
# ReleaseNotes = ''
121+
ReleaseNotes = '## 2018.8.12
122+
* Module dependencies updated
123+
* AzureRM.Profile
124+
* AzureRM.Resources
125+
* Support handling names of nested resources
126+
* Get-AzsQuota
127+
* Remove-AzsQuota
128+
* Bug fixes
129+
* Handle ErrrorAction correctly now
130+
'
122131

123132
} # End of PSData hashtable
124133

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Azs.Network.Admin.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the MIT License. See License.txt in the project root for license
55

66
Microsoft.PowerShell.Core\Set-StrictMode -Version Latest
77

8-
Write-Warning "Preview version of the module Azs.Netowrk.Admin loaded. Future release of this module may have breaking changes."
8+
Write-Warning "Preview version of the module Azs.Network.Admin loaded. Future release of this module may have breaking changes."
99

1010
# We always import embedded version.
1111
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath PSSwaggerUtility) -Force
@@ -29,5 +29,6 @@ if (Test-Path -Path $ClrPath -PathType Container) {
2929
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ApplicableFilters.ps1')
3030
. (Join-Path -Path $PSScriptRoot -ChildPath 'Test-FilteredResult.ps1')
3131
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ArmResourceIdParameterValue.ps1')
32+
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ResourceNameSuffix.ps1')
3233
$allPs1FilesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Generated.PowerShell.Commands' | Join-Path -ChildPath '*.ps1'
3334
Get-ChildItem -Path $allPs1FilesPath -Recurse -File | ForEach-Object { . $_.FullName}

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsNetworkQuota.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function Get-AzsNetworkQuota {
116116
$null
117117
}))
118118
} elseif ('Get' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
119+
$Name = Get-ResourceNameSuffix -ResourceName $Name
119120
Write-Verbose -Message 'Performing operation GetWithHttpMessagesAsync on $NetworkAdminClient.'
120121
$TaskResult = $NetworkAdminClient.Quotas.GetWithHttpMessagesAsync($Location, $Name)
121122
} else {

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/New-AzsNetworkQuota.ps1

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function New-AzsNetworkQuota {
112112

113113
# Add here, leave defaults above.
114114
if (-not $PSBoundParameters.ContainsKey('MigrationPhase')) {
115-
$PSBoundParameters.Add('MigrationPhase',$MigrationPhase)
115+
$PSBoundParameters.Add('MigrationPhase', $MigrationPhase)
116116
}
117117

118118
if ($PSCmdlet.ShouldProcess("$Name", "Create a new network quota")) {
@@ -122,15 +122,9 @@ function New-AzsNetworkQuota {
122122
}
123123

124124
# Validate this resource does not exist.
125-
$_objectCheck = $null
126-
try {
127-
$_objectCheck = Get-AzsNetworkQuota -Name $Name -Location $Location
128-
} catch {
129-
# No op
130-
} finally {
131-
if ($_objectCheck -ne $null) {
132-
throw "A network quota with name $Name at location $Location already exists."
133-
}
125+
if ($null -ne (Get-AzsNetworkQuota -Name $Name -Location $Location -ErrorAction SilentlyContinue)) {
126+
Write-Error "A network quota with the name $Name at location $Location already exists"
127+
return
134128
}
135129

136130
# Create object

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsNetworkQuota.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ function Remove-AzsNetworkQuota {
8787

8888
$location = $ArmResourceIdParameterValues['location']
8989
$Name = $ArmResourceIdParameterValues['resourceName']
90+
} else {
91+
$Name = Get-ResourceNameSuffix -ResourceName $Name
9092
}
9193

9294
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the network quota")) {

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Get-ApplicableFilters.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Get-ApplicableFilters {
2121
$Filters
2222
)
2323

24-
$ErrorActionPreference = 'Stop'
24+
2525
foreach ($filter in $Filters) {
2626
$res = @{
2727
Filter = $filter
@@ -31,7 +31,7 @@ function Get-ApplicableFilters {
3131
if (Test-WildcardFilter -Filter $filter) {
3232
$res['Strict'] = $true
3333
}
34-
}
34+
}
3535
elseif ($filter.Type -eq 'equalityOperator') {
3636
if (Test-EqualityFilter -Filter $filter) {
3737
$res['Strict'] = $true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
function Get-ResourceNameSuffix {
3+
param(
4+
[string]$ResourceName
5+
)
6+
if ($null -ne $ResourceName -and $ResourceName.Contains('/')) {
7+
$ResourceName = $ResourceName.Split("/")[-1]
8+
}
9+
return $ResourceName
10+
}

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Get-TaskResult.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ function Get-TaskResult {
5959
} catch {
6060
# Catch exception so no output.
6161
} finally {
62-
throw $Exception
62+
Write-Error -Exception $Exception
6363
}
6464
}
6565

66-
$ErrorActionPreference = 'Stop'
66+
6767
$null = $TaskResult.AsyncWaitHandle.WaitOne()
6868
Write-Debug -Message "$($TaskResult | Out-String)"
6969

src/StackAdmin/Azs.Network.Admin/Module/Azs.Network.Admin/Test-FilteredResult.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Test-FilteredResult {
2727
$Filter
2828
)
2929

30-
$ErrorActionPreference = 'Stop'
30+
3131
if ($Filter.Type -eq 'wildcard') {
3232
Test-WildcardFilterOnResult -Filter $Filter -Result $Result
3333
} elseif ($Filter.Type -eq 'equalityOperator') {

src/StackAdmin/Azs.Network.Admin/Tests/Azs.Network.Admin.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@
6464
</ProjectReference>
6565
</ItemGroup>
6666
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
67-
</Project>
67+
</Project>

src/StackAdmin/Azs.Network.Admin/Tests/SessionRecords/NetworkAdmin/TestPutAndDeleteQuota.json

Lines changed: 128 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"Microsoft.AzureStack.Management.Network.Admin.NetworkAdminClient/0.1.0.0"
1818
]
1919
},
20-
"ResponseBody": "{\r\n \"name\": \"TestQuotaForRemoval\",\r\n \"etag\": \"W/\\\"3e32ab3c-5e41-4f8d-a947-e3a71d17f4c7\\\"\",\r\n \"type\": \"Microsoft.Network.Admin/quotas\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"maxPublicIpsPerSubscription\": 32,\r\n \"maxVnetsPerSubscription\": 32,\r\n \"maxVirtualNetworkGatewaysPerSubscription\": 32,\r\n \"maxVirtualNetworkGatewayConnectionsPerSubscription\": 32,\r\n \"maxLoadBalancersPerSubscription\": 32,\r\n \"maxNicsPerSubscription\": 4,\r\n \"maxSecurityGroupsPerSubscription\": 2,\r\n \"migrationPhase\": \"None\"\r\n },\r\n \"id\": \"/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/quotas/TestQuotaForRemoval\"\r\n}",
20+
"ResponseBody": "",
2121
"ResponseHeaders": {
2222
"Content-Length": [
23-
"688"
23+
"0"
2424
],
2525
"Content-Type": [
2626
"application/json; charset=utf-8"
@@ -65,7 +65,7 @@
6565
"nosniff"
6666
]
6767
},
68-
"StatusCode": 200
68+
"StatusCode": 404
6969
},
7070
{
7171
"RequestUri": "/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/quotas/TestQuotaForRemoval?api-version=2015-06-15",
@@ -143,6 +143,73 @@
143143
},
144144
"StatusCode": 201
145145
},
146+
{
147+
"RequestUri": "/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/quotas/TestQuotaForRemoval?api-version=2015-06-15",
148+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODgyN2IwZmItNjAzOS00N2ViLWE3ZTgtMzVjYTlkMmE3YTAwL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay5BZG1pbi9sb2NhdGlvbnMvbG9jYWwvcXVvdGFzL1Rlc3RRdW90YUZvclJlbW92YWw/YXBpLXZlcnNpb249MjAxNS0wNi0xNQ==",
149+
"RequestMethod": "GET",
150+
"RequestBody": "",
151+
"RequestHeaders": {
152+
"x-ms-client-request-id": [
153+
"6a76969b-4f09-4f34-aa6f-82935c1e7a7c"
154+
],
155+
"accept-language": [
156+
"en-US"
157+
],
158+
"User-Agent": [
159+
"FxVersion/4.6.26011.01",
160+
"Microsoft.AzureStack.Management.Network.Admin.NetworkAdminClient/0.1.0.0"
161+
]
162+
},
163+
"ResponseBody": "{\r\n \"name\": \"TestQuotaForRemoval\",\r\n \"etag\": \"W/\\\"3e32ab3c-5e41-4f8d-a947-e3a71d17f4c7\\\"\",\r\n \"type\": \"Microsoft.Network.Admin/quotas\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"maxPublicIpsPerSubscription\": 32,\r\n \"maxVnetsPerSubscription\": 32,\r\n \"maxVirtualNetworkGatewaysPerSubscription\": 32,\r\n \"maxVirtualNetworkGatewayConnectionsPerSubscription\": 32,\r\n \"maxLoadBalancersPerSubscription\": 32,\r\n \"maxNicsPerSubscription\": 4,\r\n \"maxSecurityGroupsPerSubscription\": 2,\r\n \"migrationPhase\": \"None\"\r\n },\r\n \"id\": \"/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/quotas/TestQuotaForRemoval\"\r\n}",
164+
"ResponseHeaders": {
165+
"Content-Length": [
166+
"688"
167+
],
168+
"Content-Type": [
169+
"application/json; charset=utf-8"
170+
],
171+
"Expires": [
172+
"-1"
173+
],
174+
"Cache-Control": [
175+
"no-cache"
176+
],
177+
"Date": [
178+
"Fri, 26 Jan 2018 23:31:44 GMT"
179+
],
180+
"Pragma": [
181+
"no-cache"
182+
],
183+
"ETag": [
184+
"W/\"3e32ab3c-5e41-4f8d-a947-e3a71d17f4c7\""
185+
],
186+
"Server": [
187+
"Microsoft-HTTPAPI/2.0"
188+
],
189+
"WWW-Authenticate": [
190+
"oYG3MIG0oAMKAQChCwYJKoZIgvcSAQICooGfBIGcYIGZBgkqhkiG9xIBAgICAG+BiTCBhqADAgEFoQMCAQ+iejB4oAMCARKicQRvipUwevaRsr6pwaozoYgc7Fg+Uu0SUAkbcRvsQik/cVqPKVHnxoY+Xz5CogiClrlzc/op+fIX/Z5iaaxI4Jlo+cZJCKyHAkgBIZBHi/KD3OmAOOZponudrfw9cNM719yhnQAUC061PaPRwUzQtd6b"
191+
],
192+
"x-ms-correlation-request-id": [
193+
"817479b2-d012-4af0-856d-0b9992853dfd"
194+
],
195+
"x-ms-request-id": [
196+
"316d4dd3-5eee-4d9d-be22-5c40eb7df092"
197+
],
198+
"x-ms-ratelimit-remaining-subscription-reads": [
199+
"14750"
200+
],
201+
"x-ms-routing-request-id": [
202+
"local:20180126T233144Z:817479b2-d012-4af0-856d-0b9992853dfd"
203+
],
204+
"Strict-Transport-Security": [
205+
"max-age=31536000; includeSubDomains"
206+
],
207+
"X-Content-Type-Options": [
208+
"nosniff"
209+
]
210+
},
211+
"StatusCode": 200
212+
},
146213
{
147214
"RequestUri": "/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/quotas/TestQuotaForRemoval?api-version=2015-06-15",
148215
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODgyN2IwZmItNjAzOS00N2ViLWE3ZTgtMzVjYTlkMmE3YTAwL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay5BZG1pbi9sb2NhdGlvbnMvbG9jYWwvcXVvdGFzL1Rlc3RRdW90YUZvclJlbW92YWw/YXBpLXZlcnNpb249MjAxNS0wNi0xNQ==",
@@ -210,6 +277,64 @@
210277
},
211278
"StatusCode": 202
212279
},
280+
{
281+
"RequestUri": "/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/operations/6ef3138d-5d25-4016-818c-bfa7983811b2?api-version=2015-06-15",
282+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODgyN2IwZmItNjAzOS00N2ViLWE3ZTgtMzVjYTlkMmE3YTAwL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay5BZG1pbi9sb2NhdGlvbnMvbG9jYWwvb3BlcmF0aW9ucy82ZWYzMTM4ZC01ZDI1LTQwMTYtODE4Yy1iZmE3OTgzODExYjI/YXBpLXZlcnNpb249MjAxNS0wNi0xNQ==",
283+
"RequestMethod": "GET",
284+
"RequestBody": "",
285+
"RequestHeaders": {
286+
"User-Agent": [
287+
"FxVersion/4.6.26011.01",
288+
"Microsoft.AzureStack.Management.Network.Admin.NetworkAdminClient/0.1.0.0"
289+
]
290+
},
291+
"ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}",
292+
"ResponseHeaders": {
293+
"Content-Length": [
294+
"29"
295+
],
296+
"Content-Type": [
297+
"application/json; charset=utf-8"
298+
],
299+
"Expires": [
300+
"-1"
301+
],
302+
"Cache-Control": [
303+
"no-cache"
304+
],
305+
"Date": [
306+
"Fri, 26 Jan 2018 23:31:55 GMT"
307+
],
308+
"Pragma": [
309+
"no-cache"
310+
],
311+
"Server": [
312+
"Microsoft-HTTPAPI/2.0"
313+
],
314+
"WWW-Authenticate": [
315+
"oYG3MIG0oAMKAQChCwYJKoZIgvcSAQICooGfBIGcYIGZBgkqhkiG9xIBAgICAG+BiTCBhqADAgEFoQMCAQ+iejB4oAMCARKicQRvFLzZP42n7sQaNC/O1ANCNTkieL65eM8x8WNvvPU5CAgw80k41jVegXAYU8NTWZAMetcxZOAO0ypg2fWpq5EcunP6t9LEeMKJfpxDwRqYwyE3NcwViZr7+i306pVPE/vxGIsmlXSINlpzmRu/BZmb"
316+
],
317+
"x-ms-correlation-request-id": [
318+
"27ca8853-df15-4736-aaf9-95315aadfa7b"
319+
],
320+
"x-ms-request-id": [
321+
"c754f718-dfed-4872-a9f1-e416ec24d6aa"
322+
],
323+
"x-ms-ratelimit-remaining-subscription-reads": [
324+
"14749"
325+
],
326+
"x-ms-routing-request-id": [
327+
"local:20180126T233155Z:27ca8853-df15-4736-aaf9-95315aadfa7b"
328+
],
329+
"Strict-Transport-Security": [
330+
"max-age=31536000; includeSubDomains"
331+
],
332+
"X-Content-Type-Options": [
333+
"nosniff"
334+
]
335+
},
336+
"StatusCode": 200
337+
},
213338
{
214339
"RequestUri": "/subscriptions/8827b0fb-6039-47eb-a7e8-35ca9d2a7a00/providers/Microsoft.Network.Admin/locations/local/operations/6ef3138d-5d25-4016-818c-bfa7983811b2?api-version=2015-06-15",
215340
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODgyN2IwZmItNjAzOS00N2ViLWE3ZTgtMzVjYTlkMmE3YTAwL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay5BZG1pbi9sb2NhdGlvbnMvbG9jYWwvb3BlcmF0aW9ucy82ZWYzMTM4ZC01ZDI1LTQwMTYtODE4Yy1iZmE3OTgzODExYjI/YXBpLXZlcnNpb249MjAxNS0wNi0xNQ==",

0 commit comments

Comments
 (0)