Skip to content

Commit 4ee302b

Browse files
committed
Item support for mercury
1 parent 482b8fd commit 4ee302b

File tree

32 files changed

+2010
-682
lines changed

32 files changed

+2010
-682
lines changed

src/Accounts/Accounts/Accounts.csproj

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
30+
<PackageReference Include ="System.Security.Permissions" Version ="4.5.0"/>
3131
</ItemGroup>
3232

3333
<Target Name="CopyFiles" AfterTargets="Build">
@@ -44,19 +44,4 @@
4444
<EmbeddedResource Include="AzureRmAlias\Mappings.json" />
4545
</ItemGroup>
4646

47-
<ItemGroup>
48-
<Compile Update="Properties\Resources.Designer.cs">
49-
<DesignTime>True</DesignTime>
50-
<AutoGen>True</AutoGen>
51-
<DependentUpon>Resources.resx</DependentUpon>
52-
</Compile>
53-
</ItemGroup>
54-
55-
<ItemGroup>
56-
<EmbeddedResource Update="Properties\Resources.resx">
57-
<Generator>ResXFileCodeGenerator</Generator>
58-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
59-
</EmbeddedResource>
60-
</ItemGroup>
61-
6247
</Project>

src/Compute/Compute/Compute.csproj

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,4 @@
3030
<Compile Include="$(StorageToolsPath)Adapters\WindowsAzure.Storage.6\AzureStorageContext.cs" Link="Common\AzureStorageContext.cs" />
3131
</ItemGroup>
3232

33-
<ItemGroup>
34-
<Compile Update="Properties\Resources.Designer.cs">
35-
<DesignTime>True</DesignTime>
36-
<AutoGen>True</AutoGen>
37-
<DependentUpon>Resources.resx</DependentUpon>
38-
</Compile>
39-
</ItemGroup>
40-
41-
<ItemGroup>
42-
<EmbeddedResource Update="Properties\Resources.resx">
43-
<Generator>ResXFileCodeGenerator</Generator>
44-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
45-
</EmbeddedResource>
46-
</ItemGroup>
47-
4833
</Project>

src/Network/Network/Network.csproj

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.7.0-preview" />
1616
</ItemGroup>
1717

18-
<ItemGroup>
19-
<Compile Update="Properties\Resources.Designer.cs">
20-
<DesignTime>True</DesignTime>
21-
<AutoGen>True</AutoGen>
22-
<DependentUpon>Resources.resx</DependentUpon>
23-
</Compile>
24-
</ItemGroup>
25-
26-
<ItemGroup>
27-
<EmbeddedResource Update="Properties\Resources.resx">
28-
<Generator>ResXFileCodeGenerator</Generator>
29-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
30-
</EmbeddedResource>
31-
</ItemGroup>
32-
3318
<ItemGroup>
3419
<None Update="AzureRmNetworkStartup.ps1" CopyToOutputDirectory="PreserveNewest" />
3520
</ItemGroup>

src/Network/Network/Properties/Resources.Designer.cs

Lines changed: 84 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RecoveryServices/RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
16-
using System.Collections.Generic;
1715
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
1816
using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties;
17+
using System;
18+
using System.Collections.Generic;
1919
using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models;
2020

