Skip to content

Commit e6cc11a

Browse files
author
Samuel Anudeep
committed
Merge pull request #323 from MabOneSdk/dev1
Push from dev1 to release
2 parents 2f6f908 + fc68f75 commit e6cc11a

File tree

1 file changed

+39
-41
lines changed

1 file changed

+39
-41
lines changed

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

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class LongTermRetentionPolicy : RetentionPolicyBase
3131
public bool IsMonthlyScheduleEnabled { get; set; }
3232
public bool IsYearlyScheduleEnabled { get; set; }
3333
public DailyRetentionSchedule DailySchedule { get; set; }
34-
public WeeklyRetentionSchedule WeeklySchedule { get; set; }
34+
public WeeklyRetentionSchedule WeeklySchedule { get; set; }
3535
public MonthlyRetentionSchedule MonthlySchedule { get; set; }
3636
public YearlyRetentionSchedule YearlySchedule { get; set; }
3737

@@ -98,8 +98,8 @@ public override void Validate()
9898
{
9999
YearlySchedule.Validate();
100100
}
101-
}
102-
}
101+
}
102+
}
103103

104104
public override string ToString()
105105
{
@@ -114,7 +114,7 @@ public override string ToString()
114114
YearlySchedule == null ? "NULL" : YearlySchedule.ToString());
115115
}
116116
}
117-
117+
118118
/// <summary>
119119
/// Base class for retention schedule.
120120
/// </summary>
@@ -127,15 +127,15 @@ public virtual void Validate()
127127
if (RetentionTimes == null || RetentionTimes.Count == 0 || RetentionTimes.Count != 1)
128128
{
129129
throw new ArgumentException(Resources.InvalidRetentionTimesInPolicyException);
130-
}
131-
}
130+
}
131+
}
132132

133133
public override string ToString()
134134
{
135-
return string.Format("RetentionTimes: {0}", TraceUtils.GetString(RetentionTimes));
135+
return string.Format("RetentionTimes: {0}", TraceUtils.GetString(RetentionTimes));
136136
}
137137
}
138-
138+
139139
/// <summary>
140140
/// Daily rentention schedule.
141141
/// </summary>
@@ -149,18 +149,17 @@ public override void Validate()
149149
if (DurationCountInDays <= 0 || DurationCountInDays > PolicyConstants.MaxAllowedRetentionDurationCount)
150150
{
151151
throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
152-
}
152+
}
153153

154154
base.Validate();
155155
}
156-
156+
157157
public override string ToString()
158158
{
159-
return string.Format("DurationCountInDays: {0}, {1}",
160-
DurationCountInDays, base.ToString());
159+
return string.Format("DurationCountInDays: {0}, {1}", DurationCountInDays, base.ToString());
161160
}
162161
}
163-
162+
164163
/// <summary>
165164
/// Weekly rentention schedule.
166165
/// </summary>
@@ -183,16 +182,15 @@ public override void Validate()
183182
}
184183

185184
base.Validate();
186-
}
185+
}
187186

188187
public override string ToString()
189188
{
190-
return string.Format("DaysOfTheWeek: {0}, {1}",
191-
TraceUtils.GetString(DaysOfTheWeek),
192-
base.ToString());
189+
return string.Format("DurationCountInWeeks: {0}, DaysOfTheWeek: {1}, {2}",
190+
DurationCountInWeeks, TraceUtils.GetString(DaysOfTheWeek), base.ToString());
193191
}
194192
}
195-
193+
196194
/// <summary>
197195
/// Monthly rentention schedule.
198196
/// </summary>
@@ -208,7 +206,7 @@ public class MonthlyRetentionSchedule : RetentionScheduleBase
208206

209207
public MonthlyRetentionSchedule()
210208
: base()
211-
{
209+
{
212210
}
213211

214212
public override void Validate()
@@ -219,7 +217,7 @@ public override void Validate()
219217
{
220218
throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
221219
}
222-
220+
223221
if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily)
224222
{
225223
if (RetentionScheduleDaily == null)
@@ -234,23 +232,24 @@ public override void Validate()
234232
{
235233
if (RetentionScheduleWeekly == null)
236234
{
237-
throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException);
235+
throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException);
238236
}
239237

240238
RetentionScheduleWeekly.Validate();
241239
}
242-
}
240+
}
243241

