Skip to content

Commit 0e6b3f8

Browse files
committed
Migrate Compute project
1 parent a0c23b4 commit 0e6b3f8

File tree

63 files changed

+397
-178
lines changed

Some content is hidden

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

63 files changed

+397
-178
lines changed

src/Common/Commands.Common/ComputeCloudException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected static string GetErrorMessageWithRequestIdInfo(CloudException cloudExc
4949
if (headers.ContainsKey(RequestIdHeaderInResponse))
5050
{
5151
sb.AppendLine().AppendFormat(
52-
Properties.Resources.ComputeCloudExceptionOperationIdMessage,
52+
"OperationID : '{0}'",
5353
headers[RequestIdHeaderInResponse].FirstOrDefault());
5454
}
5555
}

src/Common/Commands.Common/DiagnosticsHelper.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using System.IO;
1818
using System.Text;
1919
using System.Xml;
20-
using Microsoft.WindowsAzure.Commands.Common.Properties;
2120
using Newtonsoft.Json;
2221

2322
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
@@ -56,18 +55,18 @@ public static Hashtable GetPublicDiagnosticsConfiguration(string config, string
5655
int wadCfgBeginIndex = config.IndexOf("<WadCfg>");
5756
if (wadCfgBeginIndex == -1)
5857
{
59-
throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoWadCfg);
58+
throw new ArgumentException("Cannot find the WadCfg element in the config.");
6059
}
6160

6261
int wadCfgEndIndex = config.IndexOf("</WadCfg>");
6362
if (wadCfgEndIndex == -1)
6463
{
65-
throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoEndWadCfg);
64+
throw new ArgumentException("Cannot find the WadCfg end element in the config.");
6665
}
6766

6867
if (wadCfgEndIndex <= wadCfgBeginIndex)
6968
{
70-
throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoMatchingWadCfg);
69+
throw new ArgumentException("WadCfg start element in the config is not matching the end element.");
7170
}
7271

