Skip to content

Commit 22fcb9f

Browse files
committed
Resolving MergeConflict
2 parents 502d827 + 5094f2c commit 22fcb9f

33 files changed

+1129
-128
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<appSettings>
4-
<add key="ResourceName" value="swatirn1" />
5-
<add key="ResourceGroupName" value="swatirg1" />
4+
<add key="ResourceName" value="backuprn" />
5+
<add key="ResourceGroupName" value="backuprg" />
66
<add key="ResourceId" value="7368183945769329045" />
77
<add key="ClientSettingsProvider.ServiceUri" value="" />
88
</appSettings>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@
153153
</None>
154154
<None Include="ScenarioTests\AzureBackupTests.ps1">
155155
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156-
</None>
156+
</None>
157+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\BackUpAzureBackUpItem.json" />
158+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\GetRecoveryPointTests.json" />
157159
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListProtectionPolicyTests.json">
158160
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159161
</None>

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@ public void ListProtectionPolicyTests()
2424
{
2525
this.RunPowerShellTest("Test-GetAzureBackupProtectionPolicyTests");
2626
}
27+
28+
[Fact]
29+
public void GetRecoveryPointTests()
30+
{
31+
this.RunPowerShellTest("GetAzureRecoveryPointTest");
32+
}
33+
34+
[Fact]
35+
public void BackUpAzureBackUpItem()
36+
{
37+
this.RunPowerShellTest("BackUpAzureBackUpItemTest");
38+
}
2739
}
2840
}

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
$ResourceGroupName = "swatirg1";
16-
$ResourceName = "swatirn1"
15+
$ResourceGroupName = "backuprg";
16+
$ResourceName = "backuprn"
17+
$ContainerName = "iaasvmcontainer;dev01testing;dev01testing"
18+
$ContainerType = "IaasVMContainer"
19+
$DataSourceType = "VM"
20+
$DataSourceId = "17593283453810"
21+
$Location = "SouthEast Asia"
1722

1823
<#
1924
.SYNOPSIS
@@ -36,4 +41,36 @@ function Test-GetAzureBackupProtectionPolicyTests
3641
}
3742
}
3843

44+
function GetAzureRecoveryPointTest
45+
{
46+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
47+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
48+
$azureBackUpItem.ResourceName = $ResourceGroupName
49+
$azureBackUpItem.Location = $Location
50+
$azureBackUpItem.ContainerUniqueName = $ContainerName
51+
$azureBackUpItem.ContainerType = $ContainerType
52+
$azureBackUpItem.DataSourceId = $DataSourceId
53+
$azureBackUpItem.Type = $DataSourceType
54+
$recoveryPoints = Get-AzureBackupRecoveryPoint -item $azureBackUpItem
55+
Assert-NotNull $recoveryPoints 'Recovery Points should not be null'
56+
foreach($recoveryPoint in $recoveryPoints)
57+
{
58+
Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null'
59+
Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null'
60+
}
61+
}
62+
63+
function BackUpAzureBackUpItemTest
64+
{
65+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
66+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
67+
$azureBackUpItem.ResourceName = $ResourceName
68+
$azureBackUpItem.Location = $Location
69+
$azureBackUpItem.ContainerUniqueName = $ContainerName
70+
$azureBackUpItem.ContainerType = $ContainerType
71+
$azureBackUpItem.DataSourceId = $DataSourceId
72+
$azureBackUpItem.Type = $DataSourceType
73+
$operationId = Backup-AzureBackupItem -item $azureBackUpItem
74+
}
75+
3976

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/backup?api-version=2014-09-01",
5+
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvYmFja3VwP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
6+
"RequestMethod": "POST",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"Accept-Language": [
10+
"en-us"
11+
],
12+
"User-Agent": [
13+
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
14+
]
15+
},
16+
"ResponseBody": "\"062c55cd-a201-4464-a628-4ee1cc20397a\"",
17+
"ResponseHeaders": {
18+
"Content-Length": [
19+
"38"
20+
],
21+
"Content-Type": [
22+
"application/json"
23+
],
24+
"Expires": [
25+
"-1"
26+
],
27+
"Pragma": [
28+
"no-cache"
29+
],
30+
"x-ms-request-id": [
31+
"7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
32+
],
33+
"x-ms-client-request-id": [
34+
"76b831b2-0644-4703-becd-5831a9deae65",
35+
"76b831b2-0644-4703-becd-5831a9deae65"
36+
],
37+
"Strict-Transport-Security": [
38+
"max-age=31536000; includeSubDomains"
39+
],
40+
"x-ms-ratelimit-remaining-subscription-writes": [
41+
"1197"
42+
],
43+
"x-ms-correlation-request-id": [
44+
"7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
45+
],
46+
"x-ms-routing-request-id": [
47+
"CENTRALUS:20150612T143521Z:7bd6b748-c6b1-4bf1-8583-841a4292e5aa"
48+
],
49+
"Cache-Control": [
50+
"no-cache"
51+
],
52+
"Date": [
53+
"Fri, 12 Jun 2015 14:35:21 GMT"
54+
],
55+
"Server": [
56+
"Microsoft-IIS/8.0"
57+
],
58+
"X-Powered-By": [
59+
"ASP.NET"
60+
]
61+
},
62+
"StatusCode": 202
63+
}
64+
],
65+
"Names": {},
66+
"Variables": {
67+
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/recoverypoints?api-version=2014-09-01",
5+
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvcmVjb3Zlcnlwb2ludHM/YXBpLXZlcnNpb249MjAxNC0wOS0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"Accept-Language": [
10+
"en-us"
11+
],
12+
"User-Agent": [
13+
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
14+
]
15+
},
16+
"ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T10:52:30.0345282Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"19591702463836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:05:46.9189974Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20483888156836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T05:49:51.2034409Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20920255378610\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:24:33.0768703Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"26453384139263\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T14:41:46.0950893Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"32528401668178\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 5,\r\n \"Skiptoken\": null\r\n}",
17+
"ResponseHeaders": {
18+
"Content-Length": [
19+
"1006"
20+
],
21+
"Content-Type": [
22+
"application/json"
23+
],
24+
"Expires": [
25+
"-1"
26+
],
27+
"Pragma": [
28+
"no-cache"
29+
],
30+
"x-ms-request-id": [
31+
"3e21bbb3-afb6-4d88-a2f7-4af14d817853"
32+
],
33+
"x-ms-client-request-id": [
34+
"0762a614-5fd9-468c-97f1-f0742060deef",
35+
"0762a614-5fd9-468c-97f1-f0742060deef"
36+
],
37+
"Strict-Transport-Security": [
38+
"max-age=31536000; includeSubDomains"
39+
],
40+
"x-ms-ratelimit-remaining-subscription-reads": [
41+
"14996"
42+
],
43+
"x-ms-correlation-request-id": [
44+
"3e21bbb3-afb6-4d88-a2f7-4af14d817853"
45+
],
46+
"x-ms-routing-request-id": [
47+
"CENTRALUS:20150612T133209Z:3e21bbb3-afb6-4d88-a2f7-4af14d817853"
48+
],
49+
"Cache-Control": [
50+
"no-cache"
51+
],
52+
"Date": [
53+
"Fri, 12 Jun 2015 13:32:08 GMT"
54+
],
55+
"Server": [
56+
"Microsoft-IIS/8.0"
57+
],
58+
"X-Powered-By": [
59+
"ASP.NET"
60+
]
61+
},
62+
"StatusCode": 200
63+
}
64+
],
65+
"Names": {},
66+
"Variables": {
67+
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
68+
}
69+
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,19 @@ internal static class AzureBackupCmdletHelpMessage
2626
public const string ContainerId = "The container ID.";
2727
public const string ContainerRegistrationStatus = "The container registration status.";
2828
public const string ContainerType = "The container type.";
29+
public const string VirtualMachine = "Virtual Machine.";
2930
public const string ContainerResourceGroupName = "The container resource group name.";
3031
public const string ProtectionStatus = "Protection Status of the azure backup item.";
3132
public const string AzureBackUpItem = "Azure BackUp Item.";
3233
public const string RecoveryPointId = "Recovery Point Id.";
34+
public const string StorageType = "The vault back-end storage type.";
35+
public const string Type = "Type of Azure Backup Item.";
36+
public const string Status = "Status of Azure Backup Item";
37+
public const string AzureBackupContainer = "Azure Backup Container for Azure Backup Item.";
38+
public const string AzureBackupItem = "Azure Backup Item for enabling protection";
39+
public const string RemoveProtectionOption = "Remove Protection Option";
40+
public const string Reason = "Reson for removing protection";
41+
public const string Comments = "Comments for for removing protection";
3342
public const string WorkloadType = "Workload type for which the policy is defined.";
3443
public const string BackupType = "Type of backup.";
3544
public const string ScheduleType = "Type of schedule.";

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2828
{
2929
public abstract class AzureBackupContainerCmdletBase : AzureBackupCmdletBase
3030
{
31-
// ToDO:
32-
// Correct Help message and other attributes related to paameters
33-
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.ResourceGroupName, ValueFromPipelineByPropertyName = true)]
31+
[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackupContainer, ValueFromPipeline = true)]
3432
[ValidateNotNullOrEmpty]
35-
public AzureBackupContainer AzureBackupContainer { get; set; }
33+
public AzureBackupContainer container { get; set; }
3634

