Skip to content

Commit 39d1421

Browse files
author
Samuel Anudeep
committed
Merge pull request #215 from MabOneSdk/dev1
Checkin acceptance tests
2 parents ec548d3 + e68ceaa commit 39d1421

File tree

21 files changed

+222
-125
lines changed

21 files changed

+222
-125
lines changed

src/ResourceManager/RecoveryServices.Backup/Cmdlets/ProtectionPolicy/SetAzureRmRecoveryServicesPolicy.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,29 @@ public override void ExecuteCmdlet()
6969
}, HydraAdapter);
7070

7171
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(Policy.WorkloadType,
72-
Policy.BackupManagementType);
73-
// now convert hydraPolicy to PSObject
74-
WriteObject(psBackupProvider.ModifyPolicy());
72+
Policy.BackupManagementType);
73+
ProtectionPolicyResponse policyResponse = psBackupProvider.ModifyPolicy();
74+
75+
if(policyResponse.StatusCode == System.Net.HttpStatusCode.Accepted)
76+
{
77+
// Track OperationStatus URL for operation completion
78+
BackUpOperationStatusResponse operationResponse = WaitForOperationCompletionUsingStatusLink(
79+
policyResponse.AzureAsyncOperation,
80+
HydraAdapter.GetProtectionPolicyOperationStatusByURL);
81+
82+
if(operationResponse.OperationStatus.Status == OperationStatusValues.Failed.ToString())
83+
{
84+
// if operation failed, then trace warning/error
85+
}
86+
87+
// get list of jobIds and return jobResponses
88+
WriteObject(GetJobObject(((OperationStatusJobsExtendedInfo)operationResponse.OperationStatus.Properties).JobIds));
89+
}
90+
else
91+
{
92+
// Hydra will return OK if NO datasources are associated with this policy
93+
// just trace and return
94+
}
7595
});
7696
}
7797
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
<Compile Include="Properties\AssemblyInfo.cs" />
6161
</ItemGroup>
6262
<ItemGroup>
63+
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
64+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
65+
<Name>Commands.Common</Name>
66+
</ProjectReference>
6367
<ProjectReference Include="..\Commands.RecoveryServices.Backup.Logger\Commands.RecoveryServices.Backup.Logger.csproj">
6468
<Project>{5e675749-6139-464a-904c-59c0ffdfec82}</Project>
6569
<Name>Commands.RecoveryServices.Backup.Logger</Name>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,24 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Reflection;
1617
using System.Runtime.CompilerServices;
1718
using System.Runtime.InteropServices;
1819

1920
// General Information about an assembly is controlled through the following
2021
// set of attributes. Change these attribute values to modify the information
2122
// associated with an assembly.
22-
[assembly: AssemblyTitle("Helpers")]
23-
[assembly: AssemblyDescription("")]
24-
[assembly: AssemblyConfiguration("")]
25-
[assembly: AssemblyCompany("")]
26-
[assembly: AssemblyProduct("Helpers")]
27-
[assembly: AssemblyCopyright("Copyright © 2016")]
28-
[assembly: AssemblyTrademark("")]
29-
[assembly: AssemblyCulture("")]
23+
[assembly: AssemblyTitle("Microsoft Azure Powershell")]
24+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
25+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
26+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
3027

3128
// Setting ComVisible to false makes the types in this assembly not visible
3229
// to COM components. If you need to access a type in this assembly from
3330
// COM, set the ComVisible attribute to true on that type.
3431
[assembly: ComVisible(false)]
35-
36-
// The following GUID is for the ID of the typelib if this project is exposed to COM
37-
[assembly: Guid("80e5eb92-c776-4e6a-af93-712e23965e2a")]
32+
[assembly: CLSCompliant(false)]
3833

3934
// Version information for an assembly consists of the following four values:
4035
//

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ public ProtectionPolicyListResponse ListProtectionPolicy(
5757
BmsAdapter.CmdletCancellationToken).Result;
5858
}
5959

