@@ -126,13 +126,21 @@ $helpParamStr = @'
126126'@
127127
128128$functionBodyStr = @'
129- $serviceCredentials = Get-AzCredentials
130- $subscriptionId = Get-SubscriptionId
131129
132- $clientName = [$fullModuleName]::new($serviceCredentials, [System.Net.Http.DelegatingHandler[]]::new(0))
133- $clientName.ApiVersion = $infoVersion
130+ $serviceCredentials = Get-AzServiceCredential
131+ $subscriptionId = Get-AzSubscriptionId
132+ $delegatingHandler = Get-AzDelegatingHandler
133+
134+ $clientName = [$fullModuleName]::new($serviceCredentials, $delegatingHandler)
135+ $clientName.ApiVersion = '$infoVersion'
134136 $clientName.SubscriptionId = $subscriptionId
135- $operationVar = $clientName.$operations.$methodName($requiredParamList)
137+
138+ Write-Verbose 'Performing operation $methodName on $clientName.'
139+ $taskResult = $clientName.$operations.$methodName($requiredParamList)
140+ Write-Verbose "Waiting for the operation to complete."
141+ $taskResult.AsyncWaitHandle.WaitOne() | out-null
142+ Write-Verbose "Operation Completed."
143+ $taskResult.Result.Body.Value
136144'@
137145
138146 $commandName = ProcessOperationId $jsonPathItemObject.operationId
@@ -190,9 +198,9 @@ $functionBodyStr = @'
190198 # Handle the function body
191199 # region Function Body
192200 $infoVersion = $Global :parameters [' infoVersion' ]
193- $modulePostfix = $Global :parameters [' infoTitle ' ] + ' . ' + $ Global :parameters [ ' infoName' ]
201+ $modulePostfix = $Global :parameters [' infoName' ]
194202 $fullModuleName = $Global :parameters [' namespace' ] + ' .' + $modulePostfix
195- $clientName = ' $' + $modulePostfix.Split ( ' . ' )[ $_ .count - 1 ]
203+ $clientName = ' $' + $modulePostfix
196204
197205 $operationName = $jsonPathItemObject.operationId.Split (' _' )[0 ]
198206 $operationType = $jsonPathItemObject.operationId.Split (' _' )[1 ]
@@ -202,6 +210,8 @@ $functionBodyStr = @'
202210
203211 $serviceCredentials = ' $' + ' serviceCredentials'
204212 $subscriptionId = ' $' + ' subscriptionId'
213+ $delegatingHandler = ' $' + ' delegatingHandler'
214+ $taskResult = ' $taskResult'
205215
206216 $body = $executionContext.InvokeCommand.ExpandString ($functionBodyStr )
207217
@@ -219,7 +229,7 @@ function ProcessOperationId
219229 param ([string ] $opId )
220230
221231 $cmdNounMap = @ {" Create" = " New" ; " Activate" = " Enable" ; " Delete" = " Remove" ;
222- " List" = " Get " }
232+ " List" = " GetAll " }
223233 $opIdValues = $opId.Split (' _' )
224234 $cmdNoun = $opIdValues [0 ]
225235 $cmdVerb = $opIdValues [1 ]
@@ -337,7 +347,7 @@ function GenerateCsharpCode
337347 del $net45Dir - Force - Recurse
338348 }
339349
340- & $autoRestExePath - input $swaggerSpecPath - CodeGenerator CSharp - OutputDirectory $generatedCSharpPath - NameSpace $nameSpace
350+ & $autoRestExePath - AddCredentials - input $swaggerSpecPath - CodeGenerator CSharp - OutputDirectory $generatedCSharpPath - NameSpace $nameSpace
341351 if ($LastExitCode )
342352 {
343353 throw " AutoRest resulted in an error"
@@ -376,7 +386,7 @@ function GenerateModuleManifest
376386 Add-Type -LiteralPath "$PSScriptRoot\azure.csharp.ps.generated.dll"
377387'@ | out-file - Encoding Ascii $startUpScriptFile
378388
379- New-ModuleManifest - Path $moduleManifestFile - Guid (New-Guid ) - Author (whoami) - ScriptsToProcess ($moduleName + " .StartupScript.ps1" ) - RequiredModules " Generated.Azure.Common.Helpers" - RootModule " $rootModule "
389+ New-ModuleManifest - Path $moduleManifestFile - Guid (New-Guid ) - Author (whoami) - ScriptsToProcess ($moduleName + " .StartupScript.ps1" ) - RequiredModules " Generated.Azure.Common.Helpers" - RootModule " $rootModule " - FunctionsToExport ' * '
380390}
381391
382392# endregion
0 commit comments