Skip to content

Commit 65c7d4e

Browse files
author
Samuel Anudeep
committed
Merge pull request #172 from MabOneSdk/anudeeb-dev1
Provider Model and Base Models
2 parents 642b5e4 + 17e2838 commit 65c7d4e

13 files changed

+330
-6
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
16+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel;
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Linq;
20+
using System.Text;
21+
using System.Threading.Tasks;
22+
23+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
24+
{
25+
class GetAzureRmRecoveryServicesContainer : RecoveryServicesBackupCmdletBase
26+
{
27+
PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary<string, object>()
28+
{
29+
{GetContainerParams.Name.ToString(), "Param1Value"},
30+
{GetContainerParams.Status.ToString(), "Param2Value"}
31+
});
32+
33+
public override void ExecuteCmdlet()
34+
{
35+
base.ExecuteCmdlet();
36+
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(ContainerType.AzureVM);
37+
}
38+
}
39+
}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Reference Include="System.Xml" />
4949
</ItemGroup>
5050
<ItemGroup>
51+
<Compile Include="Cmdlets\Container\GetAzureRmRecoveryServicesContainer.cs" />
5152
<Compile Include="Properties\AssemblyInfo.cs" />
5253
<Compile Include="Properties\Resources.Designer.cs">
5354
<AutoGen>True</AutoGen>
@@ -58,7 +59,6 @@
5859
</ItemGroup>
5960
<ItemGroup>
6061
<Folder Include="Cmdlets\Backup\" />
61-
<Folder Include="Cmdlets\Container\" />
6262
<Folder Include="Cmdlets\Item\" />
6363
<Folder Include="Cmdlets\Jobs\" />
6464
<Folder Include="Cmdlets\ProtectionPolicy\" />
@@ -74,6 +74,18 @@
7474
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
7575
<Name>Commands.ResourceManager.Common</Name>
7676
</ProjectReference>
77+
<ProjectReference Include="Commands.RecoveryServices.Backup.Helpers\Commands.RecoveryServices.Backup.Helpers.csproj">
78+
<Project>{0e1d3f36-e6c8-4764-8c7d-6f9ee537490c}</Project>
79+
<Name>Commands.RecoveryServices.Backup.Helpers</Name>
80+
</ProjectReference>
81+
<ProjectReference Include="Commands.RecoveryServices.Backup.Models\Commands.RecoveryServices.Backup.Models.csproj">
82+
<Project>{30b92759-50b3-494e-b9f0-ec9a2ce9d57b}</Project>
83+
<Name>Commands.RecoveryServices.Backup.Models</Name>
84+
</ProjectReference>
85+
<ProjectReference Include="Commands.RecoveryServices.Backup.Providers\Commands.RecoveryServices.Backup.Providers.csproj">
86+
<Project>{02234e90-bcde-4b20-b1f5-01b1005821db}</Project>
87+
<Name>Commands.RecoveryServices.Backup.Providers</Name>
88+
</ProjectReference>
7789
</ItemGroup>
7890
<ItemGroup>
7991
<EmbeddedResource Include="Properties\Resources.resx">

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,28 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23-
public class BaseObjects
23+
public class AzureRmRecoveryServicesContainerBase
24+
{
25+
public string Name { get; set; }
26+
27+
public string ResourceGroupName { get; set; }
28+
29+
public string Status { get; set; }
30+
31+
public ContainerType ContainerType { get; set; }
32+
33+
public int BackupItemsCount { get; set; }
34+
}
35+
36+
public class AzureRmRecoveryServicesItemBase
37+
{
38+
}
39+
40+
public class AzureRmRecoveryServicesPolicyBase
41+
{
42+
}
43+
44+
public class AzureRmRecoveryServicesRecoveryPointBase
2445
{
2546
}
2647
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
22+
{
23+
public enum GetContainerParams
24+
{
25+
Vault,
26+
ContainerType,
27+
BackupManagementType,
28+
BackupManagementServer,
29+
Name,
30+
ResourceGroupName,
31+
Status,
32+
}
33+
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@
4040
</ItemGroup>
4141
<ItemGroup>
4242
<Compile Include="BaseObjects.cs" />
43-
<Compile Include="Enums.cs" />
44-
<Compile Include="IaasVmModels\Container.cs" />
43+
<Compile Include="CmdletParamEnums.cs" />
44+
<Compile Include="CommonEnums.cs" />
45+
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmPolicy.cs" />
46+
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmItem.cs" />
47+
<Compile Include="IaasVmModels\AzureRmRecoveryServicesIaasVmContainer.cs" />
4548
<Compile Include="Properties\AssemblyInfo.cs" />
4649
</ItemGroup>
4750
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
22+
{
23+
public enum ContainerType
24+
{
25+
AzureVM,
26+
}
27+
28+
public enum BackupManagementType
29+
{
30+
}
31+
32+
public enum WorkloadType
33+
{
34+
}
35+
36+
public enum PsBackupProviderTypes
37+
{
38+
IaasVm = 1,
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
22+
{
23+
public class AzureRmRecoveryServicesIaasVmContainer : AzureRmRecoveryServicesContainerBase
24+
{
25+
}
26+
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Enums.cs renamed to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/IaasVmModels/AzureRmRecoveryServicesIaasVmItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23-
public class Enums
23+
public class AzureRmRecoveryServicesIaasVmItem : AzureRmRecoveryServicesItemBase
2424
{
2525
}
2626
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/IaasVmModels/Container.cs renamed to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/IaasVmModels/AzureRmRecoveryServicesIaasVmPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2222
{
23-
public class Container
23+
public class AzureRmRecoveryServicesIaasVmPolicy : AzureRmRecoveryServicesPolicyBase
2424
{
2525
}
2626
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
3232
<ItemGroup>
33+
<Reference Include="Microsoft.Azure.Management.RecoveryServicesBackupManagement, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
34+
<SpecificVersion>False</SpecificVersion>
35+
<HintPath>..\Commands.RecoveryServices.Backup.HydraAdapter\Resources\Microsoft.Azure.Management.RecoveryServicesBackupManagement.dll</HintPath>
36+
</Reference>
3337
<Reference Include="System" />
3438
<Reference Include="System.Core" />
3539
<Reference Include="System.Xml.Linq" />
@@ -41,9 +45,15 @@
4145
<ItemGroup>
4246
<Compile Include="IPsBackupProvider.cs" />
4347
<Compile Include="Properties\AssemblyInfo.cs" />
48+
<Compile Include="PsBackupProviderManager.cs" />
49+
<Compile Include="PsBackupProviderDC.cs" />
4450
<Compile Include="Providers\IaasVmPsBackupProvider.cs" />
4551
</ItemGroup>
4652
<ItemGroup>
53+
<ProjectReference Include="..\Commands.RecoveryServices.Backup.Helpers\Commands.RecoveryServices.Backup.Helpers.csproj">
54+
<Project>{0e1d3f36-e6c8-4764-8c7d-6f9ee537490c}</Project>
55+
<Name>Commands.RecoveryServices.Backup.Helpers</Name>
56+
</ProjectReference>
4757
<ProjectReference Include="..\Commands.RecoveryServices.Backup.HydraAdapter\Commands.RecoveryServices.Backup.HydraAdapter.csproj">
4858
<Project>{b758fec1-35c1-4f93-a954-66dd33f6e0ec}</Project>
4959
<Name>Commands.RecoveryServices.Backup.HydraAdapter</Name>

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

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

15+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
1516
using System;
1617
using System.Collections.Generic;
1718
using System.Linq;
@@ -22,5 +23,22 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel
2223
{
2324
public interface IPsBackupProvider
2425
{
26+
void Initialize(ProviderData providerData);
27+
28+
BaseRecoveryServicesJobResponse EnableProtection();
29+
30+
BaseRecoveryServicesJobResponse DisableProtection();
31+
32+
BaseRecoveryServicesJobResponse TriggerBackup();
33+
34+
BaseRecoveryServicesJobResponse TriggerRestore();
35+
36+
ProtectedItemResponse GetProtectedItem();
37+
38+
RecoveryPointResponse GetRecoveryPoint();
39+
40+
ProtectionPolicyResponse CreatePolicy();
41+
42+
ProtectionPolicyResponse ModifyPolicy();
2543
}
2644
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel
22+
{
23+
public class ProviderData
24+
{
25+
Dictionary<string, object> providerParameters;
26+
27+
public Dictionary<string, object> ProviderParameters
28+
{
29+
get
30+
{
31+
return providerParameters;
32+
}
33+
}
34+
35+
public ProviderData(Dictionary<string, object> inProviderParameters)
36+
{
37+
providerParameters = inProviderParameters;
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)