244242
public override string ToString()
245243
{
246-
return string.Format("RetentionScheduleType:{0}, {1}, RetentionScheduleDaily:{2}," +
247-
"RetentionScheduleWeekly:{3}, {4}", RetentionScheduleFormatType, base.ToString(),
244+
return string.Format("DurationCountInMonths:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," +
245+
"RetentionScheduleWeekly:{4}, {5}",
246+
DurationCountInMonths, RetentionScheduleFormatType, base.ToString(),
248247
RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(),
249248
RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(),
250249
base.ToString());
251250
}
252251
}
253-
252+
254253
/// <summary>
255254
/// Yearly rentention schedule.
256255
/// </summary>
@@ -261,13 +260,13 @@ public class YearlyRetentionSchedule : RetentionScheduleBase
261260

262261
public List<Month> MonthsOfYear { get; set; }
263262
public DailyRetentionFormat RetentionScheduleDaily { get; set; }
264-
263+
265264
public WeeklyRetentionFormat RetentionScheduleWeekly { get; set; }
266265

267266
public YearlyRetentionSchedule()
268267
: base()
269268
{
270-
269+
271270
}
272271

273272
public override void Validate()
@@ -278,12 +277,12 @@ public override void Validate()
278277
{
279278
throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
280279
}
281-
280+
282281
if (MonthsOfYear == null || MonthsOfYear.Count == 0 || MonthsOfYear.Count != MonthsOfYear.Distinct().Count())
283282
{
284283
throw new ArgumentException(Resources.YearlyScheduleMonthsOfYearException);
285284
}
286-
285+
287286
if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily)
288287
{
289288
if (RetentionScheduleDaily == null)
@@ -303,20 +302,19 @@ public override void Validate()
303302

304303
RetentionScheduleWeekly.Validate();
305304
}
306-
}
305+
}
307306

308307
public override string ToString()
309308
{
310-
return string.Format("RetentionScheduleType:{0}, {1}, RetentionScheduleDaily:{2}," +
311-
"RetentionScheduleWeekly:{3}, MonthsOfYear: {4}, {5}",
312-
RetentionScheduleFormatType.ToString(),
313-
base.ToString(),
309+
return string.Format("DurationCountInYears:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," +
310+
"RetentionScheduleWeekly:{4}, MonthsOfYear: {5}, {6}",
311+
DurationCountInYears, RetentionScheduleFormatType.ToString(), base.ToString(),
314312
RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(),
315313
RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(),
316314
TraceUtils.GetString<Month>(MonthsOfYear), base.ToString());
317315
}
318316
}
319-
317+
320318
/// <summary>
321319
/// Daily rentention format.
322320
/// </summary>
@@ -343,13 +341,13 @@ public void Validate()
343341
foreach (Day day in DaysOfTheMonth)
344342
{
345343
day.Validate();
346-
if(day.IsLast)
344+
if (day.IsLast)
347345
{
348346
countOfIsLast++;
349347
}
350348
}
351349

352-
if(countOfIsLast > 1)
350+
if (countOfIsLast > 1)
353351
{
354352
throw new ArgumentException(Resources.InvalidDayInDaysOfMonthOfMonthlyYearlyRetentionPolicyException);
355353
}
@@ -360,7 +358,7 @@ public override string ToString()
360358
return string.Format("DaysOfTheMonth:{0}", TraceUtils.GetString(DaysOfTheMonth));
361359
}
362360
}
363-
361+
364362
/// <summary>
365363
/// Weekly rentention format.
366364
/// </summary>
@@ -376,13 +374,13 @@ public void Validate()
376374
DaysOfTheWeek.Count != DaysOfTheWeek.Distinct().Count())
377375
{
378376
throw new ArgumentException(Resources.InvalidDaysOfWeekInMonthlyYearlyRetentionPolicyException);
379-
}
377+
}
380378

381379
if (WeeksOfTheMonth == null || WeeksOfTheMonth.Count == 0 ||
382380
WeeksOfTheMonth.Count != WeeksOfTheMonth.Distinct().Count())
383381
{
384382
throw new ArgumentException(Resources.InvalidWeeksOfMonthInMonthlyYearlyRetentionPolicyException);
385-
}
383+
}
386384
}
387385

388386
public override string ToString()
@@ -419,5 +417,5 @@ public override string ToString()
419417
{
420418
return string.Format("Date:{0}, IsLast:{1}", Date, IsLast);
421419
}
422-
}
420+
}
423421
}

0 commit comments

Comments
 (0)