Skip to content

Commit 11bfe48

Browse files
committed
Merge pull request AzureRT#189 from MabOneSdk/dev1-sudreddy
Initial checkin for policy validations and conversions
2 parents 29b6d96 + 04dc077 commit 11bfe48

File tree

7 files changed

+604
-19
lines changed

7 files changed

+604
-19
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Commands.RecoveryServices.Backup.Helpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
</ItemGroup>
5050
<ItemGroup>
5151
<Compile Include="Conversions\JobConversions.cs" />
52+
<Compile Include="Utils.cs" />
5253
<Compile Include="Validations\PolicyValidations.cs" />
5354
<Compile Include="Conversions\SchedulePolicyConversions.cs" />
5455
<Compile Include="Conversions\RetentionPolicyConversions.cs" />

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ public static AzureRmRecoveryServicesPolicyBase GetPolicyModel(ProtectionPolicyR
6767

6868
if (hydraResponse.Properties.GetType() == typeof(AzureIaaSVMProtectionPolicy))
6969
{
70+
if(((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy.GetType() !=
71+
typeof(LongTermRetentionPolicy))
72+
{
73+
// unsupported by old powershell - trace warning and return null
74+
return null;
75+
}
76+
77+
if (((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy.GetType() !=
78+
typeof(SimpleSchedulePolicy))
79+
{
80+
// unsupported by old powershell - trace warning and return null
81+
return null;
82+
}
83+
7084
policyModel = new AzureRmRecoveryServicesIaasVmPolicy();
7185
AzureRmRecoveryServicesIaasVmPolicy iaasPolicyModel = policyModel as AzureRmRecoveryServicesIaasVmPolicy;
7286
iaasPolicyModel.WorkloadType = WorkloadType.AzureVM;

0 commit comments

Comments
 (0)