Skip to content

Commit

Permalink
Merge pull request Azure#34 from hyonholee/vmss
Browse files Browse the repository at this point in the history
Adding format file generator for PS auto generator
  • Loading branch information
AzureRT committed Sep 22, 2015
2 parents 5d233d9 + 92fa1c1 commit de826cb
Show file tree
Hide file tree
Showing 6 changed files with 523 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ResourceManager/Compute/AzureRM.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ TypesToProcess = @(
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @(
'.\Microsoft.Azure.Commands.Compute.format.ps1xml',
'.\Microsoft.Azure.Commands.Compute.format.generated.ps1xml'
'.\Microsoft.Azure.Commands.Compute.format.generated.ps1xml',
'.\Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml',
)

# Modules to import as nested modules of the module specified in ModuleToProcess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,66 @@ function Test-VirtualMachineScaleSet
$vmss.VirtualMachineProfile.StorageProfile.OSDisk.VirtualHardDiskContainers.Add($vhdContainer);

$st = New-AzureVirtualMachineScaleSet -ResourceGroupName $rgname -VirtualMachineScaleSetCreateOrUpdateParameters $vmss;

Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSet');
$vmssResult = Get-AzureVirtualMachineScaleSet -ResourceGroupName $rgname -VMScaleSetName $vmss.Name;
Assert-True { $vmss.Name -eq $vmssResult.VirtualMachineScaleSet.Name };
$output = $vmssResult | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSet") };
Write-Verbose ($output);

# List All
Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetAllList');
$vmssList = Get-AzureVirtualMachineScaleSetAllList -VirtualMachineScaleSetListAllParameters $null;
Assert-True { ($vmssList.VirtualMachineScaleSets | select -ExpandProperty Name) -contains $vmss.Name };
$output = $vmssList | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSets") };
Write-Verbose ($output);

# List from RG
Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetList');
$vmssList = Get-AzureVirtualMachineScaleSetList -ResourceGroupName $rgname;
Assert-True { ($vmssList.VirtualMachineScaleSets | select -ExpandProperty Name) -contains $vmss.Name };
$output = $vmssList | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSets") };
Write-Verbose ($output);

# List Skus
Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetSkusList');
$skuList = Get-AzureVirtualMachineScaleSetSkusList -ResourceGroupName $rgname -VMScaleSetName $vmss.Name;
$output = $skuList | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSetSku") };
Write-Verbose ($output);

# List All VMs
$vmListParams = New-AzureComputeParameterObject -FriendlyName VirtualMachineScaleSetVMListParameters;
$vmListParams.ResourceGroupName = $rgname;
$vmListParams.VirtualMachineScaleSetName = $vmss.Name;

Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVMList');
$vmListResult = Get-AzureVirtualMachineScaleSetVMList -VirtualMachineScaleSetVMListParameters $vmListParams;
$output = $vmListResult | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSetVM") };
Write-Verbose ($output);

$vmList = $vmListResult.VirtualMachineScaleSetVMs;

# List each VM
for ($i = 0; $i -lt $vmList.Count; $i++)
{
Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVM');
$vm = Get-AzureVirtualMachineScaleSetVM -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -InstanceId $i;
Assert-NotNull $vm.VirtualMachineScaleSetVM;
$output = $vm | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSetVM") };
Write-Verbose ($output);

Write-Verbose ('Running Command : ' + 'Get-AzureVirtualMachineScaleSetVMInstanceView');
$vmInstance = Get-AzureVirtualMachineScaleSetVMInstanceView -ResourceGroupName $rgname -VMScaleSetName $vmss.Name -InstanceId $i;
Assert-NotNull $vmInstance.VirtualMachineScaleSetVMInstanceView;
$output = $vmInstance | Out-String;
Assert-True { $output.Contains("VirtualMachineScaleSetVMInstanceView") };
Write-Verbose($output);
}

# List Next (negative test)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@
<Link>AzureRM.Compute.psd1</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Microsoft.Azure.Commands.Compute.dll-Help.psd1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
-->
<Configuration>
<ViewDefinitions>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.DeleteOperationResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.DeleteOperationResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>EndTime</Label>
<PropertyName>EndTime</PropertyName>
</ListItem>
<ListItem>
<Label>Error</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_.Error, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
<ListItem>
<Label>StartTime</Label>
<PropertyName>StartTime</PropertyName>
</ListItem>
<ListItem>
<Label>Status</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_.Status, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
<ListItem>
<Label>TrackingOperationId</Label>
<PropertyName>TrackingOperationId</PropertyName>
</ListItem>
<ListItem>
<Label>AzureAsyncOperation</Label>
<PropertyName>AzureAsyncOperation</PropertyName>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetGetResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetGetResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSet</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSet, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>NextLink</Label>
<PropertyName>NextLink</PropertyName>
</ListItem>
<ListItem>
<Label>VirtualMachineScaleSets.Count</Label>
<ScriptBlock> if ($_.VirtualMachineScaleSets -eq $null) { 0 } else { $_.VirtualMachineScaleSets.Count }</ScriptBlock>
</ListItem>
<ListItem>
<Label>VirtualMachineScaleSets</Label>
<ScriptBlock> foreach ($item in $_.VirtualMachineScaleSets) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) } </ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSet</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSet</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListSkusResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetListSkusResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetAvailableSkus.Count</Label>
<ScriptBlock> if ($_.VirtualMachineScaleSetAvailableSkus -eq $null) { 0 } else { $_.VirtualMachineScaleSetAvailableSkus.Count }</ScriptBlock>
</ListItem>
<ListItem>
<Label>VirtualMachineScaleSetAvailableSkus</Label>
<ScriptBlock> foreach ($item in $_.VirtualMachineScaleSetAvailableSkus) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) } </ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetSku</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetSku</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetSku</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetVM</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSetVM, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetInstanceViewResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMGetInstanceViewResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetVMInstanceView</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_.VirtualMachineScaleSetVMInstanceView, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMListResponse</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMListResponse</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetVMs.Count</Label>
<ScriptBlock> if ($_.VirtualMachineScaleSetVMs -eq $null) { 0 } else { $_.VirtualMachineScaleSetVMs.Count }</ScriptBlock>
</ListItem>
<ListItem>
<Label>VirtualMachineScaleSetVMs</Label>
<ScriptBlock> foreach ($item in $_.VirtualMachineScaleSetVMs) { [Newtonsoft.Json.JsonConvert]::SerializeObject($item, [Newtonsoft.Json.Formatting]::Indented) } </ScriptBlock>
</ListItem>
<ListItem>
<Label>RequestId</Label>
<PropertyName>RequestId</PropertyName>
</ListItem>
<ListItem>
<Label>StatusCode</Label>
<PropertyName>StatusCode</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVM</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVM</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>VirtualMachineScaleSetVM</Label>
<ScriptBlock>[Newtonsoft.Json.JsonConvert]::SerializeObject($_, [Newtonsoft.Json.Formatting]::Indented)</ScriptBlock>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
</ViewDefinitions>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ FormatsToProcess = @(
'.\AzureRM.StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml',
'.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.format.ps1xml',
'.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.format.generated.ps1xml',
'.\AzureRM.Compute\Microsoft.Azure.Commands.Compute.Automation.format.generated.ps1xml',
'.\AzureRM.Network\Microsoft.Azure.Commands.Network.format.ps1xml',
'.\Azure.Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml',
'.\AzureRM.Storage\Microsoft.Azure.Commands.Management.Storage.format.ps1xml',
Expand Down
Loading

0 comments on commit de826cb

Please sign in to comment.