Skip to content

Commit 4eaf626

Browse files
unknownunknown
unknown
authored and
unknown
committed
Update the output of Remove-AzureAvailabilitySet cmdlet
1 parent 9f910dd commit 4eaf626

File tree

5 files changed

+114
-9
lines changed

5 files changed

+114
-9
lines changed

src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using AutoMapper;
1516
using Microsoft.Azure.Commands.Compute.Common;
17+
using Microsoft.Azure.Commands.Compute.Models;
1618
using Microsoft.Azure.Management.Compute;
1719
using System.Management.Automation;
1820

1921
namespace Microsoft.Azure.Commands.Compute
2022
{
2123
[Cmdlet(VerbsCommon.Remove, ProfileNouns.AvailabilitySet)]
24+
[OutputType(typeof(PSOperationResponse))]
2225
public class RemoveAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
2326
{
2427
[Parameter(
@@ -51,8 +54,9 @@ public override void ExecuteCmdlet()
5154
|| this.ShouldContinue(Properties.Resources.AvailabilitySetRemovalConfirmation,
5255
Properties.Resources.AvailabilitySetRemovalCaption))
5356
{
54-
var op = this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name);
55-
WriteObject(op);
57+
AzureOperationResponse op = this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name);
58+
var result = Mapper.Map<PSOperationResponse>(op);
59+
WriteObject(result);
5660
}
5761
}
5862
}

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
<Compile Include="Images\GetAzureVMImageOfferCommand.cs" />
178178
<Compile Include="Images\GetAzureVMImageDetailCommand.cs" />
179179
<Compile Include="Images\VirtualMachineImageBaseCmdlet.cs" />
180+
<Compile Include="Models\PSOperationResponse.cs" />
180181
<Compile Include="Models\PSUsage.cs" />
181182
<Compile Include="Models\PSVirtualMachineExtensionImage.cs" />
182183
<Compile Include="Models\PSVirtualMachineImage.cs" />

src/ResourceManager/Compute/Commands.Compute/Common/ComputeAutoMapperProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ protected override void Configure()
7272
Mapper.CreateMap<FROM.VirtualMachine, TO.PSVirtualMachine>();
7373
Mapper.CreateMap<FROM.VirtualMachineSize, TO.PSVirtualMachineSize>();
7474
Mapper.CreateMap<FROM.Usage, TO.PSUsage>();
75-
7675
Mapper.CreateMap<FROM.ComputeLongRunningOperationResponse, TO.PSComputeLongRunningOperation>();
76+
Mapper.CreateMap<Microsoft.Azure.AzureOperationResponse, TO.PSOperationResponse>();
7777
}
7878
}
7979
}

src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@
6060
<ListEntries>
6161
<ListEntry>
6262
<ListItems>
63-
<ListItem>
64-
<Label>TrackingOperationId</Label>
65-
<PropertyName>TrackingOperationId</PropertyName>
66-
</ListItem>
6763
<ListItem>
6864
<Label>Status</Label>
6965
<PropertyName>Status</PropertyName>
@@ -72,6 +68,10 @@
7268
<Label>Output</Label>
7369
<PropertyName>Output</PropertyName>
7470
</ListItem>
71+
<ListItem>
72+
<Label>Error</Label>
73+
<PropertyName>ErrorText</PropertyName>
74+
</ListItem>
7575
<ListItem>
7676
<Label>StartTime</Label>
7777
<PropertyName>StartTime</PropertyName>
@@ -81,8 +81,81 @@
8181
<PropertyName>EndTime</PropertyName>
8282
</ListItem>
8383
<ListItem>
84-
<Label>Error</Label>
85-
<PropertyName>ErrorText</PropertyName>
84+
<Label>TrackingOperationId</Label>
85+
<PropertyName>TrackingOperationId</PropertyName>
86+
</ListItem>
87+
</ListItems>
88+
</ListEntry>
89+
</ListEntries>
90+
</ListControl>
91+
</View>
92+
<View>
93+
<Name>Microsoft.Azure.Commands.Compute.Models.PSOperationResponse</Name>
94+
<ViewSelectedBy>
95+
<TypeName>Microsoft.Azure.Commands.Compute.Models.PSOperationResponse</TypeName>
96+
</ViewSelectedBy>
97+
<ListControl>
98+
<ListEntries>
99+
<ListEntry>
100+
<ListItems>
101+
<ListItem>
102+
<Label>StatusCode</Label>
103+
<PropertyName>StatusCode</PropertyName>
104+
</ListItem>
105+
<ListItem>
106+
<Label>RequestId</Label>
107+
<PropertyName>RequestId</PropertyName>
108+
</ListItem>
109+
</ListItems>
110+
</ListEntry>
111+
</ListEntries>
112+
</ListControl>
113+
</View>
114+
<View>
115+
<Name>Microsoft.Azure.Management.Compute.Models.DataDisk</Name>
116+
<ViewSelectedBy>
117+
<TypeName>Microsoft.Azure.Management.Compute.Models.DataDisk</TypeName>
118+
</ViewSelectedBy>
119+
<ListControl>
120+
<ListEntries>
121+
<ListEntry>
122+
<ListItems>
123+
<ListItem>
124+
<Label>Name</Label>
125+
<PropertyName>Name</PropertyName>
126+
</ListItem>
127+
<ListItem>
128+
<Label>DiskSizeGB</Label>
129+
<PropertyName>DiskSizeGB</PropertyName>
130+
</ListItem>
131+
<ListItem>
132+
<Label>Lun</Label>
133+
<PropertyName>Lun</PropertyName>
134+
</ListItem>
135+
<ListItem>
136+
<Label>Caching</Label>
137+
<PropertyName>Caching</PropertyName>
138+
</ListItem>
139+
<ListItem>
140+
<Label>CreateOption</Label>
141+
<PropertyName>CreateOption</PropertyName>
142+
</ListItem>
143+
<ListItem>
144+
<Label>SourceImage</Label>
145+
<PropertyName>SourceImage</PropertyName>
146+
</ListItem>
147+
<ListItem>
148+
<Label>VirtualHardDisk</Label>
149+
<ScriptBlock>
150+
if ($_.VirtualHardDisk -ne $null)
151+
{
152+
$_.VirtualHardDisk.Uri;
153+
}
154+
else
155+
{
156+
$_.VirtualHardDisk;
157+
}
158+
</ScriptBlock>
86159
</ListItem>
87160
</ListItems>
88161
</ListEntry>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Copyright (c) Microsoft and contributors. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
//
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
using System.Net;
18+
19+
namespace Microsoft.Azure.Commands.Compute.Models
20+
{
21+
public class PSOperationResponse
22+
{
23+
public string RequestId { get; set; }
24+
25+
public HttpStatusCode StatusCode { get; set; }
26+
}
27+
}

0 commit comments

Comments
 (0)