Skip to content

Commit bf104f6

Browse files
committed
Merge pull request #137 from Azure/dev
.
2 parents 92eac87 + 5dc79ac commit bf104f6

File tree

236 files changed

+7440
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+7440
-352
lines changed

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function EnsureRegistryPath
3535
$error.clear()
3636
try {
3737
if ($Install.IsPresent) {
38-
EnsureRegistryPath
3938
Write-Output @"
4039
4140
Finalizing installation of Azure PowerShell.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
5757
</Reference>
5858
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59-
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
59+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
6060
<Private>True</Private>
6161
</Reference>
6262
<Reference Include="Microsoft.Azure.Common.NetFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/Common/Commands.Common.Storage/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<packages>
33
<package id="Hyak.Common" version="1.0.2" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
5-
<package id="Microsoft.Azure.Common.Authentication" version="1.3.1-preview" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Common.Authentication" version="1.3.2-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ protected override void BeginProcessing()
218218
ProductInfoHeaderValue userAgentValue = new ProductInfoHeaderValue(
219219
ModuleName, string.Format("v{0}", ModuleVersion));
220220
AzureSession.ClientFactory.UserAgents.Add(userAgentValue);
221+
AzureSession.ClientFactory.AddHandler(new CmdletInfoHandler(this.CommandRuntime.ToString(), this.ParameterSetName));
221222

222223
base.BeginProcessing();
223224
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Net.Http;
16+
using System.Threading;
17+
using System.Threading.Tasks;
18+
19+
namespace Microsoft.WindowsAzure.Commands.Common
20+
{
21+
/// <summary>
22+
/// A delegating handler that writes the current cmdlet info into request headers.
23+
/// </summary>
24+
public class CmdletInfoHandler : DelegatingHandler
25+
{
26+
/// <summary>
27+
/// The name of the cmdlet.
28+
/// </summary>
29+
public string Cmdlet { get; private set; }
30+
31+
/// <summary>
32+
/// The name of the parameter set specified by user.
33+
/// </summary>
34+
public string ParameterSet { get; private set; }
35+
36+
/// <summary>
37+
/// Initializes an instance of a CmdletInfoHandler with the name of the cmdlet and the parameter set.
38+
/// </summary>
39+
/// <param name="cmdlet">the name of the cmdlet</param>
40+
/// <param name="parameterSet">the name of the parameter set specified by user</param>
41+
public CmdletInfoHandler(string cmdlet, string parameterSet)
42+
{
43+
this.Cmdlet = cmdlet;
44+
this.ParameterSet = parameterSet;
45+
}
46+
47+
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
48+
{
49+
if (Cmdlet != null)
50+
{
51+
request.Headers.Add("CommandName", Cmdlet);
52+
}
53+
if (ParameterSet != null)
54+
{
55+
request.Headers.Add("ParameterSetName", ParameterSet);
56+
}
57+
return base.SendAsync(request, cancellationToken);
58+
}
59+
}
60+
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66-
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
67-
<Private>True</Private>
66+
<SpecificVersion>False</SpecificVersion>
67+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Common.NetFramework">
7070
<SpecificVersion>False</SpecificVersion>
@@ -154,6 +154,7 @@
154154
</Compile>
155155
<Compile Include="PublishSettingsImporter.cs" />
156156
<Compile Include="MetricHelper.cs" />
157+
<Compile Include="CmdletInfoHandler.cs" />
157158
<Compile Include="SecureStringExtensions.cs" />
158159
<Compile Include="ConversionUtilities.cs" />
159160
<Compile Include="DebugStreamTraceListener.cs" />

src/Common/Commands.Common/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.ApplicationInsights" version="1.1.1-beta" targetFramework="net45" />
55
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Common.Authentication" version="1.3.1-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Common.Authentication" version="1.3.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
1010
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />

src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</Reference>
4848
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4949
<SpecificVersion>False</SpecificVersion>
50-
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.0-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
50+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
5151
</Reference>
5252
<Reference Include="Microsoft.Azure.Common.NetFramework">
5353
<HintPath>..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>

src/Common/Commands.ScenarioTests.Common/Mocks/MockCertificateAuthenticationFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,10 @@ public Microsoft.Rest.ServiceClientCredentials GetServiceClientCredentials(Azure
7979
{
8080
throw new System.NotImplementedException();
8181
}
82+
83+
public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint)
84+
{
85+
throw new System.NotImplementedException();
86+
}
8287
}
8388
}

src/Common/Commands.ScenarioTests.Common/Mocks/MockClientFactory.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ public void RemoveAction(Type actionType)
165165
// Do nothing
166166
}
167167

168+
public void AddHandler(DelegatingHandler handler)
169+
{
170+
// Do nothing
171+
}
172+
173+
public void RemoveHandler(Type handlerType)
174+
{
175+
// Do nothing
176+
}
177+
168178
public void AddUserAgent(string productName, string productVersion)
169179
{
170180
throw new NotImplementedException();

0 commit comments

Comments
 (0)