Skip to content

Commit 2a82837

Browse files
author
dragonfly91
committed
Implemented PR comments
1 parent c2fd9ed commit 2a82837

File tree

5 files changed

+30
-9
lines changed

5 files changed

+30
-9
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/EnableAzureRMBackupContainerReregistration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ protected override void ProcessRecord()
4646
{
4747
case AzureBackupContainerType.Windows:
4848
case AzureBackupContainerType.SCDPM:
49+
case AzureBackupContainerType.AzureBackupServer:
4950
AzureBackupClient.EnableMachineContainerReregistration(Container.ResourceGroupName, Container.ResourceName, Container.Id);
5051
break;
5152
default:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureRMBackupContainer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ protected override void ProcessRecord()
6060
{
6161
case AzureBackupContainerType.Windows:
6262
case AzureBackupContainerType.SCDPM:
63+
case AzureBackupContainerType.AzureBackupServer:
6364
containers.AddRange(GetMachineContainers(Vault.ResourceGroupName, Vault.Name));
6465
break;
6566
case AzureBackupContainerType.AzureVM:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureRMBackupContainer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected override void ProcessRecord()
4747
{
4848
case AzureBackupContainerType.Windows:
4949
case AzureBackupContainerType.SCDPM:
50+
case AzureBackupContainerType.AzureBackupServer:
5051
DeleteServer();
5152
break;
5253
case AzureBackupContainerType.AzureVM:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,37 @@ internal class ContainerHelpers
3838
{
3939
private static readonly Regex ResourceGroupRegex = new Regex(@"/subscriptions/(?<subscriptionsId>.+)/resourceGroups/(?<resourceGroupName>.+)/providers/(?<providersName>.+)/BackupVault/(?<BackupVaultName>.+)/containers/(?<containersName>.+)", RegexOptions.Compiled);
4040

41-
internal static AzureBackupContainerType GetContainerType(string customerType)
41+
internal static AzureBackupContainerType GetContainerType(string customerTypeString)
4242
{
4343
AzureBackupContainerType containerType = 0;
44+
CustomerType customerType = CustomerType.Invalid;
4445

45-
if (string.Compare(customerType, CustomerType.DPM.ToString()) == 0)
46+
if (Enum.TryParse<CustomerType>(customerTypeString, out customerType))
4647
{
47-
containerType = AzureBackupContainerType.SCDPM;
48-
}
49-
else if (string.Compare(customerType, CustomerType.OBS.ToString()) == 0)
50-
{
51-
containerType = AzureBackupContainerType.Windows;
48+
switch (customerType)
49+
{
50+
case CustomerType.DPM:
51+
containerType = AzureBackupContainerType.SCDPM;
52+
break;
53+
case CustomerType.OBS:
54+
containerType = AzureBackupContainerType.Windows;
55+
break;
56+
case CustomerType.SBS:
57+
containerType = AzureBackupContainerType.Windows;
58+
break;
59+
case CustomerType.DPMVenus:
60+
containerType = AzureBackupContainerType.AzureBackupServer;
61+
break;
62+
case CustomerType.Invalid:
63+
break;
64+
default:
65+
containerType = AzureBackupContainerType.Other;
66+
break;
67+
}
5268
}
53-
else if (string.Compare(customerType, CustomerType.SBS.ToString()) == 0)
69+
else if (!string.IsNullOrEmpty(customerTypeString))
5470
{
55-
containerType = AzureBackupContainerType.Windows;
71+
containerType = AzureBackupContainerType.Other;
5672
}
5773

5874
return containerType;

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public enum AzureBackupContainerType
2525
Windows = 1,
2626
SCDPM,
2727
AzureVM,
28+
AzureBackupServer,
29+
Other,
2830
}
2931

3032
public enum DataSourceType

0 commit comments

Comments
 (0)