Skip to content

Commit 402dcb2

Browse files
committed
Merge pull request #142 from huangpf/vmss
Vmss
2 parents 662c2ca + 34596c6 commit 402dcb2

File tree

13 files changed

+177
-199
lines changed

13 files changed

+177
-199
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ Add-AzureRmVmssPublicKey 1.2.3 AzureRM.Compute
2929
Add-AzureRmVmssSecret 1.2.3 AzureRM.Compute
3030
Get-AzureRmVmss 1.2.3 AzureRM.Compute
3131
Get-AzureRmVmssAllList 1.2.3 AzureRM.Compute
32-
Get-AzureRmVmssAllNextList 1.2.3 AzureRM.Compute
3332
Get-AzureRmVmssInstanceView 1.2.3 AzureRM.Compute
3433
Get-AzureRmVmssList 1.2.3 AzureRM.Compute
35-
Get-AzureRmVmssNextList 1.2.3 AzureRM.Compute
3634
Get-AzureRmVmssSkusList 1.2.3 AzureRM.Compute
37-
Get-AzureRmVmssSkusNextList 1.2.3 AzureRM.Compute
3835
Get-AzureRmVmssVM 1.2.3 AzureRM.Compute
3936
Get-AzureRmVmssVMInstanceView 1.2.3 AzureRM.Compute
4037
Get-AzureRmVmssVMList 1.2.3 AzureRM.Compute
41-
Get-AzureRmVmssVMNextList 1.2.3 AzureRM.Compute
4238
New-AzureRmVmss 1.2.3 AzureRM.Compute
4339
New-AzureRmVmssConfig 1.2.3 AzureRM.Compute
4440
New-AzureRmVmssIpConfigurationConfig 1.2.3 AzureRM.Compute
@@ -182,7 +178,7 @@ function Test-VirtualMachineScaleSet
182178
}
183179

184180
# List Next (negative test)
185-
Assert-ThrowsContains { Get-AzureRmVmssNextList -NextPageLink test.com } "Invalid URI: The format of the URI could not be determined.";
181+
# Assert-ThrowsContains { Get-AzureRmVmssNextList -NextPageLink test.com } "Invalid URI: The format of the URI could not be determined.";
186182