2121
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
@@ -427,8 +427,38 @@ public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource pro
427427
{
428428
itemModel = GetAzureFileShareItemModel(protectedItem);
429429
}
430+
431+
if (protectedItem.Properties.GetType() ==
432+
typeof(ServiceClientModel.AzureVmWorkloadSQLDatabaseProtectedItem))
433+
{
434+
itemModel = GetAzureVmWorkloadItemModel(protectedItem);
435+
}
436+
}
437+
438+
return itemModel;
439+
}
440+
441+
private static ItemBase GetAzureVmWorkloadItemModel(ServiceClientModel.ProtectedItemResource protectedItem)
442+
{
443+
ItemBase itemModel;
444+
string policyName = null;
445+
string policyId = ((ServiceClientModel.AzureVmWorkloadSQLDatabaseProtectedItem)protectedItem.Properties).PolicyId;
446+
if (!string.IsNullOrEmpty(policyId))
447+
{
448+
Dictionary<UriEnums, string> keyValueDict =
449+
HelperUtils.ParseUri(policyId);
450+
policyName = HelperUtils.GetPolicyNameFromPolicyId(keyValueDict, policyId);
430451
}
431452

453+
string containerUri = HelperUtils.GetContainerUri(
454+
HelperUtils.ParseUri(protectedItem.Id),
455+
protectedItem.Id);
456+
457+
itemModel = new AzureWorkloadSQLDatabaseProtectedItem(
458+
protectedItem,
459+
IdUtils.GetNameFromUri(containerUri),
460+
ContainerType.AzureWorkload,
461+
policyName);
432462
return itemModel;
433463
}
434464

@@ -507,7 +537,42 @@ private static ItemBase GetAzureVmItemModel(ServiceClientModel.ProtectedItemReso
507537
}
508538

