Skip to content

Commit b22b9b4

Browse files
committed
Changes For Object
1 parent e6548f7 commit b22b9b4

File tree

6 files changed

+68
-16
lines changed

6 files changed

+68
-16
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/BackUp/TriggerBackUp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2424
{
2525
// ToDo:
2626
// Correct the Commandlet
27-
// Coorect the OperationResponse
27+
// Correct the OperationResponse
2828
// Get Tracking API from Piyush and Get JobResponse
2929
// Get JobResponse Object from Aditya
3030

3131
/// <summary>
3232
/// Get list of containers
3333
/// </summary>
34-
[Cmdlet(VerbsCommon.New, "AzureBackup"), OutputType(typeof(MBS.OperationResponse))]
34+
[Cmdlet(VerbsCommon.New, "AzureBackupItem"), OutputType(typeof(MBS.OperationResponse))]
3535
public class TriggerAzureBackup : AzureBackupDSCmdletBase
3636
{
3737
public override void ExecuteCmdlet()

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public override void ExecuteCmdlet()
4646
IEnumerable<ProtectionPolicyInfo> policyObjects = null;
4747
if (Name != null)
4848
{
49-
policyObjects = policyListResponse.Objects.Where(x => x.Name.Equals(Name, System.StringComparison.InvariantCultureIgnoreCase));
49+
policyObjects = policyListResponse.ProtectionPolicies.Objects.Where(x => x.Name.Equals(Name, System.StringComparison.InvariantCultureIgnoreCase));
5050
}
5151
else
5252
{
53-
policyObjects = policyListResponse.Objects;
53+
policyObjects = policyListResponse.ProtectionPolicies.Objects;
5454
}
5555

5656
WriteVerbose("Converting response");

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/RecoveryPoint/GetAzureBackupRecoveryPoint.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,30 @@ public override void ExecuteCmdlet()
5151
IEnumerable<RecoveryPointInfo> recoveryPointObjects = null;
5252
if (Id != null)
5353
{
54-
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects.Where(x => x.Name.Equals(Id, System.StringComparison.InvariantCultureIgnoreCase));
54+
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects.Where(x => x.InstanceId.Equals(Id, System.StringComparison.InvariantCultureIgnoreCase));
5555
}
5656
else
5757
{
5858
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects;
5959
}
6060

6161
WriteVerbose("Converting response");
62-
WriteAzureBackupProtectionPolicy(recoveryPointObjects);
62+
WriteAzureBackupProtectionPolicy(recoveryPointObjects, AzureBackupItem);
6363
});
6464
}
6565

66-
public void WriteAzureBackupProtectionPolicy(RecoveryPointInfo sourceRecoverPoint)
66+
public void WriteAzureBackupProtectionPolicy(RecoveryPointInfo sourceRecoverPoint, AzureBackupItem azureBackupItem)
6767
{
68-
// this needs to be uncommented once we have proper constructor
69-
//this.WriteObject(new AzureBackupRecoveryPoint(AzureBackupItem.ResourceGroupName, AzureBackupItem.ResourceName, sourceRecoverPoint));
68+
this.WriteObject(new AzureBackupRecoveryPoint(sourceRecoverPoint, azureBackupItem));
7069
}
7170

