From 5f45df35dfd2868f2ee231ac1c9ba96d6a782c33 Mon Sep 17 00:00:00 2001 From: huangpf Date: Tue, 23 Feb 2016 00:17:03 -0800 Subject: [PATCH 1/2] Combine Next-Page Functions --- .../VirtualMachineScaleSetTests.ps1 | 2 +- .../VirtualMachineScaleSetListAllMethod.cs | 13 +++- ...VirtualMachineScaleSetListAllNextMethod.cs | 46 -------------- .../VirtualMachineScaleSetListMethod.cs | 13 +++- .../VirtualMachineScaleSetListNextMethod.cs | 46 -------------- .../VirtualMachineScaleSetListSkusMethod.cs | 13 +++- ...irtualMachineScaleSetListSkusNextMethod.cs | 46 -------------- .../VirtualMachineScaleSetVMListMethod.cs | 13 +++- .../VirtualMachineScaleSetVMListNextMethod.cs | 46 -------------- .../Automation/Generate-FunctionCommand.ps1 | 33 +++++++++- .../Automation/Import-CommonVariables.ps1 | 2 + .../Automation/Import-TypeFunction.ps1 | 39 ++++++++++++ .../Automation/RunCodeGeneration.ps1 | 60 +++++++++++++++++-- 13 files changed, 177 insertions(+), 195 deletions(-) diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 index cdcf8aabb1e0..a927cb412a1c 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 @@ -182,7 +182,7 @@ function Test-VirtualMachineScaleSet } # List Next (negative test) - Assert-ThrowsContains { Get-AzureRmVmssNextList -NextPageLink test.com } "Invalid URI: The format of the URI could not be determined."; + # Assert-ThrowsContains { Get-AzureRmVmssNextList -NextPageLink test.com } "Invalid URI: The format of the URI could not be determined."; # Stop/Start/Restart Operation for ($i = 0; $i -lt 2; $i++) diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllMethod.cs index 3d4d671be800..80a0c0218f27 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllMethod.cs @@ -54,7 +54,18 @@ protected void ExecuteVirtualMachineScaleSetListAllMethod(object[] invokeMethodI { var result = VirtualMachineScaleSetsClient.ListAll(); - WriteObject(result); + var resultList = result.ToList(); + var nextPageLink = result.NextPageLink; + while (!string.IsNullOrEmpty(nextPageLink)) + { + var pageResult = VirtualMachineScaleSetsClient.ListAllNext(nextPageLink); + foreach (var pageItem in pageResult) + { + resultList.Add(pageItem); + } + nextPageLink = pageResult.NextPageLink; + } + WriteObject(resultList, true); } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllNextMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllNextMethod.cs index 0df2894183db..b6b549cd4a03 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllNextMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllNextMethod.cs @@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListAllNextParameters() new object[] { nextPageLink }); } } - - [Cmdlet("Get", "AzureRmVmssAllNextList", DefaultParameterSetName = "InvokeByDynamicParameters")] - public partial class GetAzureRmVMSSAllNextList : InvokeAzureComputeMethodCmdlet - { - public GetAzureRmVMSSAllNextList() - { - } - - public override string MethodName { get; set; } - - protected override void ProcessRecord() - { - this.MethodName = "VirtualMachineScaleSetListAllNext"; - base.ProcessRecord(); - } - - public override object GetDynamicParameters() - { - dynamicParameters = new RuntimeDefinedParameterDictionary(); - var pNextPageLink = new RuntimeDefinedParameter(); - pNextPageLink.Name = "NextPageLink"; - pNextPageLink.ParameterType = typeof(string); - pNextPageLink.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByDynamicParameters", - Position = 1, - Mandatory = false - }); - pNextPageLink.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("NextPageLink", pNextPageLink); - - var pArgumentList = new RuntimeDefinedParameter(); - pArgumentList.Name = "ArgumentList"; - pArgumentList.ParameterType = typeof(object[]); - pArgumentList.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByStaticParameters", - Position = 2, - Mandatory = true - }); - pArgumentList.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("ArgumentList", pArgumentList); - - return dynamicParameters; - } - } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListMethod.cs index c27a1fd0857a..fe4268417443 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListMethod.cs @@ -67,7 +67,18 @@ protected void ExecuteVirtualMachineScaleSetListMethod(object[] invokeMethodInpu string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]); var result = VirtualMachineScaleSetsClient.List(resourceGroupName); - WriteObject(result); + var resultList = result.ToList(); + var nextPageLink = result.NextPageLink; + while (!string.IsNullOrEmpty(nextPageLink)) + { + var pageResult = VirtualMachineScaleSetsClient.ListNext(nextPageLink); + foreach (var pageItem in pageResult) + { + resultList.Add(pageItem); + } + nextPageLink = pageResult.NextPageLink; + } + WriteObject(resultList, true); } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListNextMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListNextMethod.cs index e372987cc82b..00c6ab8f2cd4 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListNextMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListNextMethod.cs @@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListNextParameters() new object[] { nextPageLink }); } } - - [Cmdlet("Get", "AzureRmVmssNextList", DefaultParameterSetName = "InvokeByDynamicParameters")] - public partial class GetAzureRmVMSSNextList : InvokeAzureComputeMethodCmdlet - { - public GetAzureRmVMSSNextList() - { - } - - public override string MethodName { get; set; } - - protected override void ProcessRecord() - { - this.MethodName = "VirtualMachineScaleSetListNext"; - base.ProcessRecord(); - } - - public override object GetDynamicParameters() - { - dynamicParameters = new RuntimeDefinedParameterDictionary(); - var pNextPageLink = new RuntimeDefinedParameter(); - pNextPageLink.Name = "NextPageLink"; - pNextPageLink.ParameterType = typeof(string); - pNextPageLink.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByDynamicParameters", - Position = 1, - Mandatory = false - }); - pNextPageLink.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("NextPageLink", pNextPageLink); - - var pArgumentList = new RuntimeDefinedParameter(); - pArgumentList.Name = "ArgumentList"; - pArgumentList.ParameterType = typeof(object[]); - pArgumentList.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByStaticParameters", - Position = 2, - Mandatory = true - }); - pArgumentList.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("ArgumentList", pArgumentList); - - return dynamicParameters; - } - } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusMethod.cs index a3d330e28697..e378b23c390c 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusMethod.cs @@ -80,7 +80,18 @@ protected void ExecuteVirtualMachineScaleSetListSkusMethod(object[] invokeMethod string vmScaleSetName = (string)ParseParameter(invokeMethodInputParameters[1]); var result = VirtualMachineScaleSetsClient.ListSkus(resourceGroupName, vmScaleSetName); - WriteObject(result); + var resultList = result.ToList(); + var nextPageLink = result.NextPageLink; + while (!string.IsNullOrEmpty(nextPageLink)) + { + var pageResult = VirtualMachineScaleSetsClient.ListSkusNext(nextPageLink); + foreach (var pageItem in pageResult) + { + resultList.Add(pageItem); + } + nextPageLink = pageResult.NextPageLink; + } + WriteObject(resultList, true); } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusNextMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusNextMethod.cs index ea36ef25338c..440ba3f2e40f 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusNextMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusNextMethod.cs @@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListSkusNextParameters() new object[] { nextPageLink }); } } - - [Cmdlet("Get", "AzureRmVmssSkusNextList", DefaultParameterSetName = "InvokeByDynamicParameters")] - public partial class GetAzureRmVMSSSkusNextList : InvokeAzureComputeMethodCmdlet - { - public GetAzureRmVMSSSkusNextList() - { - } - - public override string MethodName { get; set; } - - protected override void ProcessRecord() - { - this.MethodName = "VirtualMachineScaleSetListSkusNext"; - base.ProcessRecord(); - } - - public override object GetDynamicParameters() - { - dynamicParameters = new RuntimeDefinedParameterDictionary(); - var pNextPageLink = new RuntimeDefinedParameter(); - pNextPageLink.Name = "NextPageLink"; - pNextPageLink.ParameterType = typeof(string); - pNextPageLink.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByDynamicParameters", - Position = 1, - Mandatory = false - }); - pNextPageLink.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("NextPageLink", pNextPageLink); - - var pArgumentList = new RuntimeDefinedParameter(); - pArgumentList.Name = "ArgumentList"; - pArgumentList.ParameterType = typeof(object[]); - pArgumentList.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByStaticParameters", - Position = 2, - Mandatory = true - }); - pArgumentList.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("ArgumentList", pArgumentList); - - return dynamicParameters; - } - } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListMethod.cs index 3cc576fc6633..2e86f991718c 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListMethod.cs @@ -94,7 +94,18 @@ protected void ExecuteVirtualMachineScaleSetVMListMethod(object[] invokeMethodIn string select = (string)ParseParameter(invokeMethodInputParameters[3]); var result = VirtualMachineScaleSetVMsClient.List(resourceGroupName, virtualMachineScaleSetName, odataQuery, select); - WriteObject(result); + var resultList = result.ToList(); + var nextPageLink = result.NextPageLink; + while (!string.IsNullOrEmpty(nextPageLink)) + { + var pageResult = VirtualMachineScaleSetVMsClient.ListNext(nextPageLink); + foreach (var pageItem in pageResult) + { + resultList.Add(pageItem); + } + nextPageLink = pageResult.NextPageLink; + } + WriteObject(resultList, true); } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListNextMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListNextMethod.cs index c6431137a8dc..2418ba78505d 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListNextMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListNextMethod.cs @@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetVMListNextParameters() new object[] { nextPageLink }); } } - - [Cmdlet("Get", "AzureRmVmssVMNextList", DefaultParameterSetName = "InvokeByDynamicParameters")] - public partial class GetAzureRmVMSSVMNextList : InvokeAzureComputeMethodCmdlet - { - public GetAzureRmVMSSVMNextList() - { - } - - public override string MethodName { get; set; } - - protected override void ProcessRecord() - { - this.MethodName = "VirtualMachineScaleSetVMListNext"; - base.ProcessRecord(); - } - - public override object GetDynamicParameters() - { - dynamicParameters = new RuntimeDefinedParameterDictionary(); - var pNextPageLink = new RuntimeDefinedParameter(); - pNextPageLink.Name = "NextPageLink"; - pNextPageLink.ParameterType = typeof(string); - pNextPageLink.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByDynamicParameters", - Position = 1, - Mandatory = false - }); - pNextPageLink.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("NextPageLink", pNextPageLink); - - var pArgumentList = new RuntimeDefinedParameter(); - pArgumentList.Name = "ArgumentList"; - pArgumentList.ParameterType = typeof(object[]); - pArgumentList.Attributes.Add(new ParameterAttribute - { - ParameterSetName = "InvokeByStaticParameters", - Position = 2, - Mandatory = true - }); - pArgumentList.Attributes.Add(new AllowNullAttribute()); - dynamicParameters.Add("ArgumentList", pArgumentList); - - return dynamicParameters; - } - } } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1 b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1 index 5c4cf8fc5bf3..5788f61ac36a 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1 +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1 @@ -28,7 +28,13 @@ param [string]$FileOutputFolder, [Parameter(Mandatory = $false)] - [System.Reflection.MethodInfo]$FriendMethodInfo = $null + [string]$FunctionCmdletFlavor = 'None', + + [Parameter(Mandatory = $false)] + [System.Reflection.MethodInfo]$FriendMethodInfo = $null, + + [Parameter(Mandatory = $false)] + [System.Reflection.MethodInfo]$PageMethodInfo = $null ) . "$PSScriptRoot\Import-StringFunction.ps1"; @@ -115,7 +121,7 @@ function Generate-PsFunctionCommandImpl $code += $NEW_LINE; $code += $part2; - if ($cmdletFlavor -eq 'Verb' -and (-not ($methodName -eq 'PowerOff'))) + if ($FunctionCmdletFlavor -eq 'Verb') { # If the Cmdlet Flavor is 'Verb', generate the Verb-based cmdlet code $part3 = Get-VerbNounCmdletCode -ComponentName $componentName -OperationName $OperationName -MethodInfo $MethodInfo; @@ -394,6 +400,29 @@ $dynamic_param_assignment_code ${invoke_local_param_code_content} ${OperationName}Client.${methodName}(${invoke_params_join_str}); } +"@; + } + elseif ($PageMethodInfo -ne $null) + { + $invoke_cmdlt_source_template = +@" + protected void Execute${invoke_param_set_name}Method(object[] ${invoke_input_params_name}) + { +${invoke_local_param_code_content} + var result = ${OperationName}Client.${methodName}(${invoke_params_join_str}); + var resultList = result.ToList(); + var nextPageLink = result.NextPageLink; + while (!string.IsNullOrEmpty(nextPageLink)) + { + var pageResult = ${OperationName}Client.${methodName}Next(nextPageLink); + foreach (var pageItem in pageResult) + { + resultList.Add(pageItem); + } + nextPageLink = pageResult.NextPageLink; + } + WriteObject(resultList, true); + } "@; } else diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-CommonVariables.ps1 b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-CommonVariables.ps1 index 4689ea1b8411..953fddb21b63 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-CommonVariables.ps1 +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-CommonVariables.ps1 @@ -79,6 +79,8 @@ $component_name = $client_library_namespace.Substring($client_library_namespace. $all_return_type_names = @(); +$SKIP_METHOD_NAME_LIST = @('PowerOff', 'ListNext', 'ListAllNext', 'ListSkusNext'); + Write-Verbose $BAR_LINE; Write-Verbose "Input Parameters:"; Write-Verbose "DLL Folder = $dllFolder"; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-TypeFunction.ps1 b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-TypeFunction.ps1 index 73ecde0280f5..dbfe756198d2 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-TypeFunction.ps1 +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-TypeFunction.ps1 @@ -742,4 +742,43 @@ function CheckIf-SameParameterList } return $true; +} + +# Check if 2 methods are list-page relation +function CheckIf-ListAndPageMethods +{ + param + ( + [Parameter(Mandatory = $true)] + [System.Reflection.MethodInfo]$listMethodInfo, + + [Parameter(Mandatory = $true)] + [System.Reflection.MethodInfo]$pageMethodInfo + ) + + if ($listMethodInfo -eq $null -or $pageMethodInfo -eq $null) + { + return $false; + } + + if (-not (($listMethodInfo.Name.Replace('Async', '') + 'Next') -eq $pageMethodInfo.Name.Replace('Async', ''))) + { + return $false; + } + + $pageParams = $pageMethodInfo.GetParameters(); + Write-Verbose ('pageParams = ' + $pageParams); + # Skip the 1st 'operations' parameter, e.g. + # 1. Microsoft.Azure.Management.Compute.IVirtualMachineScaleSetVMsOperations operations + # 2. System.String nextPageLink + if ($pageParams.Count -eq 2) + { + $paramInfo = $pageParams[1]; + if ($paramInfo.ParameterType.IsEquivalentTo([string]) -and $paramInfo.Name -eq 'nextPageLink') + { + return $true; + } + } + + return $false; } \ No newline at end of file diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1 b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1 index ad2ecd5fd400..288643c26e7a 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1 +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1 @@ -1173,6 +1173,7 @@ else $qualified_methods = @(); $total_method_count = 0; [System.Collections.Hashtable]$friendMethodDict = @{}; + [System.Collections.Hashtable]$pageMethodDict = @{}; foreach ($mtItem in $methods) { [System.Reflection.MethodInfo]$methodInfo = $mtItem; @@ -1208,6 +1209,23 @@ else } } } + + # Handle Page Methods + if ($mtItem.Name -like 'List*' -and (-not $pageMethodDict.ContainsKey($mtItem.Name))) + { + $methods2 = Get-OperationMethods $operation_type; + foreach ($pageMethodInfo in $methods2) + { + if ($pageMethodInfo.Name -eq ($mtItem.Name + 'Next')) + { + if (CheckIf-ListAndPageMethods $methodInfo $pageMethodInfo) + { + $pageMethodDict.Add($mtItem.Name, $pageMethodInfo); + break; + } + } + } + } } $method_count = 0; @@ -1215,7 +1233,7 @@ else { [System.Reflection.MethodInfo]$methodInfo = $mtItem; $method_count++; - + # Get Friend Method (if any) $friendMethodInfo = $null; if ($friendMethodDict.ContainsKey($methodInfo.Name)) @@ -1226,13 +1244,38 @@ else $friendMethodMessage = ''; if ($friendMethodInfo -ne $null -and $friendMethodInfo.Name -ne $null) { - $friendMethodMessage = '(Friend: ' + ($friendMethodInfo.Name.Replace('Async', '')) + ')'; + $friendMethodMessage = 'Friend=' + ($friendMethodInfo.Name.Replace('Async', '')) + ''; + } + + # Get Page Method (if any) + $pageMethodInfo = $null; + if ($pageMethodDict.ContainsKey($methodInfo.Name)) + { + $pageMethodInfo = $pageMethodDict[$methodInfo.Name]; + } + + $pageMethodMessage = ''; + if ($pageMethodInfo -ne $null -and $pageMethodInfo.Name -ne $null) + { + $pageMethodMessage = 'Page=' + ($pageMethodInfo.Name.Replace('Async', '')) + ''; } # Output Info for Method Signature Write-Verbose ""; Write-Verbose $SEC_LINE; - Write-Verbose ("[${operation_type_count}] ${method_count}/${total_method_count} " + $methodInfo.Name.Replace('Async', '') + ' ' + $friendMethodMessage); + $methodMessage = "[${operation_type_count}] ${method_count}/${total_method_count} " + $methodInfo.Name.Replace('Async', ''); + if (($friendMethodMessage -ne '') -or ($pageMethodMessage -ne '')) + { + $methodMessage += ' {' + $friendMethodMessage; + if ($friendMethodMessage -ne '' -and $pageMethodMessage -ne '') + { + $methodMessage += ', '; + } + $methodMessage += $pageMethodMessage; + $methodMessage += '}'; + } + + Write-Verbose $methodMessage; foreach ($paramInfoItem in $methodInfo.GetParameters()) { [System.Reflection.ParameterInfo]$paramInfo = $paramInfoItem; @@ -1249,11 +1292,20 @@ else } Write-Verbose $SEC_LINE; + $opCmdletFlavor = $cmdletFlavor; + if ($SKIP_METHOD_NAME_LIST -contains $methodInfo.Name) + { + #Overwrite and skip these method's 'Verb' cmdlet flavor + $opCmdletFlavor = 'None'; + } + $outputs = (. $PSScriptRoot\Generate-FunctionCommand.ps1 -OperationName $opShortName ` -MethodInfo $methodInfo ` -ModelClassNameSpace $client_model_namespace ` -FileOutputFolder $opOutFolder ` - -FriendMethodInfo $friendMethodInfo); + -FunctionCmdletFlavor $opCmdletFlavor ` + -FriendMethodInfo $friendMethodInfo ` + -PageMethodInfo $pageMethodInfo); if ($outputs.Count -ne $null) { From 34596c6edc192aa798ffbdb3ba424e1cf963196a Mon Sep 17 00:00:00 2001 From: huangpf Date: Tue, 23 Feb 2016 10:49:24 -0800 Subject: [PATCH 2/2] Remove *Next Commands --- .../ScenarioTests/VirtualMachineScaleSetTests.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 index a927cb412a1c..095d925e18f1 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 @@ -29,16 +29,12 @@ Add-AzureRmVmssPublicKey 1.2.3 AzureRM.Compute Add-AzureRmVmssSecret 1.2.3 AzureRM.Compute Get-AzureRmVmss 1.2.3 AzureRM.Compute Get-AzureRmVmssAllList 1.2.3 AzureRM.Compute -Get-AzureRmVmssAllNextList 1.2.3 AzureRM.Compute Get-AzureRmVmssInstanceView 1.2.3 AzureRM.Compute Get-AzureRmVmssList 1.2.3 AzureRM.Compute -Get-AzureRmVmssNextList 1.2.3 AzureRM.Compute Get-AzureRmVmssSkusList 1.2.3 AzureRM.Compute -Get-AzureRmVmssSkusNextList 1.2.3 AzureRM.Compute Get-AzureRmVmssVM 1.2.3 AzureRM.Compute Get-AzureRmVmssVMInstanceView 1.2.3 AzureRM.Compute Get-AzureRmVmssVMList 1.2.3 AzureRM.Compute -Get-AzureRmVmssVMNextList 1.2.3 AzureRM.Compute New-AzureRmVmss 1.2.3 AzureRM.Compute New-AzureRmVmssConfig 1.2.3 AzureRM.Compute New-AzureRmVmssIpConfigurationConfig 1.2.3 AzureRM.Compute