diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 index 268994d5a1b6..3d8c91f93b70 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 @@ -189,7 +189,7 @@ function Test-VirtualMachineList try { - $s1 = Get-AzureVM -All; + $s1 = Get-AzureVM; $s2 = Get-AzureVM; if ($s2 -ne $null) diff --git a/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs b/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs index 79fdc481e533..e19eba2f6c77 100644 --- a/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs @@ -12,7 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using System.Management.Automation; @@ -20,6 +22,7 @@ namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsCommon.New, ProfileNouns.AvailabilitySet)] + [OutputType(typeof(PSAvailabilitySet))] public class NewAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet { [Parameter( @@ -73,11 +76,12 @@ public override void ExecuteCmdlet() PlatformFaultDomainCount = this.PlatformFaultDomainCount }; - var op = this.AvailabilitySetClient.CreateOrUpdate( + var result = this.AvailabilitySetClient.CreateOrUpdate( this.ResourceGroupName, avSetParams); - WriteObject(op); + var psResult = Mapper.Map(result.AvailabilitySet); + WriteObject(psResult); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj index f8d367e16130..533b475004d3 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj +++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj @@ -164,6 +164,7 @@ + @@ -253,6 +254,9 @@ Always + + Always + Always diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeAutoMapperProfile.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeAutoMapperProfile.cs index 0f66d1887a34..c621b8ed69c1 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeAutoMapperProfile.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeAutoMapperProfile.cs @@ -72,6 +72,8 @@ protected override void Configure() Mapper.CreateMap(); Mapper.CreateMap(); Mapper.CreateMap(); + + Mapper.CreateMap(); } } } \ No newline at end of file diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/RemoveAzureVMExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/RemoveAzureVMExtensionCommand.cs index 8fd9aa382eba..e78447a8f961 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/RemoveAzureVMExtensionCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/RemoveAzureVMExtensionCommand.cs @@ -12,15 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; -using Microsoft.Azure.Management.Compute.Models; using System.Management.Automation; namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsCommon.Remove, ProfileNouns.VirtualMachineExtension)] - [OutputType(typeof(ComputeLongRunningOperationResponse))] + [OutputType(typeof(PSComputeLongRunningOperation))] public class RemoveAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet { [Parameter( @@ -61,7 +62,8 @@ public override void ExecuteCmdlet() || this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption)) { var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SetAzureVMExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SetAzureVMExtensionCommand.cs index 9c23a7ad77f1..1de3b4a52f53 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/SetAzureVMExtensionCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SetAzureVMExtensionCommand.cs @@ -12,7 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Newtonsoft.Json; @@ -25,6 +27,7 @@ namespace Microsoft.Azure.Commands.Compute VerbsCommon.Set, ProfileNouns.VirtualMachineExtension, DefaultParameterSetName = SettingsParamSet)] + [OutputType(typeof(PSComputeLongRunningOperation))] public class SetAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet { protected const string SettingStringParamSet = "SettingString"; @@ -124,8 +127,6 @@ public override void ExecuteCmdlet() { base.ExecuteCmdlet(); - - if (this.Settings != null) { this.SettingString = JsonConvert.SerializeObject(Settings); @@ -149,7 +150,8 @@ public override void ExecuteCmdlet() this.VMName, parameters); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.psd1 b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.psd1 index b61deaf6282b..3cfe8b84f911 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.psd1 +++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.psd1 @@ -60,7 +60,8 @@ TypesToProcess = @( # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = @( - '.\Microsoft.Azure.Commands.Compute.format.ps1xml' + '.\Microsoft.Azure.Commands.Compute.format.ps1xml', + '.\Microsoft.Azure.Commands.Compute.format.generated.ps1xml' ) # Modules to import as nested modules of the module specified in ModuleToProcess diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.generated.ps1xml b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.generated.ps1xml new file mode 100644 index 000000000000..e5d31fb83a4f --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.generated.ps1xml @@ -0,0 +1,223 @@ + + + + + + Microsoft.Azure.Commands.Compute.Models.PSAvailabilitySet + + Microsoft.Azure.Commands.Compute.Models.PSAvailabilitySet + + + + + + + + ResourceGroupName + + + + Id + + + + Name + + + + Type + + + + Location + + + + TagsText + + + + PlatformFaultDomainCount + + + + PlatformUpdateDomainCount + + + + StatusesText + + + + VirtualMachinesReferencesText + + + + + + + + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineSize + + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineSize + + + + + + + + MaxDataDiskCount + + + + MemoryInMB + + + + Name + + + + NumberOfCores + + + + OSDiskSizeInMB + + + + ResourceDiskSizeInMB + + + + + + + + Microsoft.Azure.Commands.Compute.Models.PSUsage + + Microsoft.Azure.Commands.Compute.Models.PSUsage + + + + + + + + CurrentValue + + + + Limit + + + + NameText + + + + UnitText + + + + + + + + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine + + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine + + + + + + + + ResourceGroupName + + + + Id + + + + Name + + + + Type + + + + Location + + + + TagsText + + + + AvailabilitySetReferenceText + + + + ExtensionsText + + + + HardwareProfileText + + + + InstanceViewText + + + + NetworkProfileText + + + + OSProfileText + + + + PlanText + + + + ProvisioningState + + + + StorageProfileText + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml index e5d31fb83a4f..10a34543f006 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml +++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml @@ -1,32 +1,10 @@  - - Microsoft.Azure.Commands.Compute.Models.PSAvailabilitySet + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineInstanceView - Microsoft.Azure.Commands.Compute.Models.PSAvailabilitySet + Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineInstanceView @@ -36,109 +14,37 @@ ResourceGroupName - - - Id - Name - - Type - - - - Location - - - - TagsText - - - - PlatformFaultDomainCount - - - - PlatformUpdateDomainCount + + DisksText - - StatusesText - - - - VirtualMachinesReferencesText - - - - - - - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineSize - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineSize - - - - - - - - MaxDataDiskCount + + ExtensionsText - - MemoryInMB + + PlatformFaultDomain - - Name + + PlatformUpdateDomain - - NumberOfCores + + RemoteDesktopThumbprint - - OSDiskSizeInMB + + VMAgentText - - ResourceDiskSizeInMB - - - - - - - - Microsoft.Azure.Commands.Compute.Models.PSUsage - - Microsoft.Azure.Commands.Compute.Models.PSUsage - - - - - - - - CurrentValue - - - - Limit - - - - NameText - - - - UnitText + + StatusesText @@ -146,73 +52,37 @@ - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine + Microsoft.Azure.Commands.Compute.Models.PSComputeLongRunningOperation - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine + Microsoft.Azure.Commands.Compute.Models.PSComputeLongRunningOperation - - ResourceGroupName - - - - Id - - - - Name - - - - Type - - - - Location - - - - TagsText - - - - AvailabilitySetReferenceText - - - - ExtensionsText - - - - HardwareProfileText - - - - InstanceViewText + + TrackingOperationId - - NetworkProfileText + + Status - - OSProfileText + + Output - - PlanText + + StartTime - - ProvisioningState + + EndTime - - StorageProfileText + + ErrorText diff --git a/src/ResourceManager/Compute/Commands.Compute/Models/PSComputeLongRunningOperation.cs b/src/ResourceManager/Compute/Commands.Compute/Models/PSComputeLongRunningOperation.cs new file mode 100644 index 000000000000..3952b553f7e7 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Models/PSComputeLongRunningOperation.cs @@ -0,0 +1,45 @@ +// +// 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. +// + +using Microsoft.Azure.Management.Compute.Models; +using Newtonsoft.Json; +using System; + +namespace Microsoft.Azure.Commands.Compute.Models +{ + public class PSComputeLongRunningOperation + { + public string TrackingOperationId { get; set; } + + public string RequestId { get; set; } + + public ComputeOperationStatus Status { get; set; } + + public string Output { get; set; } + + public DateTimeOffset StartTime { get; set; } + + public DateTimeOffset? EndTime { get; set; } + + public ApiError Error { get; set; } + + [JsonIgnore] + public string ErrorText + { + get { return JsonConvert.SerializeObject(Error, Formatting.Indented); } + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachineInstanceView.cs b/src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachineInstanceView.cs index ebfccebda461..d70326d29c57 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachineInstanceView.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachineInstanceView.cs @@ -13,9 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Management.Compute.Models; -using System; +using Newtonsoft.Json; using System.Collections.Generic; -using System.Linq; namespace Microsoft.Azure.Commands.Compute.Models { @@ -27,8 +26,20 @@ public class PSVirtualMachineInstanceView public IList Disks { get; set; } + [JsonIgnore] + public string DisksText + { + get { return JsonConvert.SerializeObject(Disks, Formatting.Indented); } + } + public IList Extensions { get; set; } + [JsonIgnore] + public string ExtensionsText + { + get { return JsonConvert.SerializeObject(Extensions, Formatting.Indented); } + } + public int? PlatformFaultDomain { get; set; } public int? PlatformUpdateDomain { get; set; } @@ -37,7 +48,19 @@ public class PSVirtualMachineInstanceView public VirtualMachineAgentInstanceView VMAgent { get; set; } + [JsonIgnore] + public string VMAgentText + { + get { return JsonConvert.SerializeObject(VMAgent, Formatting.Indented); } + } + public IList Statuses { get; set; } + + [JsonIgnore] + public string StatusesText + { + get { return JsonConvert.SerializeObject(Statuses, Formatting.Indented); } + } } public static class PSVirtualMachineInstanceViewExtension diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/RestartAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/RestartAzureVMCommand.cs index 6b7564b4f9a6..92a84cd7e3df 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/RestartAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/RestartAzureVMCommand.cs @@ -12,13 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Management.Automation; +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; +using System.Management.Automation; namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsLifecycle.Restart, ProfileNouns.VirtualMachine)] + [OutputType(typeof(PSComputeLongRunningOperation))] public class RestartAzureVMCommand : VirtualMachineBaseCmdlet { [Parameter( @@ -40,7 +43,8 @@ public class RestartAzureVMCommand : VirtualMachineBaseCmdlet public override void ExecuteCmdlet() { var op = this.VirtualMachineClient.Restart(this.ResourceGroupName, this.Name); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/SaveAzureVMImageCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/SaveAzureVMImageCommand.cs index 2e269a4e2294..2f61df5ea8a2 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/SaveAzureVMImageCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/SaveAzureVMImageCommand.cs @@ -12,7 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using System.Management.Automation; @@ -20,7 +22,7 @@ namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsData.Save, ProfileNouns.VirtualMachineImage)] - [OutputType(typeof(ComputeLongRunningOperationResponse))] + [OutputType(typeof(PSComputeLongRunningOperation))] public class SaveAzureVMImageCommand : VirtualMachineBaseCmdlet { public string Name { get; set; } @@ -82,7 +84,8 @@ public override void ExecuteCmdlet() this.VMName, parameters); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StartAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StartAzureVMCommand.cs index 50a9dfc6f24c..6f44e04c9c37 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StartAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StartAzureVMCommand.cs @@ -12,13 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Management.Automation; +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; +using System.Management.Automation; namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsLifecycle.Start, ProfileNouns.VirtualMachine)] + [OutputType(typeof(PSComputeLongRunningOperation))] public class StartAzureVMCommand : VirtualMachineBaseCmdlet { [Parameter( @@ -40,7 +43,8 @@ public class StartAzureVMCommand : VirtualMachineBaseCmdlet public override void ExecuteCmdlet() { var op = this.VirtualMachineClient.Start(this.ResourceGroupName, this.Name); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StopAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StopAzureVMCommand.cs index f5eb8287a94f..37aca36287a0 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StopAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Action/StopAzureVMCommand.cs @@ -12,16 +12,18 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Management.Automation; +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; -using Microsoft.Azure.Commands.Compute.Properties; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; +using System; +using System.Management.Automation; namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsLifecycle.Stop, ProfileNouns.VirtualMachine)] + [OutputType(typeof(PSComputeLongRunningOperation))] public class StopAzureVMCommand : VirtualMachineBaseCmdlet { [Parameter( @@ -62,7 +64,8 @@ public override void ExecuteCmdlet() Action> call = f => { var op = f(this.ResourceGroupName, this.Name); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); }; if (this.StayProvisioned) diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs index 0ca6f0c2d6e9..6ecacc06313b 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs @@ -27,23 +27,21 @@ namespace Microsoft.Azure.Commands.Compute [OutputType(typeof(PSVirtualMachine), typeof(PSVirtualMachineInstanceView))] public class GetAzureVMCommand : VirtualMachineBaseCmdlet { - protected const string GetVirtualMachineParamSet = "GetVirtualMachineParamSet"; - protected const string ListVirtualMachineParamSet = "ListVirtualMachineParamSet"; + protected const string GetVirtualMachineInResourceGroupParamSet = "GetVirtualMachineInResourceGroupParamSet"; + protected const string ListVirtualMachineInResourceGroupParamSet = "ListVirtualMachineInResourceGroupParamSet"; protected const string ListAllVirtualMachinesParamSet = "ListAllVirtualMachinesParamSet"; - protected const string ListNextVirtualMachinesParamSet = "ListNextVirtualMachinesParamSet"; + protected const string ListNextLinkVirtualMachinesParamSet = "ListNextLinkVirtualMachinesParamSet"; [Parameter( Mandatory = true, Position = 0, - ParameterSetName = ListVirtualMachineParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The resource group name.")] + ParameterSetName = ListVirtualMachineInResourceGroupParamSet, + ValueFromPipelineByPropertyName = true)] [Parameter( Mandatory = true, Position = 0, - ParameterSetName = GetVirtualMachineParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The resource group name.")] + ParameterSetName = GetVirtualMachineInResourceGroupParamSet, + ValueFromPipelineByPropertyName = true)] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } @@ -51,34 +49,22 @@ public class GetAzureVMCommand : VirtualMachineBaseCmdlet [Parameter( Mandatory = true, Position = 1, - ParameterSetName = GetVirtualMachineParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The resource name.")] + ParameterSetName = GetVirtualMachineInResourceGroupParamSet, + ValueFromPipelineByPropertyName = true)] [ValidateNotNullOrEmpty] public string Name { get; set; } [Parameter( Position = 2, - ParameterSetName = GetVirtualMachineParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "To show the status.")] + ParameterSetName = GetVirtualMachineInResourceGroupParamSet)] [ValidateNotNullOrEmpty] public SwitchParameter Status { get; set; } - [Parameter( - Position = 1, - ParameterSetName = ListAllVirtualMachinesParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "To list all virtual machines.")] - [ValidateNotNullOrEmpty] - public SwitchParameter All { get; set; } - [Parameter( Mandatory = true, Position = 1, - ParameterSetName = ListNextVirtualMachinesParamSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The link to the next page of virtual machines.")] + ParameterSetName = ListNextLinkVirtualMachinesParamSet, + ValueFromPipelineByPropertyName = true)] [ValidateNotNullOrEmpty] public Uri NextLink { get; set; } @@ -125,7 +111,6 @@ public override void ExecuteCmdlet() psResultList.Add(psItem); } - WriteObject(psResultList, true); } } diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/RemoveAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/RemoveAzureVMCommand.cs index a83d5dd43609..32636fced5e0 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/RemoveAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/RemoveAzureVMCommand.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; -using Microsoft.Azure.Commands.Compute.Properties; +using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; using System.Management.Automation; namespace Microsoft.Azure.Commands.Compute { [Cmdlet(VerbsCommon.Remove, ProfileNouns.VirtualMachine)] + [OutputType(typeof(PSComputeLongRunningOperation))] public class RemoveAzureVMCommand : VirtualMachineBaseCmdlet { [Parameter( @@ -53,7 +55,8 @@ public override void ExecuteCmdlet() || this.ShouldContinue(Properties.Resources.VirtualMachineRemovalConfirmation, Properties.Resources.VirtualMachineRemovalCaption)) { var op = this.VirtualMachineClient.Delete(this.ResourceGroupName, this.Name); - WriteObject(op); + var result = Mapper.Map(op); + WriteObject(result); } } } diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index 5cf0b78a2317..103768eefda5 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -69,6 +69,7 @@ FormatsToProcess = @( '.\KeyVault\Microsoft.Azure.Commands.KeyVault.format.ps1xml', '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml', '.\Compute\Microsoft.Azure.Commands.Compute.format.ps1xml', + '.\Compute\Microsoft.Azure.Commands.Compute.format.generated.ps1xml', '.\Network\Microsoft.Azure.Commands.Network.format.ps1xml', '.\Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml', '.\StorageManagement\Microsoft.Azure.Commands.Management.Storage.format.ps1xml'