Skip to content
Merged

Vmss #157

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 @@ -24,3 +24,28 @@ function Load-AssemblyFile
$st = [System.Reflection.Assembly]::LoadWithPartialName("System.Collections.Generic");
return $assembly;
}

function Get-AzureNameSpace
{
param
(
[Parameter(Mandatory = $true)]
[string]$dllPath
)

[System.Reflection.Assembly]$assembly = Load-AssemblyFile $dllPath;

$clientNameSpace = $null;
foreach ($type in $assembly.GetTypes())
{
[System.Type]$type = $type;
if ($type.Namespace -like "Microsoft.*Azure.Management.*" -and `
$type.Namespace -notlike "Microsoft.*Azure.Management.*.Model*")
{
$clientNameSpace = $type.Namespace;
break;
}
}

return $clientNameSpace;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,40 @@ $code_common_header =
// code is regenerated.
"@;

. "$PSScriptRoot\Import-AssemblyFunction.ps1";

# Load Assembly and get the Azure namespace for the client,
# e.g. Microsoft.Azure.Management.Compute
$clientNameSpace = Get-AzureNameSpace $dllFileFullPath;
$clientModelNameSpace = $clientNameSpace + '.Models';

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

# The base cmdlet from which all automation cmdlets derive
[string]$baseCmdletFullName = "Microsoft.Azure.Commands.${component_name}.${component_name}ClientBaseCmdlet";
if ($clientNameSpace -like "Microsoft.WindowsAzure.Management.${component_name}")
{
# Overwrite RDFE base cmdlet name
$baseCmdletFullName = "Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet";
}

# The property field to access the client wrapper class from the base cmdlet
[string]$baseClientFullName = "${component_name}Client.${component_name}ManagementClient";
if ($clientNameSpace -like "Microsoft.WindowsAzure.Management.${component_name}")
{
# Overwrite RDFE base cmdlet name
$baseClientFullName = "${component_name}Client";
}

# Initialize other variables
$all_return_type_names = @();

$SKIP_VERB_NOUN_CMDLET_LIST = @('PowerOff', 'ListNext', 'ListAllNext', 'ListSkusNext', 'GetInstanceView', 'List', 'ListAll');

Write-Verbose $BAR_LINE;
Write-Verbose "Input Parameters:";
Write-Verbose "DLL Folder = $dllFolder";
Write-Verbose "DLL File = $dllFileFullPath";
Write-Verbose "Out Folder = $outFolder";
Write-Verbose "Client NameSpace = $clientNameSpace";
Write-Verbose "Model NameSpace = $clientModelNameSpace";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,19 @@

[CmdletBinding()]
param(
# The folder that contains the source DLL, and all its dependency DLLs.
# The path to the client library DLL file, along with all its dependency DLLs,
# e.g. 'x:\y\z\Microsoft.Azure.Management.Compute.dll',
# Note that dependency DLL files must be place at the same folder, for reflection:
# e.g. 'x:\y\z\Newtonsoft.Json.dll',
# 'x:\y\z\...' ...
[Parameter(Mandatory = $true)]
[string]$dllFolder,
[string]$dllFileFullPath,

# The target output folder, and the generated files would be organized in
# the sub-folder called 'Generated'.
[Parameter(Mandatory = $true)]
[string]$outFolder,

# The namespace of the Compute client library
[Parameter(Mandatory = $true)]
[string]$clientNameSpace = 'Microsoft.WindowsAzure.Management.Compute',

# The base cmdlet from which all automation cmdlets derive
[Parameter(Mandatory = $false)]
[string]$baseCmdletFullName = 'Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet',

# The property field to access the client wrapper class from the base cmdlet
[Parameter(Mandatory = $false)]
[string]$baseClientFullName = 'ComputeClient',

# Cmdlet Code Generation Flavor
# 1. Invoke (default) that uses Invoke as the verb, and Operation + Method (e.g. VirtualMachine + Get)
# 2. Verb style that maps the method name to a certain common PS verb (e.g. CreateOrUpdate -> New)
Expand All @@ -61,8 +53,9 @@ param(
[string[]]$operationNameFilter = $null
)

. "$PSScriptRoot\Import-CommonVariables.ps1";
# Import functions and variables
. "$PSScriptRoot\Import-AssemblyFunction.ps1";
. "$PSScriptRoot\Import-CommonVariables.ps1";
. "$PSScriptRoot\Import-StringFunction.ps1";
. "$PSScriptRoot\Import-TypeFunction.ps1";
. "$PSScriptRoot\Import-OperationFunction.ps1";
Expand All @@ -71,15 +64,6 @@ param(
# Code Generation Main Run
$outFolder += '/Generated';

$output = Get-ChildItem -Path $dllFolder | Out-String;

# Set-FileContent -Path ($outFolder + '/Output.txt');
# Write-Verbose "List items under the folder: $dllFolder"
# Write-Verbose $output;

$dllfile = $clientNameSpace + '.dll';
$dllFileFullPath = $dllFolder + '\' + $dllfile;

if (-not (Test-Path -Path $dllFileFullPath))
{
Write-Verbose "DLL file `'$dllFileFullPath`' not found. Exit.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.1-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AutoMapper, Version=3.1.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.dll</HintPath>
Expand All @@ -77,6 +73,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Compute, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.11.3.0-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
Expand Down Expand Up @@ -110,6 +110,10 @@
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -186,6 +190,7 @@
<Compile Include="ServiceManagementPreviewProfile.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Automation\Import-CommonVariables.ps1" />
<None Include="Automation\Generate-FunctionCommand.ps1" />
<None Include="Automation\Generate-PowershellParameterCmdlet.ps1" />
Expand Down Expand Up @@ -256,29 +261,23 @@
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
<ScriptPath>.\Automation\Invoke-CodeGeneration.ps1</ScriptPath>
<DllFolder>$(OutputPath)</DllFolder>
<ClientDll>$(OutputPath)\Microsoft.WindowsAzure.Management.Compute.dll</ClientDll>
<TargetFolder>$(MSBuildProjectDirectory)</TargetFolder>
<NamesSpace>Microsoft.WindowsAzure.Management.Compute</NamesSpace>
<BaseCmdlet>Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet</BaseCmdlet>
<BaseClient>ComputeClient</BaseClient>
<PSFlavor>Invoke</PSFlavor>
<CLIFlavor>Verb</CLIFlavor>
</PropertyGroup>
<Exec Command="$(PowerShellExe) $(ScriptPath) $(DllFolder) $(TargetFolder) $(NamesSpace) $(BaseCmdlet) $(BaseClient) $(PSFlavor) $(CLIFlavor)" />
<Exec Command="$(PowerShellExe) $(ScriptPath) $(ClientDll) $(TargetFolder) $(PSFlavor) $(CLIFlavor)" />
</Target>
<Target Name="BuildGenerateARM" DependsOnTargets="BuildGenerateRDFE">
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
<ScriptPath>.\Automation\Invoke-CodeGeneration.ps1</ScriptPath>
<DllFolder>$(OutputPath)\..\..\..\ResourceManager\AzureResourceManager\AzureRM.Compute</DllFolder>
<ClientDll>$(OutputPath)\Microsoft.Azure.Management.Compute.dll</ClientDll>
<TargetFolder>..\..\..\ResourceManager\Compute\Commands.Compute</TargetFolder>
<BaseCmdlet>Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet</BaseCmdlet>
<BaseClient>ComputeClient.ComputeManagementClient</BaseClient>
<NamesSpace>Microsoft.Azure.Management.Compute</NamesSpace>
<PSFlavor>Verb</PSFlavor>
<CLIFlavor>Verb</CLIFlavor>
<Operations>VirtualMachineScaleSets,VirtualMachineScaleSetVMs</Operations>
</PropertyGroup>
<Exec Command="$(PowerShellExe) $(ScriptPath) $(DllFolder) $(TargetFolder) $(NamesSpace) $(BaseCmdlet) $(BaseClient) $(PSFlavor) $(CLIFlavor) $(Operations)" />
<Exec Command="$(PowerShellExe) $(ScriptPath) $(ClientDll) $(TargetFolder) $(PSFlavor) $(CLIFlavor) $(Operations)" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="11.3.0-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="3.1.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.11-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand All @@ -16,6 +17,7 @@
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.18.206251556" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.0.1" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.0.2" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="FunctionalTests\ExtensionTests\MicrosoftAntimalware\AzureVMMicrosoftAntimalwareExtensionFunctionalTests.ps1" />
<None Include="app.config" />
<None Include="AzureRTBVTs.playlist" />
<None Include="AzureRTComplete.playlist" />
<None Include="AzureRTComplete_Full_Diff.playlist" />
Expand Down
Binary file not shown.
Binary file not shown.
Loading