Skip to content

Commit 7db66dd

Browse files
author
dragonfly91
committed
Merge branch 'dev1' into anudeeb-dev1
2 parents 6fe8e55 + 8fe40b3 commit 7db66dd

File tree

14 files changed

+341
-28
lines changed

14 files changed

+341
-28
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
2626
/// <summary>
2727
/// Create new protection policy
2828
/// </summary>
29-
[Cmdlet(VerbsCommon.New, "AzureRmRecoveryServicesProtectionPolicy")]
29+
[Cmdlet(VerbsCommon.New, "AzureRmRecoveryServicesProtectionPolicy"), OutputType(typeof(AzureRmRecoveryServicesPolicyBase))]
3030
public class NewAzureRmRecoveryServicesProtectionPolicy : RecoveryServicesBackupCmdletBase
3131
{
3232
[Parameter(Mandatory = true, HelpMessage = "")]
3333
[ValidateNotNullOrEmpty]
3434
public string Name { get; set; }
3535

36-
[Parameter(Mandatory = true, HelpMessage = "", ValueFromPipeline = true)]
36+
[Parameter(Mandatory = true, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
3737
[ValidateNotNullOrEmpty]
3838
public WorkloadType WorkloadType { get; set; }
3939

40-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
40+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4141
[ValidateNotNullOrEmpty]
4242
public BackupManagementType BackupManagementType { get; set; }
43-
44-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
43+
44+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4545
[ValidateNotNullOrEmpty]
4646
public AzureRmRecoveryServicesRetentionPolicyBase RetentionPolicy { get; set; }
4747

48-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
48+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4949
[ValidateNotNullOrEmpty]
50-
public AzureRmRecoveryServicesSchedulePolicyBase SchedulePolicy { get; set; }
50+
public AzureRmRecoveryServicesSchedulePolicyBase SchedulePolicy { get; set; }
5151

5252
public override void ExecuteCmdlet()
5353
{

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
2626
/// <summary>
2727
/// Update existing protection policy
2828
/// </summary>
29-
[Cmdlet(VerbsCommon.Set, "AzureRmRecoveryServicesProtectionPolicy")]
29+
[Cmdlet(VerbsCommon.Set, "AzureRmRecoveryServicesProtectionPolicy")]
3030
public class SetAzureRmRecoveryServicesProtectionPolicy : RecoveryServicesBackupCmdletBase
3131
{
3232
[Parameter(Mandatory = true, HelpMessage = "")]
3333
[ValidateNotNullOrEmpty]
3434
public string Name { get; set; }
3535

36-
[Parameter(Mandatory = true, HelpMessage = "", ValueFromPipeline = true)]
36+
[Parameter(Mandatory = true, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
3737
[ValidateNotNullOrEmpty]
3838
public WorkloadType WorkloadType { get; set; }
3939

40-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
40+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4141
[ValidateNotNullOrEmpty]
4242
public BackupManagementType BackupManagementType { get; set; }
43-
44-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
43+
44+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4545
[ValidateNotNullOrEmpty]
4646
public AzureRmRecoveryServicesRetentionPolicyBase RetentionPolicy { get; set; }
4747

48-
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipeline = true)]
48+
[Parameter(Mandatory = false, HelpMessage = "", ValueFromPipelineByPropertyName = true)]
4949
[ValidateNotNullOrEmpty]
50-
public AzureRmRecoveryServicesSchedulePolicyBase SchedulePolicy { get; set; }
50+
public AzureRmRecoveryServicesSchedulePolicyBase SchedulePolicy { get; set; }
5151

5252
public override void ExecuteCmdlet()
5353
{

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
<Reference Include="System.Xml" />
4343
</ItemGroup>
4444
<ItemGroup>
45-
<Compile Include="ConversionHelpers.cs" />
45+
<Compile Include="Validations\PolicyValidations.cs" />
46+
<Compile Include="Conversions\SchedulePolicyConversions.cs" />
47+
<Compile Include="Conversions\RetentionPolicyConversions.cs" />
48+
<Compile Include="Conversions\ConversionHelpers.cs" />
4649
<Compile Include="HydraHelpers.cs" />
4750
<Compile Include="Properties\AssemblyInfo.cs" />
4851
</ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
using System.Collections.Generic;
20+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
21+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
22+
23+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
24+
{
25+
public partial class PolicyHelpers
26+
{
27+
#region HydraToPSObject conversions
28+
public static AzureRmRecoveryServicesLongTermRetentionPolicy GetPSLongTermRetentionPolicy(
29+
LongTermRetentionPolicy hydraRetPolicy)
30+
{
31+
throw new NotImplementedException();
32+
}
33+
34+
#endregion
35+
36+
#region PStoHydraObject conversions
37+
public static LongTermRetentionPolicy GetHydraLongTermRetentionPolicy(
38+
AzureRmRecoveryServicesLongTermRetentionPolicy psRetPolicy)
39+
{
40+
throw new NotImplementedException();
41+
}
42+
43+
#endregion
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
using System.Collections.Generic;
20+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
21+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
22+
23+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
24+
{
25+
public partial class PolicyHelpers
26+
{
27+
#region HydraToPSObject conversions
28+
29+
public static AzureRmRecoveryServicesSimpleSchedulePolicy GetPSSimpleSchedulePolicyPolicy(
30+
SimpleSchedulePolicy hydraRetPolicy)
31+
{
32+
throw new NotImplementedException();
33+
}
34+
35+
#endregion
36+
37+
#region PStoHydraObject conversions
38+
39+
public static SimpleSchedulePolicy GetHydraSimpleSchedulePolicy(
40+
AzureRmRecoveryServicesSimpleSchedulePolicy psRetPolicy)
41+
{
42+
throw new NotImplementedException();
43+
}
44+
45+
#endregion
46+
}
47+
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HydraHelpers.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,21 @@ public static string GetHydraProviderType(ContainerType containerType)
3939

4040
return providerType;
4141
}
42+
43+
public static string GetHydraProviderType(WorkloadType workloadType)
44+
{
45+
string providerType = string.Empty;
46+
47+
switch (workloadType)
48+
{
49+
case WorkloadType.AzureVM:
50+
providerType = ProviderType.AzureIaasVM.ToString();
51+
break;
52+
default:
53+
break;
54+
}
55+
56+
return providerType;
57+
}
4258
}
4359
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
using System.Collections.Generic;
20+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
21+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
22+
23+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
24+
{
25+
public partial class PolicyHelpers
26+
{
27+
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
28+
AzureRmRecoveryServicesLongTermRetentionPolicy ltrPolicy,
29+
AzureRmRecoveryServicesSimpleSchedulePolicy schPolicy)
30+
{
31+
throw new NotImplementedException();
32+
}
33+
}
34+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class AzureRmRecoveryServicesIaasVmContainer : AzureRmRecoveryServicesCon
3434
public string Status { get; set; }
3535

3636
public AzureRmRecoveryServicesIaasVmContainer(ProtectionContainerResource protectionContainer)
37-
: base(protectionContainer)
37+
: base(protectionContainer.Properties as ProtectionContainer)
3838
{
3939
AzureIaaSVMProtectionContainer iaasVmProtectionContainer = (AzureIaaSVMProtectionContainer)protectionContainer.Properties;
4040
ContainerType = ContainerType.AzureVM;

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,68 @@
1717
using System.Linq;
1818
using System.Text;
1919
using System.Threading.Tasks;
20+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
2021

2122
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2223
{
24+
/// <summary>
25+
/// Represents IaaSVM Item Class
26+
/// </summary>
2327
public class AzureRmRecoveryServicesIaasVmItem : AzureRmRecoveryServicesItemBase
28+
{
29+
public string VirtualMachineId { get; set; }
30+
31+
/// <summary>
32+
/// Protection Status of the item
33+
/// </summary>
34+
public string ProtectionStatus { get; set; }
35+
36+
/// <summary>
37+
/// Protection State of the item
38+
/// </summary>
39+
public string ProtectionState { get; set; }
40+
41+
/// <summary>
42+
/// Last Backup Status for the item
43+
/// </summary>
44+
public string LastBackupStatus { get; set; }
45+
46+
/// <summary>
47+
/// Protection Policy Name for the Item
48+
/// </summary>
49+
public string ProtectionPolicyName { get; set; }
50+
51+
/// <summary>
52+
/// ExtendedInfo for the Item
53+
/// </summary
54+
public AzureRmRecoveryServicesIaasVmItemExtendedInfo ExtendedInfo { get; set; }
55+
56+
public AzureRmRecoveryServicesIaasVmItem(AzureIaaSVMProtectedItem protectedItem,
57+
AzureRmRecoveryServicesContainerBase container)
58+
: base(protectedItem, container)
59+
{
60+
61+
}
62+
}
63+
64+
/// <summary>
65+
/// Represents IaaSVM Item ExtendedInfo Class
66+
/// </summary>
67+
public class AzureRmRecoveryServicesIaasVmItemExtendedInfo : AzureRmRecoveryServicesItemExtendedInfoBase
2468
{
69+
/// <summary>
70+
/// Oldest Recovery Point for the Item
71+
/// </summary
72+
public DateTime? OldestRecoveryPoint { get; set; }
73+
74+
/// <summary>
75+
/// Recovery Points Count for the Item
76+
/// </summary
77+
public int RecoveryPointCount { get; set; }
78+
79+
/// <summary>
80+
/// PolicyState for the Item
81+
/// </summary
82+
public string PolicyState { get; set; }
2583
}
2684
}

0 commit comments

Comments
 (0)