Skip to content

Commit 325a26a

Browse files
Merge pull request #245 from MabOneSdk/swatim-dev1
Updating UnregisterBackupManagementServer and making SCDPM and MARS caps
2 parents ffbf688 + eae4f01 commit 325a26a

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Enums.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public enum BackupEngineType
3939
public enum BackupManagementType
4040
{
4141
AzureVM = 1,
42-
Mars,
43-
Scdpm
42+
MARS,
43+
SCDPM
4444
}
4545

4646
public enum WorkloadType

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Utils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ public static BackupManagementType GetPsBackupManagementType(string backupManage
125125
case ProviderType.AzureIaasVM:
126126
return BackupManagementType.AzureVM;
127127
case ProviderType.MAB:
128-
return BackupManagementType.Mars;
128+
return BackupManagementType.MARS;
129129
case ProviderType.DPM:
130-
return BackupManagementType.Scdpm;
130+
return BackupManagementType.SCDPM;
131131
default:
132132
throw new Exception("Unsupported BackupManagmentType: " + backupManagementType);
133133
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public IPsBackupProvider GetProviderInstance(ContainerType containerType, Backup
4545
providerType = PsBackupProviderTypes.IaasVm;
4646
break;
4747
case ContainerType.Windows:
48-
if (backupManagementType == BackupManagementType.Mars)
48+
if (backupManagementType == BackupManagementType.MARS)
4949
providerType = PsBackupProviderTypes.Mab;
50-
else if (backupManagementType == BackupManagementType.Scdpm)
50+
else if (backupManagementType == BackupManagementType.SCDPM)
5151
providerType = PsBackupProviderTypes.Dpm;
5252
else
5353
throw new ArgumentException(String.Format("BackupManagementType {0} is not expected for ContainerType {1}", backupManagementType, containerType));

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Container/GetAzureRmBackupManagementServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public override void ExecuteCmdlet()
4343
PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary<System.Enum, object>()
4444
{
4545
{ContainerParams.ContainerType, ContainerType.Windows},
46-
{ContainerParams.BackupManagementType, BackupManagementType.Scdpm},
46+
{ContainerParams.BackupManagementType, BackupManagementType.SCDPM},
4747
{ContainerParams.Name, Name}
4848
}, HydraAdapter);
4949

50-
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(ContainerType.Windows, BackupManagementType.Scdpm);
50+
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(ContainerType.Windows, BackupManagementType.SCDPM);
5151

5252
var containerModels = psBackupProvider.ListBackupManagementServers();
5353
if (!string.IsNullOrEmpty(this.Name))

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Container/UnregisterAzureRmBackupManagementServer.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,22 @@ public class UnregisterAzureRmBackupManagementServer : RecoveryServicesBackupCmd
2929
{
3030
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Container.RegisteredContainer)]
3131
[ValidateNotNullOrEmpty]
32-
public AzureRmRecoveryServicesContainerBase Container { get; set; }
32+
public AzureRmRecoveryServicesBackupEngineBase AzureRmBackupManagementServer { get; set; }
3333

3434
public override void ExecuteCmdlet()
3535
{
3636
ExecutionBlock(() =>
3737
{
3838
base.ExecuteCmdlet();
3939

40-
if (Container.ContainerType != ContainerType.Windows || Container.BackupManagementType != BackupManagementType.Scdpm)
40+
if ((AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.DpmEngine && AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.DpmVenusEngine)||
41+
AzureRmBackupManagementServer.BackupManagementType != BackupManagementType.SCDPM)
4142
{
42-
throw new ArgumentException(String.Format("Please provide Container of containerType Windows and backupManagementType Scdpm. Provided Container has containerType {0} and backupManagementType {1}", Container.ContainerType, Container.BackupManagementType));
43+
throw new ArgumentException(String.Format("Please provide AzureRmBackupManagementServer of BackupEngineType as DpmEngine or DpmVenusEngine and provide BackupManagementType as SCDPM. Provided AzureRmBackupManagementServer has BackupEngineType {0} and backupManagementType {1} which is not valid.", AzureRmBackupManagementServer.BackupEngineType, AzureRmBackupManagementServer.BackupManagementType));
4344
}
4445

45-
string containerName = Container.Name;
46-
HydraAdapter.UnregisterContainers(containerName);
46+
string azureRmBackupManagementServer = AzureRmBackupManagementServer.Name;
47+
HydraAdapter.UnregisterContainers(azureRmBackupManagementServer);
4748
});
4849
}
4950
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Container/UnregisterAzureRmRecoveryServicesBackupContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public override void ExecuteCmdlet()
4040
{
4141
base.ExecuteCmdlet();
4242

43-
if (Container.ContainerType != ContainerType.Windows || Container.BackupManagementType != BackupManagementType.Mars)
43+
if (Container.ContainerType != ContainerType.Windows || Container.BackupManagementType != BackupManagementType.MARS)
4444
{
45-
throw new ArgumentException(String.Format("Please provide Container of containerType Windows and backupManagementType Mars. Provided Container has containerType {0} and backupManagementType {1}", Container.ContainerType, Container.BackupManagementType));
45+
throw new ArgumentException(String.Format("Please provide Container of containerType as Windows and backupManagementType as MARS. Provided Container has containerType {0} and backupManagementType {1} which is invalid.", Container.ContainerType, Container.BackupManagementType));
4646
}
4747
AzureRmRecoveryServicesMabContainer mabContainer = Container as AzureRmRecoveryServicesMabContainer;
4848
string containerName = mabContainer.FriendlyName;

0 commit comments

Comments
 (0)