Skip to content

Commit c823b7a

Browse files
committed
Combine ListAll Methods
1 parent 971bae8 commit c823b7a

File tree

5 files changed

+44
-39
lines changed

5 files changed

+44
-39
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Add-AzureRmVmssNetworkInterfaceConfiguration 1.2.3 AzureRM.Compute
2828
Add-AzureRmVmssPublicKey 1.2.3 AzureRM.Compute
2929
Add-AzureRmVmssSecret 1.2.3 AzureRM.Compute
3030
Get-AzureRmVmss 1.2.3 AzureRM.Compute
31-
Get-AzureRmVmssAllList 1.2.3 AzureRM.Compute
3231
Get-AzureRmVmssList 1.2.3 AzureRM.Compute
3332
Get-AzureRmVmssSkusList 1.2.3 AzureRM.Compute
3433
Get-AzureRmVmssVM 1.2.3 AzureRM.Compute
@@ -124,7 +123,7 @@ function Test-VirtualMachineScaleSet
124123

125124
$argList = New-AzureComputeArgumentList -MethodName VirtualMachineScaleSetsListAll;
126125
$args = ($argList | select -ExpandProperty Value);
127-
$vmssList = Get-AzureRmVmssAllList;
126+
$vmssList = Get-AzureRmVmssList -All;
128127
Assert-True { ($vmssList | select -ExpandProperty Name) -contains $vmssName };
129128
$output = $vmssList | Out-String;
130129
Write-Verbose ($output);

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,4 @@ protected PSArgument[] CreateVirtualMachineScaleSetListAllParameters()
7676
return ConvertFromObjectsToArguments(new string[0], new object[0]);
7777
}
7878
}
79-
80-
[Cmdlet("Get", "AzureRmVmssAllList", DefaultParameterSetName = "InvokeByDynamicParameters")]
81-
public partial class GetAzureRmVMSSAllList : InvokeAzureComputeMethodCmdlet
82-
{
83-
public GetAzureRmVMSSAllList()
84-
{
85-
}
86-
87-
public override string MethodName { get; set; }
88-
89-
protected override void ProcessRecord()
90-
{
91-
this.MethodName = "VirtualMachineScaleSetListAll";
92-
base.ProcessRecord();
93-
}
94-
95-
public override object GetDynamicParameters()
96-
{
97-
dynamicParameters = new RuntimeDefinedParameterDictionary();
98-
var pArgumentList = new RuntimeDefinedParameter();
99-
pArgumentList.Name = "ArgumentList";
100-
pArgumentList.ParameterType = typeof(object[]);
101-
pArgumentList.Attributes.Add(new ParameterAttribute
102-
{
103-
ParameterSetName = "InvokeByStaticParameters",
104-
Position = 1,
105-
Mandatory = true
106-
});
107-
pArgumentList.Attributes.Add(new AllowNullAttribute());
108-
dynamicParameters.Add("ArgumentList", pArgumentList);
109-
110-
return dynamicParameters;
111-
}
112-
}
11379
}

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

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ public GetAzureRmVMSSList()
105105

106106
protected override void ProcessRecord()
107107
{
108-
this.MethodName = "VirtualMachineScaleSetList";
108+
if (this.ParameterSetName == "InvokeByDynamicParameters")
109+
{
110+
this.MethodName = "VirtualMachineScaleSetList";
111+
}
112+
else
113+
{
114+
this.MethodName = "VirtualMachineScaleSetListAll";
115+
}
109116
base.ProcessRecord();
110117
}
111118

@@ -121,6 +128,12 @@ public override object GetDynamicParameters()
121128
Position = 1,
122129
Mandatory = false
123130
});
131+
pResourceGroupName.Attributes.Add(new ParameterAttribute
132+
{
133+
ParameterSetName = "InvokeByDynamicParametersForFriendMethod",
134+
Position = 1,
135+
Mandatory = false
136+
});
124137
pResourceGroupName.Attributes.Add(new AllowNullAttribute());
125138
dynamicParameters.Add("ResourceGroupName", pResourceGroupName);
126139

@@ -133,9 +146,33 @@ public override object GetDynamicParameters()
133146
Position = 2,
134147
Mandatory = true
135148
});
149+
pArgumentList.Attributes.Add(new ParameterAttribute
150+
{
151+
ParameterSetName = "InvokeByStaticParametersForFriendMethod",
152+
Position = 2,
153+
Mandatory = true
154+
});
136155
pArgumentList.Attributes.Add(new AllowNullAttribute());
137156
dynamicParameters.Add("ArgumentList", pArgumentList);
138157

158+
var pAll = new RuntimeDefinedParameter();
159+
pAll.Name = "All";
160+
pAll.ParameterType = typeof(SwitchParameter);
161+
pAll.Attributes.Add(new ParameterAttribute
162+
{
163+
ParameterSetName = "InvokeByDynamicParametersForFriendMethod",
164+
Position = 2,
165+
Mandatory = true
166+
});
167+
pAll.Attributes.Add(new ParameterAttribute
168+
{
169+
ParameterSetName = "InvokeByStaticParametersForFriendMethod",
170+
Position = 3,
171+
Mandatory = true
172+
});
173+
pAll.Attributes.Add(new AllowNullAttribute());
174+
dynamicParameters.Add("All", pAll);
175+
139176
return dynamicParameters;
140177
}
141178
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ $component_name = $client_library_namespace.Substring($client_library_namespace.
7979

8080
$all_return_type_names = @();
8181

82-
$SKIP_VERB_NOUN_CMDLET_LIST = @('PowerOff', 'ListNext', 'ListAllNext', 'ListSkusNext', 'GetInstanceView');
82+
$SKIP_VERB_NOUN_CMDLET_LIST = @('PowerOff', 'ListNext', 'ListAllNext', 'ListSkusNext', 'GetInstanceView', 'ListAll');
8383

8484
Write-Verbose $BAR_LINE;
8585
Write-Verbose "Input Parameters:";

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/RunCodeGeneration.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,13 +1197,16 @@ else
11971197
if (-not $friendMethodDict.ContainsKey($mtItem.Name))
11981198
{
11991199
$searchName = $null;
1200+
$matchedMethodInfo = $null;
12001201
if ($mtItem.Name -eq 'Deallocate')
12011202
{
12021203
$searchName = 'PowerOff';
1204+
$matchedMethodInfo = $methodInfo;
12031205
}
12041206
elseif ($mtItem.Name -eq 'Get')
12051207
{
12061208
$searchName = 'GetInstanceView';
1209+
$matchedMethodInfo = $methodInfo;
12071210
}
12081211
elseif ($mtItem.Name -eq 'List')
12091212
{
@@ -1213,7 +1216,7 @@ else
12131216
if ($searchName -ne $null)
12141217
{
12151218
$methods2 = Get-OperationMethods $operation_type;
1216-
$foundMethod = Find-MatchedMethod $searchName $methods2 $methodInfo;
1219+
$foundMethod = Find-MatchedMethod $searchName $methods2 $matchedMethodInfo;
12171220
if ($foundMethod -ne $null)
12181221
{
12191222
$friendMethodDict.Add($mtItem.Name, $foundMethod);

0 commit comments

Comments
 (0)