509539
/// <summary>
510-
/// Helper function to convert ps backup policy item list from service response.
540+
/// Helper function to convert ps protectable item from service response.
541+
/// </summary>
542+
public static ProtectableItemBase GetProtectableItemModel(ServiceClientModel.WorkloadProtectableItemResource protectableItem)
543+
{
544+
ProtectableItemBase itemModel = null;
545+
546+
if (protectableItem != null &&
547+
protectableItem.Properties != null)
548+
{
549+
if (protectableItem.Properties.GetType().IsSubclassOf(typeof(ServiceClientModel.AzureVmWorkloadProtectableItem)))
550+
{
551+
itemModel = GetAzureWorkloadProtectableItemModel(protectableItem);
552+
}
553+
}
554+
555+
return itemModel;
556+
}
557+
558+
private static ProtectableItemBase GetAzureWorkloadProtectableItemModel(ServiceClientModel.WorkloadProtectableItemResource protectableItem)
559+
{
560+
ProtectableItemBase itemModel;
561+
562+
string containerUri = HelperUtils.GetContainerUri(
563+
HelperUtils.ParseUri(protectableItem.Id),
564+
protectableItem.Id);
565+
566+
itemModel = new AzureWorkloadProtectableItem(
567+
protectableItem,
568+
IdUtils.GetNameFromUri(containerUri),
569+
ContainerType.AzureWorkload);
570+
571+
return itemModel;
572+
}
573+
574+
/// <summary>
575+
/// Helper function to convert ps item list from service response.
511576
/// </summary>
512577
public static List<ItemBase> GetItemModelList(IEnumerable<ServiceClientModel.ProtectedItemResource> protectedItems)
513578
{
@@ -567,6 +632,21 @@ public static void GetPSSubProtectionPolicy(AzureVmWorkloadPolicy azureVmWorkloa
567632
}
568633
}
569634
}
635+
636+
/// <summary>
637+
/// Helper function to convert ps protectable item list from service response.
638+
/// </summary>
639+
public static List<ProtectableItemBase> GetProtectableItemModelList(IEnumerable<ServiceClientModel.WorkloadProtectableItemResource> protectableItems)
640+
{
641+
List<ProtectableItemBase> itemModels = new List<ProtectableItemBase>();
642+
643+
foreach (var protectableItem in protectableItems)
644+
{
645+
itemModels.Add(GetProtectableItemModel(protectableItem));
646+
}
647+
648+
return itemModels;
649+
}
570650
#endregion
571651
}
572652
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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.Management.RecoveryServices.Backup.Models;
16+
17+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
18+
{
19+
/// <summary>
20+
/// Azure workload protectable item Class
21+
/// </summary>
22+
public class AzureWorkloadProtectableItem : ProtectableItemBase
23+
{
24+
/// <summary>
25+
/// name for instance or AG
26+
/// </summary>
27+
public string ParentName { get; set; }
28+
29+
/// <summary>
30+
/// Name of the Parent Only Applicable for data bases where the parent would be either
31+
/// Instance or a SQL AG.
32+
/// </summary>
33+
public string ParentUniqueName { get; set; }
34+
35+
/// <summary>
36+
/// host/Cluster Name for instance or AG
37+
/// </summary>
38+
public string ServerName { get; set; }
39+
40+
/// <summary>
41+
/// indicates if protectable item is auto-protectable
42+
/// </summary>
43+
public bool? IsAutoProtectable { get; set; }
44+
45+
/// <summary>
46+
/// for instance or AG, indicates number of DB's present
47+
/// </summary>
48+
public int? Subinquireditemcount { get; set; }
49+
50+
/// <summary>
51+
/// for instance or AG, indicates number of DB's to be protected
52+
/// </summary>
53+
public int? Subprotectableitemcount { get; set; }
54+
55+
/// <summary>
56+
/// pre-backup validation for protectable objects
57+
/// </summary>
58+
public PreBackupValidation Prebackupvalidation { get; set; }
59+
60+
/// <summary>
61+
/// Constructor. Takes the service client object representing the protected item
62+
/// and converts it in to the PS protected item model
63+
/// </summary>
64+
/// <param name="protectedItemResource">Service client object representing the protected item resource</param>
65+
/// <param name="containerName">Name of the container associated with this protected item</param>
66+
/// <param name="containerType">Type of the container associated with this protected item</param>
67+
public AzureWorkloadProtectableItem(WorkloadProtectableItemResource workloadProtectableItemResource,
68+
string containerName, ContainerType containerType)
69+
: base(workloadProtectableItemResource, containerName, containerType)
70+
{
71+
AzureVmWorkloadProtectableItem protectedItem = (AzureVmWorkloadProtectableItem)workloadProtectableItemResource.Properties;
72+
ParentName = protectedItem.ParentName;
73+
ParentUniqueName = protectedItem.ParentUniqueName;
74+
ServerName = protectedItem.ServerName;
75+
IsAutoProtectable = protectedItem.IsAutoProtectable;
76+
Subinquireditemcount = protectedItem.Subinquireditemcount;
77+
Subprotectableitemcount = protectedItem.Subprotectableitemcount;
78+
}
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.Management.RecoveryServices.Backup.Models;
16+
using System;
17+
using System.Collections.Generic;
18+
19+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
20+
{
21+
/// <summary>
22+
/// Recovery config of a resource.
23+
/// </summary>
24+
public class AzureWorkloadRecoveryConfig : RecoveryConfigBase
25+
{
26+
/// <summary>
27+
/// Target Server
28+
/// </summary>
29+
public string TargetServer { get; set; }
30+
31+
/// <summary>
32+
/// Target Instance
33+
/// </summary>
34+
public string TargetInstance { get; set; }
35+
36+
/// <summary>
37+
/// Restored DB Name
38+
/// </summary>
39+
public string RestoredDBName { get; set; }
40+
41+
/// <summary>
42+
/// OverwriteWLIfpresent
43+
/// </summary>
44+
public string OverwriteWLIfpresent { get; set; }
45+
46+
/// <summary>
47+
/// NoRecoveryMode
48+
/// </summary>
49+
public string NoRecoveryMode { get; set; }
50+
51+
/// <summary>
52+
/// targetPhysicalPath
53+
/// </summary>
54+
public IList<SQLDataDirectoryMapping> targetPhysicalPath { get; set; }
55+
56+
public AzureWorkloadRecoveryConfig()
57+
{
58+
}
59+
}
60+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
16+
{
17+
/// <summary>
18+
/// Azure workload specific recovery point class.
19+
/// </summary>
20+
public class AzureWorkloadRecoveryPoint : AzureRecoveryPoint
21+
{
22+
public AzureWorkloadRecoveryPoint()
23+
{
24+
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)