Skip to content

Commit a9352ba

Browse files
author
Samuel Anudeep
committed
resolved merge conflicts
2 parents 431e632 + b0ac635 commit a9352ba

File tree

8 files changed

+40
-66
lines changed

8 files changed

+40
-66
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public interface IPsBackupProvider
4747

4848
List<CmdletModel.RecoveryPointBase> ListRecoveryPoints();
4949

50-
ProtectionPolicyResponse CreatePolicy();
50+
ProtectionPolicyResource CreatePolicy();
5151

52-
ProtectionPolicyResponse ModifyPolicy();
52+
Microsoft.Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> ModifyPolicy();
5353

5454
SchedulePolicyBase GetDefaultSchedulePolicyObject();
5555

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public CmdletModel.RecoveryPointBase GetRecoveryPointDetails()
164164
/// Creates policy given the provider data
165165
/// </summary>
166166
/// <returns>Created policy object as returned by the service</returns>
167-
public ProtectionPolicyResponse CreatePolicy()
167+
public ProtectionPolicyResource CreatePolicy()
168168
{
169169
string policyName = (string)ProviderData[PolicyParams.PolicyName];
170170
CmdletModel.WorkloadType workloadType =
@@ -181,28 +181,25 @@ public ProtectionPolicyResponse CreatePolicy()
181181
Logger.Instance.WriteDebug("Validation of Retention policy is successful");
182182

183183
// construct Hydra policy request
184-
ProtectionPolicyRequest hydraRequest = new ProtectionPolicyRequest()
184+
ProtectionPolicyResource hydraRequest = new ProtectionPolicyResource()
185185
{
186-
Item = new ProtectionPolicyResource()
186+
Properties = new AzureSqlProtectionPolicy()
187187
{
188-
Properties = new AzureSqlProtectionPolicy()
189-
{
190-
RetentionPolicy = PolicyHelpers.GetServiceClientSimpleRetentionPolicy(
188+
RetentionPolicy = PolicyHelpers.GetServiceClientSimpleRetentionPolicy(
191189
(CmdletModel.SimpleRetentionPolicy)retentionPolicy)
192-
}
193190
}
194191
};
195192

196193
return ServiceClientAdapter.CreateOrUpdateProtectionPolicy(
197194
policyName,
198-
hydraRequest);
195+
hydraRequest).Body;
199196
}
200197

