Skip to content

Commit f3fd186

Browse files
Merge pull request #3 from MiYanni/add-profile-name
Add ProfileName
2 parents ca00838 + e1eab88 commit f3fd186

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

src/Accounts/Accounts/CommonModule/ContextAdapter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ await Task.Run(() =>
130130
authToken.AuthorizeRequest((type, token) => request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(type, token));
131131
}, outerToken);
132132
}
133+
134+
/// <summary>
135+
/// Gets the currently selected profile from the context
136+
/// </summary>
137+
/// <returns>The name of the selected profile</returns>
138+
internal string GetSelectedProfile()
139+
{
140+
// TODO: Implement profile support into the context and return it here.
141+
return String.Empty;
142+
}
133143
}
134144

135145
}

src/Accounts/Accounts/CommonModule/RegisterAzModule.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16-
using System.Linq;
1716
using System.Threading;
1817
using System.Threading.Tasks;
1918
using System.Management.Automation;
2019
using System.Net.Http;
21-
using System.Collections.Generic;
22-
using Microsoft.Azure.Commands.Profile.Models.Core;
23-
using System.IO;
24-
using Microsoft.Rest;
2520

2621
namespace Microsoft.Azure.Commands.Common
2722
{
@@ -36,7 +31,6 @@ namespace Microsoft.Azure.Commands.Common
3631
[Cmdlet(VerbsLifecycle.Register, @"AzModule")]
3732
public class RegisterAzModule : System.Management.Automation.PSCmdlet
3833
{
39-
4034
protected override void ProcessRecord()
4135
{
4236
try
@@ -58,6 +52,9 @@ protected override void ProcessRecord()
5852

5953
// Called for well-known parameters that require argument completers
6054
ArgumentCompleter = ContextAdapter.Instance.CompleteArgument,
55+
56+
// Gets the selected Azure profile from the context
57+
ProfileName = ContextAdapter.Instance.GetSelectedProfile()
6158
});
6259
}
6360
catch (Exception exception)

src/Accounts/Accounts/CommonModule/VTable.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using System.Threading;
1717
using System.Threading.Tasks;
1818
using System.Net.Http;
19-
using System.Collections.Generic;
2019

2120
namespace Microsoft.Azure.Commands.Common
2221
{
@@ -31,8 +30,6 @@ namespace Microsoft.Azure.Commands.Common
3130
/// </summary>
3231
public class VTable
3332
{
34-
// public object GetParameterValue(string resourceId, string moduleName, System.Management.Automation.InvocationInfo invocationInfo, string name)
35-
3633
/// <summary>
3734
/// The cmdlet will call this when it is trying to fill in a parameter value that it needs
3835
/// </summary>
@@ -41,6 +38,7 @@ public class VTable
4138
/// <param name="invocationInfo">The <see cref="System.Management.Automation.InvocationInfo" /> from the cmdlet</param>
4239
/// <param name="correlationId">The <see cref="string" /> containing the correlation id for the cmdlet</param>
4340
/// <param name="name">The <see cref="string" /> parameter name being asked for</param>
41+
/// <example>public object GetParameterValue(string resourceId, string moduleName, System.Management.Automation.InvocationInfo invocationInfo, string name)</example>
4442
public GetParameterDelegate GetParameterValue;
4543

4644
/// <summary>
@@ -77,16 +75,19 @@ public class VTable
7775
public NewRequestPipelineDelegate OnNewRequest;
7876

7977
/// <summary>
80-
/// Called for well-known parameters that require argument completers
81-
/// </summary>
78+
/// Called for well-known parameters that require argument completers
79+
/// </summary>
8280
/// <param name="completerName">string - the type of completer requested (Resource, Location)</param>
8381
/// <param name="invocationInfo">The <see cref="System.Management.Automation.InvocationInfo" /> from the cmdlet</param>
8482
/// <param name="correlationId">The <see cref="string" /> containing the correlation id for the cmdlet (if available)</param>
8583
/// <param name="resourceTypes">An <see cref="System.String[]"/> containing resource (or resource types) being completed </param >
8684
/// <param name="parentResourceParameterNames"> An <see cref="System.String[]"/> containing list of parent resource parameter names (if applicable)</param >
8785
/// <returns>A <c>string[]</c> containing the valid options for the completer.</returns>
88-
8986
public ArgumentCompleterDelegate ArgumentCompleter;
90-
}
9187

88+
/// <summary>
89+
/// The name of the currently selected Azure profile
90+
/// </summary>
91+
public string ProfileName { get; internal set; }
92+
}
9293
}

0 commit comments

Comments
 (0)