72-
public void WriteAzureBackupProtectionPolicy(IEnumerable<RecoveryPointInfo> sourceRecoverPointList)
71+
public void WriteAzureBackupProtectionPolicy(IEnumerable<RecoveryPointInfo> sourceRecoverPointList, AzureBackupItem azureBackupItem)
7372
{
7473
List<AzureBackupRecoveryPoint> targetList = new List<AzureBackupRecoveryPoint>();
7574

7675
foreach (var sourceRecoverPoint in sourceRecoverPointList)
7776
{
78-
// this needs to be uncommented once we have proper constructor
79-
//targetList.Add(new AzureBackupRecoveryPoint(AzureBackupItem.ResourceGroupName, AzureBackupItem.ResourceName, sourceRecoverPoint));
77+
targetList.Add(new AzureBackupRecoveryPoint(sourceRecoverPoint, azureBackupItem));
8078
}
8179

8280
this.WriteObject(targetList, true);

src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@
7777
<Reference Include="Microsoft.WindowsAzure.Management">
7878
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
7979
</Reference>
80-
<Reference Include="Microsoft.WindowsAzure.Management.BackupServicesManagment, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
81-
<SpecificVersion>False</SpecificVersion>
82-
<HintPath>..\..\..\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
80+
<Reference Include="Microsoft.WindowsAzure.Management.BackupServicesManagment">
81+
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net40-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
8382
</Reference>
8483
<Reference Include="Microsoft.WindowsAzure.Management.Scheduler">
8584
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll</HintPath>
@@ -111,12 +110,18 @@
111110
<Reference Include="System.Xml" />
112111
</ItemGroup>
113112
<ItemGroup>
113+
<Compile Include="AzureBackupDSCmdletBase.cs" />
114114
<Compile Include="AzureBackupVaultCmdletBase.cs" />
115115
<Compile Include="AzureBackupCmdletBase.cs" />
116116
<Compile Include="AzureBackupCmdletHelpMessage.cs" />
117+
<Compile Include="Cmdlets\BackUp\TriggerBackUp.cs" />
117118
<Compile Include="Cmdlets\Jobs\GetAzureBackupJob.cs" />
118119
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureBackupProtectionPolicy.cs" />
120+
<Compile Include="Cmdlets\RecoveryPoint\GetAzureBackupRecoveryPoint.cs" />
119121
<Compile Include="Models\AzureBackupBaseObjects.cs" />
122+
<Compile Include="Models\AzureBackupContainer.cs" />
123+
<Compile Include="Models\AzureBackupItem.cs" />
124+
<Compile Include="Models\AzureBackupRecoveryPoint.cs" />
120125
<Compile Include="Models\ProtectionPolicy.cs" />
121126
<Compile Include="Properties\Resources.Designer.cs">
122127
<AutoGen>True</AutoGen>

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ public class AzureBackupContainerContextObject : AzureBackupVaultContextObject
5353
/// Id of the Azure Backup Container
5454
/// </summary>
5555
public string ContainerId { get; set; }
56+
57+
public AzureBackupContainerContextObject()
58+
: base()
59+
{
60+
}
61+
62+
public AzureBackupContainerContextObject(AzureBackupContainerContextObject azureBackupContainerContextObject)
63+
: base(azureBackupContainerContextObject.ResourceGroupName, azureBackupContainerContextObject.ResourceName)
64+
{
65+
ContainerType = azureBackupContainerContextObject.ContainerType;
66+
ContainerName = azureBackupContainerContextObject.ContainerName;
67+
ContainerId = azureBackupContainerContextObject.ContainerId;
68+
}
5669
}
5770

5871
public class AzureBackupItemContextObject : AzureBackupContainerContextObject
@@ -66,5 +79,17 @@ public class AzureBackupItemContextObject : AzureBackupContainerContextObject
6679
/// DataSourceId of Azure Backup Item
6780
/// </summary>
6881
public string DataSourceType { get; set; }
82+
83+
public AzureBackupItemContextObject()
84+
: base()
85+
{
86+
}
87+
88+
public AzureBackupItemContextObject(AzureBackupItemContextObject azureBackupItemContextObject)
89+
: base(azureBackupItemContextObject)
90+
{
91+
DataSourceId = azureBackupItemContextObject.DataSourceId;
92+
DataSourceType = azureBackupItemContextObject.DataSourceType;
93+
}
6994
}
7095
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupRecoveryPoint.cs

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

15+
using Microsoft.Azure.Management.BackupServices.Models;
1516
using System;
1617
using System.Collections.Generic;
1718
using System.Linq;
@@ -26,6 +27,17 @@ public class AzureBackupRecoveryPointContextObject : AzureBackupItemContextObjec
2627
/// RecoveryPointId of Azure Backup Item
2728
/// </summary>
2829
public string RecoveryPointId { get; set; }
30+
31+
public AzureBackupRecoveryPointContextObject()
32+
: base()
33+
{
34+
}
35+
36+
public AzureBackupRecoveryPointContextObject(RecoveryPointInfo recoveryPointInfo, AzureBackupItem azureBackupItem)
37+
: base(azureBackupItem)
38+
{
39+
RecoveryPointId = recoveryPointInfo.InstanceId;
40+
}
2941
}
3042

3143
/// <summary>
@@ -41,6 +53,18 @@ public class AzureBackupRecoveryPoint : AzureBackupRecoveryPointContextObject
4153
/// <summary>
4254
/// DataSourceId of Azure Backup Item
4355
/// </summary>
44-
public string RecoveryPointType { get; set; }
56+
public string RecoveryPointType { get; set; }
57+
58+
public AzureBackupRecoveryPoint()
59+
: base()
60+
{
61+
}
62+
63+
public AzureBackupRecoveryPoint(RecoveryPointInfo recoveryPointInfo, AzureBackupItem azureBackupItem)
64+
: base(recoveryPointInfo, azureBackupItem)
65+
{
66+
RecoveryPointTime = recoveryPointInfo.RecoveryPointTime;
67+
RecoveryPointType = recoveryPointInfo.RecoveryPointType;
68+
}
4569
}
4670
}

0 commit comments

Comments
 (0)