Skip to content

Commit 70afa87

Browse files
committed
Merge pull request #26 from AzCiS/onesdk-p2-sumanths
Bug fix: allow rename of entities
2 parents a97cd9f + a92260f commit 70afa87

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/BackupPolicy/SetAzureStorSimpleDeviceBackupPolicy.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public class SetAzureStorSimpleDeviceBackupPolicy: StorSimpleCmdletBase
5858
[Parameter(Position = 7, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.WaitTillComplete)]
5959
public SwitchParameter WaitForComplete { get; set; }
6060

61+
[Parameter(Position = 8, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.BackupPolicyNewName)]
62+
[ValidateNotNullOrEmpty]
63+
public string NewName { get; set; }
64+
6165
private string deviceId = null;
6266
private List<BackupScheduleBase> schedulesToAdd = null;
6367
private List<BackupScheduleUpdateRequest> schedulesToUpdate = null;
@@ -74,7 +78,7 @@ public override void ExecuteCmdlet()
7478
return;
7579

7680
updateConfig.InstanceId = BackupPolicyId;
77-
updateConfig.Name = BackupPolicyName;
81+
updateConfig.Name = (NewName != null ? NewName : BackupPolicyName);
7882
updateConfig.IsPolicyRenamed = true;
7983
updateConfig.BackupSchedulesToBeAdded = schedulesToAdd;
8084
updateConfig.BackupSchedulesToBeUpdated = schedulesToUpdate;

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/ServiceConfig/SetAzureStorSimpleAccessControlRecord.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public class SetAzureStorSimpleAccessControlRecord : StorSimpleCmdletBase
4141
[Parameter(Position = 2, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.WaitTillComplete)]
4242
public SwitchParameter WaitForComplete { get; set; }
4343

44+
[Parameter(Position = 3, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.ACRNewName)]
45+
[ValidateNotNullOrEmpty]
46+
public string NewName { get; set; }
47+
4448
public override void ExecuteCmdlet()
4549
{
4650
try
@@ -67,7 +71,7 @@ public override void ExecuteCmdlet()
6771
GlobalId = existingAcr.GlobalId,
6872
InitiatorName = IQNInitiatorName,
6973
InstanceId = existingAcr.InstanceId,
70-
Name = existingAcr.Name,
74+
Name = (!string.IsNullOrWhiteSpace(NewName) ? NewName : existingAcr.Name),
7175
VolumeCount = existingAcr.VolumeCount
7276
},
7377
}

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Volume/SetAzureStorSimpleDeviceVolume.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public class SetAzureStorSimpleDeviceVolume : StorSimpleCmdletBase
5454
[Parameter(Position = 6, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.WaitTillComplete)]
5555
public SwitchParameter WaitForComplete { get; set; }
5656

57+
[Parameter(Position = 7, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.VolumeNewName)]
58+
[ValidateNotNullOrEmpty]
59+
public string NewName { get; set; }
60+
5761
public override void ExecuteCmdlet()
5862
{
5963
try
@@ -91,11 +95,16 @@ public override void ExecuteCmdlet()
9195
diskDetails.AcrList = AccessControlRecords;
9296
}
9397

98+
if (!string.IsNullOrWhiteSpace(NewName))
99+
{
100+
diskDetails.Name = NewName;
101+
}
102+
94103
if (WaitForComplete.IsPresent)
95104
{
96105
var taskstatus = StorSimpleClient.UpdateVolume(deviceId, diskDetails.InstanceId, diskDetails);
97106
HandleSyncTaskResponse(taskstatus, "update");
98-
var updatedVolume = StorSimpleClient.GetVolumeByName(deviceId, VolumeName);
107+
var updatedVolume = StorSimpleClient.GetVolumeByName(deviceId, diskDetails.Name);
99108
WriteObject(updatedVolume.VirtualDiskInfo);
100109
}
101110
else

src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletHelpMessage.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.WindowsAzure.Commands.StorSimple
1818
internal static class StorSimpleCmdletHelpMessage
1919
{
2020
public const string ACRName = "The access control record name.";
21+
public const string ACRNewName = "The new name for the access control record";
2122
public const string ACRObject = "The access control record object.";
2223
public const string DataContainerBandwidth = "The data container bandwidth rate.";
2324
public const string DataContainerEncryptionEnabled = "Flag to encrypt the data container.";
@@ -46,6 +47,7 @@ internal static class StorSimpleCmdletHelpMessage
4647
public const string VolumeName = "The volume name.";
4748
public const string VolumeOnline = "Is the volume online";
4849
public const string VolumeSize = "The size of volume in bytes.";
50+
public const string VolumeNewName = "The new name for the volume";
4951
public const string WaitTillComplete = "Wait till the async operation completes.";
5052
public const string BackupPolicyName = "Name of the Backup policy that you wish to retrieve. Skip this parameter to get all policies";
5153
public const string BackupIdToDelete = "InstanceId of the Backup that needs to be deleted";
@@ -78,6 +80,7 @@ internal static class StorSimpleCmdletHelpMessage
7880
public const string BackupScheduleBaseObjsToAdd = "List of BackupScheduleBase objects to be added to the policy";
7981
public const string BackupScheduleBaseObjsToUpdate = "List of BackupScheduleUpdateRequest objects to be updated";
8082
public const string BackupScheduleBaseObjsToDelete = "List of Instance Id of BackupSchedule objects to be deleted";
83+
public const string BackupPolicyNewName = "The new name for the backup policy";
8184
public const string VolumeObjsToUpdate = "List of VolumeIds to be updated";
8285
public const string ResourceName = "Name of the resource which needs to be retrieved";
8386
public const string SourceDeviceId = "The device identifier of the source device";

0 commit comments

Comments
 (0)