Skip to content

Commit 6a86536

Browse files
committed
Merge pull request #312 from MabOneSdk/pragrawa-dev1
Adding comment sectino in classes and helper functions
2 parents 8dd0162 + f02aa23 commit 6a86536

File tree

19 files changed

+209
-9
lines changed

19 files changed

+209
-9
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
2424

2525
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2626
{
27+
/// <summary>
28+
/// Conversion helpers.
29+
/// </summary>
2730
public class ConversionHelpers
2831
{
2932
#region containers
33+
34+
/// <summary>
35+
/// Helper function to convert ps backup container model from service response.
36+
/// </summary>
3037
public static ContainerBase GetContainerModel(ServiceClientModel.ProtectionContainerResource protectionContainer)
3138
{
3239
ContainerBase containerModel = null;
@@ -47,6 +54,9 @@ public static ContainerBase GetContainerModel(ServiceClientModel.ProtectionConta
4754
return containerModel;
4855
}
4956

57+
/// <summary>
58+
/// Helper function to convert ps backup engine model from service response.
59+
/// </summary>
5060
public static BackupEngineBase GetBackupEngineModel(ServiceClientModel.BackupEngineResource backupEngine)
5161
{
5262
BackupEngineBase backupEngineModel = null;
@@ -67,6 +77,9 @@ public static BackupEngineBase GetBackupEngineModel(ServiceClientModel.BackupEng
6777
return backupEngineModel;
6878
}
6979

80+
/// <summary>
81+
/// Helper function to convert ps backup container model list from service response.
82+
/// </summary>
7083
public static List<ContainerBase> GetContainerModelList(IEnumerable<ServiceClientModel.ProtectionContainerResource> protectionContainers)
7184
{
7285
List<ContainerBase> containerModels = new List<ContainerBase>();
@@ -79,6 +92,9 @@ public static List<ContainerBase> GetContainerModelList(IEnumerable<ServiceClien
7992
return containerModels;
8093
}
8194

95+
/// <summary>
96+
/// Helper function to convert ps backup engine model list from service response.
97+
/// </summary>
8298
public static List<BackupEngineBase> GetBackupEngineModelList(IEnumerable<ServiceClientModel.BackupEngineResource> backupEngines)
8399
{
84100
List<BackupEngineBase> backupEngineModel = new List<BackupEngineBase>();
@@ -94,6 +110,10 @@ public static List<BackupEngineBase> GetBackupEngineModelList(IEnumerable<Servic
94110
#endregion
95111

96112
#region policy
113+
114+
/// <summary>
115+
/// Helper function to convert ps backup policy model from service response.
116+
/// </summary>
97117
public static PolicyBase GetPolicyModel(ServiceClientModel.ProtectionPolicyResource serviceClientResponse)
98118
{
99119
PolicyBase policyModel = null;
@@ -149,6 +169,9 @@ public static PolicyBase GetPolicyModel(ServiceClientModel.ProtectionPolicyResou
149169
return policyModel;
150170
}
151171

172+
/// <summary>
173+
/// Helper function to convert ps backup policy list model from service response.
174+
/// </summary>
152175
public static List<PolicyBase> GetPolicyModelList(
153176
ServiceClientModel.ProtectionPolicyListResponse serviceClientListResponse)
154177
{
@@ -179,6 +202,9 @@ public static List<PolicyBase> GetPolicyModelList(
179202

180203
#region Item
181204

205+
/// <summary>
206+
/// Helper function to convert ps backup policy item from service response.
207+
/// </summary>
182208
public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource protectedItem)
183209
{
184210
ItemBase itemModel = null;
@@ -212,6 +238,9 @@ public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource pro
212238
return itemModel;
213239
}
214240

241+
/// <summary>
242+
/// Helper function to convert ps backup policy item list from service response.
243+
/// </summary>
215244
public static List<ItemBase> GetItemModelList(IEnumerable<ServiceClientModel.ProtectedItemResource> protectedItems)
216245
{
217246
List<ItemBase> itemModels = new List<ItemBase>();

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2222
{
23+
/// <summary>
24+
/// Job conversions helper.
25+
/// </summary>
2326
public class JobConversions
2427
{
2528
#region ServiceClient to PS convertors
@@ -37,6 +40,9 @@ public static CmdletModel.JobBase GetPSJob(JobResponse serviceClientJob)
3740
return GetPSJob(serviceClientJob.Item);
3841
}
3942

43+
/// <summary>
44+
/// Helper function to convert ps backup job model from service response.
45+
/// </summary>
4046
public static CmdletModel.JobBase GetPSJob(JobResource serviceClientJob)
4147
{
4248
CmdletModel.JobBase response = null;
@@ -54,6 +60,9 @@ public static CmdletModel.JobBase GetPSJob(JobResource serviceClientJob)
5460
return response;
5561
}
5662

63+
/// <summary>
64+
/// Helper function to convert ps backup job list model from service response.
65+
/// </summary>
5766
public static void AddServiceClientJobsToPSList(JobListResponse serviceClientJobs, List<CmdletModel.JobBase> psJobs, ref int jobsCount)
5867
{
5968
if (serviceClientJobs.ItemList != null && serviceClientJobs.ItemList.Value != null)
@@ -72,6 +81,9 @@ public static void AddServiceClientJobsToPSList(JobListResponse serviceClientJob
7281

7382
#region AzureVm job private helpers
7483

84+
/// <summary>
85+
/// Helper function to convert ps auzre vm backup policy job from service response.
86+
/// </summary>
7587
private static CmdletModel.AzureVmJob GetPSAzureVmJob(JobResource serviceClientJob)
7688
{
7789
CmdletModel.AzureVmJob response;
@@ -141,6 +153,9 @@ private static CmdletModel.AzureVmJob GetPSAzureVmJob(JobResource serviceClientJ
141153
return response;
142154
}
143155

156+
/// <summary>
157+
/// Helper function to convert ps auzre vm backup job error info from service response.
158+
/// </summary>
144159
private static CmdletModel.AzureVmJobErrorInfo GetPSAzureVmErrorInfo(AzureIaaSVMErrorInfo serviceClientError)
145160
{
146161
CmdletModel.AzureVmJobErrorInfo psErrorInfo = new CmdletModel.AzureVmJobErrorInfo();
@@ -155,6 +170,9 @@ private static CmdletModel.AzureVmJobErrorInfo GetPSAzureVmErrorInfo(AzureIaaSVM
155170
return psErrorInfo;
156171
}
157172

173+
/// <summary>
174+
/// Helper function to get last index value from full id.
175+
/// </summary>
158176
public static string GetLastIdFromFullId(string fullId)
159177
{
160178
string[] splitArr = fullId.Split("/".ToCharArray());
@@ -167,6 +185,10 @@ public static string GetLastIdFromFullId(string fullId)
167185

168186
#region Enum translators
169187

188+
189+
/// <summary>
190+
/// Helper function to get job type from ps backupmanagement type.
191+
/// </summary>
170192
public static string GetJobTypeForService(CmdletModel.BackupManagementType mgmtType)
171193
{
172194
switch (mgmtType)
@@ -178,6 +200,9 @@ public static string GetJobTypeForService(CmdletModel.BackupManagementType mgmtT
178200
}
179201
}
180202

203+
/// <summary>
204+
/// Helper function to get ps backup management type from job type.
205+
/// </summary>
181206
public static string GetPSBackupManagementType(string jobType)
182207
{
183208
if (jobType == BackupManagementType.AzureIaasVM.ToString())

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@
2121

2222
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2323
{
24+
/// <summary>
25+
/// Recovery Point conversion helper.
26+
/// </summary>
2427
public class RecoveryPointConversions
2528
{
29+
/// <summary>
30+
/// Helper function to convert ps recovery points list model from service response.
31+
/// </summary>
2632
public static List<RecoveryPointBase> GetPSAzureRecoveryPoints(ServiceClientModel.RecoveryPointListResponse rpList, AzureVmItem item)
2733
{
2834
if (rpList == null || rpList.RecoveryPointList == null ||
@@ -61,6 +67,9 @@ public static List<RecoveryPointBase> GetPSAzureRecoveryPoints(ServiceClientMode
6167
return result;
6268
}
6369

70+
// <summary>
71+
/// Helper function to convert ps recovery point model from service response.
72+
/// </summary>
6473
public static RecoveryPointBase GetPSAzureRecoveryPoints(ServiceClientModel.RecoveryPointResponse rpResponse, AzureVmItem item)
6574
{
6675
if (rpResponse == null || rpResponse.RecPoint == null)

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@
2323

2424
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2525
{
26+
/// <summary>
27+
/// Backup policy conversion helper
28+
/// </summary>
2629
public partial class PolicyHelpers
2730
{
2831
#region ServiceClientToPSObject conversions
2932

3033
#region public
34+
35+
// <summary>
36+
/// Helper function to convert ps long term retention policy from service response.
37+
/// </summary>
3138
public static LongTermRetentionPolicy GetPSLongTermRetentionPolicy(
3239
ServiceClientModel.LongTermRetentionPolicy serviceClientRetPolicy)
3340
{
@@ -68,6 +75,9 @@ public static LongTermRetentionPolicy GetPSLongTermRetentionPolicy(
6875
return ltrPolicy;
6976
}
7077

78+
// <summary>
79+
/// Helper function to convert ps simple retention policy from service response.
80+
/// </summary>
7181
public static LongTermRetentionPolicy GetPSSimpleRetentionPolicy(
7282
ServiceClientModel.SimpleRetentionPolicy serviceClientRetPolicy)
7383
{
@@ -323,6 +333,9 @@ private static WeeklyRetentionFormat GetPSLTRWeeklyRetentionFormat(
323333
#endregion
324334

325335
#region PStoServiceClientObject conversions
336+
// <summary>
337+
/// Helper function to convert service long term retention policy from ps retention policy.
338+
/// </summary>
326339
public static ServiceClientModel.LongTermRetentionPolicy GetServiceClientLongTermRetentionPolicy(
327340
LongTermRetentionPolicy psRetPolicy)
328341
{
@@ -356,6 +369,9 @@ public static ServiceClientModel.LongTermRetentionPolicy GetServiceClientLongTer
356369
return serviceClientRetPolicy;
357370
}
358371

372+
// <summary>
373+
/// Helper function to convert service simple retention policy from ps simple policy.
374+
/// </summary>
359375
public static ServiceClientModel.SimpleRetentionPolicy GetServiceClientSimpleRetentionPolicy(
360376
SimpleSchedulePolicy psRetPolicy)
361377
{

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@
2222

2323
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2424
{
25+
/// <summary>
26+
/// Backup policy conversion helper
27+
/// </summary>
2528
public partial class PolicyHelpers
2629
{
2730
#region ServiceClientToPSObject conversions
2831

32+
// <summary>
33+
/// Helper function to convert ps simple schedule policy from service response.
34+
/// </summary>
2935
public static SimpleSchedulePolicy GetPSSimpleSchedulePolicy(
3036
ServiceClientModel.SimpleSchedulePolicy serviceClientPolicy)
3137
{
@@ -51,6 +57,9 @@ public static SimpleSchedulePolicy GetPSSimpleSchedulePolicy(
5157

5258
#region PStoServiceClientObject conversions
5359

60+
// <summary>
61+
/// Helper function to parse utc time from local time.
62+
/// </summary>
5463
public static List<DateTime> ParseDateTimesToUTC(IList<DateTime> localTimes)
5564
{
5665
if (localTimes == null || localTimes.Count == 0)
@@ -66,14 +75,17 @@ public static List<DateTime> ParseDateTimesToUTC(IList<DateTime> localTimes)
6675
temp = localTime;
6776
if (localTime.Kind != DateTimeKind.Utc)
6877
{
69-
temp = localTime.ToUniversalTime();
78+
temp = localTime.ToUniversalTime();
7079
}
7180
utcTimes.Add(temp);
7281
}
7382

7483
return utcTimes;
7584
}
7685

86+
// <summary>
87+
/// Helper function to convert service simple schedule policy from ps scheduel policy.
88+
/// </summary>
7789
public static ServiceClientModel.SimpleSchedulePolicy GetServiceClientSimpleSchedulePolicy(
7890
SimpleSchedulePolicy psPolicy)
7991
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2424
{
2525
public partial class PolicyHelpers
2626
{
27+
// <summary>
28+
/// Helper function to validate long term rentention policy and simple schedule policy.
29+
/// </summary>
2730
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
2831
LongTermRetentionPolicy ltrPolicy,
2932
SimpleSchedulePolicy schPolicy)

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2323
{
24+
/// <summary>
25+
/// Azure VM specific container class.
26+
/// </summary>
2427
public class AzureVmContainer : ContainerBase
2528
{
2629
/// <summary>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2323
{
2424
/// <summary>
25-
/// Represents IaaSVM Item Class
25+
/// IaaSVM Item Class
2626
/// </summary>
2727
public class AzureVmItem : ItemBase
2828
{
@@ -67,7 +67,7 @@ public AzureVmItem(ProtectedItemResource protectedItemResource,
6767
}
6868

6969
/// <summary>
70-
/// Represents IaaSVM Item ExtendedInfo Class
70+
/// IaaSVM Item ExtendedInfo Class
7171
/// </summary>
7272
public class AzureVmItemExtendedInfo : ItemExtendedInfoBase
7373
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmJob.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
1818
{
19+
/// <summary>
20+
/// Represents Azure VM specific job class.
21+
/// </summary>
1922
public class AzureVmJob : JobBase
2023
{
2124
public bool IsCancellable { get; set; }
@@ -27,6 +30,9 @@ public class AzureVmJob : JobBase
2730
public List<AzureVmJobErrorInfo> ErrorDetails { get; set; }
2831
}
2932

33+
/// <summary>
34+
/// Azure VM specific job details class.
35+
/// </summary>
3036
public class AzureVmJobDetails : AzureVmJob
3137
{
3238
/// <summary>
@@ -40,11 +46,17 @@ public class AzureVmJobDetails : AzureVmJob
4046
public List<AzureVmJobSubTask> SubTasks { get; set; }
4147
}
4248

49+
/// <summary>
50+
/// Azure VM specific job error info class.
51+
/// </summary>
4352
public class AzureVmJobErrorInfo : JobErrorInfoBase
4453
{
4554
public int ErrorCode { get; set; }
4655
}
4756

57+
/// <summary>
58+
/// Azure VM specific job sub-task class.
59+
/// </summary>
4860
public class AzureVmJobSubTask : JobSubTaskBase
4961
{
5062
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmPolicy.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23+
/// <summary>
24+
/// Azure VM specific backup policy class.
25+
/// </summary>
2326
public class AzureVmPolicy : PolicyBase
2427
{
2528
public SchedulePolicyBase SchedulePolicy { get; set; }

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmRecoveryPoint.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23+
/// <summary>
24+
/// Azure VM specific recovery point class.
25+
/// </summary>
2326
public class AzureVmRecoveryPoint : RecoveryPointBase
2427
{
2528
public string RecoveryPointAdditionalInfo { get; set; }

0 commit comments

Comments
 (0)