201198
/// <summary>
202199
/// Modifies policy using the provider data
203200
/// </summary>
204201
/// <returns>Modified policy object as returned by the service</returns>
205-
public ProtectionPolicyResponse ModifyPolicy()
202+
public Microsoft.Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> ModifyPolicy()
206203
{
207204
RetentionPolicyBase retentionPolicy =
208205
ProviderData.ContainsKey(PolicyParams.RetentionPolicy) ?
@@ -228,15 +225,12 @@ public ProtectionPolicyResponse ModifyPolicy()
228225

229226
CmdletModel.SimpleRetentionPolicy sqlRetentionPolicy =
230227
(CmdletModel.SimpleRetentionPolicy)((AzureSqlPolicy)policy).RetentionPolicy;
231-
ProtectionPolicyRequest hydraRequest = new ProtectionPolicyRequest()
228+
ProtectionPolicyResource hydraRequest = new ProtectionPolicyResource()
232229
{
233-
Item = new ProtectionPolicyResource()
230+
Properties = new AzureSqlProtectionPolicy()
234231
{
235-
Properties = new AzureSqlProtectionPolicy()
236-
{
237-
RetentionPolicy =
232+
RetentionPolicy =
238233
PolicyHelpers.GetServiceClientSimpleRetentionPolicy(sqlRetentionPolicy)
239-
}
240234
}
241235
};
242236

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

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public CmdletModel.RecoveryPointBase GetRecoveryPointDetails()
311311
/// Creates policy given the provider data
312312
/// </summary>
313313
/// <returns>Created policy object as returned by the service</returns>
314-
public ProtectionPolicyResponse CreatePolicy()
314+
public ProtectionPolicyResource CreatePolicy()
315315
{
316316
string policyName = (string)ProviderData[PolicyParams.PolicyName];
317317
Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType workloadType =
@@ -346,30 +346,27 @@ public ProtectionPolicyResponse CreatePolicy()
346346
Logger.Instance.WriteDebug("Validation of Retention policy with Schedule policy is successful");
347347

348348
// construct Service Client policy request
349-
ProtectionPolicyRequest serviceClientRequest = new ProtectionPolicyRequest()
349+
ProtectionPolicyResource serviceClientRequest = new ProtectionPolicyResource()
350350
{
351-
Item = new ProtectionPolicyResource()
351+
Properties = new AzureIaaSVMProtectionPolicy()
352352
{
353-
Properties = new AzureIaaSVMProtectionPolicy()
354-
{
355-
RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy(
353+
RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy(
356354
(CmdletModel.LongTermRetentionPolicy)retentionPolicy),
357-
SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy(
355+
SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy(
358356
(CmdletModel.SimpleSchedulePolicy)schedulePolicy)
359-
}
360357
}
361358
};
362359

363360
return ServiceClientAdapter.CreateOrUpdateProtectionPolicy(
364361
policyName,
365-
serviceClientRequest);
362+
serviceClientRequest).Body;
366363
}
367364

368365
/// <summary>
369366
/// Modifies policy using the provider data
370367
/// </summary>
371368
/// <returns>Modified policy object as returned by the service</returns>
372-
public ProtectionPolicyResponse ModifyPolicy()
369+
public Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> ModifyPolicy()
373370
{
374371
RetentionPolicyBase retentionPolicy =
375372
ProviderData.ContainsKey(PolicyParams.RetentionPolicy) ?
@@ -422,17 +419,14 @@ public ProtectionPolicyResponse ModifyPolicy()
422419
Logger.Instance.WriteDebug("Validation of Retention policy with Schedule policy is successful");
423420

424421
// construct Service Client policy request
425-
ProtectionPolicyRequest serviceClientRequest = new ProtectionPolicyRequest()
422+
ProtectionPolicyResource serviceClientRequest = new ProtectionPolicyResource()
426423
{
427-
Item = new ProtectionPolicyResource()
424+
Properties = new AzureIaaSVMProtectionPolicy()
428425
{
429-
Properties = new AzureIaaSVMProtectionPolicy()
430-
{
431-
RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy(
426+
RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy(
432427
(CmdletModel.LongTermRetentionPolicy)((AzureVmPolicy)policy).RetentionPolicy),
433-
SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy(
428+
SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy(
434429
(CmdletModel.SimpleSchedulePolicy)((AzureVmPolicy)policy).SchedulePolicy)
435-
}
436430
}
437431
};
438432

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers;
1718
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
18-
using Microsoft.Rest;
19-
using Microsoft.Rest.Azure;
2019
using Microsoft.Rest.Azure.OData;
21-
using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers;
2220

2321
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS
2422
{

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public Microsoft.Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> Cre
4949
/// </summary>
5050
/// <param name="policyName">Name of the policy</param>
5151
/// <returns>Policy response returned by the service</returns>
52-
public Microsoft.Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> GetWithHttpMessagesAsync(string policyName)
52+
public ProtectionPolicyResource GetProtectionPolicy(string policyName)
5353
{
54-
return BmsAdapter.Client.ProtectionPoliciesOperations.GetAsync(
54+
return BmsAdapter.Client.ProtectionPoliciesOperations.GetWithHttpMessagesAsync(
5555
BmsAdapter.GetResourceGroupName(),
5656
BmsAdapter.GetResourceName(),
5757
policyName,
@@ -68,32 +68,20 @@ public List<ProtectionPolicyResource> ListProtectionPolicy(
6868
string skipToken = default(string))
6969
{
7070
Func<Microsoft.Rest.Azure.IPage<ProtectionPolicyResource>> listAsync =
71-
() => BmsAdapter.Client.ProtectionPolicy.ListWithHttpMessagesAsync(
71+
() => BmsAdapter.Client.ProtectionPoliciesOperations.ListWithHttpMessagesAsync(
7272
BmsAdapter.GetResourceGroupName(),
7373
BmsAdapter.GetResourceName(),
7474
queryFilter,
7575
skipToken,
7676
cancellationToken: BmsAdapter.CmdletCancellationToken).Result;
7777

7878
Func<string, Microsoft.Rest.Azure.IPage<ProtectionPolicyResource>> listNextAsync =
79-
nextLink => BmsAdapter.Client.ProtectionPolicy.ListNextWithHttpMessagesAsync(
79+
nextLink => BmsAdapter.Client.ProtectionPoliciesOperations.ListNextWithHttpMessagesAsync(
8080
nextLink,
8181
cancellationToken: BmsAdapter.CmdletCancellationToken).Result;
8282

8383
return HelperUtils.GetPagedList<ProtectionPolicyResource>(listAsync, listNextAsync);
84-
}
85-
86-
/// <summary>
87-
/// Gets protection policy operation status using the operation tracking URL
88-
/// </summary>
89-
/// <param name="url">Operation tracking URL</param>
90-
/// <returns>Operation status response returned by the service</returns>
91-
public BackUpOperationStatusResponse GetProtectionPolicyOperationStatusByURL(string url)
92-
{
93-
return BmsAdapter.Client.GetOperationStatusByURLAsync(
94-
url,
95-
cancellationToken: BmsAdapter.CmdletCancellationToken).Result;
96-
}
84+
}
9785

9886
/// <summary>
9987
/// Deletes protection policy from the vault specified by the name

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Jobs/StopAzureRmRecoveryServicesBackupJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public override void ExecuteCmdlet()
6666

6767
var cancelResponse = ServiceClientAdapter.CancelJob(JobId);
6868

69-
if (cancelResponse.StatusCode != HttpStatusCode.NoContent)
69+
if (cancelResponse.Response.StatusCode != HttpStatusCode.NoContent)
7070
{
7171
throw new Exception(string.Format(Resources.JobCouldNotCancelJob,
72-
cancelResponse.StatusCode.ToString()));
72+
cancelResponse.Response.StatusCode.ToString()));
7373
}
7474
else
7575
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/ProtectionPolicy/PolicyCmdletHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public static void ValidateProtectionPolicyName(string policyName)
6666
/// <param name="policyName">Name of the policy to be fetched</param>
6767
/// <param name="serviceClientAdapter">Service client adapter with which to make calls</param>
6868
/// <returns></returns>
69-
public static ProtectionPolicyResponse GetProtectionPolicyByName(string policyName,
69+
public static ProtectionPolicyResource GetProtectionPolicyByName(string policyName,
7070
ServiceClientAdapter serviceClientAdapter)
7171
{
72-
ProtectionPolicyResponse response = null;
72+
ProtectionPolicyResource response = null;
7373

7474
try
7575
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/ProtectionPolicy/SetAzureRmRecoveryServicesBackupProtectionPolicy.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public override void ExecuteCmdlet()
7272
PolicyCmdletHelpers.ValidateProtectionPolicyName(Policy.Name);
7373

7474
// Validate if policy already exists
75-
ProtectionPolicyResponse servicePolicy = PolicyCmdletHelpers.GetProtectionPolicyByName(
75+
ProtectionPolicyResource servicePolicy = PolicyCmdletHelpers.GetProtectionPolicyByName(
7676
Policy.Name, ServiceClientAdapter);
7777
if (servicePolicy == null)
7878
{
@@ -90,15 +90,15 @@ public override void ExecuteCmdlet()
9090

9191
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(
9292
Policy.WorkloadType,
93-
Policy.BackupManagementType);
94-
ProtectionPolicyResponse policyResponse = psBackupProvider.ModifyPolicy();
93+
Policy.BackupManagementType);
94+
Microsoft.Rest.Azure.AzureOperationResponse<ProtectionPolicyResource> policyResponse = psBackupProvider.ModifyPolicy();
9595
WriteDebug("ModifyPolicy http response from service: " +
96-
policyResponse.StatusCode.ToString());
96+
policyResponse.Response.StatusCode.ToString());
9797

98-
if(policyResponse.StatusCode == System.Net.HttpStatusCode.Accepted)
98+
if(policyResponse.Response.StatusCode == System.Net.HttpStatusCode.Accepted)
9999
{
100-
WriteDebug("Tracking operation status URL for completion: " +
101-
policyResponse.AzureAsyncOperation);
100+
//WriteDebug("Tracking operation status URL for completion: " +
101+
// policyResponse.Response.AzureAsyncOperation);
102102

103103
// Track OperationStatus URL for operation completion
104104
BackUpOperationStatusResponse operationResponse =
@@ -133,7 +133,7 @@ public override void ExecuteCmdlet()
133133
{
134134
// ServiceClient will return OK if NO datasources are associated with this policy
135135
WriteDebug("No datasources are associated with Policy, http response code: " +
136-
policyResponse.StatusCode.ToString());
136+
policyResponse.Response.StatusCode.ToString());
137137
}
138138
});
139139
}

0 commit comments

Comments
 (0)