Skip to content

Commit 5c28b7e

Browse files
Merge pull request #6683 from wastoresh/previewformat
[Storage] Add Ps1XmlAttribute to Storage cmdlets output types properties.
2 parents 115e26c + d2cc2d1 commit 5c28b7e

18 files changed

+474
-309
lines changed

src/Common/Commands.Common.Storage/Adapters/WindowsAzure.Storage.8/ResourceModel/AzureStorageBlob.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel
1616
{
1717
using Microsoft.WindowsAzure.Storage.Blob;
1818
using System;
19+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1920

2021
/// <summary>
2122
/// Azure storage blob object
@@ -24,22 +25,28 @@ public class AzureStorageBlob : AzureStorageBase
2425
{
2526
/// <summary>
2627
/// CloudBlob object
27-
/// </summary>
28+
/// </summary>
29+
[Ps1Xml(Label = "Container Uri", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.ICloudBlob.Container.Uri")]
30+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0, TableColumnWidth = 20)]
31+
[Ps1Xml(Label = "AccessTier", Target = ViewControl.Table, ScriptBlock = "$_.ICloudBlob.Properties.StandardBlobTier", Position = 5, TableColumnWidth = 10)]
2832
public CloudBlob ICloudBlob { get; private set; }
2933

3034
/// <summary>
3135
/// Azure storage blob type
3236
/// </summary>
37+
[Ps1Xml(Label = "BlobType", Target = ViewControl.Table, Position = 1, TableColumnWidth = 9)]
3338
public BlobType BlobType { get; private set; }
3439

3540
/// <summary>
3641
/// Blob length
3742
/// </summary>
43+
[Ps1Xml(Label = "Length", Target = ViewControl.Table, Position = 2, TableColumnWidth = 15)]
3844
public long Length { get; private set; }
3945

4046
/// <summary>
4147
/// Blob IsDeleted
4248
/// </summary>
49+
[Ps1Xml(Label = "IsDeleted", Target = ViewControl.Table, Position = 7, TableColumnWidth = 10)]
4350
public bool IsDeleted { get; private set; }
4451

4552
/// <summary>
@@ -50,16 +57,19 @@ public class AzureStorageBlob : AzureStorageBase
5057
/// <summary>
5158
/// Blob content type
5259
/// </summary>
60+
[Ps1Xml(Label = "ContentType", Target = ViewControl.Table, Position = 3, TableColumnWidth = 30)]
5361
public string ContentType { get; private set; }
5462

5563
/// <summary>
5664
/// Blob last modified time
5765
/// </summary>
66+
[Ps1Xml(Label = "LastModified", Target = ViewControl.Table, ScriptBlock = "$_.LastModified.UtcDateTime.ToString(\"u\")", Position = 4, TableColumnWidth = 20)]
5867
public DateTimeOffset? LastModified { get; private set; }
5968

6069
/// <summary>
6170
/// Blob snapshot time
6271
/// </summary>
72+
[Ps1Xml(Label = "SnapshotTime", Target = ViewControl.Table, ScriptBlock = "$_.SnapshotTime.UtcDateTime.ToString(\"u\")", Position = 6, TableColumnWidth = 20)]
6373
public DateTimeOffset? SnapshotTime { get; private set; }
6474

6575
/// <summary>

src/Common/Commands.Common.Storage/Adapters/WindowsAzure.Storage.8/ResourceModel/AzureStorageContainer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel
1616
{
1717
using Microsoft.WindowsAzure.Storage.Blob;
1818
using System;
19+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1920

2021
/// <summary>
2122
/// azure storage container
@@ -25,6 +26,8 @@ public class AzureStorageContainer : AzureStorageBase
2526
/// <summary>
2627
/// CloudBlobContainer object
2728
/// </summary>
29+
[Ps1Xml(Label = "Blob End Point", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.CloudBlobContainer.ServiceClient.BaseUri")]
30+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0, TableColumnWidth = 20)]
2831
public CloudBlobContainer CloudBlobContainer { get; private set; }
2932

3033
/// <summary>
@@ -35,11 +38,13 @@ public class AzureStorageContainer : AzureStorageBase
3538
/// <summary>
3639
/// the public access level of CloudBlobContainer
3740
/// </summary>
41+
[Ps1Xml(Label = "PublicAccess", Target = ViewControl.Table, Position = 1, TableColumnWidth = 20)]
3842
public BlobContainerPublicAccessType? PublicAccess { get; private set; }
3943

4044
/// <summary>
4145
/// last modified of CloudBlobContainer
4246
/// </summary>
47+
[Ps1Xml(Label = "LastModified", Target = ViewControl.Table, Position = 2)]
4348
public DateTimeOffset? LastModified { get; private set; }
4449

4550
/// <summary>

src/Common/Commands.Common.Storage/Adapters/WindowsAzure.Storage.8/ResourceModel/AzureStorageQueue.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel
1616
{
1717
using Microsoft.WindowsAzure.Storage.Queue;
1818
using System;
19+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1920

2021
/// <summary>
2122
/// Azure storage queue
@@ -25,21 +26,26 @@ public class AzureStorageQueue : AzureStorageBase
2526
/// <summary>
2627
/// Cloud Queue object
2728
/// </summary>
29+
[Ps1Xml(Label = "Queue End Point", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.CloudQueue.ServiceClient.BaseUri")]
30+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0)]
2831
public CloudQueue CloudQueue { get; private set; }
2932

3033
/// <summary>
3134
/// Queue uri
3235
/// </summary>
36+
[Ps1Xml(Label = "Uri", Target = ViewControl.Table, ScriptBlock = "$_.Uri", Position = 1)]
3337
public Uri Uri { get; private set; }
3438

3539
/// <summary>
3640
/// Approximate message count
3741
/// </summary>
42+
[Ps1Xml(Label = "ApproximateMessageCount", Target = ViewControl.Table, ScriptBlock = "$_.ApproximateMessageCount", Position = 2)]
3843
public int? ApproximateMessageCount { get; private set; }
3944

4045
/// <summary>
4146
/// Whether applied base64 encoding
4247
/// </summary>
48+
[Ps1Xml(Label = "EncodeMessage", Target = ViewControl.Table, ScriptBlock = "$_.EncodeMessage", Position = 3)]
4349
public bool EncodeMessage { get; private set; }
4450

4551
/// <summary>

src/Common/Commands.Common.Storage/Adapters/WindowsAzure.Storage.8/ResourceModel/AzureStorageTable.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel
1616
{
1717
using Microsoft.WindowsAzure.Storage.Table;
1818
using System;
19+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1920

2021
/// <summary>
2122
/// Azure storage table object
@@ -25,11 +26,14 @@ public class AzureStorageTable : AzureStorageBase
2526
/// <summary>
2627
/// Cloud table object
2728
/// </summary>
29+
[Ps1Xml(Label = "Table End Point", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.CloudTable.ServiceClient.BaseUri")]
30+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0)]
2831
public CloudTable CloudTable { get; private set; }
2932

3033
/// <summary>
3134
/// Table uri
3235
/// </summary>
36+
[Ps1Xml(Label = "Uri", Target = ViewControl.Table, ScriptBlock = "$_.Uri", Position = 1)]
3337
public Uri Uri { get; private set; }
3438

3539
/// <summary>

src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
<Project>{70527617-7598-4aef-b5bd-db9186b8184b}</Project>
8989
<Name>Commands.Common.Authentication.Abstractions</Name>
9090
</ProjectReference>
91+
<ProjectReference Include="..\Commands.Common\Commands.Common.csproj">
92+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
93+
<Name>Commands.Common</Name>
94+
</ProjectReference>
9195
</ItemGroup>
9296
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9397
</Project>

src/ResourceManager/Profile/Commands.Profile/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
## Current Release
2121
* Updated Common.Strategy library to be able to validate that the current config for a resource is compatible with the target resource. Default is always true, individual resources and overridet the default.
2222
* Updated help files to include full parameter types.
23+
* Added ps1xml types to Common.Storage
2324

2425
## Version 5.3.3
2526
* Updated help for `Get-AzureRmContextAutosaveSetting`

src/ResourceManager/Storage/Commands.Management.Storage/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
-->
2020
## Current Release
2121
* Updated help files to include full parameter types.
22+
* Add Ps1XmlAttribute to cmdlets output types properties
23+
* Show StorageAccount cmdlet output in table view
24+
- Get-AzureRmStorageAccount
25+
- New-AzureRmStorageAccount
26+
- Set-AzureRmStorageAccount
2227

2328
## Version 5.0.0
2429
* Set minimum dependency of module to PowerShell 5.0
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,94 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0"?>
22
<Configuration>
33
<ViewDefinitions>
4+
<View>
5+
<Name>Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount</Name>
6+
<ViewSelectedBy>
7+
<TypeName>Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount</TypeName>
8+
</ViewSelectedBy>
9+
<TableControl>
10+
<TableHeaders>
11+
<TableColumnHeader>
12+
<Alignment>Left</Alignment>
13+
<Label>StorageAccountName</Label>
14+
</TableColumnHeader>
15+
<TableColumnHeader>
16+
<Alignment>Left</Alignment>
17+
<Label>ResourceGroupName</Label>
18+
</TableColumnHeader>
19+
<TableColumnHeader>
20+
<Alignment>Left</Alignment>
21+
<Label>Location</Label>
22+
</TableColumnHeader>
23+
<TableColumnHeader>
24+
<Alignment>Left</Alignment>
25+
<Label>SkuName</Label>
26+
</TableColumnHeader>
27+
<TableColumnHeader>
28+
<Alignment>Left</Alignment>
29+
<Label>Kind</Label>
30+
</TableColumnHeader>
31+
<TableColumnHeader>
32+
<Alignment>Left</Alignment>
33+
<Label>AccessTier</Label>
34+
</TableColumnHeader>
35+
<TableColumnHeader>
36+
<Alignment>Left</Alignment>
37+
<Label>CreationTime</Label>
38+
</TableColumnHeader>
39+
<TableColumnHeader>
40+
<Alignment>Left</Alignment>
41+
<Label>ProvisioningState</Label>
42+
</TableColumnHeader>
43+
<TableColumnHeader>
44+
<Alignment>Left</Alignment>
45+
<Label>EnableHttpsTrafficOnly</Label>
46+
</TableColumnHeader>
47+
</TableHeaders>
48+
<TableRowEntries>
49+
<TableRowEntry>
50+
<TableColumnItems>
51+
<TableColumnItem>
52+
<Alignment>Left</Alignment>
53+
<PropertyName>StorageAccountName</PropertyName>
54+
</TableColumnItem>
55+
<TableColumnItem>
56+
<Alignment>Left</Alignment>
57+
<PropertyName>ResourceGroupName</PropertyName>
58+
</TableColumnItem>
59+
<TableColumnItem>
60+
<Alignment>Left</Alignment>
61+
<PropertyName>Location</PropertyName>
62+
</TableColumnItem>
63+
<TableColumnItem>
64+
<Alignment>Left</Alignment>
65+
<ScriptBlock>$_.Sku.Name</ScriptBlock>
66+
</TableColumnItem>
67+
<TableColumnItem>
68+
<Alignment>Left</Alignment>
69+
<PropertyName>Kind</PropertyName>
70+
</TableColumnItem>
71+
<TableColumnItem>
72+
<Alignment>Left</Alignment>
73+
<PropertyName>AccessTier</PropertyName>
74+
</TableColumnItem>
75+
<TableColumnItem>
76+
<Alignment>Left</Alignment>
77+
<PropertyName>CreationTime</PropertyName>
78+
</TableColumnItem>
79+
<TableColumnItem>
80+
<Alignment>Left</Alignment>
81+
<PropertyName>ProvisioningState</PropertyName>
82+
</TableColumnItem>
83+
<TableColumnItem>
84+
<Alignment>Left</Alignment>
85+
<PropertyName>EnableHttpsTrafficOnly</PropertyName>
86+
</TableColumnItem>
87+
</TableColumnItems>
88+
</TableRowEntry>
89+
</TableRowEntries>
90+
</TableControl>
91+
</View>
492
<View>
593
<Name>Microsoft.Azure.Commands.Management.Storage.Models.PSNetworkRuleSet</Name>
694
<ViewSelectedBy>
@@ -11,45 +99,25 @@
1199
<ListEntry>
12100
<ListItems>
13101
<ListItem>
102+
<PropertyName>Bypass</PropertyName>
14103
<Label>Bypass</Label>
15-
<PropertyName>bypass</PropertyName>
16104
</ListItem>
17105
<ListItem>
106+
<PropertyName>DefaultAction</PropertyName>
18107
<Label>DefaultAction</Label>
19-
<PropertyName>defaultAction</PropertyName>
20108
</ListItem>
21109
<ListItem>
110+
<ScriptBlock>if (($_.ipRules -ne $null) -and ($_.ipRules.Count -ne 0)) {"[" + $_.ipRules[0].IPAddressOrRange + ",...]"} else {$null}</ScriptBlock>
22111
<Label>IpRules</Label>
23-
<ScriptBlock>
24-
if (($_.ipRules -ne $null) -and ($_.ipRules.Count -ne 0))
25-
{
26-
"[" + $_.ipRules[0].IPAddressOrRange + ",...]"
27-
}
28-
else
29-
{
30-
$null
31-
}
32-
</ScriptBlock>
33112
</ListItem>
34113
<ListItem>
114+
<ScriptBlock>if ($_.virtualNetworkRules[0] -ne $null) {"[" + $_.virtualNetworkRules[0].VirtualNetworkResourceId + ",...]"} else {$null}</ScriptBlock>
35115
<Label>VirtualNetworkRules</Label>
36-
<ScriptBlock>
37-
if ($_.virtualNetworkRules[0] -ne $null)
38-
{
39-
"[" + $_.virtualNetworkRules[0].VirtualNetworkResourceId + ",...]"
40-
}
41-
else
42-
{
43-
$null
44-
}
45-
</ScriptBlock>
46-
</ListItem>
116+
</ListItem>
47117
</ListItems>
48118
</ListEntry>
49119
</ListEntries>
50-
</ListControl>
51-
</View>
120+
</ListControl>
121+
</View>
52122
</ViewDefinitions>
53-
</Configuration>
54-
55-
123+
</Configuration>

src/ResourceManager/Storage/Commands.Management.Storage/Models/PSNetworkRule.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Azure.Management.Storage.Models;
1616
using System;
1717
using System.Collections.Generic;
18+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1819

1920
namespace Microsoft.Azure.Commands.Management.Storage.Models
2021
{
@@ -59,12 +60,16 @@ public struct PSVirtualNetworkRule
5960
//Wrapper of NetworkRuleSet
6061
public class PSNetworkRuleSet
6162
{
63+
[Ps1Xml(Label = "IpRules", Target = ViewControl.List, ScriptBlock = "if (($_.ipRules -ne $null) -and ($_.ipRules.Count -ne 0)) {\"[\" + $_.ipRules[0].IPAddressOrRange + \",...]\"} else {$null}", Position = 2)]
6264
public PSIpRule[] IpRules { get; set; }
6365

66+
[Ps1Xml(Label = "VirtualNetworkRules", Target = ViewControl.List, ScriptBlock = "if ($_.virtualNetworkRules[0] -ne $null) {\"[\" + $_.virtualNetworkRules[0].VirtualNetworkResourceId + \",...]\"} else {$null}", Position = 3)]
6467
public PSVirtualNetworkRule[] VirtualNetworkRules { get; set; }
6568

69+
[Ps1Xml(Label = "Bypass", Target = ViewControl.List, Position = 0)]
6670
public PSNetWorkRuleBypassEnum? Bypass { get; set; }
6771

72+
[Ps1Xml(Label = "DefaultAction", Target = ViewControl.List, Position = 1)]
6873
public PSNetWorkRuleDefaultActionEnum DefaultAction { get; set; }
6974

7075

0 commit comments

Comments
 (0)