Skip to content

Commit e8d213c

Browse files
committed
Merge branch 'clu' of github.com:Azure/azure-powershell into clu
Conflicts: src/CLU/CLUCoreCLR.sln
2 parents e83a6ab + 7ac43c3 commit e8d213c

File tree

271 files changed

+49612
-89
lines changed

Some content is hidden

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

271 files changed

+49612
-89
lines changed

src/CLU/CLUCoreCLR.sln

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common", "Commands
77
EndProject
88
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common.Authentication", "Commands.Common.Authentication\Commands.Common.Authentication.xproj", "{4CE82310-D016-497D-93A0-0323A3E62064}"
99
EndProject
10-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common.Resources", "Commands.Common.Resources\Commands.Common.Resources.xproj", "{447889D2-370A-461B-ADA3-E892C22E2C05}"
10+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.ResourceManager.Common", "Commands.ResourceManager.Common\Commands.ResourceManager.Common.xproj", "{447889D2-370A-461B-ADA3-E892C22E2C05}"
1111
EndProject
1212
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Profile", "Microsoft.Azure.Commands.Profile\Microsoft.Azure.Commands.Profile.xproj", "{45B05B68-516F-4D74-897F-56D12894946C}"
1313
EndProject
1414
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Websites", "Microsoft.Azure.Commands.Websites\Microsoft.Azure.Commands.Websites.xproj", "{F1A791BB-273E-446F-B9A1-6F8B9991F712}"
15+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.ResourceManager.Cmdlets", "Commands.ResourceManager.Cmdlets\Commands.ResourceManager.Cmdlets.xproj", "{D3F16CA7-CF23-4EBD-B70E-336D2D12415E}"
16+
EndProject
17+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Profile.Test", "Microsoft.Azure.Commands.Profile.Test\Microsoft.Azure.Commands.Profile.Test.xproj", "{E267C25B-98EA-4872-9753-4F6B22F7CA24}"
18+
EndProject
19+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.ScenarioTests.ResourceManager.Common", "Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.xproj", "{9D1F91E1-B319-4914-B09B-60070C5531C7}"
20+
EndProject
21+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Resources", "Microsoft.Azure.Commands.Resources\Microsoft.Azure.Commands.Resources.xproj", "{99B1290D-A073-4907-8018-51C714431778}"
1522
EndProject
1623
Global
1724
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -39,6 +46,22 @@ Global
3946
{F1A791BB-273E-446F-B9A1-6F8B9991F712}.Debug|Any CPU.Build.0 = Debug|Any CPU
4047
{F1A791BB-273E-446F-B9A1-6F8B9991F712}.Release|Any CPU.ActiveCfg = Release|Any CPU
4148
{F1A791BB-273E-446F-B9A1-6F8B9991F712}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{D3F16CA7-CF23-4EBD-B70E-336D2D12415E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{D3F16CA7-CF23-4EBD-B70E-336D2D12415E}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{D3F16CA7-CF23-4EBD-B70E-336D2D12415E}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{D3F16CA7-CF23-4EBD-B70E-336D2D12415E}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{E267C25B-98EA-4872-9753-4F6B22F7CA24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{E267C25B-98EA-4872-9753-4F6B22F7CA24}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{E267C25B-98EA-4872-9753-4F6B22F7CA24}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{E267C25B-98EA-4872-9753-4F6B22F7CA24}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58+
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
59+
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
60+
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Release|Any CPU.Build.0 = Release|Any CPU
61+
{99B1290D-A073-4907-8018-51C714431778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62+
{99B1290D-A073-4907-8018-51C714431778}.Debug|Any CPU.Build.0 = Debug|Any CPU
63+
{99B1290D-A073-4907-8018-51C714431778}.Release|Any CPU.ActiveCfg = Release|Any CPU
64+
{99B1290D-A073-4907-8018-51C714431778}.Release|Any CPU.Build.0 = Release|Any CPU
4265
EndGlobalSection
4366
GlobalSection(SolutionProperties) = preSolution
4467
HideSolutionNode = FALSE

src/CLU/Commands.Common.Authentication/ClientFactory.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,25 @@ public virtual TClient CreateArmClient<TClient>(AzureContext context, AzureEnvir
8080

8181
public virtual TClient CreateCustomArmClient<TClient>(params object[] parameters) where TClient : Microsoft.Rest.ServiceClient<TClient>
8282
{
83+
var handlers = new List<DelegatingHandler>();
84+
var newParameters = new List<object>();
8385
List<Type> types = new List<Type>();
8486
foreach (object obj in parameters)
8587
{
86-
types.Add(obj.GetType());
88+
if (obj is DelegatingHandler)
89+
{
90+
handlers.Add(obj as DelegatingHandler);
91+
}
92+
else
93+
{
94+
types.Add(obj.GetType());
95+
newParameters.Add(obj);
96+
}
8797
}
98+
99+
types.Add(typeof (DelegatingHandler[]));
100+
newParameters.Add(handlers.ToArray());
101+
88102

89103
var constructor = typeof(TClient).GetConstructor(types.ToArray());
90104

@@ -93,7 +107,7 @@ public virtual TClient CreateCustomArmClient<TClient>(params object[] parameters
93107
throw new InvalidOperationException(string.Format(Resources.InvalidManagementClientType, typeof(TClient).Name));
94108
}
95109

96-
TClient client = (TClient)constructor.Invoke(parameters);
110+
TClient client = (TClient)constructor.Invoke(newParameters.ToArray());
97111

98112
foreach (ProductInfoHeaderValue userAgent in UserAgents)
99113
{

src/CLU/Commands.Common.Authentication/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}
@@ -31,7 +31,7 @@
3131
"System.Reflection.Extensions": "4.0.1-beta-23516",
3232
"System.Reflection.Primitives": "4.0.1-beta-23516",
3333
"System.Reflection.TypeExtensions": "4.1.0-beta-23516",
34-
"System.Runtime": "4.0.20",
34+
"System.Runtime": "4.0.21-beta-23516",
3535
"System.Runtime.Extensions": "4.0.11-beta-23409",
3636
"System.Runtime.Serialization.Json": "4.0.1-beta-23409",
3737
"System.Runtime.Serialization.Primitives": "4.0.11-beta-23409",

src/CLU/Commands.Common/AzurePSCmdlet.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,20 @@ protected virtual bool IsErrorMetricEnabled
8484
public AzurePSCmdlet()
8585
{
8686
_debugMessages = new ConcurrentQueue<string>();
87-
// TODO: Instantiate ClientFactory and AuthenticationFactory
88-
// remove
89-
ClientFactory = new ClientFactory();
90-
AuthenticationFactory = new AuthenticationFactory();
9187
#if DEBUG
9288
if (!TestMockSupport.RunningMocked)
9389
{
9490
#endif
95-
DataStore = new DiskDataStore();
91+
DataStore = DataStore ?? new DiskDataStore();
9692
#if DEBUG
9793
}
9894
else
9995
{
100-
DataStore = new MemoryDataStore();
96+
DataStore = DataStore ?? new MemoryDataStore();
10197
}
10298
#endif
99+
AuthenticationFactory = AuthenticationFactory ?? new AuthenticationFactory(DataStore);
100+
ClientFactory = ClientFactory?? new ClientFactory(DataStore, AuthenticationFactory);
103101
}
104102

105103
protected virtual T GetSessionVariableValue<T>(string name, T defaultValue) where T : class
@@ -338,7 +336,11 @@ protected bool IsVerbose()
338336
protected new void WriteObject(object sendToPipeline)
339337
{
340338
FlushDebugMessages();
339+
#if DEBUG
340+
CommandRuntime.WriteObject(sendToPipeline);
341+
#else
341342
base.WriteObject(sendToPipeline);
343+
#endif
342344
}
343345

344346
protected new void WriteObject(object sendToPipeline, bool enumerateCollection)

src/CLU/Commands.Common/AzureSMProfileProvder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using Microsoft.Azure.Commands.Common.Authentication;
1818
using Microsoft.Azure.Commands.Common.Authentication.Models;
1919
using Microsoft.IdentityModel.Clients.ActiveDirectory;
20-
using Microsoft.WindowsAzure.Commands.Utilities.Common;
20+
using Microsoft.Azure.Commands.Utilities.Common;
2121

2222
namespace Microsoft.Azure.Commands.Common
2323
{

src/CLU/Commands.Common/CmdletExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using System.Management.Automation;
1818
using System.Reflection;
1919

20-
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
20+
namespace Microsoft.Azure.Commands.Utilities.Common
2121
{
2222
public static class CmdletExtensions
2323
{

src/CLU/Commands.Common/GeneralUtilities.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
using Microsoft.Azure.Commands.Common;
2828
using Microsoft.Azure.Commands.Common.Properties;
2929

30-
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
30+
namespace Microsoft.Azure.Commands.Utilities.Common
3131
{
3232
public static class GeneralUtilities
3333
{
@@ -347,6 +347,25 @@ public static Uri CreateHttpsEndpoint(string endpointUri)
347347
return new Uri(endpoint);
348348
}
349349

350+
public static string DownloadFile(string uri)
351+
{
352+
string contents = null;
353+
354+
using (HttpClient httClient = new HttpClient())
355+
{
356+
try
357+
{
358+
contents = httClient.GetStringAsync(uri).ConfigureAwait(false).GetAwaiter().GetResult();
359+
}
360+
catch
361+
{
362+
// Ignore the exception and return empty contents
363+
}
364+
}
365+
366+
return contents;
367+
}
368+
350369
public static string GenerateSeparator(int amount, string separator)
351370
{
352371
StringBuilder result = new StringBuilder();

src/CLU/Commands.Common/Models/PSAzureProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Text;
44
using System.Threading.Tasks;
55
using Microsoft.Azure.Commands.Common.Authentication.Models;
6-
using Microsoft.WindowsAzure.Commands.Utilities.Common;
6+
using Microsoft.Azure.Commands.Utilities.Common;
77

88
namespace Microsoft.Azure.Commands.Models
99
{

0 commit comments

Comments
 (0)