60-
// TBD for other operations
60+
public BackUpOperationStatusResponse GetProtectionPolicyOperationStatusByURL(string url)
61+
{
62+
return BmsAdapter.Client.ProtectionPolicy.GetOperationStatusByURLAsync(
63+
url,
64+
BmsAdapter.GetCustomRequestHeaders(),
65+
BmsAdapter.CmdletCancellationToken).Result;
66+
}
6167
}
6268
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
<Project>{d3804b64-c0d3-48f8-82ec-1f632f833c9e}</Project>
7777
<Name>Commands.Common.Authentication</Name>
7878
</ProjectReference>
79+
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
80+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
81+
<Name>Commands.Common</Name>
82+
</ProjectReference>
7983
<ProjectReference Include="..\Commands.RecoveryServices.Backup.Models\Commands.RecoveryServices.Backup.Models.csproj">
8084
<Project>{30b92759-50b3-494e-b9f0-ec9a2ce9d57b}</Project>
8185
<Name>Commands.RecoveryServices.Backup.Models</Name>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,24 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Reflection;
1617
using System.Runtime.CompilerServices;
1718
using System.Runtime.InteropServices;
1819

1920
// General Information about an assembly is controlled through the following
2021
// set of attributes. Change these attribute values to modify the information
2122
// associated with an assembly.
22-
[assembly: AssemblyTitle("Adapter")]
23-
[assembly: AssemblyDescription("")]
24-
[assembly: AssemblyConfiguration("")]
25-
[assembly: AssemblyCompany("")]
26-
[assembly: AssemblyProduct("Adapter")]
27-
[assembly: AssemblyCopyright("Copyright © 2016")]
28-
[assembly: AssemblyTrademark("")]
29-
[assembly: AssemblyCulture("")]
23+
[assembly: AssemblyTitle("Microsoft Azure Powershell")]
24+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
25+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
26+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
3027

3128
// Setting ComVisible to false makes the types in this assembly not visible
3229
// to COM components. If you need to access a type in this assembly from
3330
// COM, set the ComVisible attribute to true on that type.
3431
[assembly: ComVisible(false)]
35-
36-
// The following GUID is for the ID of the typelib if this project is exposed to COM
37-
[assembly: Guid("ad1e4b97-f782-4fd0-b2bf-14472c362306")]
32+
[assembly: CLSCompliant(false)]
3833

3934
// Version information for an assembly consists of the following four values:
4035
//

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<Compile Include="Logger.cs" />
4343
<Compile Include="Properties\AssemblyInfo.cs" />
4444
</ItemGroup>
45+
<ItemGroup>
46+
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
47+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
48+
<Name>Commands.Common</Name>
49+
</ProjectReference>
50+
</ItemGroup>
4551
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
4652
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
4753
Other similar extension points exist, see Microsoft.Common.targets.

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Logger/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,24 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Reflection;
1617
using System.Runtime.CompilerServices;
1718
using System.Runtime.InteropServices;
1819

1920
// General Information about an assembly is controlled through the following
2021
// set of attributes. Change these attribute values to modify the information
2122
// associated with an assembly.
22-
[assembly: AssemblyTitle("Commands.RecoveryServices.Backup.Logger")]
23-
[assembly: AssemblyDescription("")]
24-
[assembly: AssemblyConfiguration("")]
25-
[assembly: AssemblyCompany("")]
26-
[assembly: AssemblyProduct("Commands.RecoveryServices.Backup.Logger")]
27-
[assembly: AssemblyCopyright("Copyright © 2016")]
28-
[assembly: AssemblyTrademark("")]
29-
[assembly: AssemblyCulture("")]
23+
[assembly: AssemblyTitle("Microsoft Azure Powershell")]
24+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
25+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
26+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
3027