3735
public override void ExecuteCmdlet()
3836
{
3937
base.ExecuteCmdlet();
4038

41-
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}, Location: {2}", AzureBackupContainer.ResourceGroupName, AzureBackupContainer.ResourceName, AzureBackupContainer.Location));
39+
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}, Location: {2}", container.ResourceGroupName, container.ResourceName, container.Location));
4240

43-
InitializeAzureBackupCmdlet(AzureBackupContainer.ResourceGroupName, AzureBackupContainer.ResourceName, AzureBackupContainer.Location);
41+
InitializeAzureBackupCmdlet(container.ResourceGroupName, container.ResourceName, container.Location);
4442
}
4543
}
4644
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public abstract class AzureBackupDSCmdletBase : AzureBackupCmdletBase
3030
{
3131
// ToDO:
3232
// Correct Help message and other attributes related to paameters
33-
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackUpItem, ValueFromPipelineByPropertyName = true)]
33+
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackUpItem, ValueFromPipeline = true)]
3434
[ValidateNotNullOrEmpty]
3535
public AzureBackupItem item { get; set; }
3636

Lines changed: 45 additions & 0 deletions
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.Management.Automation;
17+
using System.Collections.Generic;
18+
using System.Xml;
19+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
20+
using Microsoft.Azure.Common.Authentication;
21+
using Microsoft.Azure.Common.Authentication.Models;
22+
using System.Threading;
23+
using Hyak.Common;
24+
using Microsoft.Azure.Commands.AzureBackup.Properties;
25+
using System.Net;
26+
27+
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
28+
{
29+
public abstract class AzureBackupItemCmdletBase : AzureBackupCmdletBase
30+
{
31+
// ToDO:
32+
// Correct Help message and other attributes related to paameters
33+
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackupItem, ValueFromPipeline = true)]
34+
[ValidateNotNullOrEmpty]
35+
public AzureBackupContainerContextObject item { get; set; }
36+
37+
public override void ExecuteCmdlet()
38+
{
39+
base.ExecuteCmdlet();
40+
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}, Location: {2}", item.ResourceGroupName, item.ResourceName, item.Location));
41+
InitializeAzureBackupCmdlet(item.ResourceGroupName, item.ResourceName, item.Location);
42+
}
43+
}
44+
}
45+

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ public override void ExecuteCmdlet()
4949
item.DataSourceId,
5050
CmdletCancellationToken).Result;
5151

52-
WriteVerbose("Received policy response");
53-
WriteVerbose("Received policy response2");
54-
52+
WriteVerbose("Received backup response");
53+
5554
WriteVerbose("Converting response");
5655
WriteAzureBackupOperationId(triggerBackUpInfo);
5756
});

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public class GetAzureBackupContainer : AzureBackupVaultCmdletBase
4040

4141
[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerRegistrationStatus)]
4242
[ValidateNotNullOrEmpty]
43-
public AzureBackupContainerStatus Status { get; set; }
43+
public AzureBackupContainerStatusInput Status { get; set; }
4444

4545
[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerType)]
4646
[ValidateNotNullOrEmpty]
47-
public AzureBackupContainerType Type { get; set; }
47+
public AzureBackupContainerTypeInput Type { get; set; }
4848

4949
public override void ExecuteCmdlet()
5050
{
@@ -98,7 +98,7 @@ private string ConstructQueryFilterString()
9898

9999
switch (Type)
100100
{
101-
case AzureBackupContainerType.AzureVirtualMachine:
101+
case AzureBackupContainerTypeInput.AzureVirtualMachine:
102102
containerQueryObject.Type = BCI.ContainerType.IaasVMContainer.ToString();
103103
break;
104104
default:
@@ -107,15 +107,12 @@ private string ConstructQueryFilterString()
107107

108108
switch (Status)
109109
{
110-
case AzureBackupContainerStatus.Registered:
110+
case AzureBackupContainerStatusInput.Registered:
111111
containerQueryObject.Status = BCI.RegistrationStatus.Registered.ToString();
112112
break;
113-
case AzureBackupContainerStatus.Registering:
113+
case AzureBackupContainerStatusInput.Registering:
114114
containerQueryObject.Status = BCI.RegistrationStatus.Registering.ToString();
115115
break;
116-
case AzureBackupContainerStatus.NotRegistered:
117-
containerQueryObject.Status = BCI.RegistrationStatus.NotRegistered.ToString();
118-
break;
119116
default:
120117
break;
121118
}

0 commit comments

Comments
 (0)