Skip to content
Merged

Vmss #154

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ public override void ExecuteCmdlet()
});
}

private void WriteInformation(string message, params string[] args)
{
base.WriteInformation(String.Format(message, args), new string[0]);
}

private void WriteVerbose(string message, params object[] args)
{
base.WriteVerbose(String.Format(message, args));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.Profile.Test
{
public class ProfileModuleTests
{
[Fact(Skip="Removed flaky test from CI.")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void WarningOnIncompatibleVersions()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,27 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

param(
[Parameter(Mandatory = $true)]
[System.Type]$typeInfo = $null
[CmdletBinding(DefaultParameterSetName = "ByTypeInfo")]
param
(
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByTypeInfo')]
[System.Type]$TypeInfo = $null,

[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$TypeFullName = $null,

[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$DllFullPath = $null
)

function Create-ParameterObjectImpl
{
param(
[Parameter(Mandatory = $True)]
param
(
[Parameter(Mandatory = $true)]
[System.Type]$typeInfo,

[Parameter(Mandatory = $True)]
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]$typeList
)

Expand All @@ -34,32 +43,32 @@ function Create-ParameterObjectImpl

if ($typeInfo.FullName -like "Microsoft.*Azure.Management.*.*" -and (-not ($typeInfo.FullName -like "Microsoft.*Azure.Management.*.SubResource")))
{
$typeList.Add($typeInfo.FullName, $typeInfo);
$st = $typeList.Add($typeInfo.FullName, $typeInfo);
}

if ($typeInfo.FullName -eq 'System.String' -or $typeInfo.FullName -eq 'string')
{
return '';
$obj = '';
}
if ($typeInfo.FullName -eq 'System.Uri')
elseif ($typeInfo.FullName -eq 'System.Uri')
{
return '' -as 'System.Uri';
$obj = '' -as 'System.Uri';
}
elseif ($typeInfo.FullName -eq 'System.Boolean')
{
return $false;
$obj = $false;
}
elseif ($typeInfo.FullName -eq 'System.Int32')
{
return 0;
$obj = 0;
}
elseif ($typeInfo.FullName -eq 'System.UInt32')
{
return 0;
$obj = 0;
}
elseif ($typeInfo.FullName -eq 'System.Byte[]')
{
return New-Object -TypeName System.Byte[] -ArgumentList 0;
$obj = New-Object -TypeName System.Byte[] -ArgumentList 0;
}
elseif ($typeInfo.FullName -like 'System.Collections.Generic.IList*' -or $typeInfo.FullName -like 'System.Collections.Generic.List*')
{
Expand All @@ -70,16 +79,16 @@ function Create-ParameterObjectImpl
$listObj = New-Object -TypeName $typeName;
$listObj.Add($itemObj);

return $listObj;
$obj = $listObj;
}
elseif ($typeInfo.FullName -like 'System.Collections.Generic.IDictionary*')
{
# Dictionary in client library always consists of string key & values.
return New-Object 'System.Collections.Generic.Dictionary[string,string]';
$obj = New-Object 'System.Collections.Generic.Dictionary[string,string]';
}
elseif ($typeInfo.FullName -like 'System.Nullable*')
{
return $null;
$obj = $null;
}
else
{
Expand All @@ -101,19 +110,28 @@ function Create-ParameterObjectImpl
$listTypeName = "System.Collections.Generic.List[" + $itemType.FullName + "]";

$propObjList = New-Object -TypeName $listTypeName;
$propObjList.Add($itemObj);
$st = $propObjList.Add($itemObj);

$prop.SetValue($obj, $propObjList -as $listTypeName);
$st = $prop.SetValue($obj, $propObjList -as $listTypeName);
}
else
{
$propObj = Create-ParameterObjectImpl $prop.PropertyType $typeList;
$prop.SetValue($obj, $propObj);
$st = $prop.SetValue($obj, $propObj);
}
}
}

$st = $typeList.Remove($typeInfo.FullName);

return $obj;
}

Write-Output (Create-ParameterObjectImpl $typeInfo @{});
if (($TypeFullName -ne $null) -and ($TypeFullName.Trim() -ne ''))
{
. "$PSScriptRoot\Import-AssemblyFunction.ps1";
$dll = Load-AssemblyFile $DllFullPath;
$TypeInfo = $dll.GetType($TypeFullName);
}

Write-Output (Create-ParameterObjectImpl $TypeInfo @{});
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,24 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

param(
[Parameter(Mandatory = $true)]
[System.Type]$TypeInfo,

[Parameter(Mandatory = $true)]
[CmdletBinding(DefaultParameterSetName = "ByTypeInfo")]
param
(
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByTypeInfo')]
[System.Type]$TypeInfo = $null,

[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$TypeFullName = $null,

[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$DllFullPath = $null,

[Parameter(Mandatory = $true, Position = 1, ParameterSetName = 'ByTypeInfo')]
[Parameter(Mandatory = $true, Position = 2, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$NameSpace,

[Parameter(Mandatory = $false)]
[Parameter(Mandatory = $false, Position = 2, ParameterSetName = 'ByTypeInfo')]
[Parameter(Mandatory = $false, Position = 3, ParameterSetName = 'ByFullTypeNameAndDllPath')]
[string]$ParameterName = $null
)

Expand Down Expand Up @@ -174,4 +184,11 @@ function Create-ParameterTreeImpl
}
}

if (($TypeFullName -ne $null) -and ($TypeFullName.Trim() -ne ''))
{
. "$PSScriptRoot\Import-AssemblyFunction.ps1";
$dll = Load-AssemblyFile $DllFullPath;
$TypeInfo = $dll.GetType($TypeFullName);
}

Write-Output (Create-ParameterTreeImpl $ParameterName $TypeInfo @{});
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ $cmdlet_remove_object_code
$fileFullPath = $OutputFolder + $cmdlet_class_name + ".cs";
$full_code = $code_common_header + "`r`n`r`n" + $code_usings + "`r`n" + $cmdlet_class_code + "`r`n" + $cmdlet_code_body;

Set-Content -Path $fileFullPath -Value $full_code -Force;
Set-FileContent -Path $fileFullPath -Value $full_code;
}

# Decide the name of cmdlet verb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ $code_common_header =
// code is regenerated.
"@;

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

$all_return_type_names = @();

Expand All @@ -85,25 +85,49 @@ Write-Verbose $BAR_LINE;
Write-Verbose "Input Parameters:";
Write-Verbose "DLL Folder = $dllFolder";
Write-Verbose "Out Folder = $outFolder";
Write-Verbose "Client NameSpace = $client_library_namespace";
Write-Verbose "Model NameSpace = $client_model_namespace";
Write-Verbose "Client NameSpace = $clientNameSpace";
Write-Verbose "Model NameSpace = $clientModelNameSpace";
Write-Verbose "Component Name = $component_name";
Write-Verbose "Base Cmdlet Full Name = $baseCmdletFullName";
Write-Verbose "Base Client Name = $base_class_client_field";
Write-Verbose "Base Client Full Name = $baseClientFullName";
Write-Verbose "Cmdlet Flavor = $cmdletFlavor";
Write-Verbose "Operation Name Filter = $operationNameFilter";
Write-Verbose $BAR_LINE;
Write-Verbose "${new_line_str}";

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

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

$code_using_strs = Get-SortedUsingsCode;
$code_using_strs = Get-SortedUsingsCode;

function Get-RomanNumeral
{
param
(
[Parameter(Mandatory = $true)]
$number
)

if ($number -ge 1000) { return "M" + (Get-RomanNumeral ($number - 1000)); }
if ($number -ge 900) { return "CM" + (Get-RomanNumeral ($number - 900)); }
if ($number -ge 500) { return "D" + (Get-RomanNumeral ($number - 500)); }
if ($number -ge 400) { return "CD" + (Get-RomanNumeral ($number - 400)); }
if ($number -ge 100) { return "C" + (Get-RomanNumeral ($number - 100)); }
if ($number -ge 90) { return "XC" + (Get-RomanNumeral ($number - 90)); }
if ($number -ge 50) { return "L" + (Get-RomanNumeral ($number - 50)); }
if ($number -ge 40) { return "XL" + (Get-RomanNumeral ($number - 40)); }
if ($number -ge 10) { return "X" + (Get-RomanNumeral ($number - 10)); }
if ($number -ge 9) { return "IX" + (Get-RomanNumeral ($number - 9)); }
if ($number -ge 5) { return "V" + (Get-RomanNumeral ($number - 5)); }
if ($number -ge 4) { return "IV" + (Get-RomanNumeral ($number - 4)); }
if ($number -ge 1) { return "I" + (Get-RomanNumeral ($number - 1)); }
return "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function Get-NormalizedTypeName
}

$outputName = $inputName;
$client_model_namespace_prefix = $client_model_namespace + '.';
$clientModelNameSpacePrefix = $clientModelNameSpace + '.';

if ($inputName -eq 'System.String')
{
Expand All @@ -228,9 +228,9 @@ function Get-NormalizedTypeName
{
return 'char';
}
elseif ($inputName.StartsWith($client_model_namespace_prefix))
elseif ($inputName.StartsWith($clientModelNameSpacePrefix))
{
$outputName = $inputName.Substring($client_model_namespace_prefix.Length);
$outputName = $inputName.Substring($clientModelNameSpacePrefix.Length);
}

$outputName = $outputName.Replace('+', '.');
Expand Down Expand Up @@ -327,9 +327,9 @@ function Get-ConstructorCode
}
else
{
if ($InputName.StartsWith($client_model_namespace + "."))
if ($InputName.StartsWith($clientModelNameSpace + "."))
{
$InputName = $InputName.Replace($client_model_namespace + ".", '');
$InputName = $InputName.Replace($clientModelNameSpace + ".", '');
}
elseif ($InputName.StartsWith('System.Collections.Generic.'))
{
Expand Down
Loading