Skip to content

Commit b1813ad

Browse files
author
Maddie Clayton
authored
Merge pull request #92 from maddieclayton/profileformat
Update profile models for ps1xml table format
2 parents af5d853 + fc074db commit b1813ad

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

src/Authentication.ResourceManager/Models/PSAzureContext.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,30 +150,30 @@ public PSAzureContext(PSObject other)
150150
/// <summary>
151151
/// The name of the context. The context may be selected by name
152152
/// </summary>
153-
[Ps1Xml(Label = "Context Name", Target = ViewControl.Table)]
153+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, Position = 0)]
154154
public string Name { get; set; }
155155
/// <summary>
156156
/// The account used to connect to Azure.
157157
/// </summary>
158-
[Ps1Xml(Label = "Account id", Target = ViewControl.Table, ScriptBlock = "$_.Account.Id")]
158+
[Ps1Xml(Label = "Account", Target = ViewControl.Table, Position = 1)]
159159
public IAzureAccount Account { get; set; }
160160

161161
/// <summary>
162162
/// The endpoint and connection metadata for the targeted instance of the Azure cloud.
163163
/// </summary>
164-
[Ps1Xml(Label = "Environment Name", Target = ViewControl.Table, ScriptBlock = "$_.Environment.Name")]
164+
[Ps1Xml(Label = "Environment", Target = ViewControl.Table, Position = 3)]
165165
public IAzureEnvironment Environment { get; set; }
166166

167167
/// <summary>
168168
/// The subscription targeted in Azure.
169169
/// </summary>
170-
[Ps1Xml(Label = "Subscription Name", Target = ViewControl.Table, ScriptBlock = "$_.Subscription.Name")]
170+
[Ps1Xml(Label = "SubscriptionName", Target = ViewControl.Table, ScriptBlock = "$_.Subscription.Name", Position = 2)]
171171
public IAzureSubscription Subscription { get; set; }
172172

173173
/// <summary>
174174
/// The targeted tenant in Azure.
175175
/// </summary>
176-
[Ps1Xml(Label = "Tenant Id", Target = ViewControl.Table, ScriptBlock = "$_.Tenant.Id")]
176+
[Ps1Xml(Label = "TenantId", Target = ViewControl.Table, ScriptBlock = "$_.Tenant.ToString()", Position = 4)]
177177
public IAzureTenant Tenant { get; set; }
178178

179179
public IAzureTokenCache TokenCache { get; set; }

src/Authentication.ResourceManager/Models/PSAzureEnvironment.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
1616
using Microsoft.Azure.Commands.Profile.Common;
17+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1718
using System;
1819
using System.Collections.Generic;
1920
using System.Linq;
@@ -117,6 +118,7 @@ public PSAzureEnvironment(PSObject other)
117118
/// <summary>
118119
/// Gets or sets the name of the environment.
119120
/// </summary>
121+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, Position = 0)]
120122
public string Name { get; set; }
121123

122124
/// <summary>
@@ -170,6 +172,7 @@ public bool OnPremise
170172
/// <summary>
171173
/// Gets or sets the Uri of the Azure Resource Manager (ARM) service.
172174
/// </summary>
175+
[Ps1Xml(Label = "Resource Manager Url", Target = ViewControl.Table, Position = 1)]
173176
public string ResourceManagerUrl { get; set; }
174177

175178
/// <summary>
@@ -185,6 +188,7 @@ public bool OnPremise
185188
/// <summary>
186189
/// Gets or sets the Uri of the Active Directory authentication endpoint.
187190
/// </summary>
191+
[Ps1Xml(Label = "ActiveDirectory Authority", Target = ViewControl.Table, Position = 2)]
188192
public string ActiveDirectoryAuthority { get; set; }
189193

190194
/// <summary>

src/Authentication.ResourceManager/Models/PSAzureProfile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public IDictionary<string, PSAzureEnvironment> Environments
8484
/// <summary>
8585
/// The current credentials and metadata for connecting with the current Azure cloud instance.
8686
/// </summary>
87-
[Ps1Xml(Label = "Account Name", Target = ViewControl.Table, ScriptBlock = "$_.Context.Account.Name")]
88-
[Ps1Xml(Label = "Subscription Name", Target = ViewControl.Table, ScriptBlock = "$_.Context.Subscription.Name")]
89-
[Ps1Xml(Label = "Tenant Id", Target = ViewControl.Table, ScriptBlock = "$_.Context.Tenant.Name")]
90-
[Ps1Xml(Label = "Environment Name", Target = ViewControl.Table, ScriptBlock = "$_.Context.Environment.Name")]
87+
[Ps1Xml(Label = "Account", Target = ViewControl.Table, ScriptBlock = "$_.Context.Account.ToString()", Position = 0)]
88+
[Ps1Xml(Label = "SubscriptionName", Target = ViewControl.Table, ScriptBlock = "$_.Context.Subscription.Name", Position = 1)]
89+
[Ps1Xml(Label = "TenantId", Target = ViewControl.Table, ScriptBlock = "$_.Context.Tenant.ToString()", Position = 2)]
90+
[Ps1Xml(Label = "Environment", Target = ViewControl.Table, ScriptBlock = "$_.Context.Environment.ToString()", Position = 3)]
9191
public PSAzureContext Context { get; set; }
9292

9393
public override string ToString()

src/Authentication.ResourceManager/Models/PSAzureSubscription.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ public PSAzureSubscription(PSObject other)
8888
}
8989

9090
/// <inheritdoc />
91-
[Ps1Xml(Label = "Subscription Id", Target = ViewControl.Table)]
91+
[Ps1Xml(Label = "Id", Target = ViewControl.Table, Position = 1)]
9292
public string Id { get; set; }
9393

9494
/// <inheritdoc />
95-
[Ps1Xml(Label = "Subscription Name", Target = ViewControl.Table)]
95+
[Ps1Xml(Label = "Name", Target = ViewControl.Table, Position = 0)]
9696
public string Name { get; set; }
9797

9898
/// <inheritdoc />
99-
[Ps1Xml]
99+
[Ps1Xml(Label = "State", Target = ViewControl.Table, Position = 3)]
100100
public string State { get; set; }
101101

102102
/// <summary>
@@ -107,7 +107,7 @@ public PSAzureSubscription(PSObject other)
107107
/// <summary>
108108
/// The tenant home for the subscription.
109109
/// </summary>
110-
[Ps1Xml(Label = "Tenant Id", Target = ViewControl.Table)]
110+
[Ps1Xml(Label = "TenantId", Target = ViewControl.Table, Position = 2)]
111111
public string TenantId
112112
{
113113
get

src/Authentication.ResourceManager/Models/PSAzureTenant.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ public PSAzureTenant(PSObject other)
8888
/// <summary>
8989
/// The tenant id.
9090
/// </summary>
91-
[Ps1Xml(Label = "Tenant Id", Target = ViewControl.Table)]
91+
[Ps1Xml(Label = "Id", Target = ViewControl.Table, Position = 0)]
9292
public string Id { get; set; }
9393

9494
/// <summary>
9595
/// The name of the subscription.
9696
/// </summary>
97-
[Ps1Xml(Label = "Directory Name", Target = ViewControl.Table)]
97+
[Ps1Xml(Label = "Directory", Target = ViewControl.Table, Position = 1)]
9898
public string Directory { get; set; }
9999

100100
/// <summary>

0 commit comments

Comments
 (0)