Skip to content

Commit 5e72514

Browse files
committed
Added MUA support for V1 vaults
Added cross subscription restore updated help text Re-recorded test cases
1 parent 6a55c50 commit 5e72514

File tree

76 files changed

+111844
-42286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+111844
-42286
lines changed

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

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

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
1616
<PackageReference Include="TimeZoneConverter" Version="3.0.0" />
1717
</ItemGroup>
1818

src/RecoveryServices/RecoveryServices.Backup.Helpers/TrackingHelpers.cs

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,13 @@ public static T GetOperationStatus<T>(RestAzureNS.AzureOperationResponse respons
4545
var opStatusResponse = getOpStatus(operationId);
4646

4747
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
48-
while (opStatusResponse.Body.Status ==
49-
ServiceClientModel.OperationStatusValues.InProgress)
48+
while (opStatusResponse.Body.Status == ServiceClientModel.OperationStatusValues.InProgress)
5049
{
51-
if (!TestMockSupport.RunningMocked)
52-
{
53-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
54-
}
55-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
50+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
51+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
5652
{
5753
Thread.Sleep(5000);
5854
}
59-
6055
opStatusResponse = getOpStatus(operationId);
6156
}
6257

@@ -84,11 +79,8 @@ public static T GetOperationStatus<T, S>(RestAzureNS.AzureOperationResponse<S> r
8479
while (opStatusResponse.Body.Status ==
8580
ServiceClientModel.OperationStatusValues.InProgress)
8681
{
87-
if (!TestMockSupport.RunningMocked)
88-
{
89-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
90-
}
91-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
82+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
83+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
9284
{
9385
Thread.Sleep(5000);
9486
}
@@ -118,15 +110,11 @@ public static RestAzureNS.AzureOperationResponse GetOperationResult(
118110
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
119111
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
120112
{
121-
if (!TestMockSupport.RunningMocked)
122-
{
123-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
124-
}
125-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
113+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
114+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
126115
{
127116
Thread.Sleep(5000);
128117
}
129-
130118
opStatusResponse = getOpStatus(operationId);
131119
}
132120

@@ -153,15 +141,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationStatusDataMove<T
153141
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
154142
while (opStatusResponse.Body.Status == "InProgress")
155143
{
156-
if (!TestMockSupport.RunningMocked)
157-
{
158-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
159-
}
160-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
144+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
145+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
161146
{
162147
Thread.Sleep(5000);
163148
}
164-
165149
opStatusResponse = getOpStatus(operationId);
166150
}
167151
opStatusResponse = getOpStatus(operationId);
@@ -187,15 +171,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
187171
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
188172
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
189173
{
190-
if (!TestMockSupport.RunningMocked)
191-
{
192-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
193-
}
194-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
174+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
175+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
195176
{
196177
Thread.Sleep(5000);
197178
}
198-
199179
opStatusResponse = getOpStatus(operationId);
200180
}
201181
opStatusResponse = getOpStatus(operationId);
@@ -236,15 +216,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
236216
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
237217
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
238218
{
239-
if (!TestMockSupport.RunningMocked)
240-
{
241-
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
242-
}
243-
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
219+
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
220+
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
244221
{
245222
Thread.Sleep(5000);
246223
}
247-
248224
opStatusResponse = getOpStatus(operationId);
249225
}
250226

src/RecoveryServices/RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public partial class PolicyHelpers
2727
// <summary>
2828
/// Helper function to validate long term rentention policy and simple schedule policy.
2929
/// </summary>
30-
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
30+
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
3131
LongTermRetentionPolicy ltrPolicy,
3232
SimpleSchedulePolicy schPolicy)
3333
{
@@ -124,7 +124,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
124124
// <summary>
125125
/// Helper function to validate long term rentention policy and simple schedule policy.
126126
/// </summary>
127-
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
127+
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
128128
LongTermRetentionPolicy ltrPolicy,
129129
SimpleSchedulePolicyV2 schPolicy)
130130
{
@@ -226,7 +226,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
226226
}
227227
}
228228

229-
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
229+
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
230230
SQLRetentionPolicy ltrPolicy,
231231
SQLSchedulePolicy schPolicy)
232232
{

src/RecoveryServices/RecoveryServices.Backup.Models/CmdletParamEnums.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public enum VaultParams
2121
VaultLocation,
2222
}
2323

24+
public enum ResourceGuardParams
25+
{
26+
Token,
27+
IsMUAOperation,
28+
}
29+
2430
public enum ContainerParams
2531
{
2632
Vault,
@@ -77,7 +83,8 @@ public enum RestoreVMBackupItemParams
7783
TargetVMName,
7884
TargetVNetName,
7985
TargetVNetResourceGroup,
80-
TargetSubnetName
86+
TargetSubnetName,
87+
TargetSubscriptionId
8188
}
8289

8390
public enum RestoreFSBackupItemParams
@@ -123,7 +130,8 @@ public enum PolicyParams
123130
ResourceName,
124131
FixForInconsistentItems,
125132
ScheduleRunFrequency,
126-
PolicySubType
133+
PolicySubType,
134+
ExistingPolicy
127135
}
128136

129137
public enum ItemParams

src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs

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

src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,4 +739,25 @@ Please contact Microsoft for further assistance.</value>
739739
<data name="InvalidPolicyForTrustedVMProtection" xml:space="preserve">
740740
<value>Trusted VM can only be protected using Enhanced policy. Please provide a valid AzureVM Enhanced policy</value>
741741
</data>
742+
<data name="ProtectedItemURICantBeNull" xml:space="preserve">
743+
<value>ProtectedItemURI can't be null as the operation is protected with ResourceGuard</value>
744+
</data>
745+
<data name="PolicyUpdateNotCritical" xml:space="preserve">
746+
<value>Operation not critical, please try without the Token parameter. MUA currently only protects reducing or disabling retention times</value>
747+
</data>
748+
<data name="UnexpectedParameterToken" xml:space="preserve">
749+
<value>{0} is not protected via MUA, either protect or try without the Token parameter</value>
750+
</data>
751+
<data name="BackupConfigUpdateNotCritical" xml:space="preserve">
752+
<value>Operation not critical, please try without the Token parameter. MUA currently protects disabling SoftDelete or SecurityFeatures only when it was previously enabled</value>
753+
</data>
754+
<data name="ResourceGuardMappingNotFound" xml:space="preserve">
755+
<value>ResourceGuardMapping not found</value>
756+
</data>
757+
<data name="DisableWithRetainBackupNotCrititcal" xml:space="preserve">
758+
<value>Invalid parameter Token: Stop protection with retain backup data is not MUA protected</value>
759+
</data>
760+
<data name="CRRNotSupportedWIthCSR" xml:space="preserve">
761+
<value>Cross region restore is not supported along with cross subscription restore, please try passing either RestoreToSecondaryRegion or TargetSubscriptionId parameter but not both</value>
762+
</data>
742763
</root>

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

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

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

0 commit comments

Comments
 (0)