3128
// Setting ComVisible to false makes the types in this assembly not visible
3229
// to COM components. If you need to access a type in this assembly from
3330
// COM, set the ComVisible attribute to true on that type.
3431
[assembly: ComVisible(false)]
35-
36-
// The following GUID is for the ID of the typelib if this project is exposed to COM
37-
[assembly: Guid("cac38a0e-a5a2-4473-b2a9-e6f6f49ca63d")]
32+
[assembly: CLSCompliant(false)]
3833

3934
// Version information for an assembly consists of the following four values:
4035
//

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
6767
</EmbeddedResource>
6868
</ItemGroup>
69+
<ItemGroup>
70+
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
71+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
72+
<Name>Commands.Common</Name>
73+
</ProjectReference>
74+
</ItemGroup>
6975
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7076
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7177
Other similar extension points exist, see Microsoft.Common.targets.

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,24 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Reflection;
1617
using System.Runtime.CompilerServices;
1718
using System.Runtime.InteropServices;
1819

1920
// General Information about an assembly is controlled through the following
2021
// set of attributes. Change these attribute values to modify the information
2122
// associated with an assembly.
22-
[assembly: AssemblyTitle("Models")]
23-
[assembly: AssemblyDescription("")]
24-
[assembly: AssemblyConfiguration("")]
25-
[assembly: AssemblyCompany("")]
26-
[assembly: AssemblyProduct("Models")]
27-
[assembly: AssemblyCopyright("Copyright © 2016")]
28-
[assembly: AssemblyTrademark("")]
29-
[assembly: AssemblyCulture("")]
23+
[assembly: AssemblyTitle("Microsoft Azure Powershell")]
24+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
25+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
26+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
3027

3128
// Setting ComVisible to false makes the types in this assembly not visible
3229
// to COM components. If you need to access a type in this assembly from
3330
// COM, set the ComVisible attribute to true on that type.
3431
[assembly: ComVisible(false)]
35-
36-
// The following GUID is for the ID of the typelib if this project is exposed to COM
37-
[assembly: Guid("c26540c5-042f-4727-ad18-56342944e821")]
32+
[assembly: CLSCompliant(false)]
3833

3934
// Version information for an assembly consists of the following four values:
4035
//

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
<Compile Include="Providers\IaasVmPsBackupProvider.cs" />
6161
</ItemGroup>
6262
<ItemGroup>
63+
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
64+
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
65+
<Name>Commands.Common</Name>
66+
</ProjectReference>
6367
<ProjectReference Include="..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
6468
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
6569
<Name>Commands.ResourceManager.Common</Name>

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,11 @@ public interface IPsBackupProvider
4242

4343
ProtectionPolicyResponse CreatePolicy();
4444

45-
List<AzureRmRecoveryServicesJobBase> ModifyPolicy();
46-
47-
ProtectionPolicyResponse GetPolicy();
45+
ProtectionPolicyResponse ModifyPolicy();
4846

4947
AzureRmRecoveryServicesSchedulePolicyBase GetDefaultSchedulePolicyObject();
5048

51-
AzureRmRecoveryServicesRetentionPolicyBase GetDefaultRetentionPolicyObject();
52-
void DeletePolicy();
49+
AzureRmRecoveryServicesRetentionPolicyBase GetDefaultRetentionPolicyObject();
5350

5451
List<AzureRmRecoveryServicesContainerBase> ListProtectionContainers();
5552

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,24 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Reflection;
1617
using System.Runtime.CompilerServices;
1718
using System.Runtime.InteropServices;
1819

1920
// General Information about an assembly is controlled through the following
2021
// set of attributes. Change these attribute values to modify the information
2122
// associated with an assembly.
22-
[assembly: AssemblyTitle("ProviderModel")]
23-
[assembly: AssemblyDescription("")]
24-
[assembly: AssemblyConfiguration("")]
25-
[assembly: AssemblyCompany("")]
26-
[assembly: AssemblyProduct("ProviderModel")]
27-
[assembly: AssemblyCopyright("Copyright © 2016")]
28-
[assembly: AssemblyTrademark("")]
29-
[assembly: AssemblyCulture("")]
23+
[assembly: AssemblyTitle("Microsoft Azure Powershell")]
24+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
25+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
26+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
3027

