Skip to content

Commit 5f686f1

Browse files
author
Samuel Anudeep
committed
Merge pull request #330 from MabOneSdk/anudeeb-dev1
Fixing 7349803 in Provider and Service Client Adapter Layers
2 parents 583d0b7 + 7d32d67 commit 5f686f1

File tree

15 files changed

+244
-15
lines changed

15 files changed

+244
-15
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public class DpmPsBackupProvider : IPsBackupProvider
3232
Dictionary<System.Enum, object> ProviderData { get; set; }
3333
ServiceClientAdapter ServiceClientAdapter { get; set; }
3434

35+
/// <summary>
36+
/// Initializes the provider with the data recieved from the cmdlet layer
37+
/// </summary>
38+
/// <param name="providerData">Data from the cmdlet layer intended for the provider</param>
39+
/// <param name="serviceClientAdapter">Service client adapter for communicating with the backend service</param>
3540
public void Initialize(Dictionary<System.Enum, object> providerData, ServiceClientAdapter serviceClientAdapter)
3641
{
3742
this.ProviderData = providerData;
@@ -88,6 +93,10 @@ public ServiceClientModel.ProtectionPolicyResponse ModifyPolicy()
8893
throw new NotImplementedException();
8994
}
9095

96+
/// <summary>
97+
/// Lists backup management servers registered with the recovery services vault
98+
/// </summary>
99+
/// <returns></returns>
91100
public List<Models.BackupEngineBase> ListBackupManagementServers()
92101
{
93102
string name = (string)this.ProviderData[ContainerParams.Name];

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,21 @@ public class IaasVmPsBackupProvider : IPsBackupProvider
4141
Dictionary<System.Enum, object> ProviderData { get; set; }
4242
ServiceClientAdapter ServiceClientAdapter { get; set; }
4343

44+
/// <summary>
45+
/// Initializes the provider with the data recieved from the cmdlet layer
46+
/// </summary>
47+
/// <param name="providerData">Data from the cmdlet layer intended for the provider</param>
48+
/// <param name="serviceClientAdapter">Service client adapter for communicating with the backend service</param>
4449
public void Initialize(Dictionary<System.Enum, object> providerData, ServiceClientAdapter serviceClientAdapter)
4550
{
4651
this.ProviderData = providerData;
4752
this.ServiceClientAdapter = serviceClientAdapter;
4853
}
4954

55+
/// <summary>
56+
/// Triggers the enable protection operation for the given item
57+
/// </summary>
58+
/// <returns>The job response returned from the service</returns>
5059
public BaseRecoveryServicesJobResponse EnableProtection()
5160
{
5261
string azureVMName = (string)ProviderData[ItemParams.AzureVMName];
@@ -130,6 +139,10 @@ public BaseRecoveryServicesJobResponse EnableProtection()
130139
serviceClientRequest);
131140
}
132141

142+
/// <summary>
143+
/// Triggers the disable protection operation for the given item
144+
/// </summary>
145+
/// <returns>The job response returned from the service</returns>
133146
public BaseRecoveryServicesJobResponse DisableProtection()
134147
{
135148
bool deleteBackupData = (bool)ProviderData[ItemParams.DeleteBackupData];
@@ -189,6 +202,10 @@ public BaseRecoveryServicesJobResponse DisableProtection()
189202
}
190203
}
191204

205+
/// <summary>
206+
/// Triggers the backup operation for the given item
207+
/// </summary>
208+
/// <returns>The job response returned from the service</returns>
192209
public BaseRecoveryServicesJobResponse TriggerBackup()
193210
{
194211
ItemBase item = (ItemBase)ProviderData[ItemParams.Item];
@@ -197,6 +214,10 @@ public BaseRecoveryServicesJobResponse TriggerBackup()
197214
IdUtils.GetValueByName(iaasVmItem.Id, IdUtils.IdNames.ProtectedItemName));
198215
}
199216

217+
/// <summary>
218+
/// Triggers the recovery operation for the given recovery point
219+
/// </summary>
220+
/// <returns>The job response returned from the service</returns>
200221
public BaseRecoveryServicesJobResponse TriggerRestore()
201222
{
202223
AzureVmRecoveryPoint rp = ProviderData[RestoreBackupItemParams.RecoveryPoint]
@@ -216,6 +237,10 @@ public ProtectedItemResponse GetProtectedItem()
216237
throw new NotImplementedException();
217238
}
218239

240+
/// <summary>
241+
/// Fetches the detail info for the given recovery point
242+
/// </summary>
243+
/// <returns>Recovery point detail as returned by the service</returns>
219244
public CmdletModel.RecoveryPointBase GetRecoveryPointDetails()
220245
{
221246
AzureVmItem item = ProviderData[GetRecoveryPointParams.Item]
@@ -231,6 +256,10 @@ public CmdletModel.RecoveryPointBase GetRecoveryPointDetails()
231256
return RecoveryPointConversions.GetPSAzureRecoveryPoints(rpResponse, item);
232257
}
233258