187183
# Stop/Start/Restart Operation
188184
for ($i = 0; $i -lt 2; $i++)

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllMethod.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ protected void ExecuteVirtualMachineScaleSetListAllMethod(object[] invokeMethodI
5454
{
5555

5656
var result = VirtualMachineScaleSetsClient.ListAll();
57-
WriteObject(result);
57+
var resultList = result.ToList();
58+
var nextPageLink = result.NextPageLink;
59+
while (!string.IsNullOrEmpty(nextPageLink))
60+
{
61+
var pageResult = VirtualMachineScaleSetsClient.ListAllNext(nextPageLink);
62+
foreach (var pageItem in pageResult)
63+
{
64+
resultList.Add(pageItem);
65+
}
66+
nextPageLink = pageResult.NextPageLink;
67+
}
68+
WriteObject(resultList, true);
5869
}
5970
}
6071

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListAllNextMethod.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListAllNextParameters()
8282
new object[] { nextPageLink });
8383
}
8484
}
85-
86-
[Cmdlet("Get", "AzureRmVmssAllNextList", DefaultParameterSetName = "InvokeByDynamicParameters")]
87-
public partial class GetAzureRmVMSSAllNextList : InvokeAzureComputeMethodCmdlet
88-
{
89-
public GetAzureRmVMSSAllNextList()
90-
{
91-
}
92-
93-
public override string MethodName { get; set; }
94-
95-
protected override void ProcessRecord()
96-
{
97-
this.MethodName = "VirtualMachineScaleSetListAllNext";
98-
base.ProcessRecord();
99-
}
100-
101-
public override object GetDynamicParameters()
102-
{
103-
dynamicParameters = new RuntimeDefinedParameterDictionary();
104-
var pNextPageLink = new RuntimeDefinedParameter();
105-
pNextPageLink.Name = "NextPageLink";
106-
pNextPageLink.ParameterType = typeof(string);
107-
pNextPageLink.Attributes.Add(new ParameterAttribute
108-
{
109-
ParameterSetName = "InvokeByDynamicParameters",
110-
Position = 1,
111-
Mandatory = false
112-
});
113-
pNextPageLink.Attributes.Add(new AllowNullAttribute());
114-
dynamicParameters.Add("NextPageLink", pNextPageLink);
115-
116-
var pArgumentList = new RuntimeDefinedParameter();
117-
pArgumentList.Name = "ArgumentList";
118-
pArgumentList.ParameterType = typeof(object[]);
119-
pArgumentList.Attributes.Add(new ParameterAttribute
120-
{
121-
ParameterSetName = "InvokeByStaticParameters",
122-
Position = 2,
123-
Mandatory = true
124-
});
125-
pArgumentList.Attributes.Add(new AllowNullAttribute());
126-
dynamicParameters.Add("ArgumentList", pArgumentList);
127-
128-
return dynamicParameters;
129-
}
130-
}
13185
}

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListMethod.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ protected void ExecuteVirtualMachineScaleSetListMethod(object[] invokeMethodInpu
6767
string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
6868

6969
var result = VirtualMachineScaleSetsClient.List(resourceGroupName);
70-
WriteObject(result);
70+
var resultList = result.ToList();
71+
var nextPageLink = result.NextPageLink;
72+
while (!string.IsNullOrEmpty(nextPageLink))
73+
{
74+
var pageResult = VirtualMachineScaleSetsClient.ListNext(nextPageLink);
75+
foreach (var pageItem in pageResult)
76+
{
77+
resultList.Add(pageItem);
78+
}
79+
nextPageLink = pageResult.NextPageLink;
80+
}
81+
WriteObject(resultList, true);
7182
}
7283
}
7384

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListNextMethod.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListNextParameters()
8282
new object[] { nextPageLink });
8383
}
8484
}
85-
86-
[Cmdlet("Get", "AzureRmVmssNextList", DefaultParameterSetName = "InvokeByDynamicParameters")]
87-
public partial class GetAzureRmVMSSNextList : InvokeAzureComputeMethodCmdlet
88-
{
89-
public GetAzureRmVMSSNextList()
90-
{
91-
}
92-
93-
public override string MethodName { get; set; }
94-
95-
protected override void ProcessRecord()
96-
{
97-
this.MethodName = "VirtualMachineScaleSetListNext";
98-
base.ProcessRecord();
99-
}
100-
101-
public override object GetDynamicParameters()
102-
{
103-
dynamicParameters = new RuntimeDefinedParameterDictionary();
104-
var pNextPageLink = new RuntimeDefinedParameter();
105-
pNextPageLink.Name = "NextPageLink";
106-
pNextPageLink.ParameterType = typeof(string);
107-
pNextPageLink.Attributes.Add(new ParameterAttribute
108-
{
109-
ParameterSetName = "InvokeByDynamicParameters",
110-
Position = 1,
111-
Mandatory = false
112-
});
113-
pNextPageLink.Attributes.Add(new AllowNullAttribute());
114-
dynamicParameters.Add("NextPageLink", pNextPageLink);
115-
116-
var pArgumentList = new RuntimeDefinedParameter();
117-
pArgumentList.Name = "ArgumentList";
118-
pArgumentList.ParameterType = typeof(object[]);
119-
pArgumentList.Attributes.Add(new ParameterAttribute
120-
{
121-
ParameterSetName = "InvokeByStaticParameters",
122-
Position = 2,
123-
Mandatory = true
124-
});
125-
pArgumentList.Attributes.Add(new AllowNullAttribute());
126-
dynamicParameters.Add("ArgumentList", pArgumentList);
127-
128-
return dynamicParameters;
129-
}
130-
}
13185
}

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusMethod.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,18 @@ protected void ExecuteVirtualMachineScaleSetListSkusMethod(object[] invokeMethod
8080
string vmScaleSetName = (string)ParseParameter(invokeMethodInputParameters[1]);
8181

8282
var result = VirtualMachineScaleSetsClient.ListSkus(resourceGroupName, vmScaleSetName);
83-
WriteObject(result);
83+
var resultList = result.ToList();
84+
var nextPageLink = result.NextPageLink;
85+
while (!string.IsNullOrEmpty(nextPageLink))
86+
{
87+
var pageResult = VirtualMachineScaleSetsClient.ListSkusNext(nextPageLink);
88+
foreach (var pageItem in pageResult)
89+
{
90+
resultList.Add(pageItem);
91+
}
92+
nextPageLink = pageResult.NextPageLink;
93+
}
94+
WriteObject(resultList, true);
8495
}
8596
}
8697

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetListSkusNextMethod.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListSkusNextParameters()
8282
new object[] { nextPageLink });
8383
}
8484
}
85-
86-
[Cmdlet("Get", "AzureRmVmssSkusNextList", DefaultParameterSetName = "InvokeByDynamicParameters")]
87-
public partial class GetAzureRmVMSSSkusNextList : InvokeAzureComputeMethodCmdlet
88-
{
89-
public GetAzureRmVMSSSkusNextList()
90-
{
91-
}
92-
93-
public override string MethodName { get; set; }
94-
95-
protected override void ProcessRecord()
96-
{
97-
this.MethodName = "VirtualMachineScaleSetListSkusNext";
98-
base.ProcessRecord();
99-
}
100-
101-
public override object GetDynamicParameters()
102-
{
103-
dynamicParameters = new RuntimeDefinedParameterDictionary();
104-
var pNextPageLink = new RuntimeDefinedParameter();
105-
pNextPageLink.Name = "NextPageLink";
106-
pNextPageLink.ParameterType = typeof(string);
107-
pNextPageLink.Attributes.Add(new ParameterAttribute
108-
{
109-
ParameterSetName = "InvokeByDynamicParameters",
110-
Position = 1,
111-
Mandatory = false
112-
});
113-
pNextPageLink.Attributes.Add(new AllowNullAttribute());
114-
dynamicParameters.Add("NextPageLink", pNextPageLink);
115-
116-
var pArgumentList = new RuntimeDefinedParameter();
117-
pArgumentList.Name = "ArgumentList";
118-
pArgumentList.ParameterType = typeof(object[]);
119-
pArgumentList.Attributes.Add(new ParameterAttribute
120-
{
121-
ParameterSetName = "InvokeByStaticParameters",
122-
Position = 2,
123-
Mandatory = true
124-
});
125-
pArgumentList.Attributes.Add(new AllowNullAttribute());
126-
dynamicParameters.Add("ArgumentList", pArgumentList);
127-
128-
return dynamicParameters;
129-
}
130-
}
13185
}

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListMethod.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,18 @@ protected void ExecuteVirtualMachineScaleSetVMListMethod(object[] invokeMethodIn
9494
string select = (string)ParseParameter(invokeMethodInputParameters[3]);
9595

9696
var result = VirtualMachineScaleSetVMsClient.List(resourceGroupName, virtualMachineScaleSetName, odataQuery, select);
97-
WriteObject(result);
97+
var resultList = result.ToList();
98+
var nextPageLink = result.NextPageLink;
99+
while (!string.IsNullOrEmpty(nextPageLink))
100+
{
101+
var pageResult = VirtualMachineScaleSetVMsClient.ListNext(nextPageLink);
102+
foreach (var pageItem in pageResult)
103+
{
104+
resultList.Add(pageItem);
105+
}
106+
nextPageLink = pageResult.NextPageLink;
107+
}
108+
WriteObject(resultList, true);
98109
}
99110
}
100111

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMListNextMethod.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,50 +82,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetVMListNextParameters()
8282
new object[] { nextPageLink });
8383
}
8484
}
85-
86-
[Cmdlet("Get", "AzureRmVmssVMNextList", DefaultParameterSetName = "InvokeByDynamicParameters")]
87-
public partial class GetAzureRmVMSSVMNextList : InvokeAzureComputeMethodCmdlet
88-
{
89-
public GetAzureRmVMSSVMNextList()
90-
{
91-
}
92-
93-
public override string MethodName { get; set; }
94-
95-
protected override void ProcessRecord()
96-
{
97-
this.MethodName = "VirtualMachineScaleSetVMListNext";
98-
base.ProcessRecord();
99-
}
100-
101-
public override object GetDynamicParameters()
102-
{
103-
dynamicParameters = new RuntimeDefinedParameterDictionary();
104-
var pNextPageLink = new RuntimeDefinedParameter();
105-
pNextPageLink.Name = "NextPageLink";
106-
pNextPageLink.ParameterType = typeof(string);
107-
pNextPageLink.Attributes.Add(new ParameterAttribute
108-
{
109-
ParameterSetName = "InvokeByDynamicParameters",
110-
Position = 1,
111-
Mandatory = false
112-
});
113-
pNextPageLink.Attributes.Add(new AllowNullAttribute());
114-
dynamicParameters.Add("NextPageLink", pNextPageLink);
115-
116-
var pArgumentList = new RuntimeDefinedParameter();
117-
pArgumentList.Name = "ArgumentList";
118-
pArgumentList.ParameterType = typeof(object[]);
119-
pArgumentList.Attributes.Add(new ParameterAttribute
120-
{
121-
ParameterSetName = "InvokeByStaticParameters",
122-
Position = 2,
123-
Mandatory = true
124-
});
125-
pArgumentList.Attributes.Add(new AllowNullAttribute());
126-
dynamicParameters.Add("ArgumentList", pArgumentList);
127-
128-
return dynamicParameters;
129-
}
130-
}
13185
}

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ param
2828
[string]$FileOutputFolder,
2929

