-
Notifications
You must be signed in to change notification settings - Fork 4k
Updating pool and database cmdlets to include optional LicenseType param #6311
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
Conversation
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.
Minor style comments. Looks good!
@@ -325,7 +332,8 @@ protected override AzureSqlDatabaseModel GetEntity() | |||
ElasticPoolName = ElasticPoolName, | |||
RequestedServiceObjectiveName = ServiceObjectiveName, | |||
Edition = Edition, | |||
CreateMode = createMode | |||
CreateMode = createMode, | |||
LicenseType = LicenseType ?? null |
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.
?? null
seems redundant
@@ -207,7 +214,8 @@ protected override AzureSqlDatabaseCreateOrUpdateModel ApplyUserInputToModel(Azu | |||
Tags = TagsConversionHelper.CreateTagDictionary(Tags, validate: true), | |||
ElasticPoolName = ElasticPoolName, | |||
ReadScale = ReadScale, | |||
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null | |||
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null, | |||
LicenseType = LicenseType ?? null // note: default license type is LicenseIncluded |
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.
same here
/// Gets or sets the license type for the Azure Sql database | ||
/// </summary> | ||
[Parameter(Mandatory = false, HelpMessage = "The license type for the Azure Sql database")] | ||
[PSArgumentCompleter("LicenseIncluded", "BasePrice")] |
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.
@@ -201,7 +208,8 @@ protected override IEnumerable<AzureSqlElasticPoolModel> ApplyUserInputToModel(I | |||
Tags = TagsConversionHelper.CreateTagDictionary(Tags, validate: true), | |||
Location = location, | |||
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null, | |||
MaxSizeBytes = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (long?)(StorageMB * Megabytes) : null | |||
MaxSizeBytes = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (long?)(StorageMB * Megabytes) : null, | |||
LicenseType = LicenseType ?? null |
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.
remove ?? null again
/// Gets or sets the license type for the Azure Sql database | ||
/// </summary> | ||
[Parameter(Mandatory = false, HelpMessage = "The license type for the Azure Sql database")] | ||
[PSArgumentCompleter("LicenseIncluded", "BasePrice")] |
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.
/// Gets or sets the license type for the Azure Sql database | ||
/// </summary> | ||
[Parameter(Mandatory = false, HelpMessage = "The license type for the Azure Sql database")] | ||
[PSArgumentCompleter("LicenseIncluded", "BasePrice")] |
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.
use constants
|
||
try | ||
{ | ||
# Create a local database copy from a vcore database with base price license type - Default |
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.
For the comment. default is License Included not base price, right?
@@ -252,6 +257,8 @@ public AzureSqlDatabaseModel(string resourceGroup, string serverName, Management | |||
Family = database.Sku == null ? null : database.Sku.Family; | |||
|
|||
SkuName = database.Sku == null ? null : database.Sku.Name; | |||
|
|||
LicenseType = database.LicenseType == null ? null : database.LicenseType; |
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.
don't need null as other places?
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.
good catch. will update.
@johnpaulkee Check out the ValidateMarkdownHelp.csv file here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/4798/ |
Thanks @maddieclayton I've updated the markdown files. |
Looks like Jenkins build succeeded. Unsure why the Travis build is failing though. @maddieclayton https://travis-ci.org/Azure/azure-powershell/builds/383972854#L2438 can you take a look? |
Travis build succeeded on retry it seems. |
function Test-CreateVcoreDatabaseWithLicenseType | ||
{ | ||
# Setup | ||
$location = "westcentralus" |
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 should use "Get-Location" https://github.com/Azure/azure-powershell/wiki/Azure-Powershell-Developer-Guide#using-common-code
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.
Will update to use Get-Location
#> | ||
function Test-CreateVcoreDatabaseCopy | ||
{ | ||
Test-CreateVcoreCopyInternal "12.0" "Southeast Asia" |
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.
Same comment about location not being hardcoded - use Get-Location. This applies everywhere.
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.
Will update to use Get-Location
@@ -207,7 +217,8 @@ protected override AzureSqlDatabaseCreateOrUpdateModel ApplyUserInputToModel(Azu | |||
Tags = TagsConversionHelper.CreateTagDictionary(Tags, validate: true), | |||
ElasticPoolName = ElasticPoolName, | |||
ReadScale = ReadScale, | |||
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null | |||
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null, | |||
LicenseType = LicenseType // note: default license type is LicenseIncluded |
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.
Where are you setting the default?
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.
Sorry if comment is confusing. Default is set in the SQL RP for License Type.
I'll update comment to be clearer.
@@ -214,7 +214,6 @@ The acceptable values for this parameter are: | |||
Type: String | |||
Parameter Sets: DtuBasedPool | |||
Aliases: | |||
Accepted values: None, Premium, Basic, Standard, DataWarehouse, Stretch, Free, PremiumRS |
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.
Why were these removed? Same for below.
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.
Unsure.
The edition should be using these valid editions:
[PSArgumentCompleter("None",
Management.Sql.Models.DatabaseEdition.Basic,
Management.Sql.Models.DatabaseEdition.Standard,
Management.Sql.Models.DatabaseEdition.Premium,
Management.Sql.Models.DatabaseEdition.DataWarehouse,
Management.Sql.Models.DatabaseEdition.Free,
Management.Sql.Models.DatabaseEdition.Stretch,
"GeneralPurpose", "BusinessCritical")]
Looks like this should updated anyway since GeneralPurpose and BusinessCritical needs to be added and PremiumRS needs to be deleted.
Will update these markdown files manually.
@maddieclayton for markdown generation, do PSArgumentCompleter values get automatically generated or do they get excluded?
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.
Unlike ValidateSet or using an enum, it looks like PSArgumentCompleter doesn't have list of suggested strings get generated.
I'll add manually.
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.
Updated to the correct accepted values @maddieclayton
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.
Yes that's correct, PSArgumentCompleter is not caught by platyPS (it was created by us while ValidateSet is a built in powershell attribute)
@@ -205,7 +210,6 @@ The acceptable values for this parameter are: | |||
Type: String | |||
Parameter Sets: FromPointInTimeBackup, FromDeletedDatabaseBackup, FromGeoBackup, FromLongTermRetentionBackup | |||
Aliases: | |||
Accepted values: None, Premium, Basic, Standard, DataWarehouse, Stretch, Free, PremiumRS |
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.
Same here (and in following files)
… new-azurermsqlelasticpool, and restore-azurermsqldatabase
Thanks @maddieclayton for merging! |
Thanks @johnpaulkee and @maddieclayton for getting this into 6.2.0 ! |
Description
License type should be available as an option for customers when creating, updating SQL databases or SQL elastic pools. During restore, the license type should also be an option for SQL databases
Checklist
CONTRIBUTING.md
- The accepted review
platyPS
module