Skip to content

Commit eb785d7

Browse files
committed
First CLU Build of Compute Commands
1 parent b356adf commit eb785d7

24 files changed

+1044
-1
lines changed

src/CLU/CLUCoreCLR.sln

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24711.0
4+
VisualStudioVersion = 14.0.23107.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common", "Commands.Common\Commands.Common.xproj", "{5F567ACA-595E-436D-83DB-A21E08F82DF6}"
77
EndProject
@@ -29,6 +29,22 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.We
2929
EndProject
3030
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Resources.Test", "Microsoft.Azure.Commands.Resources.Test\Microsoft.Azure.Commands.Resources.Test.xproj", "{A9CC2879-D45D-4DCB-A405-6EEDB749B15F}"
3131
EndProject
32+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute", "Microsoft.Azure.Commands.Compute\Microsoft.Azure.Commands.Compute.xproj", "{04F9968A-5662-4508-BEE2-31F56848FCBA}"
33+
ProjectSection(ProjectDependencies) = postProject
34+
{99B1290D-A073-4907-8018-51C714431778} = {99B1290D-A073-4907-8018-51C714431778}
35+
{3910613E-4ED2-49E2-8CCF-966D586665AC} = {3910613E-4ED2-49E2-8CCF-966D586665AC}
36+
{81A48E48-89A7-4B93-8207-4F8FA6DC251B} = {81A48E48-89A7-4B93-8207-4F8FA6DC251B}
37+
{45B05B68-516F-4D74-897F-56D12894946C} = {45B05B68-516F-4D74-897F-56D12894946C}
38+
EndProjectSection
39+
EndProject
40+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute.Test", "Microsoft.Azure.Commands.Compute.Test\Microsoft.Azure.Commands.Compute.Test.xproj", "{13C34370-51A4-4726-81B8-BE0996FC9CFF}"
41+
ProjectSection(ProjectDependencies) = postProject
42+
{3910613E-4ED2-49E2-8CCF-966D586665AC} = {3910613E-4ED2-49E2-8CCF-966D586665AC}
43+
{81A48E48-89A7-4B93-8207-4F8FA6DC251B} = {81A48E48-89A7-4B93-8207-4F8FA6DC251B}
44+
{A9CC2879-D45D-4DCB-A405-6EEDB749B15F} = {A9CC2879-D45D-4DCB-A405-6EEDB749B15F}
45+
{04F9968A-5662-4508-BEE2-31F56848FCBA} = {04F9968A-5662-4508-BEE2-31F56848FCBA}
46+
EndProjectSection
47+
EndProject
3248
Global
3349
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3450
Debug|Any CPU = Debug|Any CPU
@@ -87,6 +103,14 @@ Global
87103
{A9CC2879-D45D-4DCB-A405-6EEDB749B15F}.Debug|Any CPU.Build.0 = Debug|Any CPU
88104
{A9CC2879-D45D-4DCB-A405-6EEDB749B15F}.Release|Any CPU.ActiveCfg = Release|Any CPU
89105
{A9CC2879-D45D-4DCB-A405-6EEDB749B15F}.Release|Any CPU.Build.0 = Release|Any CPU
106+
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107+
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
108+
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
109+
{04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.Build.0 = Release|Any CPU
110+
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
111+
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
112+
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
113+
{13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.Build.0 = Release|Any CPU
90114
EndGlobalSection
91115
GlobalSection(SolutionProperties) = preSolution
92116
HideSolutionNode = FALSE
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>13c34370-51a4-4726-81b8-be0996fc9cff</ProjectGuid>
10+
<RootNamespace>Microsoft.Azure.Commands.Compute.Test</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
13+
</PropertyGroup>
14+
15+
<PropertyGroup>
16+
<SchemaVersion>2.0</SchemaVersion>
17+
</PropertyGroup>
18+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
19+
</Project>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"version": "1.0.0-*",
3+
"description": "Tests for Compute Resource Provider Cmdlets",
4+
"authors": [ "huangpf", "markcowl", "hovsepm" ],
5+
"tags": [ "" ],
6+
"projectUrl": "",
7+
"licenseUrl": "",
8+
"frameworks": {
9+
"dnxcore50": {
10+
"dependencies": {
11+
"Microsoft.NETCore": "5.0.1-beta-23516",
12+
"Microsoft.NETCore.Platforms": "1.0.1-beta-23516",
13+
"Microsoft.CSharp": "4.0.1-beta-23516"
14+
}
15+
}
16+
},
17+
"dependencies": {
18+
"Commands.Common": "",
19+
"Commands.Common.Authentication": "",
20+
"Commands.ResourceManager.Common": "",
21+
"Commands.ResourceManager.Cmdlets": "",
22+
"Commands.ScenarioTests.ResourceManager.Common": "",
23+
"Microsoft.Azure.Commands.Profile": "",
24+
"Microsoft.Azure.Commands.Resources": "",
25+
"Microsoft.Azure.Graph.RBAC": "2.0.0-preview",
26+
"Microsoft.Azure.Management.Authorization": "2.0.1-preview",
27+
"Microsoft.Azure.Management.Resources": "3.1.1-preview",
28+
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.210231457-alpha",
29+
"Microsoft.Rest.ClientRuntime": "1.4.1",
30+
"Microsoft.Rest.ClientRuntime.Azure": "2.1.0",
31+
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.0.0-preview",
32+
"Newtonsoft.Json": "7.0.1",
33+
"System.Collections": "4.0.11-beta-23516",
34+
"System.Collections.Concurrent": "4.0.11-beta-23516",
35+
"System.Diagnostics.Tools": "4.0.1-beta-23516",
36+
"System.Diagnostics.TraceSource": "4.0.0-beta-23516",
37+
"System.Diagnostics.Tracing": "4.0.21-beta-23516",
38+
"System.IO": "4.0.11-beta-23516",
39+
"System.IO.FileSystem": "4.0.1-beta-23516",
40+
"System.Net.Http": "4.0.1-beta-23516",
41+
"System.Net.WebHeaderCollection": "4.0.1-beta-23516",
42+
"System.Reflection": "4.1.0-beta-23516",
43+
"System.Reflection.Extensions": "4.0.1-beta-23516",
44+
"System.Reflection.Primitives": "4.0.1-beta-23516",
45+
"System.Reflection.TypeExtensions": "4.1.0-beta-23516",
46+
"System.Runtime": "4.0.21-beta-23516",
47+
"System.Runtime.Extensions": "4.0.11-beta-23516",
48+
"System.Runtime.Serialization.Json": "4.0.1-beta-23516",
49+
"System.Runtime.Serialization.Primitives": "4.1.0-beta-23516",
50+
"System.Runtime.Serialization.Xml": "4.1.0-beta-23516",
51+
"System.Security.Cryptography.Algorithms": "4.0.0-beta-23516",
52+
"System.Security.Cryptography.X509Certificates": "4.0.0-beta-23516",
53+
"System.Text.Encoding": "4.0.11-beta-23516",
54+
"System.Text.Encoding.Extensions": "4.0.11-beta-23516",
55+
"System.Threading": "4.0.11-beta-23516",
56+
"System.Threading.Tasks": "4.0.11-beta-23516",
57+
"System.Threading.Thread": "4.0.0-beta-23516",
58+
"System.Xml.ReaderWriter": "4.0.11-beta-23516",
59+
"xunit": "2.1.0",
60+
"xunit.assert": "2.1.0",
61+
"xunit.runner.dnx": "2.1.0-rc1-build204",
62+
"moq.netcore": "4.4.0-beta8",
63+
"Microsoft.CLU": "1.0.0",
64+
"System.Linq": "4.0.1-beta-23409"
65+
},
66+
"commands": {
67+
"test": "xunit.runner.dnx"
68+
}
69+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 Microsoft.Azure.Commands.Common.Authentication;
16+
using Microsoft.Azure.Commands.Common.Authentication.Models;
17+
using Microsoft.Azure.Management.Compute;
18+
using System;
19+
20+
namespace Microsoft.Azure.Commands.Compute
21+
{
22+
public class ComputeClient
23+
{
24+
public IComputeManagementClient ComputeManagementClient { get; private set; }
25+
26+
public Action<string> VerboseLogger { get; set; }
27+
28+
public Action<string> ErrorLogger { get; set; }
29+
30+
public ComputeClient(IClientFactory clientFactory, AzureContext context)
31+
: this(clientFactory.CreateClient<ComputeManagementClient>(context, AzureEnvironment.Endpoint.ResourceManager))
32+
{
33+
}
34+
35+
public ComputeClient(IComputeManagementClient computeManagementClient)
36+
{
37+
ComputeManagementClient = computeManagementClient;
38+
}
39+
}
40+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 Microsoft.Rest.Azure;
16+
using Microsoft.WindowsAzure.Commands.Common;
17+
using System;
18+
19+
namespace Microsoft.Azure.Commands.Compute
20+
{
21+
public abstract class ComputeClientBaseCmdlet : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
22+
{
23+
protected const string VirtualMachineExtensionType = "Microsoft.Compute/virtualMachines/extensions";
24+
25+
protected override bool IsUsageMetricEnabled
26+
{
27+
get { return true; }
28+
}
29+
30+
private ComputeClient computeClient;
31+
32+
public ComputeClient ComputeClient
33+
{
34+
get
35+
{
36+
if (computeClient == null)
37+
{
38+
computeClient = new ComputeClient(ClientFactory, DefaultProfile.Context)
39+
{
40+
VerboseLogger = WriteVerboseWithTimestamp,
41+
ErrorLogger = WriteErrorWithTimestamp
42+
};
43+
}
44+
45+
return computeClient;
46+
}
47+
48+
set { computeClient = value; }
49+
}
50+
51+
protected override void ProcessRecord()
52+
{
53+
base.ProcessRecord();
54+
}
55+
56+
protected void ExecuteClientAction(Action action)
57+
{
58+
try
59+
{
60+
action();
61+
}
62+
catch (CloudException ex)
63+
{
64+
throw new ComputeCloudException(ex);
65+
}
66+
}
67+
}
68+
}
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 Microsoft.Rest.Azure;
16+
using System;
17+
using System.Linq;
18+
using System.Text;
19+
20+
namespace Microsoft.WindowsAzure.Commands.Common
21+
{
22+
public class ComputeCloudException : CloudException
23+
{
24+
protected const string RequestIdHeaderInResponse = "x-ms-request-id";
25+
26+
public ComputeCloudException(CloudException ex)
27+
: base(GetErrorMessageWithRequestIdInfo(ex), ex)
28+
{
29+
}
30+
31+
protected static string GetErrorMessageWithRequestIdInfo(CloudException cloudException)
32+
{
33+
if (cloudException == null)
34+
{
35+
throw new ArgumentNullException("cloudException");
36+
}
37+
38+
var sb = new StringBuilder();
39+
40+
if (!string.IsNullOrEmpty(cloudException.Message))
41+
{
42+
sb.Append(cloudException.Message);
43+
}
44+
45+
if (cloudException.Response != null &&
46+
cloudException.Response.Headers != null)
47+
{
48+
var headers = cloudException.Response.Headers;
49+
if (headers.Contains(RequestIdHeaderInResponse))
50+
{
51+
sb.AppendLine().AppendFormat(
52+
"OperationID : '{0}'",
53+
headers.FirstOrDefault(h => string.Equals(h.Key, RequestIdHeaderInResponse)));
54+
}
55+
}
56+
57+
return sb.ToString();
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)