259+
/// <summary>
260+
/// Lists recovery points generated for the given item
261+
/// </summary>
262+
/// <returns>List of recovery point PowerShell model objects</returns>
234263
public List<CmdletModel.RecoveryPointBase> ListRecoveryPoints()
235264
{
236265
DateTime startDate = (DateTime)(ProviderData[GetRecoveryPointParams.StartDate]);
@@ -258,6 +287,10 @@ public CmdletModel.RecoveryPointBase GetRecoveryPointDetails()
258287
return RecoveryPointConversions.GetPSAzureRecoveryPoints(rpListResponse, item);
259288
}
260289

290+
/// <summary>
291+
/// Creates policy given the provider data
292+
/// </summary>
293+
/// <returns>Created policy object as returned by the service</returns>
261294
public ProtectionPolicyResponse CreatePolicy()
262295
{
263296
string policyName = (string)ProviderData[PolicyParams.PolicyName];
@@ -312,6 +345,10 @@ public ProtectionPolicyResponse CreatePolicy()
312345
serviceClientRequest);
313346
}
314347

348+
/// <summary>
349+
/// Modifies policy using the provider data
350+
/// </summary>
351+
/// <returns>Modified policy object as returned by the service</returns>
315352
public ProtectionPolicyResponse ModifyPolicy()
316353
{
317354
RetentionPolicyBase retentionPolicy =
@@ -383,6 +420,10 @@ public ProtectionPolicyResponse ModifyPolicy()
383420
serviceClientRequest);
384421
}
385422

423+
/// <summary>
424+
/// Lists protection containers according to the provider data
425+
/// </summary>
426+
/// <returns>List of protection containers</returns>
386427
public List<ContainerBase> ListProtectionContainers()
387428
{
388429
Models.ContainerType containerType =
@@ -433,6 +474,10 @@ public List<ContainerBase> ListProtectionContainers()
433474
throw new NotImplementedException();
434475
}
435476

477+
/// <summary>
478+
/// Lists protected items protected by the recovery services vault according to the provider data
479+
/// </summary>
480+
/// <returns>List of protected items</returns>
436481
public List<ItemBase> ListProtectedItems()
437482
{
438483
ContainerBase container =
@@ -550,6 +595,10 @@ public List<ItemBase> ListProtectedItems()
550595
return itemModels;
551596
}
552597

598+
/// <summary>
599+
/// Constructs the schedule policy object with default inits
600+
/// </summary>
601+
/// <returns>Default schedule policy object</returns>
553602
public SchedulePolicyBase GetDefaultSchedulePolicyObject()
554603
{
555604
CmdletModel.SimpleSchedulePolicy defaultSchedule = new CmdletModel.SimpleSchedulePolicy();
@@ -566,6 +615,10 @@ public SchedulePolicyBase GetDefaultSchedulePolicyObject()
566615
return defaultSchedule;
567616
}
568617

