Skip to content

Commit 7735306

Browse files
grizzlytheodoreTheodore Chang
andauthored
improved printed output for Get-AzComputeResourceSku (Azure#18474)
* add property * changes * update * update * update * update * update unecessary output from new column * last chagne * remove not useful columns * changelog Co-authored-by: Theodore Chang <theodore.l.chang@gmail.com>
1 parent a389635 commit 7735306

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
-->
2222
## Upcoming Release
23+
* Improve printed output for `Get-AzComputeResourceSku`
2324
* Updated `Update-AzVm` to give constructive error messages when empty variables are passed in parameters. [#15081]
2425

2526
## Version 4.30.0

src/Compute/Compute/Compute.Automation.generated.format.ps1xml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@
474474
</TableColumnHeader>
475475
<TableColumnHeader>
476476
<Label>Name</Label>
477+
<Width>20</Width>
477478
<Alignment>Right</Alignment>
478479
</TableColumnHeader>
479480
<TableColumnHeader>
@@ -485,16 +486,9 @@
485486
<Alignment>Right</Alignment>
486487
</TableColumnHeader>
487488
<TableColumnHeader>
488-
<Label>Restriction</Label>
489-
<Alignment>Right</Alignment>
490-
</TableColumnHeader>
491-
<TableColumnHeader>
492-
<Label>Capability</Label>
493-
<Alignment>Right</Alignment>
494-
</TableColumnHeader>
495-
<TableColumnHeader>
496-
<Label>Value</Label>
497-
<Alignment>Right</Alignment>
489+
<Label>RestrictionInfo</Label>
490+
<Alignment>Left</Alignment>
491+
<Width>30</Width>
498492
</TableColumnHeader>
499493
</TableHeaders>
500494
<TableRowEntries>
@@ -513,13 +507,7 @@
513507
<ScriptBlock>$_.LocationInfo[0].Zones</ScriptBlock>
514508
</TableColumnItem>
515509
<TableColumnItem>
516-
<ScriptBlock>$_.Restrictions[0].ReasonCode</ScriptBlock>
517-
</TableColumnItem>
518-
<TableColumnItem>
519-
<ScriptBlock>$_.Capabilities[0].Name</ScriptBlock>
520-
</TableColumnItem>
521-
<TableColumnItem>
522-
<ScriptBlock>$_.Capabilities[0].Value</ScriptBlock>
510+
<ScriptBlock>$_.RestrictionInfo</ScriptBlock>
523511
</TableColumnItem>
524512
</TableColumnItems>
525513
</TableRowEntry>

src/Compute/Compute/Generated/Models/PSResourceSku.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,34 @@ public partial class PSResourceSku
4040
public IList<ResourceSkuCosts> Costs { get; set; }
4141
public IList<ResourceSkuCapabilities> Capabilities { get; set; }
4242
public IList<ResourceSkuRestrictions> Restrictions { get; set; }
43-
43+
public IList<string> RestrictionInfo
44+
{
45+
get
46+
{
47+
List<string> restrictionInfos = new List<string>();
48+
foreach (ResourceSkuRestrictions info in Restrictions)
49+
{
50+
string aInfo = "";
51+
if (info.Type != null)
52+
{
53+
aInfo = "type: " + info.Type.ToString();
54+
}
55+
if (info.RestrictionInfo != null)
56+
{
57+
if (info.RestrictionInfo.Locations != null)
58+
{
59+
aInfo = aInfo + ", locations: " + string.Join(", ", info.RestrictionInfo.Locations);
60+
}
61+
if (info.RestrictionInfo.Zones != null)
62+
{
63+
aInfo = aInfo + ", zones: " + string.Join(", ", info.RestrictionInfo.Zones);
64+
}
65+
}
66+
restrictionInfos.Add(aInfo);
67+
}
68+
//this.restrictionInfo = restrictionInfos;
69+
return restrictionInfos;
70+
}
71+
}
4472
}
4573
}

0 commit comments

Comments
 (0)