@@ -132,92 +132,92 @@ function Add-AzsPlatformImage {
132
132
# No-op
133
133
}
134
134
135
- if ($dontCheck -or ($Force.IsPresent -or $PSCmdlet.ShouldContinue (" Virtual machine image exists with values $Publisher /$Offer /$Sku /$Version , overwrite?" , " Performing operation add virtual machine image with publisher $Publisher , offer $Offer , SKU $Sku , and version $Version ." )) {
135
+ if ($dontCheck -or ($Force.IsPresent -or $PSCmdlet.ShouldContinue (" Virtual machine image exists with values $Publisher /$Offer /$Sku /$Version , overwrite?" , " Performing operation add virtual machine image with publisher $Publisher , offer $Offer , SKU $Sku , and version $Version ." ))) {
136
136
137
- $NewServiceClient_params = @ {
138
- FullClientTypeName = ' Microsoft.AzureStack.Management.Compute.Admin.ComputeAdminClient'
139
- }
137
+ $NewServiceClient_params = @ {
138
+ FullClientTypeName = ' Microsoft.AzureStack.Management.Compute.Admin.ComputeAdminClient'
139
+ }
140
140
141
- $GlobalParameterHashtable = @ {}
142
- $NewServiceClient_params [' GlobalParameterHashtable' ] = $GlobalParameterHashtable
141
+ $GlobalParameterHashtable = @ {}
142
+ $NewServiceClient_params [' GlobalParameterHashtable' ] = $GlobalParameterHashtable
143
143
144
- $GlobalParameterHashtable [' SubscriptionId' ] = $null
145
- if ($PSBoundParameters.ContainsKey (' SubscriptionId' )) {
146
- $GlobalParameterHashtable [' SubscriptionId' ] = $PSBoundParameters [' SubscriptionId' ]
147
- }
144
+ $GlobalParameterHashtable [' SubscriptionId' ] = $null
145
+ if ($PSBoundParameters.ContainsKey (' SubscriptionId' )) {
146
+ $GlobalParameterHashtable [' SubscriptionId' ] = $PSBoundParameters [' SubscriptionId' ]
147
+ }
148
148
149
- $ComputeAdminClient = New-ServiceClient @NewServiceClient_params
149
+ $ComputeAdminClient = New-ServiceClient @NewServiceClient_params
150
150
151
- # Create object
152
- $flattenedParameters = @ (' DataDisks' )
153
- $utilityCmdParams = @ {}
154
- $utilityCmdParams [' OsDisk' ] = New-OSDiskObject - OsType $OsType - Uri $OsUri
155
- if ($PSBoundParameters.ContainsKey (' BillingPartNumber' )) {
156
- $utilityCmdParams [' Details' ] = New-ImageDetailsObject - BillingPartNumber $PSBoundParameters [' BillingPartNumber' ]
157
- }
158
- $flattenedParameters | ForEach-Object {
159
- if ($PSBoundParameters.ContainsKey ($_ )) {
160
- $utilityCmdParams [$_ ] = $PSBoundParameters [$_ ]
161
- }
151
+ # Create object
152
+ $flattenedParameters = @ (' DataDisks' )
153
+ $utilityCmdParams = @ {}
154
+ $utilityCmdParams [' OsDisk' ] = New-OSDiskObject - OsType $OsType - Uri $OsUri
155
+ if ($PSBoundParameters.ContainsKey (' BillingPartNumber' )) {
156
+ $utilityCmdParams [' Details' ] = New-ImageDetailsObject - BillingPartNumber $PSBoundParameters [' BillingPartNumber' ]
157
+ }
158
+ $flattenedParameters | ForEach-Object {
159
+ if ($PSBoundParameters.ContainsKey ($_ )) {
160
+ $utilityCmdParams [$_ ] = $PSBoundParameters [$_ ]
162
161
}
163
- $NewImage = New-PlatformImageParametersObject @utilityCmdParams
162
+ }
163
+ $NewImage = New-PlatformImageParametersObject @utilityCmdParams
164
164
165
- if ( -not $PSBoundParameters.ContainsKey (' Location' )) {
166
- $Location = (Get-AzureRMLocation ).Location
167
- }
165
+ if ( -not $PSBoundParameters.ContainsKey (' Location' )) {
166
+ $Location = (Get-AzureRMLocation ).Location
167
+ }
168
168
169
- Write-Verbose - Message ' Performing operation add on $ComputeAdminClient.'
170
- $TaskResult = $ComputeAdminClient.PlatformImages.CreateWithHttpMessagesAsync ($Location , $Publisher , $Offer , $Sku , $Version , $NewImage )
171
-
172
- Write-Verbose - Message " Waiting for the operation to complete."
173
-
174
- $PSSwaggerJobScriptBlock = {
175
- [CmdletBinding ()]
176
- param (
177
- [Parameter (Mandatory = $true )]
178
- [System.Threading.Tasks.Task ]
179
- $TaskResult ,
180
-
181
- [Parameter (Mandatory = $true )]
182
- [System.String ]
183
- $TaskHelperFilePath
184
- )
185
- if ($TaskResult ) {
186
- . $TaskHelperFilePath
187
- $GetTaskResult_params = @ {
188
- TaskResult = $TaskResult
189
- }
190
- Get-TaskResult @GetTaskResult_params
169
+ Write-Verbose - Message ' Performing operation add on $ComputeAdminClient.'
170
+ $TaskResult = $ComputeAdminClient.PlatformImages.CreateWithHttpMessagesAsync ($Location , $Publisher , $Offer , $Sku , $Version , $NewImage )
171
+
172
+ Write-Verbose - Message " Waiting for the operation to complete."
173
+
174
+ $PSSwaggerJobScriptBlock = {
175
+ [CmdletBinding ()]
176
+ param (
177
+ [Parameter (Mandatory = $true )]
178
+ [System.Threading.Tasks.Task ]
179
+ $TaskResult ,
180
+
181
+ [Parameter (Mandatory = $true )]
182
+ [System.String ]
183
+ $TaskHelperFilePath
184
+ )
185
+ if ($TaskResult ) {
186
+ . $TaskHelperFilePath
187
+ $GetTaskResult_params = @ {
188
+ TaskResult = $TaskResult
191
189
}
190
+ Get-TaskResult @GetTaskResult_params
192
191
}
192
+ }
193
193
194
- $PSCommonParameters = Get-PSCommonParameter - CallerPSBoundParameters $PSBoundParameters
195
- $TaskHelperFilePath = Join-Path - Path $ExecutionContext.SessionState.Module.ModuleBase - ChildPath ' Get-TaskResult.ps1'
196
- if ($AsJob ) {
197
- $ScriptBlockParameters = New-Object - TypeName ' System.Collections.Generic.Dictionary[string,object]'
198
- $ScriptBlockParameters [' TaskResult' ] = $TaskResult
199
- $ScriptBlockParameters [' AsJob' ] = $true
200
- $ScriptBlockParameters [' TaskHelperFilePath' ] = $TaskHelperFilePath
201
- $PSCommonParameters.GetEnumerator () | ForEach-Object { $ScriptBlockParameters [$_.Name ] = $_.Value }
202
-
203
- Start-PSSwaggerJobHelper - ScriptBlock $PSSwaggerJobScriptBlock `
204
- - CallerPSBoundParameters $ScriptBlockParameters `
205
- - CallerPSCmdlet $PSCmdlet `
206
- @PSCommonParameters
207
- } else {
208
- Invoke-Command - ScriptBlock $PSSwaggerJobScriptBlock `
209
- - ArgumentList $TaskResult , $TaskHelperFilePath `
210
- @PSCommonParameters
211
- }
194
+ $PSCommonParameters = Get-PSCommonParameter - CallerPSBoundParameters $PSBoundParameters
195
+ $TaskHelperFilePath = Join-Path - Path $ExecutionContext.SessionState.Module.ModuleBase - ChildPath ' Get-TaskResult.ps1'
196
+ if ($AsJob ) {
197
+ $ScriptBlockParameters = New-Object - TypeName ' System.Collections.Generic.Dictionary[string,object]'
198
+ $ScriptBlockParameters [' TaskResult' ] = $TaskResult
199
+ $ScriptBlockParameters [' AsJob' ] = $true
200
+ $ScriptBlockParameters [' TaskHelperFilePath' ] = $TaskHelperFilePath
201
+ $PSCommonParameters.GetEnumerator () | ForEach-Object { $ScriptBlockParameters [$_.Name ] = $_.Value }
202
+
203
+ Start-PSSwaggerJobHelper - ScriptBlock $PSSwaggerJobScriptBlock `
204
+ - CallerPSBoundParameters $ScriptBlockParameters `
205
+ - CallerPSCmdlet $PSCmdlet `
206
+ @PSCommonParameters
207
+ } else {
208
+ Invoke-Command - ScriptBlock $PSSwaggerJobScriptBlock `
209
+ - ArgumentList $TaskResult , $TaskHelperFilePath `
210
+ @PSCommonParameters
212
211
}
213
212
}
214
213
}
214
+ }
215
215
216
- End {
217
- if ($tracerObject ) {
218
- $global :DebugPreference = $oldDebugPreference
219
- Unregister-PSSwaggerClientTracing - TracerObject $tracerObject
220
- }
216
+ End {
217
+ if ($tracerObject ) {
218
+ $global :DebugPreference = $oldDebugPreference
219
+ Unregister-PSSwaggerClientTracing - TracerObject $tracerObject
221
220
}
222
221
}
222
+ }
223
223
0 commit comments