Skip to content

Commit 0c6c7b3

Browse files
committed
PR Review: Line breaks, using namespaces
1 parent 8f69cbe commit 0c6c7b3

7 files changed

+55
-28
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/ConfirmAzureStorSimpleLegacyVolumeContainerStatus.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ public class ConfirmAzureStorSimpleLegacyVolumeContainerStatus : StorSimpleCmdle
3434
[ValidateSet("Commit", "Rollback", IgnoreCase = true)]
3535
public string MigrationOperation { get; set; }
3636

37-
[Parameter(Mandatory = false, Position = 2, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
37+
[Parameter(Mandatory = false, Position = 2,
38+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3839
public string[] LegacyContainerNames { get; set; }
3940

4041
public override void ExecuteCmdlet()
4142
{
4243
try
4344
{
4445
var confirmMigrationRequest = new MigrationConfirmStatusRequest();
45-
confirmMigrationRequest.Operation = (MigrationOperation)Enum.Parse(typeof(MigrationOperation), MigrationOperation, true);
46-
confirmMigrationRequest.DataContainerNameList = (null != LegacyContainerNames) ? new List<string>(LegacyContainerNames.ToList().Distinct()) : new List<string>();
46+
confirmMigrationRequest.Operation =
47+
(MigrationOperation) Enum.Parse(typeof (MigrationOperation), MigrationOperation, true);
48+
confirmMigrationRequest.DataContainerNameList = (null != LegacyContainerNames)
49+
? new List<string>(LegacyContainerNames.ToList().Distinct())
50+
: new List<string>();
4751
var status = StorSimpleClient.ConfirmLegacyVolumeContainerStatus(LegacyConfigId, confirmMigrationRequest);
4852
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
4953
WriteObject(opFormatter.GetResultMessage(Resources.ConfirmMigrationSuccessMessage, status));
5054
}
51-
catch(Exception except)
55+
catch (Exception except)
5256
{
5357
this.HandleException(except);
5458
}

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/GetAzureStorSimpleLegacyVolumeContainerConfirmStatus.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public class GetAzureStorSimpleLegacyVolumeContainerConfirmStatus : StorSimpleCm
2626
[ValidateNotNullOrEmpty]
2727
public string LegacyConfigId { get; set; }
2828

29-
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
29+
[Parameter(Mandatory = false, Position = 1,
30+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3031
public string[] LegacyContainerNames { get; set; }
3132

3233
public override void ExecuteCmdlet()
@@ -45,7 +46,7 @@ public override void ExecuteCmdlet()
4546
}
4647
}
4748

48-
var confirmStatusMsg = new ConfirmMigrationStatusMsg(LegacyConfigId, confirmStatus);
49+
var confirmStatusMsg = new ConfirmMigrationStatusMsg(LegacyConfigId, confirmStatus);
4950
WriteObject(confirmStatusMsg);
5051
}
5152
catch (Exception except)

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/GetAzureStorSimpleLegacyVolumeContainerMigrationPlan.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public class GetAzureStorSimpleLegacyVolumeContainerMigrationPlan : StorSimpleCm
2828
[ValidateNotNullOrEmpty]
2929
public string LegacyConfigId { get; set; }
3030

31-
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
31+
[Parameter(Mandatory = false, Position = 1,
32+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3233
public string[] LegacyContainerNames { get; set; }
3334

3435
public override void ExecuteCmdlet()
@@ -67,7 +68,7 @@ public override void ExecuteCmdlet()
6768
var legacyContainerNamesList = LegacyContainerNames.ToList();
6869
migrationPlan.MigrationPlanInfo =
6970
migrationPlan.MigrationPlanInfo.ToList().FindAll(
70-
plan => legacyContainerNamesList.Contains(plan.DataContainerName));
71+
plan => legacyContainerNamesList.Contains(plan.DataContainerName));
7172
}
7273

7374
var migrationPlanMsg = new MigrationPlanMsg(migrationPlan);
@@ -80,5 +81,5 @@ public override void ExecuteCmdlet()
8081
this.HandleException(except);
8182
}
8283
}
83-
}
84+
}
8485
}

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/GetAzureStorSimpleLegacyVolumeContainerStatus.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public class GetAzureStorSimpleLegacyVolumeContainerStatus : StorSimpleCmdletBas
2727
[ValidateNotNullOrEmpty]
2828
public string LegacyConfigId { get; set; }
2929

