diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs index 82cd4e629402..66212a38c0f1 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs @@ -31,7 +31,7 @@ public class LongTermRetentionPolicy : RetentionPolicyBase public bool IsMonthlyScheduleEnabled { get; set; } public bool IsYearlyScheduleEnabled { get; set; } public DailyRetentionSchedule DailySchedule { get; set; } - public WeeklyRetentionSchedule WeeklySchedule { get; set; } + public WeeklyRetentionSchedule WeeklySchedule { get; set; } public MonthlyRetentionSchedule MonthlySchedule { get; set; } public YearlyRetentionSchedule YearlySchedule { get; set; } @@ -98,8 +98,8 @@ public override void Validate() { YearlySchedule.Validate(); } - } - } + } + } public override string ToString() { @@ -114,7 +114,7 @@ public override string ToString() YearlySchedule == null ? "NULL" : YearlySchedule.ToString()); } } - + /// /// Base class for retention schedule. /// @@ -127,15 +127,15 @@ public virtual void Validate() if (RetentionTimes == null || RetentionTimes.Count == 0 || RetentionTimes.Count != 1) { throw new ArgumentException(Resources.InvalidRetentionTimesInPolicyException); - } - } + } + } public override string ToString() { - return string.Format("RetentionTimes: {0}", TraceUtils.GetString(RetentionTimes)); + return string.Format("RetentionTimes: {0}", TraceUtils.GetString(RetentionTimes)); } } - + /// /// Daily rentention schedule. /// @@ -149,18 +149,17 @@ public override void Validate() if (DurationCountInDays <= 0 || DurationCountInDays > PolicyConstants.MaxAllowedRetentionDurationCount) { throw new ArgumentException(Resources.RetentionDurationCountInvalidException); - } + } base.Validate(); } - + public override string ToString() { - return string.Format("DurationCountInDays: {0}, {1}", - DurationCountInDays, base.ToString()); + return string.Format("DurationCountInDays: {0}, {1}", DurationCountInDays, base.ToString()); } } - + /// /// Weekly rentention schedule. /// @@ -183,16 +182,15 @@ public override void Validate() } base.Validate(); - } + } public override string ToString() { - return string.Format("DaysOfTheWeek: {0}, {1}", - TraceUtils.GetString(DaysOfTheWeek), - base.ToString()); + return string.Format("DurationCountInWeeks: {0}, DaysOfTheWeek: {1}, {2}", + DurationCountInWeeks, TraceUtils.GetString(DaysOfTheWeek), base.ToString()); } } - + /// /// Monthly rentention schedule. /// @@ -208,7 +206,7 @@ public class MonthlyRetentionSchedule : RetentionScheduleBase public MonthlyRetentionSchedule() : base() - { + { } public override void Validate() @@ -219,7 +217,7 @@ public override void Validate() { throw new ArgumentException(Resources.RetentionDurationCountInvalidException); } - + if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { if (RetentionScheduleDaily == null) @@ -234,23 +232,24 @@ public override void Validate() { if (RetentionScheduleWeekly == null) { - throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException); + throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException); } RetentionScheduleWeekly.Validate(); } - } + } public override string ToString() { - return string.Format("RetentionScheduleType:{0}, {1}, RetentionScheduleDaily:{2}," + - "RetentionScheduleWeekly:{3}, {4}", RetentionScheduleFormatType, base.ToString(), + return string.Format("DurationCountInMonths:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," + + "RetentionScheduleWeekly:{4}, {5}", + DurationCountInMonths, RetentionScheduleFormatType, base.ToString(), RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(), RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(), base.ToString()); } } - + /// /// Yearly rentention schedule. /// @@ -261,13 +260,13 @@ public class YearlyRetentionSchedule : RetentionScheduleBase public List MonthsOfYear { get; set; } public DailyRetentionFormat RetentionScheduleDaily { get; set; } - + public WeeklyRetentionFormat RetentionScheduleWeekly { get; set; } public YearlyRetentionSchedule() : base() { - + } public override void Validate() @@ -278,12 +277,12 @@ public override void Validate() { throw new ArgumentException(Resources.RetentionDurationCountInvalidException); } - + if (MonthsOfYear == null || MonthsOfYear.Count == 0 || MonthsOfYear.Count != MonthsOfYear.Distinct().Count()) { throw new ArgumentException(Resources.YearlyScheduleMonthsOfYearException); } - + if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { if (RetentionScheduleDaily == null) @@ -303,20 +302,19 @@ public override void Validate() RetentionScheduleWeekly.Validate(); } - } + } public override string ToString() { - return string.Format("RetentionScheduleType:{0}, {1}, RetentionScheduleDaily:{2}," + - "RetentionScheduleWeekly:{3}, MonthsOfYear: {4}, {5}", - RetentionScheduleFormatType.ToString(), - base.ToString(), + return string.Format("DurationCountInYears:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," + + "RetentionScheduleWeekly:{4}, MonthsOfYear: {5}, {6}", + DurationCountInYears, RetentionScheduleFormatType.ToString(), base.ToString(), RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(), RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(), TraceUtils.GetString(MonthsOfYear), base.ToString()); } } - + /// /// Daily rentention format. /// @@ -343,13 +341,13 @@ public void Validate() foreach (Day day in DaysOfTheMonth) { day.Validate(); - if(day.IsLast) + if (day.IsLast) { countOfIsLast++; } } - if(countOfIsLast > 1) + if (countOfIsLast > 1) { throw new ArgumentException(Resources.InvalidDayInDaysOfMonthOfMonthlyYearlyRetentionPolicyException); } @@ -360,7 +358,7 @@ public override string ToString() return string.Format("DaysOfTheMonth:{0}", TraceUtils.GetString(DaysOfTheMonth)); } } - + /// /// Weekly rentention format. /// @@ -376,13 +374,13 @@ public void Validate() DaysOfTheWeek.Count != DaysOfTheWeek.Distinct().Count()) { throw new ArgumentException(Resources.InvalidDaysOfWeekInMonthlyYearlyRetentionPolicyException); - } + } if (WeeksOfTheMonth == null || WeeksOfTheMonth.Count == 0 || WeeksOfTheMonth.Count != WeeksOfTheMonth.Distinct().Count()) { throw new ArgumentException(Resources.InvalidWeeksOfMonthInMonthlyYearlyRetentionPolicyException); - } + } } public override string ToString() @@ -419,5 +417,5 @@ public override string ToString() { return string.Format("Date:{0}, IsLast:{1}", Date, IsLast); } - } + } }