Skip to content

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

Merged
merged 17 commits into from
May 30, 2018

Conversation

johnpaulkee
Copy link
Contributor

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

jaredmoo
jaredmoo previously approved these changes May 25, 2018
Copy link
Contributor

@jaredmoo jaredmoo left a 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
Copy link
Contributor

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
Copy link
Contributor

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")]
Copy link
Contributor

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
Copy link
Contributor

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")]
Copy link
Contributor

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")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constants

@jaredmoo jaredmoo requested a review from akromm-zz May 25, 2018 21:40

try
{
# Create a local database copy from a vcore database with base price license type - Default
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. will update.

@maddieclayton
Copy link
Contributor

@johnpaulkee Check out the ValidateMarkdownHelp.csv file here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/4798/

@johnpaulkee
Copy link
Contributor Author

Thanks @maddieclayton I've updated the markdown files.
Will check to see if the build succeeds this time.

@johnpaulkee
Copy link
Contributor Author

Looks like Jenkins build succeeded.
https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/4813/

Unsure why the Travis build is failing though. @maddieclayton https://travis-ci.org/Azure/azure-powershell/builds/383972854#L2438 can you take a look?

@johnpaulkee
Copy link
Contributor Author

Travis build succeeded on retry it seems.
@maddieclayton can you check if it's good for merge?

jaredmoo
jaredmoo previously approved these changes May 29, 2018
function Test-CreateVcoreDatabaseWithLicenseType
{
# Setup
$location = "westcentralus"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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"
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

@johnpaulkee johnpaulkee May 29, 2018

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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

@johnpaulkee johnpaulkee May 29, 2018

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.

Copy link
Contributor Author

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

Copy link
Contributor

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
Copy link
Contributor

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)

@maddieclayton
Copy link
Contributor

@maddieclayton maddieclayton changed the base branch from preview to release-6.2.0 May 30, 2018 00:24
@maddieclayton maddieclayton merged commit 2e56ab0 into Azure:release-6.2.0 May 30, 2018
@johnpaulkee
Copy link
Contributor Author

Thanks @maddieclayton for merging!

@jaredmoo
Copy link
Contributor

Thanks @johnpaulkee and @maddieclayton for getting this into 6.2.0 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants