diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/AzureSqlDbHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/AzureSqlDbHelper.cs
index a1585636..33f5be2e 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/AzureSqlDbHelper.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/AzureSqlDbHelper.cs
@@ -21,19 +21,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
[DebuggerDisplay("{Name,nq}")]
public class AzureEdition
{
- public static readonly AzureEdition Basic = new AzureEdition("Basic", "SR.BasicAzureEdition");
- public static readonly AzureEdition Standard = new AzureEdition("Standard", "SR.StandardAzureEdition");
- public static readonly AzureEdition Premium = new AzureEdition("Premium", "SR.PremiumAzureEdition");
- public static readonly AzureEdition DataWarehouse = new AzureEdition("DataWarehouse", "SR.DataWarehouseAzureEdition");
- public static readonly AzureEdition GeneralPurpose = new AzureEdition("GeneralPurpose", "SR.GeneralPurposeAzureEdition");
- public static readonly AzureEdition BusinessCritical = new AzureEdition("BusinessCritical", "SR.BusinessCriticalAzureEdition");
-
- public static readonly AzureEdition Hyperscale = new AzureEdition("Hyperscale", "SR.HyperscaleAzureEdition");
- // Free does not offer DatabaseSize >=1GB, hence it's not "supported".
- //public static readonly AzureEdition Free = new AzureEdition("Free", SR.FreeAzureEdition);
- // Stretch and system do not seem to be applicable, so I'm commenting them out
- //public static readonly AzureEdition Stretch = new AzureEdition("Stretch", SR.StretchAzureEdition);
- //public static readonly AzureEdition System = new AzureEdition("System", SR.SystemAzureEdition);
+ public static readonly AzureEdition Basic = new AzureEdition("Basic", SR.BasicAzureEdition);
+ public static readonly AzureEdition Standard = new AzureEdition("Standard", SR.StandardAzureEdition);
+ public static readonly AzureEdition Premium = new AzureEdition("Premium", SR.PremiumAzureEdition);
+ public static readonly AzureEdition DataWarehouse = new AzureEdition("DataWarehouse", SR.DataWarehouseAzureEdition);
+ public static readonly AzureEdition GeneralPurpose = new AzureEdition("GeneralPurpose", SR.GeneralPurposeAzureEdition);
+ public static readonly AzureEdition BusinessCritical = new AzureEdition("BusinessCritical", SR.BusinessCriticalAzureEdition);
+ public static readonly AzureEdition Hyperscale = new AzureEdition("Hyperscale", SR.HyperscaleAzureEdition);
internal string Name { get; private set; }
internal string DisplayName { get; private set; }
@@ -320,6 +314,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
{ "LRS", "Local" },
{ "ZRS", "Zone" }
};
+ private static readonly string[] backupRedundancyLevels = bsrAPIToUIValueMapping.Values.ToArray();
+
+ ///
+ /// All valid backup storage redundancy levels for an Azure SQL database
+ ///
+ public static string[] BackupStorageRedundancyLevels
+ {
+ get
+ {
+ return backupRedundancyLevels;
+ }
+ }
//KeyValuePair contains the BackupStorageRedundancy values for all azure editions.
private static readonly KeyValuePair keyValuePair = new KeyValuePair(0, bsrAPIToUIValueMapping.Values.ToArray());
@@ -516,7 +522,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
/// We do this so that the AzureEdition enum can have values such as NONE or DEFAULT added
/// without requiring clients to explicitly filter out those values themselves each time.
///
- public static IEnumerable GetValidAzureEditionOptions(object unused)
+ public static IEnumerable GetValidAzureEditionOptions()
{
yield return AzureEdition.Basic;
yield return AzureEdition.Standard;
@@ -524,10 +530,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
yield return AzureEdition.DataWarehouse;
yield return AzureEdition.BusinessCritical;
yield return AzureEdition.GeneralPurpose;
- //yield return AzureEdition.Free;
yield return AzureEdition.Hyperscale;
- //yield return AzureEdition.Stretch;
- //yield return AzureEdition.System;
}
}
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs
index 8c90bab1..d6d6582f 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs
@@ -16,6 +16,8 @@ using Microsoft.SqlTools.ServiceLayer.Management;
using AzureEdition = Microsoft.SqlTools.ServiceLayer.Admin.AzureSqlDbHelper.AzureEdition;
using System;
using System.Data;
+using Microsoft.SqlTools.Utility;
+using System.Diagnostics;
namespace Microsoft.SqlTools.ServiceLayer.Admin
{
@@ -91,58 +93,56 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
{
return AzureSqlDbHelper.GetAzureEditionDisplayName(this.currentState.azureEdition);
}
- // set
- // {
- // AzureEdition edition;
- // if (AzureSqlDbHelper.TryGetAzureEditionFromDisplayName(value, out edition))
- // {
- // //Try to get the ServiceLevelObjective from the api,if not the default hardcoded service level objectives will be retrieved.
- // string serverLevelObjective = AzureServiceLevelObjectiveProvider.TryGetAzureServiceLevelObjective(value, AzureServiceLocation);
+ set
+ {
+ AzureEdition edition;
+ if (AzureSqlDbHelper.TryGetAzureEditionFromDisplayName(value, out edition))
+ {
+ //Try to get the ServiceLevelObjective from the api,if not the default hardcoded service level objectives will be retrieved.
+ // string serverLevelObjective = AzureServiceLevelObjectiveProvider.TryGetAzureServiceLevelObjective(value, AzureServiceLocation);
- // if (!string.IsNullOrEmpty(serverLevelObjective))
- // {
- // this.currentState.azureEdition = edition;
- // this.currentState.currentServiceLevelObjective = serverLevelObjective;
- // // Instead of creating db instance with default Edition, update EditionToCreate while selecting Edition from the UI.
- // this.EditionToCreate = MapAzureEditionToDbEngineEdition(edition);
- // string storageAccountType = AzureServiceLevelObjectiveProvider.TryGetAzureStorageType(value, AzureServiceLocation);
- // if (!string.IsNullOrEmpty(storageAccountType))
- // {
- // this.currentState.backupStorageRedundancy = storageAccountType;
- // }
+ // if (!string.IsNullOrEmpty(serverLevelObjective))
+ // {
+ // this.currentState.azureEdition = edition;
+ // this.currentState.currentServiceLevelObjective = serverLevelObjective;
+ // // Instead of creating db instance with default Edition, update EditionToCreate while selecting Edition from the UI.
+ // this.EditionToCreate = MapAzureEditionToDbEngineEdition(edition);
+ // string storageAccountType = AzureServiceLevelObjectiveProvider.TryGetAzureStorageType(value, AzureServiceLocation);
+ // if (!string.IsNullOrEmpty(storageAccountType))
+ // {
+ // this.currentState.backupStorageRedundancy = storageAccountType;
+ // }
- // // Try to get the azure maxsize from the api,if not the default hardcoded maxsize will be retrieved.
- // DbSize dbSize = AzureServiceLevelObjectiveProvider.TryGetAzureMaxSize(value, serverLevelObjective, AzureServiceLocation);
- // if (!string.IsNullOrEmpty(dbSize.ToString()))
- // {
- // this.currentState.maxSize = new DbSize(dbSize.Size, dbSize.SizeUnit);
- // }
- // }
- // else
- // {
- // if (edition == this.currentState.azureEdition)
- // { //No changes, return early since we don't need to do any of the changes below
- // return;
- // }
+ // // Try to get the azure maxsize from the api,if not the default hardcoded maxsize will be retrieved.
+ // DbSize dbSize = AzureServiceLevelObjectiveProvider.TryGetAzureMaxSize(value, serverLevelObjective, AzureServiceLocation);
+ // if (!string.IsNullOrEmpty(dbSize.ToString()))
+ // {
+ // this.currentState.maxSize = new DbSize(dbSize.Size, dbSize.SizeUnit);
+ // }
+ // }
+ // else
+ // {
+ if (edition == this.currentState.azureEdition)
+ { // No changes, return early since we don't need to do any of the changes below
+ return;
+ }
- // this.currentState.azureEdition = edition;
- // this.EditionToCreate = MapAzureEditionToDbEngineEdition(edition);
- // this.CurrentServiceLevelObjective = AzureSqlDbHelper.GetDefaultServiceObjective(edition);
- // this.BackupStorageRedundancy = AzureSqlDbHelper.GetDefaultBackupStorageRedundancy(edition);
- // var defaultSize = AzureSqlDbHelper.GetDatabaseDefaultSize(edition);
+ this.currentState.azureEdition = edition;
+ this.EditionToCreate = MapAzureEditionToDbEngineEdition(edition);
+ this.CurrentServiceLevelObjective = AzureSqlDbHelper.GetDefaultServiceObjective(edition);
+ this.BackupStorageRedundancy = AzureSqlDbHelper.GetDefaultBackupStorageRedundancy(edition);
+ var defaultSize = AzureSqlDbHelper.GetDatabaseDefaultSize(edition);
- // this.MaxSize = defaultSize == null ? String.Empty : defaultSize.ToString();
- // }
- // this.NotifyObservers();
- // }
- // else
- // {
- // //Can't really do much if we fail to parse the display name so just leave it as is and log a message
- // System.Diagnostics.Debug.Assert(false,
- // string.Format(CultureInfo.InvariantCulture,
- // "Failed to parse edition display name '{0}' back into AzureEdition", value));
- // }
- // }
+ this.MaxSize = defaultSize == null ? String.Empty : defaultSize.ToString();
+ // }
+ this.NotifyObservers();
+ }
+ else
+ {
+ // Can't really do much if we fail to parse the display name so just leave it as is and log a message
+ Logger.Write(TraceEventType.Error, $"Failed to parse edition display name '{value}' back into AzureEdition");
+ }
+ }
}
///
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
index 0fee0153..2735ad3b 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
@@ -12437,6 +12437,70 @@ namespace Microsoft.SqlTools.ServiceLayer
}
}
+ public static string BasicAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.BasicAzureEdition);
+ }
+ }
+
+ public static string StandardAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.StandardAzureEdition);
+ }
+ }
+
+ public static string PremiumAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.PremiumAzureEdition);
+ }
+ }
+
+ public static string DataWarehouseAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.DataWarehouseAzureEdition);
+ }
+ }
+
+ public static string GeneralPurposeAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.GeneralPurposeAzureEdition);
+ }
+ }
+
+ public static string BusinessCriticalAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.BusinessCriticalAzureEdition);
+ }
+ }
+
+ public static string ErrorInvalidEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.ErrorInvalidEdition);
+ }
+ }
+
+ public static string HyperscaleAzureEdition
+ {
+ get
+ {
+ return Keys.GetString(Keys.HyperscaleAzureEdition);
+ }
+ }
+
public static string ConnectionServiceListDbErrorNotConnected(string uri)
{
return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri);
@@ -17794,6 +17858,30 @@ namespace Microsoft.SqlTools.ServiceLayer
public const string prototype_file_noApplicableFileGroup = "prototype_file_noApplicableFileGroup";
+ public const string BasicAzureEdition = "BasicAzureEdition";
+
+
+ public const string StandardAzureEdition = "StandardAzureEdition";
+
+
+ public const string PremiumAzureEdition = "PremiumAzureEdition";
+
+
+ public const string DataWarehouseAzureEdition = "DataWarehouseAzureEdition";
+
+
+ public const string GeneralPurposeAzureEdition = "GeneralPurposeAzureEdition";
+
+
+ public const string BusinessCriticalAzureEdition = "BusinessCriticalAzureEdition";
+
+
+ public const string ErrorInvalidEdition = "ErrorInvalidEdition";
+
+
+ public const string HyperscaleAzureEdition = "HyperscaleAzureEdition";
+
+
private Keys()
{ }
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
index c0834cff..361f25ac 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
@@ -6760,4 +6760,36 @@ The Query Processor estimates that implementing the following index could improv
No Applicable Filegroup
+
+ Basic
+
+
+
+ Standard
+
+
+
+ Premium
+
+
+
+ DataWarehouse
+
+
+
+ General Purpose
+
+
+
+ Business Critical
+
+
+
+ Edition value is not valid
+
+
+
+ Hyperscale
+
+
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
index cea89ec4..b6b5065f 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
@@ -2801,4 +2801,16 @@ compatibilityLevel_sqlv160 = SQL Server 2022 (160)
general_containmentType_None = None
general_containmentType_Partial = Partial
filegroups_filestreamFiles = FILESTREAM Files
-prototype_file_noApplicableFileGroup = No Applicable Filegroup
\ No newline at end of file
+prototype_file_noApplicableFileGroup = No Applicable Filegroup
+
+############################################################################
+# Azure SQL DB
+
+BasicAzureEdition = Basic
+StandardAzureEdition = Standard
+PremiumAzureEdition = Premium
+DataWarehouseAzureEdition = DataWarehouse
+GeneralPurposeAzureEdition = General Purpose
+BusinessCriticalAzureEdition = Business Critical
+ErrorInvalidEdition = Edition value is not valid
+HyperscaleAzureEdition = Hyperscale
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf
index 123f4e6a..53aa0ef1 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf
@@ -8281,6 +8281,46 @@ The Query Processor estimates that implementing the following index could improv
No Applicable Filegroup
+
+ Basic
+ Basic
+
+
+
+ Standard
+ Standard
+
+
+
+ Premium
+ Premium
+
+
+
+ DataWarehouse
+ DataWarehouse
+
+
+
+ General Purpose
+ General Purpose
+
+
+
+ Business Critical
+ Business Critical
+
+
+
+ Edition value is not valid
+ Edition value is not valid
+
+
+
+ Hyperscale
+ Hyperscale
+
+