Skip to content

Commit 779b509

Browse files
committed
SDK Update
1 parent e012566 commit 779b509

29 files changed

+415302
-212607
lines changed

src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
16+
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
17+
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
1618
</ItemGroup>
1719

1820
<ItemGroup>

src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
16+
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
17+
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
1618
</ItemGroup>
1719

1820
</Project>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public interface IPsBackupProvider
2929
{
3030
void Initialize(Dictionary<System.Enum, object> providerData, ServiceClientAdapter serviceClientAdapter);
3131

32-
RestAzureNS.AzureOperationResponse EnableProtection();
32+
RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection();
3333

34-
RestAzureNS.AzureOperationResponse DisableProtection();
34+
RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection();
3535

3636
RestAzureNS.AzureOperationResponse DisableProtectionWithDeleteData();
3737

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureFilesPsBackupProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void Initialize(
6363
/// Triggers the enable protection operation for the given item
6464
/// </summary>
6565
/// <returns>The job response returned from the service</returns>
66-
public RestAzureNS.AzureOperationResponse EnableProtection()
66+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
6767
{
6868
return EnableOrModifyProtection();
6969
}
@@ -72,7 +72,7 @@ public RestAzureNS.AzureOperationResponse EnableProtection()
7272
/// Triggers the disable protection operation for the given item
7373
/// </summary>
7474
/// <returns>The job response returned from the service</returns>
75-
public RestAzureNS.AzureOperationResponse DisableProtection()
75+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
7676
{
7777
string vaultName = (string)ProviderData[VaultParams.VaultName];
7878
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -682,7 +682,7 @@ public void RegisterContainer()
682682
throw new NotImplementedException();
683683
}
684684

685-
private RestAzureNS.AzureOperationResponse EnableOrModifyProtection(bool disableWithRetentionData = false)
685+
private RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableOrModifyProtection(bool disableWithRetentionData = false)
686686
{
687687
string vaultName = (string)ProviderData[VaultParams.VaultName];
688688
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void Initialize(
5858
ServiceClientAdapter = serviceClientAdapter;
5959
}
6060

61-
public RestAzureNS.AzureOperationResponse EnableProtection()
61+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
6262
{
6363
throw new NotImplementedException();
6464
}
@@ -67,7 +67,7 @@ public RestAzureNS.AzureOperationResponse EnableProtection()
6767
/// Triggers the disable protection operation for the given item
6868
/// </summary>
6969
/// <returns>The job response returned from the service</returns>
70-
public RestAzureNS.AzureOperationResponse DisableProtection()
70+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
7171
{
7272
string vaultName = (string)ProviderData[VaultParams.VaultName];
7373
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ProtectionPolicyResource CreatePolicy()
5959
return CreateorModifyPolicy().Body;
6060
}
6161

62-
public RestAzureNS.AzureOperationResponse DisableProtection()
62+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
6363
{
6464
string vaultName = (string)ProviderData[VaultParams.VaultName];
6565
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -102,7 +102,7 @@ public RestAzureNS.AzureOperationResponse DisableProtectionWithDeleteData()
102102
resourceGroupName: vaultResourceGroupName);
103103
}
104104

105-
public RestAzureNS.AzureOperationResponse EnableProtection()
105+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
106106
{
107107
return EnableOrModifyProtection();
108108
}
@@ -549,7 +549,7 @@ private RestAzureNS.AzureOperationResponse<ProtectionPolicyResource> CreateorMod
549549
resourceGroupName: resourceGroupName);
550550
}
551551

