Skip to content

Commit bc144a3

Browse files
Get-BackupContainer : Throw backupManagementType is required when containertype is windows
1 parent c544d65 commit bc144a3

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Please contact Microsoft for further assistant.</value>
423423
<value>BackupManagementType is not expected for WorkloadType: {0}</value>
424424
</data>
425425
<data name="BackupManagementTypeRequiredForContainerType" xml:space="preserve">
426-
<value>BackupManagementType provider for ContainerType {0} is incorrect.</value>
426+
<value>BackupManagementType needs to be specified for ContainerType {0}</value>
427427
</data>
428428
<data name="BackupManagementTypeRequiredForWorkloadType" xml:space="preserve">
429429
<value>BackupManagementType is also required for WorkloadType: {0}</value>
@@ -434,4 +434,7 @@ Please contact Microsoft for further assistant.</value>
434434
<data name="UnExpectedBackupManagementTypeException" xml:space="preserve">
435435
<value>Unexpected BackupManagementType - expected:{0}, current:{1}</value>
436436
</data>
437+
<data name="BackupManagementTypeIncorrectForContainerType" xml:space="preserve">
438+
<value>BackupManagementType provider for ContainerType {0} is incorrect.</value>
439+
</data>
437440
</root>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ public IPsBackupProvider GetProviderInstance(ContainerType containerType, Backup
4747
if (backupManagementType == BackupManagementType.AzureVM || backupManagementType == null)
4848
providerType = PsBackupProviderTypes.IaasVm;
4949
else
50-
throw new ArgumentException(String.Format(Resources.BackupManagementTypeRequiredForContainerType, containerType));
50+
throw new ArgumentException(String.Format(Resources.BackupManagementTypeIncorrectForContainerType, containerType));
5151
break;
5252
case ContainerType.Windows:
5353
if (backupManagementType == BackupManagementType.MARS)
5454
providerType = PsBackupProviderTypes.Mab;
55-
else
55+
else if (backupManagementType == null)
5656
throw new ArgumentException(String.Format(Resources.BackupManagementTypeRequiredForContainerType, containerType));
57+
else
58+
throw new ArgumentException(String.Format(Resources.BackupManagementTypeIncorrectForContainerType, containerType));
5759
break;
5860
default:
5961
throw new ArgumentException(String.Format(Resources.UnsupportedContainerType, containerType.ToString()));

0 commit comments

Comments
 (0)