30-
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
30+
[Parameter(Mandatory = false, Position = 1,
31+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3132
public string[] LegacyContainerNames { get; set; }
3233

3334
public override void ExecuteCmdlet()
@@ -36,7 +37,8 @@ public override void ExecuteCmdlet()
3637
{
3738
StorSimpleClient.UpdateDataContainerMigrationStatusSync(LegacyConfigId);
3839
var overallMigrationStatusList = StorSimpleClient.GetDataContainerMigrationStatus(LegacyConfigId);
39-
var migrationDataContainerStatusList = overallMigrationStatusList.MigrationDataContainerStatuses.ToList();
40+
var migrationDataContainerStatusList =
41+
overallMigrationStatusList.MigrationDataContainerStatuses.ToList();
4042
if (null != LegacyContainerNames && 0 < LegacyContainerNames.Length)
4143
{
4244
List<string> containerNameList = LegacyContainerNames.ToList();

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/ImportAzureStorSimpleLegacyApplianceConfig.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System;
1919
using System.IO;
2020
using System.Management.Automation;
21+
using System.Security.Cryptography;
2122

2223
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
2324
{
@@ -34,7 +35,8 @@ public class ImportAzureStorSimpleLegacyApplianceConfig : StorSimpleCmdletBase
3435
[ValidateNotNullOrEmpty]
3536
public string TargetDeviceName { get; set; }
3637

37-
[Parameter(Position = 2, Mandatory = true, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigDecryptionKey)]
38+
[Parameter(Position = 2, Mandatory = true,
39+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigDecryptionKey)]
3840
[ValidateNotNullOrEmpty]
3941
public string ConfigDecryptionKey { get; set; }
4042

@@ -46,21 +48,24 @@ public override void ExecuteCmdlet()
4648
string deviceid = StorSimpleClient.GetDeviceId(TargetDeviceName);
4749
if (!File.Exists(ConfigFilePath))
4850
{
49-
throw new System.IO.FileNotFoundException(String.Format(Resources.MigrationConfigFileNotFound, StorSimpleContext.ResourceName, ConfigFilePath));
51+
throw new FileNotFoundException(String.Format(Resources.MigrationConfigFileNotFound,
52+
StorSimpleContext.ResourceName, ConfigFilePath));
5053
}
5154
else if (string.IsNullOrEmpty(deviceid))
5255
{
53-
throw new Exception(String.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, TargetDeviceName));
54-
}
56+
throw new ArgumentException(String.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage,
57+
StorSimpleContext.ResourceName, TargetDeviceName));
58+
}
5559
else
5660
{
5761
// creating the config file parser instance - parser decrypt the xml and parses the config xml
5862
WriteVerbose(string.Format(Resources.MigrationMsgDeviceFound, deviceid));
5963
var secretsEncryptor = new ServiceSecretEncryptor(this.StorSimpleClient);
60-
var parser = new LegacyApplianceConfigParser(secretsEncryptor);
64+
var parser = new LegacyApplianceConfigParser(secretsEncryptor);
6165
var legacyApplianceMetaData = new LegacyApplianceConfiguration();
6266

63-
legacyApplianceMetaData.Details = parser.ParseLegacyApplianceConfig(ConfigFilePath, ConfigDecryptionKey);
67+
legacyApplianceMetaData.Details = parser.ParseLegacyApplianceConfig(ConfigFilePath,
68+
ConfigDecryptionKey);
6469
LegacyApplianceConfig config = legacyApplianceMetaData.Details;
6570
legacyApplianceMetaData.LegacyConfigId = Guid.NewGuid().ToString();
6671
config.InstanceId = config.Name = legacyApplianceMetaData.LegacyConfigId;
@@ -74,7 +79,8 @@ public override void ExecuteCmdlet()
7479
var configList = ConfigSplitHelper.Split(legacyApplianceMetaData.Details);
7580
foreach (var singleConfig in configList)
7681
{
77-
StorSimpleClient.ImportLegacyApplianceConfig(legacyApplianceMetaData.LegacyConfigId, singleConfig);
82+
StorSimpleClient.ImportLegacyApplianceConfig(legacyApplianceMetaData.LegacyConfigId,
83+
singleConfig);
7884
}
7985

8086
WriteObject(legacyApplianceMetaData);
@@ -93,13 +99,17 @@ public override void ExecuteCmdlet()
9399
internal override void HandleException(Exception exception)
94100
{
95101
// Parser throws missing member exception if any expected fields are missing, handling this as special case.
96-
if (typeof(MissingMemberException) == exception.GetType())
102+
if (typeof (MissingMemberException) == exception.GetType())
97103
{
98104
WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.ParserError, null));
99105
}
100-
else if (typeof(System.Security.Cryptography.CryptographicException) == exception.GetType())
106+
else if (typeof (CryptographicException) == exception.GetType())
101107
{
102-
WriteError(new ErrorRecord(new System.Security.Cryptography.CryptographicException(Resources.MigrationConfigDecryptionFailed), string.Empty, ErrorCategory.AuthenticationError, null));
108+
WriteError(
109+
new ErrorRecord(
110+
new CryptographicException(
111+
Resources.MigrationConfigDecryptionFailed), string.Empty, ErrorCategory.AuthenticationError,
112+
null));
103113
}
104114
else
105115
{

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/ImportAzureStorSimpleLegacyVolumeContainer.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ public class ImportAzureStorSimpleLegacyVolumeContainer : StorSimpleCmdletBase
2929
[ValidateNotNullOrEmpty]
3030
public string LegacyConfigId { get; set; }
3131

32-
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
32+
[Parameter(Mandatory = false, Position = 1,
33+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3334
public string[] LegacyContainerNames { get; set; }
3435

35-
[Parameter(Mandatory = false, Position = 2, HelpMessage = StorSimpleCmdletHelpMessage.MigrationImportDCWithSkipACRs)]
36+
[Parameter(Mandatory = false, Position = 2,
37+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationImportDCWithSkipACRs)]
3638
public SwitchParameter SkipACRs { get; set; }
3739

3840
[Parameter(Mandatory = false, Position = 3, HelpMessage = StorSimpleCmdletHelpMessage.MigrationImportDCByForce)]
@@ -43,13 +45,17 @@ public override void ExecuteCmdlet()
4345
try
4446
{
4547
var importDataContainerRequest = new MigrationImportDataContainerRequest();
46-
importDataContainerRequest.DataContainerNames = (null != LegacyContainerNames) ? new List<string>(LegacyContainerNames.ToList().Distinct()) : new List<string>();
48+
importDataContainerRequest.DataContainerNames = (null != LegacyContainerNames)
49+
? new List<string>(LegacyContainerNames.ToList().Distinct())
50+
: new List<string>();
4751
importDataContainerRequest.ForceOnOtherDevice = Force.IsPresent;
4852
importDataContainerRequest.SkipACRs = SkipACRs.IsPresent;
4953

50-
var migrationJobStatus = StorSimpleClient.MigrationImportDataContainer(LegacyConfigId, importDataContainerRequest);
54+
var migrationJobStatus = StorSimpleClient.MigrationImportDataContainer(LegacyConfigId,
55+
importDataContainerRequest);
5156
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
52-
WriteObject(opFormatter.GetResultMessage(Resources.MigrationImportDataContainerSuccessMessage, migrationJobStatus));
57+
WriteObject(opFormatter.GetResultMessage(Resources.MigrationImportDataContainerSuccessMessage,
58+
migrationJobStatus));
5359
}
5460
catch (Exception except)
5561
{

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/StartAzureStorSimpleLegacyVolumeContainerMigrationPlan.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class StartAzureStorSimpleLegacyVolumeContainerMigrationPlan : StorSimple
2929
[ValidateNotNullOrEmpty]
3030
public string LegacyConfigId { get; set; }
3131

32-
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
32+
[Parameter(Mandatory = false, Position = 1,
33+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
3334
public string[] LegacyContainerNames { get; set; }
3435

3536
public override void ExecuteCmdlet()
@@ -38,7 +39,9 @@ public override void ExecuteCmdlet()
3839
{
3940
var startMigrationPlanRequest = new MigrationPlanStartRequest();
4041
startMigrationPlanRequest.ConfigId = LegacyConfigId;
41-
startMigrationPlanRequest.DataContainerNameList = (null != LegacyContainerNames) ? new List<string>(LegacyContainerNames.ToList().Distinct()) : new List<string>();
42+
startMigrationPlanRequest.DataContainerNameList = (null != LegacyContainerNames)
43+
? new List<string>(LegacyContainerNames.ToList().Distinct())
44+
: new List<string>();
4245

4346
var status = StorSimpleClient.StartLegacyVolumeContainerMigrationPlan(startMigrationPlanRequest);
4447
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();

0 commit comments

Comments
 (0)