552-
private RestAzureNS.AzureOperationResponse EnableOrModifyProtection(bool disableWithRetentionData = false)
552+
private RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableOrModifyProtection(bool disableWithRetentionData = false)
553553
{
554554
string vaultName = (string)ProviderData[VaultParams.VaultName];
555555
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -629,9 +629,12 @@ public void RegisterContainer()
629629
string containerName = (string)ProviderData[ContainerParams.Name];
630630
string backupManagementType = (string)ProviderData[ContainerParams.BackupManagementType];
631631
string workloadType = (string)ProviderData[ContainerParams.ContainerType];
632+
ContainerBase containerBase =
633+
(ContainerBase)ProviderData[ContainerParams.Container];
634+
AzureVmWorkloadContainer container = (AzureVmWorkloadContainer)ProviderData[ContainerParams.Container];
632635

633636
ProtectionContainerResource protectionContainerResource = null;
634-
637+
635638
//Trigger Discovery
636639
ODataQuery<BMSRefreshContainersQueryObject> queryParam = new ODataQuery<BMSRefreshContainersQueryObject>(
637640
q => q.BackupManagementType
@@ -644,18 +647,19 @@ public void RegisterContainer()
644647
vmContainer => string.Compare(vmContainer.Name.Split(';').Last(),
645648
containerName, true) == 0);
646649

647-
if (unregisteredVmContainer != null)
650+
if (unregisteredVmContainer != null || container != null)
648651
{
649652
protectionContainerResource =
650-
new ProtectionContainerResource(unregisteredVmContainer.Id,
651-
unregisteredVmContainer.Name);
653+
new ProtectionContainerResource(container != null ? container.Id : unregisteredVmContainer.Id,
654+
container != null ? container.Name : unregisteredVmContainer.Name);
652655
AzureVMAppContainerProtectionContainer azureVMContainer = new AzureVMAppContainerProtectionContainer(
653656
friendlyName: containerName,
654657
backupManagementType: backupManagementType,
655-
sourceResourceId: unregisteredVmContainer.Properties.ContainerId,
656-
workloadType: workloadType.ToString());
658+
sourceResourceId: container != null ? container.SourceResourceId : unregisteredVmContainer.Properties.ContainerId,
659+
workloadType: workloadType.ToString(),
660+
operationType: container != null ? OperationType.Reregister : OperationType.Register);
657661
protectionContainerResource.Properties = azureVMContainer;
658-
AzureWorkloadProviderHelper.RegisterContainer(unregisteredVmContainer.Name,
662+
AzureWorkloadProviderHelper.RegisterContainer(container != null ? container.Name : unregisteredVmContainer.Name,
659663
protectionContainerResource,
660664
vaultName,
661665
vaultResourceGroupName);

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public void Initialize(
4545
ServiceClientAdapter = serviceClientAdapter;
4646
}
4747

48-
public RestAzureNS.AzureOperationResponse EnableProtection()
48+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
4949
{
5050
throw new NotImplementedException();
5151
}
5252

53-
public RestAzureNS.AzureOperationResponse DisableProtection()
53+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
5454
{
5555
throw new NotImplementedException();
5656
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Initialize(
6666
/// Triggers the enable protection operation for the given item
6767
/// </summary>
6868
/// <returns>The job response returned from the service</returns>
69-
public RestAzureNS.AzureOperationResponse EnableProtection()
69+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
7070
{
7171
string vaultName = (string)ProviderData[VaultParams.VaultName];
7272
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -167,7 +167,7 @@ public RestAzureNS.AzureOperationResponse EnableProtection()
167167
/// Triggers the disable protection operation for the given item
168168
/// </summary>
169169
/// <returns>The job response returned from the service</returns>
170-
public RestAzureNS.AzureOperationResponse DisableProtection()
170+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
171171
{
172172
string vaultName = (string)ProviderData[VaultParams.VaultName];
173173
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public void Initialize(
4646
ServiceClientAdapter = serviceClientAdapter;
4747
}
4848

49-
public RestAzureNS.AzureOperationResponse EnableProtection()
49+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
5050
{
5151
throw new NotImplementedException();
5252
}
5353

54-
public RestAzureNS.AzureOperationResponse DisableProtection()
54+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
5555
{
5656
throw new NotImplementedException();
5757
}

src/RecoveryServices/RecoveryServices.Backup.Providers/RecoveryServices.Backup.Providers.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
16+
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
17+
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
1618
</ItemGroup>
1719

1820
<ItemGroup>

src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ItemAPIs.cs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public partial class ServiceClientAdapter
3131
/// <param name="protectedItemName">Name of the item</param>
3232
/// <param name="request">Protected item create or update request</param>
3333
/// <returns>Job created in the service for this operation</returns>
34-
public RestAzureNS.AzureOperationResponse CreateOrUpdateProtectedItem(
34+
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> CreateOrUpdateProtectedItem(
3535
string containerName,
3636
string protectedItemName,
3737
ProtectedItemResource request,
@@ -180,7 +180,6 @@ public RestAzureNS.AzureOperationResponse<BackupStatusResponse> CheckBackupStatu
180180
/// <summary>
181181
/// Creates a new protection intent or updates an already existing protection intent
182182
/// </summary>
183-
/// <param name="containerName">Name of the container which this item belongs to</param>
184183
/// <param name="protectedItemName">Name of the item</param>
185184
/// <param name="request">Protected item create or update request</param>
186185
/// <returns>Job created in the service for this operation</returns>
@@ -198,5 +197,52 @@ public RestAzureNS.AzureOperationResponse<ProtectionIntentResource> CreateOrUpda
198197
request,
199198
cancellationToken: BmsAdapter.CmdletCancellationToken).Result;
200199
}
200+
201+
/// <summary>
202+
/// Deletes a protection intent
203+
/// </summary>
204+
/// <param name="protectedItemName">Name of the item</param>
205+
/// <param name="request">Protected item create or update request</param>
206+
/// <returns>Job created in the service for this operation</returns>
207+
public RestAzureNS.AzureOperationResponse DeleteProtectionIntent(
208+
string protectedItemName,
209+
string vaultName = null,
210+
string resourceGroupName = null)
211+
{
212+
return BmsAdapter.Client.ProtectionIntent.DeleteWithHttpMessagesAsync(
213+
vaultName ?? BmsAdapter.GetResourceName(),
214+
resourceGroupName ?? BmsAdapter.GetResourceGroupName(),
215+
AzureFabricName,
216+
protectedItemName,
217+
cancellationToken: BmsAdapter.CmdletCancellationToken).Result;
218+
}
219+
220+
/// <summary>
221+
/// List protection intents
222+
/// </summary>
223+
/// <param name="protectedItemName">Name of the item</param>
224+
/// <param name="request">Protected item create or update request</param>
225+
/// <returns>Job created in the service for this operation</returns>
226+
public List<ProtectionIntentResource> ListProtectionIntent(
227+
ODataQuery<ProtectionIntentQueryObject> queryFilter,
228+
string skipToken = default(string),
229+
string vaultName = null,
230+
string resourceGroupName = null)
231+
{
232+
Func<RestAzureNS.IPage<ProtectionIntentResource>> listAsync =
233+
() => BmsAdapter.Client.BackupProtectionIntent.ListWithHttpMessagesAsync(
234+
vaultName ?? BmsAdapter.GetResourceName(),
235+
resourceGroupName ?? BmsAdapter.GetResourceGroupName(),
236+
queryFilter,
237+
skipToken,
238+
cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;
239+
240+
Func<string, RestAzureNS.IPage<ProtectionIntentResource>> listNextAsync =
241+
nextLink => BmsAdapter.Client.BackupProtectionIntent.ListNextWithHttpMessagesAsync(
242+
nextLink,
243+
cancellationToken: BmsAdapter.CmdletCancellationToken).Result.Body;
244+
245+
return HelperUtils.GetPagedList(listAsync, listNextAsync);
246+
}
201247
}
202248
}

src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RecoveryServices.Backup.ServiceClientAdapter.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
16-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
16+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
1717
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
18+
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
19+
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
1820
</ItemGroup>
1921

2022
<ItemGroup>

src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="24.1.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.7.0-preview" />
1616
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
17-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
17+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
18+
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
19+
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
1820
</ItemGroup>
1921

2022
<ItemGroup>

src/RecoveryServices/RecoveryServices.Backup.Test/ScenarioTests/AzureWorkload/ItemTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ public void TestAzureVmWorkloadEnableProtectableItem()
4848
_logger, PsBackupProviderTypes.AzureWorkload, "Test-AzureVmWorkloadEnableProtectableItem");
4949
}
5050

51+
[Fact]
52+
[Trait(Category.AcceptanceType, Category.CheckIn)]
53+
[Trait(TestConstants.Workload, TestConstants.AzureVmWorkload)]
54+
public void TestAzureVmWorkloadEnableAutoProtectableItem()
55+
{
56+
TestController.NewInstance.RunPsTest(
57+
_logger, PsBackupProviderTypes.AzureWorkload, "Test-AzureVmWorkloadEnableAutoProtectableItem");
58+
}
59+
5160
[Fact]
5261
[Trait(Category.AcceptanceType, Category.CheckIn)]
5362
[Trait(TestConstants.Workload, TestConstants.AzureVmWorkload)]

0 commit comments

Comments
 (0)