618+
/// <summary>
619+
/// Constructs the retention policy object with default inits
620+
/// </summary>
621+
/// <returns>Default retention policy object</returns>
569622
public RetentionPolicyBase GetDefaultRetentionPolicyObject()
570623
{
571624
CmdletModel.LongTermRetentionPolicy defaultRetention = new CmdletModel.LongTermRetentionPolicy();

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public class MabPsBackupProvider : IPsBackupProvider
3434
Dictionary<System.Enum, object> ProviderData { get; set; }
3535
ServiceClientAdapter ServiceClientAdapter { get; set; }
3636

37+
/// <summary>
38+
/// Initializes the provider with the data recieved from the cmdlet layer
39+
/// </summary>
40+
/// <param name="providerData">Data from the cmdlet layer intended for the provider</param>
41+
/// <param name="serviceClientAdapter">Service client adapter for communicating with the backend service</param>
3742
public void Initialize(Dictionary<System.Enum, object> providerData, ServiceClientAdapter serviceClientAdapter)
3843
{
3944
this.ProviderData = providerData;
@@ -85,6 +90,10 @@ public ProtectionPolicyResponse ModifyPolicy()
8590
throw new NotImplementedException();
8691
}
8792

93+
/// <summary>
94+
/// Lists containers registered to the recovery services vault according to the provider data
95+
/// </summary>
96+
/// <returns>List of protection containers</returns>
8897
public List<Models.ContainerBase> ListProtectionContainers()
8998
{
9099
string name = (string)this.ProviderData[ContainerParams.Name];

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public PsBackupProviderManager(Dictionary<System.Enum, object> providerDataIn, S
4545
serviceClientAdapter = serviceClientAdapterIn;
4646
}
4747

48+
/// <summary>
49+
/// Gets an instance of the provider based on the container type and backup management type (optional)
50+
/// </summary>
51+
/// <param name="containerType">Type of the container</param>
52+
/// <param name="backupManagementType">Type of the backup management type (optional)</param>
53+
/// <returns></returns>
4854
public IPsBackupProvider GetProviderInstance
4955
(
5056
ContainerType containerType,

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ContainerAPIs.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public partial class ServiceClientAdapter
2727
/// <summary>
2828
/// Fetches protection containers in the vault according to the query params
2929
/// </summary>
30-
/// <param name="parameters"></param>
31-
/// <returns></returns>
30+
/// <param name="parameters">Query parameters</param>
31+
/// <returns>List of protection containers</returns>
3232
public IEnumerable<ProtectionContainerResource> ListContainers(
3333
ProtectionContainerListQueryParams queryParams)
3434
{
@@ -42,10 +42,10 @@ public IEnumerable<ProtectionContainerResource> ListContainers(
4242
}
4343

4444
/// <summary>
45-
/// Fetches backup engine in the vault according to the query params
45+
/// Fetches backup engines in the vault according to the query params
4646
/// </summary>
47-
/// <param name="parameters"></param>
48-
/// <returns></returns>
47+
/// <param name="parameters">Query parameters</param>
48+
/// <returns>List of backup engines</returns>
4949
public IEnumerable<BackupEngineResource> ListBackupEngines(BackupEngineListQueryParams queryParams)
5050
{
5151
PaginationRequest paginationParam = new PaginationRequest();
@@ -63,7 +63,7 @@ public IEnumerable<BackupEngineResource> ListBackupEngines(BackupEngineListQuery
6363
/// <summary>
6464
/// Triggers refresh of container catalog in service
6565
/// </summary>
66-
/// <returns></returns>
66+
/// <returns>Response of the job created in the service</returns>
6767
public BaseRecoveryServicesJobResponse RefreshContainers()
6868
{
6969
string resourceName = BmsAdapter.GetResourceName();
@@ -78,9 +78,8 @@ public BaseRecoveryServicesJobResponse RefreshContainers()
7878
}
7979

8080
/// <summary>
81-
/// Unregister a container in service
81+
/// Triggers unregister of a container in service
8282
/// </summary>
83-
/// <returns></returns>
8483
public AzureOperationResponse UnregisterContainers(string containerName)
8584
{
8685
string resourceName = BmsAdapter.GetResourceName();

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ItemAPIs.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClient
2323
{
2424
public partial class ServiceClientAdapter
2525
{
26+
/// <summary>
27+
/// Creates a new protected item or updates an already existing protected item
28+
/// </summary>
29+
/// <param name="containerName">Name of the container which this item belongs to</param>
30+
/// <param name="protectedItemName">Name of the item</param>
31+
/// <param name="request">Protected item create or update request</param>
32+
/// <returns>Job created in the service for this operation</returns>
2633
public BaseRecoveryServicesJobResponse CreateOrUpdateProtectedItem(
2734
string containerName,
2835
string protectedItemName,
@@ -42,6 +49,12 @@ public BaseRecoveryServicesJobResponse CreateOrUpdateProtectedItem(
4249
BmsAdapter.CmdletCancellationToken).Result;
4350
}
4451

52+
/// <summary>
53+
/// Deletes a protected item
54+
/// </summary>
55+
/// <param name="containerName">Name of the container which this item belongs to</param>
56+
/// <param name="protectedItemName">Name of the item</param>
57+
/// <returns>Job created in the service for this operation</returns>
4558
public BaseRecoveryServicesJobResponse DeleteProtectedItem(
4659
string containerName,
4760
string protectedItemName)
@@ -59,6 +72,13 @@ public BaseRecoveryServicesJobResponse DeleteProtectedItem(
5972
BmsAdapter.CmdletCancellationToken).Result;
6073
}
6174

75+
/// <summary>
76+
/// Gets a protected item
77+
/// </summary>
78+
/// <param name="containerName">Name of the container which this item belongs to</param>
79+
/// <param name="protectedItemName">Name of the item</param>
80+
/// <param name="queryFilter">Query filter</param>
81+
/// <returns>Protected item</returns>
6282
public ProtectedItemResponse GetProtectedItem(
6383
string containerName,
6484
string protectedItemName,
@@ -78,6 +98,13 @@ public ProtectedItemResponse GetProtectedItem(
7898
BmsAdapter.CmdletCancellationToken).Result;
7999
}
80100

101+
/// <summary>
102+
/// List protected items protected by the Recovery Services vault according to the query params
103+
/// and pagination params.
104+
/// </summary>
105+
/// <param name="queryFilter">Query params</param>
106+
/// <param name="paginationParams">Pagination params</param>
107+
/// <returns>List of protected items</returns>
81108
public ProtectedItemListResponse ListProtectedItem(
82109
ProtectedItemListQueryParam queryFilter,
83110
PaginationRequest paginationParams = null)

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/JobAPIs.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClient
1919
{
2020
public partial class ServiceClientAdapter
2121
{
22+
/// <summary>
23+
/// Gets a job
24+
/// </summary>
25+
/// <param name="jobId">ID of the job</param>
26+
/// <returns>Job response returned by the service</returns>
2227
public JobResponse GetJob(string jobId)
2328
{
2429
string resourceName = BmsAdapter.GetResourceName();
@@ -32,6 +37,18 @@ public JobResponse GetJob(string jobId)
3237
BmsAdapter.CmdletCancellationToken).Result;
3338
}
3439

40+
/// <summary>
41+
/// Lists jobs according to the parameters
42+
/// </summary>
43+
/// <param name="jobId">ID of the job</param>
44+
/// <param name="status">Status of the job</param>
45+
/// <param name="operation">Operation represented by the job</param>
46+
/// <param name="startTime">Time when the job started</param>
47+
/// <param name="endTime">Time when the job finished</param>
48+
/// <param name="backupManagementType">Backup management type of the item represented by the job</param>
49+
/// <param name="top">Top pagination param</param>
50+
/// <param name="skipToken">Skip token pagination param</param>
51+
/// <returns>Job list response from the service</returns>
3552
public JobListResponse GetJobs(
3653
string jobId,
3754
string status,
@@ -73,6 +90,11 @@ public JobListResponse GetJobs(
7390
BmsAdapter.CmdletCancellationToken).Result;
7491
}
7592

93+
/// <summary>
94+
/// Cancels a job
95+
/// </summary>
96+
/// <param name="jobId">ID of the job to cancel</param>
97+
/// <returns>Cancelled job response from the service</returns>
7698
public BaseRecoveryServicesJobResponse CancelJob(string jobId)
7799
{
78100
string resourceName = BmsAdapter.GetResourceName();
@@ -86,6 +108,12 @@ public BaseRecoveryServicesJobResponse CancelJob(string jobId)
86108
BmsAdapter.CmdletCancellationToken).Result;
87109
}
88110

111+
/// <summary>
112+
/// Gets the job operation status
113+
/// </summary>
114+
/// <param name="jobId">ID of the job</param>
115+
/// <param name="operationId">ID of the operation associated with the job</param>
116+
/// <returns>Job response returned by the service</returns>
89117
public JobResponse GetJobOperationStatus(string jobId, string operationId)
90118
{
91119
string resourceName = BmsAdapter.GetResourceName();
@@ -102,6 +130,16 @@ public JobResponse GetJobOperationStatus(string jobId, string operationId)
102130

103131
#region private helpers
104132

133+
/// <summary>
134+
/// Constructs the query object based on the input parameters
135+
/// </summary>
136+
/// <param name="backupManagementType">Backup management type of the item associated with the job</param>
137+
/// <param name="startTime">Time when the job started</param>
138+
/// <param name="endTime">Time when the job ended</param>
139+
/// <param name="jobId">ID of the job</param>
140+
/// <param name="status">Status of the job</param>
141+
/// <param name="operation">ID of operation associated with the job</param>
142+
/// <returns></returns>
105143
public CommonJobQueryFilters GetQueryObject(
106144
string backupManagementType,
107145
DateTime startTime,

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/OperationStatusAPIs.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClient
2323
{
2424
public partial class ServiceClientAdapter
2525
{
26+
/// <summary>
27+
/// Gets result of the refresh container operation using the operation tracking URL
28+
/// </summary>
29+
/// <param name="operationResultLink">Operation tracking URL</param>
30+
/// <returns>Job response returned by the service</returns>
2631
public BaseRecoveryServicesJobResponse GetRefreshContainerOperationResultByURL(
2732
string operationResultLink)
2833
{
@@ -34,6 +39,11 @@ public BaseRecoveryServicesJobResponse GetRefreshContainerOperationResultByURL(
3439
BmsAdapter.CmdletCancellationToken).Result;
3540
}
3641

42+
/// <summary>
43+
/// Gets result of a generic operation on the protected item using the operation tracking URL
44+
/// </summary>
45+
/// <param name="operationResultLink">Operation tracking URL</param>
46+
/// <returns>Operation status response returned by the service</returns>
3747
public BackUpOperationStatusResponse GetProtectedItemOperationStatusByURL(
3848
string operationResultLink)
3949
{

0 commit comments

Comments
 (0)