7372
string encodedConfiguration = Convert.ToBase64String(

src/ResourceManager.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VhdManagement", "ServiceMan
101101
EndProject
102102
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network.Test", "ResourceManager\Network\Commands.Network.Test\Commands.Network.Test.csproj", "{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752}"
103103
EndProject
104+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Compute.Test", "ResourceManager\Compute\Commands.Compute.Test\Commands.Compute.Test.csproj", "{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}"
105+
EndProject
104106
Global
105107
GlobalSection(SolutionConfigurationPlatforms) = preSolution
106108
Debug|Any CPU = Debug|Any CPU
@@ -287,6 +289,10 @@ Global
287289
{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752}.Debug|Any CPU.Build.0 = Debug|Any CPU
288290
{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752}.Release|Any CPU.ActiveCfg = Release|Any CPU
289291
{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752}.Release|Any CPU.Build.0 = Release|Any CPU
292+
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
293+
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
294+
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
295+
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}.Release|Any CPU.Build.0 = Release|Any CPU
290296
EndGlobalSection
291297
GlobalSection(SolutionProperties) = preSolution
292298
HideSolutionNode = FALSE
@@ -306,5 +312,6 @@ Global
306312
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
307313
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
308314
{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
315+
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
309316
EndGlobalSection
310317
EndGlobal

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@
172172
<Compile Include="Properties\AssemblyInfo.cs" />
173173
</ItemGroup>
174174
<ItemGroup>
175+
<ProjectReference Include="..\..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
176+
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
177+
<Name>Commands.ResourceManager.Common</Name>
178+
</ProjectReference>
175179
<ProjectReference Include="..\..\..\Common\Commands.ScenarioTests.Common\Commands.ScenarioTests.Common.csproj">
176180
<Project>{c1bda476-a5cc-4394-914d-48b0ec31a710}</Project>
177181
<Name>Commands.ScenarioTests.Common</Name>
@@ -184,14 +188,6 @@
184188
<Project>{65c3a86a-716d-4e7d-ab67-1db00b3bf72d}</Project>
185189
<Name>Commands.Common.Storage</Name>
186190
</ProjectReference>
187-
<ProjectReference Include="..\..\..\Common\Commands.Common.Test\Commands.Common.Test.csproj">
188-
<Project>{3b48a77b-5956-4a62-9081-92ba04b02b27}</Project>
189-
<Name>Commands.Common.Test</Name>
190-
</ProjectReference>
191-
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
192-
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
193-
<Name>Commands.Common</Name>
194-
</ProjectReference>
195191
<ProjectReference Include="..\Commands.Compute\Commands.Compute.csproj">
196192
<Project>{52643bd5-6378-49bd-9f6e-dac9dd8a867b}</Project>
197193
<Name>Commands.Compute</Name>

src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
using System;
2828
using System.Linq;
2929
using Microsoft.Azure.Common.Authentication;
30+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
3031

3132
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
3233
{
33-
public sealed class ComputeTestController
34+
public sealed class ComputeTestController : RMTestBase
3435
{
3536
bool testViaCsm = true; // Currently set to true, we will get this from Environment varialbe.
3637

src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/GetAzureAvailabilitySetCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public class GetAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
4141
[ValidateNotNullOrEmpty]
4242
public string Name { get; set; }
4343

44-
public override void ExecuteCmdlet()
44+
protected override void ProcessRecord()
4545
{
46-
base.ExecuteCmdlet();
46+
base.ProcessRecord();
4747

4848
ExecuteClientAction(() =>
4949
{

src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public class NewAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
6464
[ValidateNotNullOrEmpty]
6565
public int? PlatformFaultDomainCount { get; set; }
6666

67-
public override void ExecuteCmdlet()
67+
protected override void ProcessRecord()
6868
{
69-
base.ExecuteCmdlet();
69+
base.ProcessRecord();
7070

7171
ExecuteClientAction(() =>
7272
{

src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public class RemoveAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
4646
[ValidateNotNullOrEmpty]
4747
public SwitchParameter Force { get; set; }
4848

49-
public override void ExecuteCmdlet()
49+
protected override void ProcessRecord()
5050
{
51-
base.ExecuteCmdlet();
51+
base.ProcessRecord();
5252

5353
ExecuteClientAction(() =>
5454
{
55-
if (this.Force.IsPresent || this.ShouldContinue(Properties.Resources.AvailabilitySetRemovalConfirmation, Properties.Resources.AvailabilitySetRemovalCaption))
55+
if (this.Force.IsPresent || this.ShouldContinue(Microsoft.Azure.Commands.Compute.Properties.Resources.AvailabilitySetRemovalConfirmation, Microsoft.Azure.Commands.Compute.Properties.Resources.AvailabilitySetRemovalCaption))
5656
{
5757
AzureOperationResponse op = this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name);
5858
var result = Mapper.Map<PSOperation>(op);

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
171171
</ItemGroup>
172172
<ItemGroup>
173+
<Compile Include="..\..\..\Common\Commands.Common\ComputeCloudException.cs">
174+
<Link>Common\ComputeCloudException.cs</Link>
175+
</Compile>
176+
<Compile Include="..\..\..\Common\Commands.Common\DiagnosticsHelper.cs">
177+
<Link>Common\DiagnosticsHelper.cs</Link>
178+
</Compile>
173179
<Compile Include="..\..\..\ServiceManagement\Compute\Commands.ServiceManagement\IaaS\Extensions\DSC\DscExtensionCmdletConstants.cs">
174180
<Link>Extension\DSC\DscExtensionCmdletConstants.cs</Link>
175181
</Compile>
@@ -296,9 +302,9 @@
296302
<Project>{65c3a86a-716d-4e7d-ab67-1db00b3bf72d}</Project>
297303
<Name>Commands.Common.Storage</Name>
298304
</ProjectReference>
299-
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
300-
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
301-
<Name>Commands.Common</Name>
305+
<ProjectReference Include="..\..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
306+
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
307+
<Name>Commands.ResourceManager.Common</Name>
302308
</ProjectReference>
303309
<ProjectReference Include="..\..\..\ServiceManagement\Compute\Sync\Sync.csproj">
304310
<Project>{73820cbc-f4eb-4c5e-b4f0-cc4a93fbf157}</Project>

src/ResourceManager/Compute/Commands.Compute/Common/ComputeClientBaseCmdlet.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace Microsoft.Azure.Commands.Compute
2121
{
22-
public abstract class ComputeClientBaseCmdlet : AzureSMCmdlet
22+
public abstract class ComputeClientBaseCmdlet : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
2323
{
2424
protected const string VirtualMachineExtensionType = "Microsoft.Compute/virtualMachines/extensions";
2525

@@ -44,9 +44,9 @@ public ComputeClient ComputeClient
4444
set { computeClient = value; }
4545
}
4646

47-
public override void ExecuteCmdlet()
47+
protected override void ProcessRecord()
4848
{
49-
base.ExecuteCmdlet();
49+
base.ProcessRecord();
5050
ComputeAutoMapperProfile.Initialize();
5151
}
5252

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/GetAzureVMCustomScriptExtensionCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public class GetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
6464
[ValidateNotNullOrEmpty]
6565
public SwitchParameter Status { get; set; }
6666

67-
public override void ExecuteCmdlet()
67+
protected override void ProcessRecord()
6868
{
69-
base.ExecuteCmdlet();
69+
base.ProcessRecord();
7070

7171
ExecuteClientAction(() =>
7272
{

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/RemoveAzureVMCustomScriptExtensionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public class RemoveAzureVMCustomScriptExtensionCommand : VirtualMachineExtension
5353
[ValidateNotNullOrEmpty]
5454
public SwitchParameter Force { get; set; }
5555

56-
public override void ExecuteCmdlet()
56+
protected override void ProcessRecord()
5757
{
58-
base.ExecuteCmdlet();
58+
base.ProcessRecord();
5959

6060
ExecuteClientAction(() =>
6161
{
62-
if (this.Force.IsPresent || this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption))
62+
if (this.Force.IsPresent || this.ShouldContinue(Microsoft.Azure.Commands.Compute.Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Microsoft.Azure.Commands.Compute.Properties.Resources.VirtualMachineExtensionRemovalCaption))
6363
{
6464
var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name);
6565
WriteObject(op);

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
177177
public string Location { get; set; }
178178

179179

180-
public override void ExecuteCmdlet()
180+
protected override void ProcessRecord()
181181
{
182-
base.ExecuteCmdlet();
182+
base.ProcessRecord();
183183

184184
ExecuteClientAction(() =>
185185
{
@@ -197,7 +197,7 @@ public override void ExecuteCmdlet()
197197

198198
if (string.IsNullOrEmpty(this.Run))
199199
{
200-
WriteWarning(Properties.Resources.CustomScriptExtensionTryToUseTheFirstSpecifiedFileAsRunScript);
200+
WriteWarning(Microsoft.Azure.Commands.Compute.Properties.Resources.CustomScriptExtensionTryToUseTheFirstSpecifiedFileAsRunScript);
201201
this.Run = this.FileName[0];
202202
}
203203
}

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/DscExtensionCmdletCommonBase.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@
55
using Microsoft.Azure.Management.Storage;
66
using Microsoft.WindowsAzure.Commands.Utilities.Common;
77
using Microsoft.WindowsAzure.Storage.Auth;
8+
using Microsoft.Azure.Commands.ResourceManager.Common;
89

910
namespace Microsoft.Azure.Commands.Compute.Extension.DSC
1011
{
1112
static class DscExtensionCmdletCommonBase
1213
{
1314
private static StorageManagementClientWrapper _storageClientWrapper;
1415

15-
private static IStorageManagementClient GetStorageClient(this AzureSMCmdlet cmdlet)
16+
private static IStorageManagementClient GetStorageClient(this Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet cmdlet)
1617
{
1718
if (_storageClientWrapper == null)
1819
{
19-
_storageClientWrapper = new StorageManagementClientWrapper(cmdlet.Profile.DefaultContext);
20+
_storageClientWrapper = new StorageManagementClientWrapper(AzureRMCmdlet.Profile.DefaultContext);
2021
}
2122

2223
return _storageClientWrapper.StorageManagementClient;
2324
}
2425

25-
internal static StorageCredentials GetStorageCredentials(this AzureSMCmdlet cmdlet, String resourceGroupName, String storageAccountName)
26+
internal static StorageCredentials GetStorageCredentials(this Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet cmdlet, String resourceGroupName, String storageAccountName)
2627
{
2728
StorageCredentials credentials = null;
2829
var storageClient = GetStorageClient(cmdlet);
@@ -43,21 +44,21 @@ internal static StorageCredentials GetStorageCredentials(this AzureSMCmdlet cmdl
4344
{
4445
cmdlet.ThrowTerminatingError(
4546
new ErrorRecord(
46-
new UnauthorizedAccessException(Properties.Resources.AzureVMDscDefaultStorageCredentialsNotFound),
47+
new UnauthorizedAccessException(Microsoft.Azure.Commands.Compute.Properties.Resources.AzureVMDscDefaultStorageCredentialsNotFound),
4748
"CredentialsNotFound",
4849
ErrorCategory.PermissionDenied,
4950
null));
5051
}
5152

5253
if (string.IsNullOrEmpty(credentials.AccountName))
5354
{
54-
ThrowInvalidArgumentError(cmdlet, Properties.Resources.AzureVMDscStorageContextMustIncludeAccountName);
55+
ThrowInvalidArgumentError(cmdlet, Microsoft.Azure.Commands.Compute.Properties.Resources.AzureVMDscStorageContextMustIncludeAccountName);
5556
}
5657

5758
return credentials;
5859
}
5960

60-
internal static void ThrowInvalidArgumentError(this AzureSMCmdlet cmdlet, string format, params object[] args)
61+
internal static void ThrowInvalidArgumentError(this Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet cmdlet, string format, params object[] args)
6162
{
6263
cmdlet.ThrowTerminatingError(
6364
new ErrorRecord(

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/GetAzureVMDscExtensionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public class GetAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdlet
5252
[ValidateNotNullOrEmpty]
5353
public SwitchParameter Status { get; set; }
5454

55-
public override void ExecuteCmdlet()
55+
protected override void ProcessRecord()
5656
{
57-
base.ExecuteCmdlet();
57+
base.ProcessRecord();
5858

5959
if (String.IsNullOrEmpty(Name))
6060
{
@@ -131,7 +131,7 @@ private VirtualMachineDscExtensionContext GetDscExtensionContext(PSVirtualMachin
131131
new JsonException(
132132
String.Format(
133133
CultureInfo.CurrentUICulture,
134-
Properties.Resources.AzureVMDscWrongSettingsFormat,
134+
Microsoft.Azure.Commands.Compute.Properties.Resources.AzureVMDscWrongSettingsFormat,
135135
extension.PublicSettings),
136136
e),
137137
string.Empty,

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ public class PublishAzureVMDscConfigurationCommand : DscExtensionPublishCmdletCo
138138
/// </summary>
139139
private StorageCredentials _storageCredentials;
140140

141-
public override void ExecuteCmdlet()
141+
protected override void ProcessRecord()
142142
{
143-
base.ExecuteCmdlet();
143+
base.ProcessRecord();
144144

145145
try
146146
{

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/RemoveAzureVMDscExtensionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ public class RemoveAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdle
4545
[ValidateNotNullOrEmpty]
4646
public string Name { get; set; }
4747

48-
public override void ExecuteCmdlet()
48+
protected override void ProcessRecord()
4949
{
50-
base.ExecuteCmdlet();
50+
base.ProcessRecord();
5151

5252
if (String.IsNullOrEmpty(Name))
5353
{
5454
Name = DscExtensionCmdletConstants.ExtensionPublishedNamespace + "." + DscExtensionCmdletConstants.ExtensionPublishedName;
5555
}
5656

57-
if (ShouldProcess(string.Format(CultureInfo.CurrentUICulture, Properties.Resources.DscExtensionRemovalConfirmation, Name), Properties.Resources.DscExtensionRemovalCaption))
57+
if (ShouldProcess(string.Format(CultureInfo.CurrentUICulture, Microsoft.Azure.Commands.Compute.Properties.Resources.DscExtensionRemovalConfirmation, Name), Microsoft.Azure.Commands.Compute.Properties.Resources.DscExtensionRemovalCaption))
5858
{
5959
//Add retry logic due to CRP service restart known issue CRP bug: 3564713
6060
var count = 1;

0 commit comments

Comments
 (0)