Skip to content

Commit ebd3133

Browse files
committed
refactored common model files
1 parent 23f0dfb commit ebd3133

File tree

5 files changed

+63
-37
lines changed

5 files changed

+63
-37
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
<ItemGroup>
4242
<Compile Include="BaseObjects.cs" />
4343
<Compile Include="CmdletParamEnums.cs" />
44-
<Compile Include="CommonEnums.cs" />
45-
<Compile Include="CommonPolicyRetentionObjects.cs" />
46-
<Compile Include="CommonPolicyScheduleObjects.cs" />
44+
<Compile Include="CommonModels\CommonUtils.cs" />
45+
<Compile Include="CommonModels\CommonEnums.cs" />
46+
<Compile Include="CommonModels\CommonPolicyRetentionObjects.cs" />
47+
<Compile Include="CommonModels\CommonPolicyScheduleObjects.cs" />
4748
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmPolicy.cs" />
4849
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmItem.cs" />
4950
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmContainer.cs" />

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonEnums.cs renamed to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/CommonEnums.cs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public enum ContainerRegistrationStatus
4343
Registered = 1,
4444
Registering,
4545
}
46-
46+
47+
#region policy
4748
public enum WeekNumber
4849
{
4950
First,
@@ -52,7 +53,6 @@ public enum WeekNumber
5253
Fourth,
5354
Last
5455
}
55-
5656
public enum Month
5757
{
5858
Invalid = 0,
@@ -77,26 +77,22 @@ public enum ScheduleRunType
7777
Weekly = 2,
7878
}
7979

80-
public class PolicyConstants
80+
public enum RetentionDurationType
8181
{
82-
public const int MaxAllowedRetentionDurationCount = 9999;
82+
Invalid = 0,
83+
Days = 1,
84+
Weeks = 2,
85+
Months = 3,
86+
Years = 4
8387
}
8488

85-
public class TraceUtils
89+
public enum RetentionScheduleFormat
8690
{
87-
public static string GetString(IEnumerable<Object> objList)
88-
{
89-
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
90-
}
91+
Invalid = 0,
92+
Daily = 1,
93+
Weekly = 2
94+
}
9195

92-
public static string GetString(IEnumerable<DateTime> objList)
93-
{
94-
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
95-
}
96+
#endregion
9697

97-
public static string GetString(IEnumerable<DayOfWeek> objList)
98-
{
99-
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
100-
}
101-
}
10298
}
Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,6 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23-
public enum RetentionDurationType
24-
{
25-
Invalid = 0,
26-
Days = 1,
27-
Weeks = 2,
28-
Months = 3,
29-
Years = 4
30-
}
31-
32-
public enum RetentionScheduleFormat
33-
{
34-
Invalid = 0,
35-
Daily = 1,
36-
Weekly = 2
37-
}
38-
3923
public class AzureRmRecoveryServicesLongTermRetentionPolicy : AzureRmRecoveryServicesRetentionPolicyBase
4024
{
4125
public DailyRetentionSchedule DailySchedule { get; set; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
using System.Collections.Generic;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
22+
{
23+
public class PolicyConstants
24+
{
25+
public const int MaxAllowedRetentionDurationCount = 9999;
26+
}
27+
28+
public class TraceUtils
29+
{
30+
public static string GetString(IEnumerable<Object> objList)
31+
{
32+
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
33+
}
34+
35+
public static string GetString(IEnumerable<DateTime> objList)
36+
{
37+
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
38+
}
39+
40+
public static string GetString(IEnumerable<DayOfWeek> objList)
41+
{
42+
return (objList == null) ? "null" : "{" + string.Join("}, {", objList) + "}";
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)