3030
[Parameter(Mandatory = $false)]
31-
[System.Reflection.MethodInfo]$FriendMethodInfo = $null
31+
[string]$FunctionCmdletFlavor = 'None',
32+
33+
[Parameter(Mandatory = $false)]
34+
[System.Reflection.MethodInfo]$FriendMethodInfo = $null,
35+
36+
[Parameter(Mandatory = $false)]
37+
[System.Reflection.MethodInfo]$PageMethodInfo = $null
3238
)
3339

3440
. "$PSScriptRoot\Import-StringFunction.ps1";
@@ -115,7 +121,7 @@ function Generate-PsFunctionCommandImpl
115121
$code += $NEW_LINE;
116122
$code += $part2;
117123

118-
if ($cmdletFlavor -eq 'Verb' -and (-not ($methodName -eq 'PowerOff')))
124+
if ($FunctionCmdletFlavor -eq 'Verb')
119125
{
120126
# If the Cmdlet Flavor is 'Verb', generate the Verb-based cmdlet code
121127
$part3 = Get-VerbNounCmdletCode -ComponentName $componentName -OperationName $OperationName -MethodInfo $MethodInfo;
@@ -394,6 +400,29 @@ $dynamic_param_assignment_code
394400
${invoke_local_param_code_content}
395401
${OperationName}Client.${methodName}(${invoke_params_join_str});
396402
}
403+
"@;
404+
}
405+
elseif ($PageMethodInfo -ne $null)
406+
{
407+
$invoke_cmdlt_source_template =
408+
@"
409+
protected void Execute${invoke_param_set_name}Method(object[] ${invoke_input_params_name})
410+
{
411+
${invoke_local_param_code_content}
412+
var result = ${OperationName}Client.${methodName}(${invoke_params_join_str});
413+
var resultList = result.ToList();
414+
var nextPageLink = result.NextPageLink;
415+
while (!string.IsNullOrEmpty(nextPageLink))
416+
{
417+
var pageResult = ${OperationName}Client.${methodName}Next(nextPageLink);
418+
foreach (var pageItem in pageResult)
419+
{
420+
resultList.Add(pageItem);
421+
}
422+
nextPageLink = pageResult.NextPageLink;
423+
}
424+
WriteObject(resultList, true);
425+
}
397426
"@;
398427
}
399428
else

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-CommonVariables.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ $component_name = $client_library_namespace.Substring($client_library_namespace.
7979

8080
$all_return_type_names = @();
8181

82+
$SKIP_METHOD_NAME_LIST = @('PowerOff', 'ListNext', 'ListAllNext', 'ListSkusNext');
83+
8284
Write-Verbose $BAR_LINE;
8385
Write-Verbose "Input Parameters:";
8486
Write-Verbose "DLL Folder = $dllFolder";

0 commit comments

Comments
 (0)