3128
// Setting ComVisible to false makes the types in this assembly not visible
3229
// to COM components. If you need to access a type in this assembly from
3330
// COM, set the ComVisible attribute to true on that type.
3431
[assembly: ComVisible(false)]
35-
36-
// The following GUID is for the ID of the typelib if this project is exposed to COM
37-
[assembly: Guid("a6263682-6dc1-43e6-858b-9128281b5e69")]
32+
[assembly: CLSCompliant(false)]
3833

3934
// Version information for an assembly consists of the following four values:
4035
//

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,16 @@ public Management.RecoveryServices.Backup.Models.ProtectionPolicyResponse Create
6969
throw new NotImplementedException();
7070
}
7171

72-
public List<AzureRmRecoveryServicesJobBase> ModifyPolicy()
72+
public Management.RecoveryServices.Backup.Models.ProtectionPolicyResponse ModifyPolicy()
7373
{
7474
throw new NotImplementedException();
7575
}
7676

7777
public List<Models.AzureRmRecoveryServicesContainerBase> ListProtectionContainers()
7878
{
7979
throw new NotImplementedException();
80-
}
81-
82-
public Management.RecoveryServices.Backup.Models.ProtectionPolicyResponse GetPolicy()
83-
{
84-
throw new NotImplementedException();
85-
}
86-
87-
public void DeletePolicy()
88-
{
89-
throw new NotImplementedException();
90-
}
91-
80+
}
81+
9282
public AzureRmRecoveryServicesSchedulePolicyBase GetDefaultSchedulePolicyObject()
9383
{
9484
throw new NotImplementedException();

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

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public ProtectionPolicyResponse CreatePolicy()
238238
hydraRequest);
239239
}
240240

241-
public List<AzureRmRecoveryServicesJobBase> ModifyPolicy()
241+
public ProtectionPolicyResponse ModifyPolicy()
242242
{
243243
AzureRmRecoveryServicesRetentionPolicyBase retentionPolicy = (AzureRmRecoveryServicesRetentionPolicyBase)
244244
ProviderData.ProviderParameters[PolicyParams.RetentionPolicy];
@@ -293,24 +293,8 @@ public List<AzureRmRecoveryServicesJobBase> ModifyPolicy()
293293
}
294294
};
295295

296-
ProtectionPolicyResponse response = HydraAdapter.CreateOrUpdateProtectionPolicy(
297-
policy.Name,
298-
hydraRequest);
299-
300-
List<AzureRmRecoveryServicesJobBase> jobsList = new List<AzureRmRecoveryServicesJobBase>();
301-
302-
if (/*response.StatusCode == System.Net.HttpStatusCode.Accepted*/ true)
303-
{
304-
// poll for AsyncHeader and get the jobsList
305-
// TBD
306-
}
307-
else
308-
{
309-
// no datasources attached to policy
310-
// hence no jobs and no action.
311-
}
312-
313-
return jobsList;
296+
return HydraAdapter.CreateOrUpdateProtectionPolicy(policy.Name,
297+
hydraRequest);
314298
}
315299

316300
public List<AzureRmRecoveryServicesContainerBase> ListProtectionContainers()
@@ -406,18 +390,7 @@ public List<AzureRmRecoveryServicesItemBase> ListProtectedItems()
406390
}
407391

408392
return itemModels;
409-
}
410-
411-
public ProtectionPolicyResponse GetPolicy()
412-
{
413-
throw new NotImplementedException();
414-
}
415-
416-
public void DeletePolicy()
417-
{
418-
throw new NotImplementedException();
419-
}
420-
393+
}
421394

422395
public AzureRmRecoveryServicesSchedulePolicyBase GetDefaultSchedulePolicyObject()
423396
{

0 commit comments

Comments
 (0)