Skip to content

Commit dae821f

Browse files
committed
Merge pull request #154 from huangpf/vmss
Vmss
2 parents 6e206b4 + 389b6a8 commit dae821f

File tree

11 files changed

+1260
-1162
lines changed

11 files changed

+1260
-1162
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/GetAzureRmVMAEMExtension.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ public override void ExecuteCmdlet()
127127
});
128128
}
129129

130-
private void WriteInformation(string message, params string[] args)
131-
{
132-
base.WriteInformation(String.Format(message, args), new string[0]);
133-
}
134-
135130
private void WriteVerbose(string message, params object[] args)
136131
{
137132
base.WriteVerbose(String.Format(message, args));

src/ResourceManager/Profile/Commands.Profile.Test/ProfileModuleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.Profile.Test
2020
{
2121
public class ProfileModuleTests
2222
{
23-
[Fact(Skip="Removed flaky test from CI.")]
23+
[Fact]
2424
[Trait(Category.AcceptanceType, Category.CheckIn)]
2525
public void WarningOnIncompatibleVersions()
2626
{

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Create-ParameterObject.ps1

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,27 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
param(
16-
[Parameter(Mandatory = $true)]
17-
[System.Type]$typeInfo = $null
15+
[CmdletBinding(DefaultParameterSetName = "ByTypeInfo")]
16+
param
17+
(
18+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByTypeInfo')]
19+
[System.Type]$TypeInfo = $null,
20+
21+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByFullTypeNameAndDllPath')]
22+
[string]$TypeFullName = $null,
23+
24+
[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByFullTypeNameAndDllPath')]
25+
[string]$DllFullPath = $null
1826
)
1927

2028
function Create-ParameterObjectImpl
2129
{
22-
param(
23-
[Parameter(Mandatory = $True)]
30+
param
31+
(
32+
[Parameter(Mandatory = $true)]
2433
[System.Type]$typeInfo,
2534

26-
[Parameter(Mandatory = $True)]
35+
[Parameter(Mandatory = $true)]
2736
[System.Collections.Hashtable]$typeList
2837
)
2938

@@ -34,32 +43,32 @@ function Create-ParameterObjectImpl
3443

3544
if ($typeInfo.FullName -like "Microsoft.*Azure.Management.*.*" -and (-not ($typeInfo.FullName -like "Microsoft.*Azure.Management.*.SubResource")))
3645
{
37-
$typeList.Add($typeInfo.FullName, $typeInfo);
46+
$st = $typeList.Add($typeInfo.FullName, $typeInfo);
3847
}
3948

4049
if ($typeInfo.FullName -eq 'System.String' -or $typeInfo.FullName -eq 'string')
4150
{
42-
return '';
51+
$obj = '';
4352
}
44-
if ($typeInfo.FullName -eq 'System.Uri')
53+
elseif ($typeInfo.FullName -eq 'System.Uri')
4554
{
46-
return '' -as 'System.Uri';
55+
$obj = '' -as 'System.Uri';
4756
}
4857
elseif ($typeInfo.FullName -eq 'System.Boolean')
4958
{
50-
return $false;
59+
$obj = $false;
5160
}
5261
elseif ($typeInfo.FullName -eq 'System.Int32')
5362
{
54-
return 0;
63+
$obj = 0;
5564
}
5665
elseif ($typeInfo.FullName -eq 'System.UInt32')
5766
{
58-
return 0;
67+
$obj = 0;
5968
}
6069
elseif ($typeInfo.FullName -eq 'System.Byte[]')
6170
{
62-
return New-Object -TypeName System.Byte[] -ArgumentList 0;
71+
$obj = New-Object -TypeName System.Byte[] -ArgumentList 0;
6372
}
6473
elseif ($typeInfo.FullName -like 'System.Collections.Generic.IList*' -or $typeInfo.FullName -like 'System.Collections.Generic.List*')
6574
{
@@ -70,16 +79,16 @@ function Create-ParameterObjectImpl
7079
$listObj = New-Object -TypeName $typeName;
7180
$listObj.Add($itemObj);
7281

73-
return $listObj;
82+
$obj = $listObj;
7483
}
7584
elseif ($typeInfo.FullName -like 'System.Collections.Generic.IDictionary*')
7685
{
7786
# Dictionary in client library always consists of string key & values.
78-
return New-Object 'System.Collections.Generic.Dictionary[string,string]';
87+
$obj = New-Object 'System.Collections.Generic.Dictionary[string,string]';
7988
}
8089
elseif ($typeInfo.FullName -like 'System.Nullable*')
8190
{
82-
return $null;
91+
$obj = $null;
8392
}
8493
else
8594
{
@@ -101,19 +110,28 @@ function Create-ParameterObjectImpl
101110
$listTypeName = "System.Collections.Generic.List[" + $itemType.FullName + "]";
102111

103112
$propObjList = New-Object -TypeName $listTypeName;
104-
$propObjList.Add($itemObj);
113+
$st = $propObjList.Add($itemObj);
105114

106-
$prop.SetValue($obj, $propObjList -as $listTypeName);
115+
$st = $prop.SetValue($obj, $propObjList -as $listTypeName);
107116
}
108117
else
109118
{
110119
$propObj = Create-ParameterObjectImpl $prop.PropertyType $typeList;
111-
$prop.SetValue($obj, $propObj);
120+
$st = $prop.SetValue($obj, $propObj);
112121
}
113122
}
114123
}
115124

125+
$st = $typeList.Remove($typeInfo.FullName);
126+
116127
return $obj;
117128
}
118129

119-
Write-Output (Create-ParameterObjectImpl $typeInfo @{});
130+
if (($TypeFullName -ne $null) -and ($TypeFullName.Trim() -ne ''))
131+
{
132+
. "$PSScriptRoot\Import-AssemblyFunction.ps1";
133+
$dll = Load-AssemblyFile $DllFullPath;
134+
$TypeInfo = $dll.GetType($TypeFullName);
135+
}
136+
137+
Write-Output (Create-ParameterObjectImpl $TypeInfo @{});

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Create-ParameterTree.ps1

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
param(
16-
[Parameter(Mandatory = $true)]
17-
[System.Type]$TypeInfo,
18-
19-
[Parameter(Mandatory = $true)]
15+
[CmdletBinding(DefaultParameterSetName = "ByTypeInfo")]
16+
param
17+
(
18+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByTypeInfo')]
19+
[System.Type]$TypeInfo = $null,
20+
21+
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByFullTypeNameAndDllPath')]
22+
[string]$TypeFullName = $null,
23+
24+
[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByFullTypeNameAndDllPath')]
25+
[string]$DllFullPath = $null,
26+
27+
[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByTypeInfo')]
28+
[Parameter(Mandatory = $true, Position = 2, ParameterSetName = 'ByFullTypeNameAndDllPath')]
2029
[string]$NameSpace,
2130

22-
[Parameter(Mandatory = $false)]
31+
[Parameter(Mandatory = $false, Position = 2, ParameterSetName = 'ByTypeInfo')]
32+
[Parameter(Mandatory = $false, Position = 3, ParameterSetName = 'ByFullTypeNameAndDllPath')]
2333
[string]$ParameterName = $null
2434
)
2535

@@ -174,4 +184,11 @@ function Create-ParameterTreeImpl
174184
}
175185
}
176186

187+
if (($TypeFullName -ne $null) -and ($TypeFullName.Trim() -ne ''))
188+
{
189+
. "$PSScriptRoot\Import-AssemblyFunction.ps1";
190+
$dll = Load-AssemblyFile $DllFullPath;
191+
$TypeInfo = $dll.GetType($TypeFullName);
192+
}
193+
177194
Write-Output (Create-ParameterTreeImpl $ParameterName $TypeInfo @{});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ $cmdlet_remove_object_code
10991099
$fileFullPath = $OutputFolder + $cmdlet_class_name + ".cs";
11001100
$full_code = $code_common_header + "`r`n`r`n" + $code_usings + "`r`n" + $cmdlet_class_code + "`r`n" + $cmdlet_code_body;
11011101

1102-
Set-Content -Path $fileFullPath -Value $full_code -Force;
1102+
Set-FileContent -Path $fileFullPath -Value $full_code;
11031103
}
11041104

11051105
# Decide the name of cmdlet verb

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

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ $code_common_header =
7373
// code is regenerated.
7474
"@;
7575

76-
$client_model_namespace = $client_library_namespace + '.Models';
77-
$is_hyak_mode = $client_library_namespace -like "Microsoft.WindowsAzure.*.*";
78-
$component_name = $client_library_namespace.Substring($client_library_namespace.LastIndexOf('.') + 1);
76+
$clientModelNameSpace = $clientNameSpace + '.Models';
77+
$is_hyak_mode = $clientNameSpace -like "Microsoft.WindowsAzure.*.*";
78+
$component_name = $clientNameSpace.Substring($clientNameSpace.LastIndexOf('.') + 1);
7979

8080
$all_return_type_names = @();
8181

@@ -85,25 +85,49 @@ Write-Verbose $BAR_LINE;
8585
Write-Verbose "Input Parameters:";
8686
Write-Verbose "DLL Folder = $dllFolder";
8787
Write-Verbose "Out Folder = $outFolder";
88-
Write-Verbose "Client NameSpace = $client_library_namespace";
89-
Write-Verbose "Model NameSpace = $client_model_namespace";
88+
Write-Verbose "Client NameSpace = $clientNameSpace";
89+
Write-Verbose "Model NameSpace = $clientModelNameSpace";
9090
Write-Verbose "Component Name = $component_name";
9191
Write-Verbose "Base Cmdlet Full Name = $baseCmdletFullName";
92-
Write-Verbose "Base Client Name = $base_class_client_field";
92+
Write-Verbose "Base Client Full Name = $baseClientFullName";
9393
Write-Verbose "Cmdlet Flavor = $cmdletFlavor";
9494
Write-Verbose "Operation Name Filter = $operationNameFilter";
9595
Write-Verbose $BAR_LINE;
9696
Write-Verbose "${new_line_str}";
9797

98-
$code_common_namespace = ($client_library_namespace.Replace('.Management.', '.Commands.')) + '.Automation';
99-
$code_model_namespace = ($client_library_namespace.Replace('.Management.', '.Commands.')) + '.Automation.Models';
98+
$code_common_namespace = ($clientNameSpace.Replace('.Management.', '.Commands.')) + '.Automation';
99+
$code_model_namespace = ($clientNameSpace.Replace('.Management.', '.Commands.')) + '.Automation.Models';
100100

101101
function Get-SortedUsingsCode
102102
{
103-
$list_of_usings = @() + $code_common_usings + $client_library_namespace + $client_model_namespace + $code_model_namespace;
103+
$list_of_usings = @() + $code_common_usings + $clientNameSpace + $clientModelNameSpace + $code_model_namespace;
104104
$sorted_usings = $list_of_usings | Sort-Object -Unique | foreach { "using ${_};" };
105105
$text = [string]::Join($NEW_LINE, $sorted_usings);
106106
return $text;
107107
}
108108

109-
$code_using_strs = Get-SortedUsingsCode;
109+
$code_using_strs = Get-SortedUsingsCode;
110+
111+
function Get-RomanNumeral
112+
{
113+
param
114+
(
115+
[Parameter(Mandatory = $true)]
116+
$number
117+
)
118+
119+
if ($number -ge 1000) { return "M" + (Get-RomanNumeral ($number - 1000)); }
120+
if ($number -ge 900) { return "CM" + (Get-RomanNumeral ($number - 900)); }
121+
if ($number -ge 500) { return "D" + (Get-RomanNumeral ($number - 500)); }
122+
if ($number -ge 400) { return "CD" + (Get-RomanNumeral ($number - 400)); }
123+
if ($number -ge 100) { return "C" + (Get-RomanNumeral ($number - 100)); }
124+
if ($number -ge 90) { return "XC" + (Get-RomanNumeral ($number - 90)); }
125+
if ($number -ge 50) { return "L" + (Get-RomanNumeral ($number - 50)); }
126+
if ($number -ge 40) { return "XL" + (Get-RomanNumeral ($number - 40)); }
127+
if ($number -ge 10) { return "X" + (Get-RomanNumeral ($number - 10)); }
128+
if ($number -ge 9) { return "IX" + (Get-RomanNumeral ($number - 9)); }
129+
if ($number -ge 5) { return "V" + (Get-RomanNumeral ($number - 5)); }
130+
if ($number -ge 4) { return "IV" + (Get-RomanNumeral ($number - 4)); }
131+
if ($number -ge 1) { return "I" + (Get-RomanNumeral ($number - 1)); }
132+
return "";
133+
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function Get-NormalizedTypeName
202202
}
203203

204204
$outputName = $inputName;
205-
$client_model_namespace_prefix = $client_model_namespace + '.';
205+
$clientModelNameSpacePrefix = $clientModelNameSpace + '.';
206206

207207
if ($inputName -eq 'System.String')
208208
{
@@ -228,9 +228,9 @@ function Get-NormalizedTypeName
228228
{
229229
return 'char';
230230
}
231-
elseif ($inputName.StartsWith($client_model_namespace_prefix))
231+
elseif ($inputName.StartsWith($clientModelNameSpacePrefix))
232232
{
233-
$outputName = $inputName.Substring($client_model_namespace_prefix.Length);
233+
$outputName = $inputName.Substring($clientModelNameSpacePrefix.Length);
234234
}
235235

236236
$outputName = $outputName.Replace('+', '.');
@@ -327,9 +327,9 @@ function Get-ConstructorCode
327327
}
328328
else
329329
{
330-
if ($InputName.StartsWith($client_model_namespace + "."))
330+
if ($InputName.StartsWith($clientModelNameSpace + "."))
331331
{
332-
$InputName = $InputName.Replace($client_model_namespace + ".", '');
332+
$InputName = $InputName.Replace($clientModelNameSpace + ".", '');
333333
}
334334
elseif ($InputName.StartsWith('System.Collections.Generic.'))
335335
{

0 commit comments

Comments
 (0)