-
Notifications
You must be signed in to change notification settings - Fork 3
Update Powershell Autogenerator for VMSS #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5b35659
0a2672c
9c11951
c15aa7f
ad1eaf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,11 @@ function Test-VirtualMachineScaleSet | |
|
||
# List All | ||
Write-Verbose ('Running Command : ' + 'Get-AzureVMSSAllList'); | ||
$vmssList = Get-AzureVMSSAllList -VirtualMachineScaleSetListAllParameters $null; | ||
|
||
$argList = New-AzureComputeArgumentList -MethodName VirtualMachineScaleSetListAll; | ||
$args = ($argList | select -ExpandProperty Value); | ||
#$vmssList = Invoke-AzureComputeMethod -MethodName VirtualMachineScaleSetListAll -ArgumentList $args; | ||
$vmssList = Get-AzureVMSSAllList; | ||
Assert-True { ($vmssList.VirtualMachineScaleSets | select -ExpandProperty Name) -contains $vmss.Name }; | ||
$output = $vmssList | Out-String; | ||
Write-Verbose ($output); | ||
|
@@ -155,12 +159,14 @@ function Test-VirtualMachineScaleSet | |
Assert-True { $output.Contains("VirtualMachineScaleSetSku") }; | ||
|
||
# List All VMs | ||
$vmListParams = New-AzureComputeParameterObject -FriendlyName VirtualMachineScaleSetVMListParameters; | ||
$vmListParams.ResourceGroupName = $rgname; | ||
$vmListParams.VirtualMachineScaleSetName = $vmss.Name; | ||
|
||
Write-Verbose ('Running Command : ' + 'Get-AzureVMSSVMList'); | ||
$vmListResult = Get-AzureVMSSVMList -VirtualMachineScaleSetVMListParameters $vmListParams; | ||
|
||
$argList = New-AzureComputeArgumentList -MethodName VirtualMachineScaleSetVMList; | ||
$argList[2].Value = $rgname; | ||
$argList[4].Value = $vmss.Name; | ||
$args = ($argList | select -ExpandProperty Value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
#$vmListResult = Invoke-AzureComputeMethod -MethodName VirtualMachineScaleSetVMList -ArgumentList $args; | ||
$vmListResult = Get-AzureVMSSVMList -ResourceGroupName $rgname -VirtualMachineScaleSetName $vmss.Name; | ||
$output = $vmListResult | Out-String; | ||
Write-Verbose ($output); | ||
Assert-True { $output.Contains("VirtualMachineScaleSetVM") }; | ||
|
@@ -202,11 +208,23 @@ function Test-VirtualMachineScaleSet | |
$st = Start-AzureVMSS -ResourceGroupName $rgname -VMScaleSetName $vmss.Name; | ||
$st = Restart-AzureVMSS -ResourceGroupName $rgname -VMScaleSetName $vmss.Name; | ||
|
||
$instanceListParam = New-AzureComputeParameterObject -FriendlyName VirtualMachineScaleSetVMInstanceIDs; | ||
$instanceListParam = @(); | ||
for ($i = 0; $i -lt $vmList.Count; $i++) | ||
{ | ||
$instanceListParam.InstanceIDs.Add($i); | ||
$instanceListParam += $i.ToString(); | ||
} | ||
|
||
$argList = New-AzureComputeArgumentList -MethodName VirtualMachineScaleSetPowerOffInstances; | ||
$argList[0].Value = $rgname; | ||
$argList[1].Value = $vmss.Name; | ||
$argList[2].Value = $instanceListParam; | ||
$args = @() | ||
for ($i = 0; $i -lt $argList.Length; $i++) | ||
{ | ||
$args += , $argList[$i].Value; | ||
} | ||
|
||
#$vmssResult = Invoke-AzureComputeMethod -MethodName VirtualMachineScaleSetPowerOffInstances -ArgumentList $args; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm testing both Invoke-AzureComputeMethod and the cmdlets itself. I don't have the subscription for VMSS, so I tested both using playback mode, and that is why I commented out Invoke-AzureComputeMethod part after I testing it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there are some breaking changes on the service side, maybe we shall re-record the tests sometime. Thanks~ |
||
$st = Stop-AzureVMSSInstances -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -VMInstanceIDs $instanceListParam; | ||
$st = Stop-AzureVMSSInstancesWithDeallocation -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -VMInstanceIDs $instanceListParam; | ||
$st = Start-AzureVMSSInstances -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -VMInstanceIDs $instanceListParam; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ protected object CreateVirtualMachineScaleSetCreateOrUpdateDynamicParameters() | |
dynamicParameters = new RuntimeDefinedParameterDictionary(); | ||
var pResourceGroupName = new RuntimeDefinedParameter(); | ||
pResourceGroupName.Name = "ResourceGroupName"; | ||
pResourceGroupName.ParameterType = typeof(System.String); | ||
pResourceGroupName.ParameterType = typeof(string); | ||
pResourceGroupName.Attributes.Add(new ParameterAttribute | ||
{ | ||
ParameterSetName = "InvokeByDynamicParameters", | ||
|
@@ -49,7 +49,7 @@ protected object CreateVirtualMachineScaleSetCreateOrUpdateDynamicParameters() | |
|
||
var pParameters = new RuntimeDefinedParameter(); | ||
pParameters.Name = "VirtualMachineScaleSetCreateOrUpdateParameters"; | ||
pParameters.ParameterType = typeof(Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet); | ||
pParameters.ParameterType = typeof(VirtualMachineScaleSet); | ||
pParameters.Attributes.Add(new ParameterAttribute | ||
{ | ||
ParameterSetName = "InvokeByDynamicParameters", | ||
|
@@ -91,11 +91,13 @@ protected PSArgument[] CreateVirtualMachineScaleSetCreateOrUpdateParameters() | |
string resourceGroupName = string.Empty; | ||
VirtualMachineScaleSet parameters = new VirtualMachineScaleSet(); | ||
|
||
return ConvertFromObjectsToArguments(new string[] { "ResourceGroupName", "Parameters" }, new object[] { resourceGroupName, parameters }); | ||
return ConvertFromObjectsToArguments( | ||
new string[] { "ResourceGroupName", "Parameters" }, | ||
new object[] { resourceGroupName, parameters }); | ||
} | ||
} | ||
|
||
[Cmdlet("New", "AzureVMSS")] | ||
[Cmdlet("New", "AzureVmss", DefaultParameterSetName = "InvokeByDynamicParameters")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
public partial class NewAzureVMSS : InvokeAzureComputeMethodCmdlet | ||
{ | ||
public NewAzureVMSS() | ||
|
@@ -115,7 +117,7 @@ public override object GetDynamicParameters() | |
dynamicParameters = new RuntimeDefinedParameterDictionary(); | ||
var pResourceGroupName = new RuntimeDefinedParameter(); | ||
pResourceGroupName.Name = "ResourceGroupName"; | ||
pResourceGroupName.ParameterType = typeof(System.String); | ||
pResourceGroupName.ParameterType = typeof(string); | ||
pResourceGroupName.Attributes.Add(new ParameterAttribute | ||
{ | ||
ParameterSetName = "InvokeByDynamicParameters", | ||
|
@@ -127,7 +129,7 @@ public override object GetDynamicParameters() | |
|
||
var pParameters = new RuntimeDefinedParameter(); | ||
pParameters.Name = "VirtualMachineScaleSetCreateOrUpdateParameters"; | ||
pParameters.ParameterType = typeof(Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet); | ||
pParameters.ParameterType = typeof(VirtualMachineScaleSet); | ||
pParameters.Attributes.Add(new ParameterAttribute | ||
{ | ||
ParameterSetName = "InvokeByDynamicParameters", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this parameter not used anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above