-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
add warning for BackupStorageRedundancy #12934
Merged
dingmeng-xue
merged 15 commits into
Azure:release-2020-09-22
from
xaliciayang:addWarning1
Sep 15, 2020
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5de8958
add warning for BackupStorageRedundancy
xaliciayang 0b4a313
update designer
xaliciayang 33857ed
add updated help file
xaliciayang 2364c36
add InitModelAdapter before warning message
xaliciayang 122ea39
merge conflict in ChangeLog; merge with upstream master
xaliciayang f5b8b26
updated recordings
xaliciayang e6ca6d8
update TDE tests and recordings
xaliciayang 1afeafb
Merge branch 'release-2020-09-22' into addWarning1
dingmeng-xue 7d2fe86
Merge branch 'release-2020-09-22' into addWarning1
dingmeng-xue e41bd23
updated session records
xaliciayang f06ee53
add session records
xaliciayang 3a98934
updating tests
xaliciayang addbf4a
Merge branch 'addWarning1' of https://github.com/xaliciayang/azure-po…
xaliciayang b94494d
add updated recording
xaliciayang 7ac0ed4
Merge branch 'release-2020-09-22' into addWarning1
dingmeng-xue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Collections; | ||
using System.Globalization; | ||
|
||
namespace Microsoft.Azure.Commands.Sql.Database.Cmdlet | ||
{ | ||
|
@@ -134,6 +135,12 @@ public class NewAzureSqlDatabase : AzureSqlDatabaseCmdletBase<AzureSqlDatabaseCr | |
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] | ||
public SwitchParameter AsJob { get; set; } | ||
|
||
/// <summary> | ||
/// Defines whether it is ok to skip the requesting of confirmation | ||
/// </summary> | ||
[Parameter(HelpMessage = "Skip confirmation message for performing the action")] | ||
public SwitchParameter Force { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the Vcore number for the Azure Sql database | ||
/// </summary> | ||
|
@@ -198,14 +205,38 @@ public class NewAzureSqlDatabase : AzureSqlDatabaseCmdletBase<AzureSqlDatabaseCr | |
/// </summary> | ||
[Parameter(Mandatory = false, | ||
HelpMessage = "The Backup storage redundancy used to store backups for the SQL Database. Options are: Local, Zone and Geo.")] | ||
[ValidateSet("Local", "Zone", "Geo")] | ||
[ValidateSet("Local", "Zone", "Geo", IgnoreCase = false)] | ||
public string BackupStorageRedundancy { get; set; } | ||
|
||
protected static readonly string[] ListOfRegionsToShowWarningMessageForGeoBackupStorage = { "eastasia", "southeastasia", "brazilsouth", "east asia", "southeast asia", "brazil south" }; | ||
|
||
/// <summary> | ||
/// Overriding to add warning message | ||
/// </summary> | ||
public override void ExecuteCmdlet() | ||
{ | ||
string location = ModelAdapter.GetServerLocation(ResourceGroupName, ServerName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (ListOfRegionsToShowWarningMessageForGeoBackupStorage.Contains(location.ToLower())) | ||
{ | ||
if (this.BackupStorageRedundancy == null) | ||
{ | ||
if (!Force.IsPresent && !ShouldContinue( | ||
string.Format(CultureInfo.InvariantCulture, Properties.Resources.DoYouWantToProceed, this.DatabaseName), | ||
string.Format(CultureInfo.InvariantCulture, Properties.Resources.GeoBackupRedundancyNotChosenWarning, this.DatabaseName))) | ||
{ | ||
return; | ||
} | ||
} | ||
else if (string.Equals(this.BackupStorageRedundancy, "Geo", System.StringComparison.OrdinalIgnoreCase)) | ||
xaliciayang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (!Force.IsPresent && !ShouldContinue( | ||
string.Format(CultureInfo.InvariantCulture, Properties.Resources.DoYouWantToProceed, this.DatabaseName), | ||
string.Format(CultureInfo.InvariantCulture, Properties.Resources.GeoBackupRedundancyChosenWarning, this.DatabaseName))) | ||
{ | ||
return; | ||
} | ||
} | ||
} | ||
base.ExecuteCmdlet(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change validate set IgnoreCase from true to false is a breaking change. Is it a bug fix? Will it report error from server when case mismatched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a newly introduced paramater (as part of PR 12899); @dingmeng-xue and I discussed this. We introduced IgnoreCase = false to match the MI user experience (PR 12849).