@@ -43,7 +43,6 @@ Licensed under the MIT License. See License.txt in the project root for license
43
43
#>
44
44
function New-AzsIpPool {
45
45
[OutputType ([Microsoft.AzureStack.Management.Fabric.Admin.Models.ProvisioningState ])]
46
- [CmdletBinding (SupportsShouldProcess = $true )]
47
46
param (
48
47
[Parameter (Mandatory = $false )]
49
48
[string ]
@@ -98,84 +97,82 @@ function New-AzsIpPool {
98
97
99
98
$ErrorActionPreference = ' Stop'
100
99
101
- if ($PSCmdlet.ShouldProcess (" $Name " , " Add IP pool" )) {
102
- if ($Force.IsPresent -or $PSCmdlet.ShouldContinue (" Add IP pool?" , " Performing operation add IP pool for $Name " )) {
100
+ if ($Force.IsPresent -or $PSCmdlet.ShouldContinue (" Add IP pool?" , " Performing operation add IP pool for $Name " )) {
103
101
104
- $NewServiceClient_params = @ {
105
- FullClientTypeName = ' Microsoft.AzureStack.Management.Fabric.Admin.FabricAdminClient'
106
- }
102
+ $NewServiceClient_params = @ {
103
+ FullClientTypeName = ' Microsoft.AzureStack.Management.Fabric.Admin.FabricAdminClient'
104
+ }
107
105
108
- $GlobalParameterHashtable = @ {}
109
- $NewServiceClient_params [' GlobalParameterHashtable' ] = $GlobalParameterHashtable
106
+ $GlobalParameterHashtable = @ {}
107
+ $NewServiceClient_params [' GlobalParameterHashtable' ] = $GlobalParameterHashtable
110
108
111
- $GlobalParameterHashtable [' SubscriptionId' ] = $null
112
- if ($PSBoundParameters.ContainsKey (' SubscriptionId' )) {
113
- $GlobalParameterHashtable [' SubscriptionId' ] = $PSBoundParameters [' SubscriptionId' ]
114
- }
109
+ $GlobalParameterHashtable [' SubscriptionId' ] = $null
110
+ if ($PSBoundParameters.ContainsKey (' SubscriptionId' )) {
111
+ $GlobalParameterHashtable [' SubscriptionId' ] = $PSBoundParameters [' SubscriptionId' ]
112
+ }
115
113
116
- $FabricAdminClient = New-ServiceClient @NewServiceClient_params
114
+ $FabricAdminClient = New-ServiceClient @NewServiceClient_params
117
115
118
- if ([String ]::IsNullOrEmpty($Location )) {
119
- $Location = (Get-AzureRMLocation ).Location
120
- }
121
- if ([String ]::IsNullOrEmpty($ResourceGroupName )) {
122
- $ResourceGroupName = " System.$Location "
123
- }
116
+ if ([String ]::IsNullOrEmpty($Location )) {
117
+ $Location = (Get-AzureRMLocation ).Location
118
+ }
119
+ if ([String ]::IsNullOrEmpty($ResourceGroupName )) {
120
+ $ResourceGroupName = " System.$Location "
121
+ }
124
122
125
- $flattenedParameters = @ (' NumberOfIpAddressesInTransition' , ' StartIpAddress' , ' Tags' , ' AddressPrefix' , ' NumberOfIpAddresses' , ' Location' , ' EndIpAddress' , ' NumberOfAllocatedIpAddresses' )
126
- $utilityCmdParams = @ {}
127
- $flattenedParameters | ForEach-Object {
128
- if ($PSBoundParameters.ContainsKey ($_ )) {
129
- $utilityCmdParams [$_ ] = $PSBoundParameters [$_ ]
130
- }
123
+ $flattenedParameters = @ (' NumberOfIpAddressesInTransition' , ' StartIpAddress' , ' Tags' , ' AddressPrefix' , ' NumberOfIpAddresses' , ' Location' , ' EndIpAddress' , ' NumberOfAllocatedIpAddresses' )
124
+ $utilityCmdParams = @ {}
125
+ $flattenedParameters | ForEach-Object {
126
+ if ($PSBoundParameters.ContainsKey ($_ )) {
127
+ $utilityCmdParams [$_ ] = $PSBoundParameters [$_ ]
131
128
}
132
- $Pool = New-IpPoolObject @utilityCmdParams
133
-
134
- Write-Verbose - Message ' Performing operation CreateOrUpdateWithHttpMessagesAsync on $FabricAdminClient.'
135
- $TaskResult = $FabricAdminClient.IpPools.CreateOrUpdateWithHttpMessagesAsync ($ResourceGroupName , $Location , $Name , $Pool )
136
-
137
- Write-Verbose - Message " Waiting for the operation to complete."
138
-
139
- $PSSwaggerJobScriptBlock = {
140
- [CmdletBinding ()]
141
- param (
142
- [Parameter (Mandatory = $true )]
143
- [System.Threading.Tasks.Task ]
144
- $TaskResult ,
145
-
146
- [Parameter (Mandatory = $true )]
147
- [string ]
148
- $TaskHelperFilePath
149
- )
150
- if ($TaskResult ) {
151
- . $TaskHelperFilePath
152
- $GetTaskResult_params = @ {
153
- TaskResult = $TaskResult
154
- }
129
+ }
130
+ $Pool = New-IpPoolObject @utilityCmdParams
131
+
132
+ Write-Verbose - Message ' Performing operation CreateOrUpdateWithHttpMessagesAsync on $FabricAdminClient.'
133
+ $TaskResult = $FabricAdminClient.IpPools.CreateOrUpdateWithHttpMessagesAsync ($ResourceGroupName , $Location , $Name , $Pool )
134
+
135
+ Write-Verbose - Message " Waiting for the operation to complete."
136
+
137
+ $PSSwaggerJobScriptBlock = {
138
+ [CmdletBinding ()]
139
+ param (
140
+ [Parameter (Mandatory = $true )]
141
+ [System.Threading.Tasks.Task ]
142
+ $TaskResult ,
143
+
144
+ [Parameter (Mandatory = $true )]
145
+ [string ]
146
+ $TaskHelperFilePath
147
+ )
148
+ if ($TaskResult ) {
149
+ . $TaskHelperFilePath
150
+ $GetTaskResult_params = @ {
151
+ TaskResult = $TaskResult
152
+ }
155
153
156
- Get-TaskResult @GetTaskResult_params
154
+ Get-TaskResult @GetTaskResult_params
157
155
158
- }
159
156
}
157
+ }
160
158
161
- $PSCommonParameters = Get-PSCommonParameter - CallerPSBoundParameters $PSBoundParameters
162
- $TaskHelperFilePath = Join-Path - Path $ExecutionContext.SessionState.Module.ModuleBase - ChildPath ' Get-TaskResult.ps1'
163
- if (-not $AsJob.IsPresent ) {
164
- Invoke-Command - ScriptBlock $PSSwaggerJobScriptBlock `
165
- - ArgumentList $TaskResult , $TaskHelperFilePath `
166
- @PSCommonParameters
167
- } else {
168
- $ScriptBlockParameters = New-Object - TypeName ' System.Collections.Generic.Dictionary[string,object]'
169
- $ScriptBlockParameters [' TaskResult' ] = $TaskResult
170
- $ScriptBlockParameters [' AsJob' ] = $true
171
- $ScriptBlockParameters [' TaskHelperFilePath' ] = $TaskHelperFilePath
172
- $PSCommonParameters.GetEnumerator () | ForEach-Object { $ScriptBlockParameters [$_.Name ] = $_.Value }
173
-
174
- Start-PSSwaggerJobHelper - ScriptBlock $PSSwaggerJobScriptBlock `
175
- - CallerPSBoundParameters $ScriptBlockParameters `
176
- - CallerPSCmdlet $PSCmdlet `
177
- @PSCommonParameters
178
- }
159
+ $PSCommonParameters = Get-PSCommonParameter - CallerPSBoundParameters $PSBoundParameters
160
+ $TaskHelperFilePath = Join-Path - Path $ExecutionContext.SessionState.Module.ModuleBase - ChildPath ' Get-TaskResult.ps1'
161
+ if (-not $AsJob.IsPresent ) {
162
+ Invoke-Command - ScriptBlock $PSSwaggerJobScriptBlock `
163
+ - ArgumentList $TaskResult , $TaskHelperFilePath `
164
+ @PSCommonParameters
165
+ } else {
166
+ $ScriptBlockParameters = New-Object - TypeName ' System.Collections.Generic.Dictionary[string,object]'
167
+ $ScriptBlockParameters [' TaskResult' ] = $TaskResult
168
+ $ScriptBlockParameters [' AsJob' ] = $true
169
+ $ScriptBlockParameters [' TaskHelperFilePath' ] = $TaskHelperFilePath
170
+ $PSCommonParameters.GetEnumerator () | ForEach-Object { $ScriptBlockParameters [$_.Name ] = $_.Value }
171
+
172
+ Start-PSSwaggerJobHelper - ScriptBlock $PSSwaggerJobScriptBlock `
173
+ - CallerPSBoundParameters $ScriptBlockParameters `
174
+ - CallerPSCmdlet $PSCmdlet `
175
+ @PSCommonParameters
179
176
}
180
177
}
181
178
}
0 commit comments