Skip to content

Commit 7f07d06

Browse files
committed
[#104553236] Add back CmdletInfoHandler to AzurePSCmdlet
1 parent 8d4d9a3 commit 7f07d06

File tree

178 files changed

+189
-180
lines changed

Some content is hidden

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

178 files changed

+189
-180
lines changed

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.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
59+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.3-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.2-preview" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Common.Authentication" version="1.3.3-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: 2 additions & 1 deletion
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
base.BeginProcessing();
222223
}
223224

@@ -235,7 +236,7 @@ protected override void EndProcessing()
235236
FlushDebugMessages();
236237

237238
AzureSession.ClientFactory.UserAgents.RemoveAll(u => u.Product.Name == ModuleName);
238-
239+
AzureSession.ClientFactory.RemoveHandler(typeof(CmdletInfoHandler));
239240
base.EndProcessing();
240241
}
241242

src/Common/Commands.Common/CmdletInfoHandler.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Net.Http;
1617
using System.Threading;
1718
using System.Threading.Tasks;
@@ -21,7 +22,7 @@ namespace Microsoft.WindowsAzure.Commands.Common
2122
/// <summary>
2223
/// A delegating handler that writes the current cmdlet info into request headers.
2324
/// </summary>
24-
public class CmdletInfoHandler : DelegatingHandler
25+
public class CmdletInfoHandler : DelegatingHandler, ICloneable
2526
{
2627
/// <summary>
2728
/// The name of the cmdlet.
@@ -56,5 +57,10 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
5657
}
5758
return base.SendAsync(request, cancellationToken);
5859
}
60+
61+
public object Clone()
62+
{
63+
return new CmdletInfoHandler(this.Cmdlet, this.ParameterSet);
64+
}
5965
}
6066
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
67+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.3-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Common.NetFramework">
7070
<SpecificVersion>False</SpecificVersion>

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.2-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Common.Authentication" version="1.3.3-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.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
50+
<HintPath>..\..\packages\Microsoft.Azure.Common.Authentication.1.3.3-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/MockClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void RemoveAction(Type actionType)
165165
// Do nothing
166166
}
167167

168-
public void AddHandler(DelegatingHandler handler)
168+
public void AddHandler<T>(T handler) where T : DelegatingHandler, ICloneable
169169
{
170170
// Do nothing
171171
}

src/Common/Commands.ScenarioTests.Common/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.2-preview" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Common.Authentication" version="1.3.3-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</Reference>
6060
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6161
<SpecificVersion>False</SpecificVersion>
62-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.2-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
62+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.3-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Common.NetFramework">
6565
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>

0 commit comments

Comments
 (0)