Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Az.RecoveryServices.Backup] Added MUA support for V1 vaults #18154

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
<PackageReference Include="TimeZoneConverter" Version="3.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,13 @@ public static T GetOperationStatus<T>(RestAzureNS.AzureOperationResponse respons
var opStatusResponse = getOpStatus(operationId);

string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status ==
ServiceClientModel.OperationStatusValues.InProgress)
while (opStatusResponse.Body.Status == ServiceClientModel.OperationStatusValues.InProgress)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand Down Expand Up @@ -84,11 +79,8 @@ public static T GetOperationStatus<T, S>(RestAzureNS.AzureOperationResponse<S> r
while (opStatusResponse.Body.Status ==
ServiceClientModel.OperationStatusValues.InProgress)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}
Expand Down Expand Up @@ -118,15 +110,11 @@ public static RestAzureNS.AzureOperationResponse GetOperationResult(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand All @@ -153,15 +141,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationStatusDataMove<T
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status == "InProgress")
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}
opStatusResponse = getOpStatus(operationId);
Expand All @@ -187,15 +171,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}
opStatusResponse = getOpStatus(operationId);
Expand Down Expand Up @@ -236,15 +216,11 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
if (!TestMockSupport.RunningMocked)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || TestMockSupport.RunningMocked)
{
Thread.Sleep(5000);
}

opStatusResponse = getOpStatus(operationId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class PolicyHelpers
// <summary>
/// Helper function to validate long term rentention policy and simple schedule policy.
/// </summary>
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
LongTermRetentionPolicy ltrPolicy,
SimpleSchedulePolicy schPolicy)
{
Expand Down Expand Up @@ -124,7 +124,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
// <summary>
/// Helper function to validate long term rentention policy and simple schedule policy.
/// </summary>
public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
LongTermRetentionPolicy ltrPolicy,
SimpleSchedulePolicyV2 schPolicy)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
}
}

public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
public static void ValidateLongTermRetentionPolicyWithSimpleSchedulePolicy(
SQLRetentionPolicy ltrPolicy,
SQLSchedulePolicy schPolicy)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public enum VaultParams
VaultLocation,
}

public enum ResourceGuardParams
{
Token,
IsMUAOperation,
}

public enum ContainerParams
{
Vault,
Expand Down Expand Up @@ -77,7 +83,8 @@ public enum RestoreVMBackupItemParams
TargetVMName,
TargetVNetName,
TargetVNetResourceGroup,
TargetSubnetName
TargetSubnetName,
TargetSubscriptionId
}

public enum RestoreFSBackupItemParams
Expand Down Expand Up @@ -123,7 +130,8 @@ public enum PolicyParams
ResourceName,
FixForInconsistentItems,
ScheduleRunFrequency,
PolicySubType
PolicySubType,
ExistingPolicy
}

public enum ItemParams
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -739,4 +739,25 @@ Please contact Microsoft for further assistance.</value>
<data name="InvalidPolicyForTrustedVMProtection" xml:space="preserve">
<value>Trusted VM can only be protected using Enhanced policy. Please provide a valid AzureVM Enhanced policy</value>
</data>
<data name="ProtectedItemURICantBeNull" xml:space="preserve">
<value>ProtectedItemURI can't be null as the operation is protected with ResourceGuard</value>
</data>
<data name="PolicyUpdateNotCritical" xml:space="preserve">
<value>Operation not critical, please try without the Token parameter. MUA currently only protects reducing or disabling retention times</value>
</data>
<data name="UnexpectedParameterToken" xml:space="preserve">
<value>{0} is not protected via MUA, either protect or try without the Token parameter</value>
</data>
<data name="BackupConfigUpdateNotCritical" xml:space="preserve">
<value>Operation not critical, please try without the Token parameter. MUA currently protects disabling SoftDelete or SecurityFeatures only when it was previously enabled</value>
</data>
<data name="ResourceGuardMappingNotFound" xml:space="preserve">
<value>ResourceGuardMapping not found</value>
</data>
<data name="DisableWithRetainBackupNotCrititcal" xml:space="preserve">
<value>Invalid parameter Token: Stop protection with retain backup data is not MUA protected</value>
</data>
<data name="CRRNotSupportedWIthCSR" xml:space="preserve">
<value>Cross region restore is not supported along with cross subscription restore, please try passing either RestoreToSecondaryRegion or TargetSubscriptionId parameter but not both</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="5.0.0-preview" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading