Skip to content

Commit f1742c2

Browse files
committed
Addressing comments from pull request
1 parent 128f008 commit f1742c2

File tree

10 files changed

+262
-261
lines changed

10 files changed

+262
-261
lines changed

ChangeLog.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
* Ability to Get-AzSqlServerServiceObjective by location without needing a preexisting server in the region.
9696
* Support for time zone parameter in Managed Instance create.
9797
* Fix documentation for wildcards
98-
* Support of Serverless specific parameters
9998

10099
#### Az.Websites
101100
* fixes the Set-AzWebApp and Set-AzWebAppSlot to not remove the tags on execution

src/Sql/Sql.Test/ScenarioTests/DatabaseCrudTests.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ function Test-CreateServerlessDatabase
198198
{
199199
# Create with Edition and RequestedServiceObjectiveName
200200
$databaseName = Get-DatabaseName
201-
$job1 = New-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName -RequestedServiceObjectiveName GP_S_Gen5_2 -AutoPauseDelayMinutes 360 -MinVCore 0.5 -AsJob
201+
$job1 = New-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName -RequestedServiceObjectiveName GP_S_Gen5_2 -AutoPauseDelayInMinutes 360 -MinVCore 0.5 -AsJob
202202
$job1 | Wait-Job
203203
$db = $job1.Output
204204

205205
Assert-AreEqual $databaseName $db.DatabaseName
206206
Assert-NotNull $db.MaxSizeBytes
207207
Assert-AreEqual GP_S_Gen5_2 $db.CurrentServiceObjectiveName
208208
Assert-AreEqual 2 $db.Capacity
209-
Assert-AreEqual 360 $db.AutoPauseDelayMinutes
210-
Assert-AreEqual 0.5 $db.MinCapacity
209+
Assert-AreEqual 360 $db.AutoPauseDelayInMinutes
210+
Assert-AreEqual 0.5 $db.MinimumCapacity
211211
Assert-AreEqual GeneralPurpose $db.Edition
212212
}
213213
finally
@@ -573,8 +573,8 @@ function Test-UpdateServerlessDatabase()
573573
Assert-NotNull $db1.MaxSizeBytes
574574
Assert-NotNull $db1.Edition
575575
Assert-NotNull $db1.CurrentServiceObjectiveName
576-
Assert-NotNull $db1.MinCapacity
577-
Assert-NotNull $db1.AutoPauseDelayMinutes
576+
Assert-NotNull $db1.MinimumCapacity
577+
Assert-NotNull $db1.AutoPauseDelayInMinutes
578578

579579
# Alter to dtu database
580580
$job = Set-AzSqlDatabase -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName `
@@ -583,8 +583,8 @@ function Test-UpdateServerlessDatabase()
583583
$db1 = $job.Output
584584
Assert-AreEqual $db1.DatabaseName $db.DatabaseName
585585
Assert-AreEqual $db1.Edition Premium
586-
Assert-Null $db1.MinCapacity
587-
Assert-Null $db1.AutoPauseDelayMinutes
586+
Assert-Null $db1.MinimumCapacity
587+
Assert-Null $db1.AutoPauseDelayInMinutes
588588

589589
# Alter back to Serverless
590590
$job = Set-AzSqlDatabase -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName `
@@ -594,19 +594,19 @@ function Test-UpdateServerlessDatabase()
594594
Assert-AreEqual $db1.DatabaseName $db.DatabaseName
595595
Assert-AreEqual $db1.Edition GeneralPurpose
596596
Assert-AreEqual $db1.CurrentServiceObjectiveName GP_S_Gen5_2
597-
Assert-NotNull $db1.MinCapacity
598-
Assert-NotNull $db1.AutoPauseDelayMinutes
597+
Assert-NotNull $db1.MinimumCapacity
598+
Assert-NotNull $db1.AutoPauseDelayInMinutes
599599

600-
# Alter mincapacity and autopausedelayminutes
600+
# Alter mincapacity and AutoPauseDelayInMinutes
601601
$job = Set-AzSqlDatabase -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName `
602-
-Vcore 2 -Edition GeneralPurpose -ComputeModel Serverless -ComputeGeneration Gen5 -MinCapacity 2 -AutoPauseDelayMinutes 1440 -AsJob
602+
-Vcore 2 -Edition GeneralPurpose -ComputeModel Serverless -ComputeGeneration Gen5 -MinimumCapacity 2 -AutoPauseDelayInMinutes 1440 -AsJob
603603
$job | Wait-Job
604604
$db1 = $job.Output
605605
Assert-AreEqual $db1.DatabaseName $db.DatabaseName
606606
Assert-AreEqual $db1.Edition GeneralPurpose
607607
Assert-AreEqual $db1.CurrentServiceObjectiveName GP_S_Gen5_2
608-
Assert-AreEqual $db1.MinCapacity 2
609-
Assert-AreEqual $db1.AutoPauseDelayMinutes 1440
608+
Assert-AreEqual $db1.MinimumCapacity 2
609+
Assert-AreEqual $db1.AutoPauseDelayInMinutes 1440
610610
}
611611
finally
612612
{

src/Sql/Sql/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Ability to Get-AzSqlServerServiceObjective by location without needing a preexisting server in the region.
2828
* Support for time zone parameter in Managed Instance create.
2929
* Fix documentation for wildcards
30-
* Support of Serverless specific parameters
30+
* Support of Serverless specific parameters in New-AzSqlDatabase and Set-AzSqlDatabase
3131

3232
## Version 1.8.0
3333
* Support Database Data Classification.

src/Sql/Sql/Database/Cmdlet/NewAzureSqlDatabase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,16 @@ public class NewAzureSqlDatabase : AzureSqlDatabaseCmdletBase<AzureSqlDatabaseCr
173173
/// Gets or sets the Auto Pause delay for Azure Sql Database
174174
/// </summary>
175175
[Parameter(Mandatory = false,
176-
HelpMessage = "The auto pause delay in minutes for database(serverless only), -1 to opt out")]
177-
public int? AutoPauseDelayMinutes { get; set; }
176+
HelpMessage = "The auto pause delay in minutes for database(serverless only), -1 to opt out from pausing")]
177+
public int AutoPauseDelayInMinutes { get; set; }
178178

179179
/// <summary>
180180
/// Gets or sets the Minimal capacity that database will always have allocated, if not paused
181181
/// </summary>
182182
[Parameter(Mandatory = false,
183183
HelpMessage = "The Minimal capacity that database will always have allocated, if not paused. For serverless database only.")]
184-
[Alias("MinVCore")]
185-
public double? MinCapacity { get; set; }
184+
[Alias("MinVCore", "MinCapacity")]
185+
public double MinimumCapacity { get; set; }
186186

187187
/// <summary>
188188
/// Overriding to add warning message
@@ -244,8 +244,8 @@ protected override AzureSqlDatabaseCreateOrUpdateModel ApplyUserInputToModel(Azu
244244
ReadScale = ReadScale,
245245
ZoneRedundant = MyInvocation.BoundParameters.ContainsKey("ZoneRedundant") ? (bool?)ZoneRedundant.ToBool() : null,
246246
LicenseType = LicenseType, // note: default license type will be LicenseIncluded in SQL RP if not specified
247-
AutoPauseDelayMinutes = AutoPauseDelayMinutes,
248-
MinCapacity = MinCapacity,
247+
AutoPauseDelayInMinutes = MyInvocation.BoundParameters.ContainsKey("AutoPauseDelayInMinutes") ? AutoPauseDelayInMinutes : (int?)null,
248+
MinimumCapacity = MyInvocation.BoundParameters.ContainsKey("AutoPauseDelayInMinutes") ? MinimumCapacity : (double?)null,
249249
};
250250

251251
if(ParameterSetName == DtuDatabaseParameterSet)

src/Sql/Sql/Database/Cmdlet/SetAzureSqlDatabase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ public class SetAzureSqlDatabase : AzureSqlDatabaseCmdletBase<IEnumerable<AzureS
194194
/// Gets or sets the auto pause delay for the Azure Sql Database
195195
/// </summary>
196196
[Parameter(Mandatory = false,
197-
HelpMessage = "The auto pause delay in minutes for database (serverless only), -1 to opt out",
197+
HelpMessage = "The auto pause delay in minutes for database (serverless only), -1 to opt out from pausing",
198198
ParameterSetName = UpdateParameterSetName)]
199199
[Parameter(Mandatory = false,
200-
HelpMessage = "The auto pause delay in minutes for database (serverless only), -1 to opt out",
200+
HelpMessage = "The auto pause delay in minutes for database (serverless only), -1 to opt out from pausing",
201201
ParameterSetName = VcoreDatabaseParameterSet)]
202-
public int? AutoPauseDelayMinutes { get; set; }
202+
public int AutoPauseDelayInMinutes { get; set; }
203203

204204
/// <summary>
205205
/// Gets or sets the Minimal capacity that database will always have allocated, if not paused
@@ -210,8 +210,8 @@ public class SetAzureSqlDatabase : AzureSqlDatabaseCmdletBase<IEnumerable<AzureS
210210
[Parameter(Mandatory = false,
211211
HelpMessage = "The Minimal capacity that database will always have allocated, if not paused. For serverless database only.",
212212
ParameterSetName = VcoreDatabaseParameterSet)]
213-
[Alias("MinVCore")]
214-
public double? MinCapacity { get; set; }
213+
[Alias("MinVCore", "MinCapacity")]
214+
public double MinimumCapacity { get; set; }
215215

216216
/// <summary>
217217
/// Overriding to add warning message
@@ -255,8 +255,8 @@ protected override IEnumerable<AzureSqlDatabaseModel> ApplyUserInputToModel(IEnu
255255
? (bool?)ZoneRedundant.ToBool()
256256
: null,
257257
LicenseType = LicenseType ?? model.FirstOrDefault().LicenseType, // set to original license type
258-
AutoPauseDelayMinutes = AutoPauseDelayMinutes,
259-
MinCapacity = MinCapacity,
258+
AutoPauseDelayInMinutes = MyInvocation.BoundParameters.ContainsKey("AutoPauseDelayInMinutes") ? AutoPauseDelayInMinutes : (int?)null,
259+
MinimumCapacity = MyInvocation.BoundParameters.ContainsKey("MinimumCapacity") ? MinimumCapacity : (double?)null,
260260
};
261261

262262
var database = ModelAdapter.GetDatabase(ResourceGroupName, ServerName, DatabaseName);

src/Sql/Sql/Database/Model/AzureSqlDatabaseModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ public class AzureSqlDatabaseModel
168168
/// <summary>
169169
/// Gets or sets the Auto pause delay of the database
170170
/// </summary>
171-
public int? AutoPauseDelayMinutes { get; set; }
171+
public int? AutoPauseDelayInMinutes { get; set; }
172172

173173
/// <summary>
174174
/// Minimal capacity that database will always have allocated, if not paused
175175
/// </summary>
176-
public double? MinCapacity { get; set; }
176+
public double? MinimumCapacity { get; set; }
177177

178178
/// <summary>
179179
/// Construct AzureSqlDatabaseModel
@@ -223,8 +223,8 @@ public AzureSqlDatabaseModel(string resourceGroup, string serverName, Management
223223
ReadScale = readScale;
224224

225225
ZoneRedundant = false;
226-
AutoPauseDelayMinutes = null;
227-
MinCapacity = null;
226+
AutoPauseDelayInMinutes = null;
227+
MinimumCapacity = null;
228228
}
229229

230230
/// <summary>
@@ -272,8 +272,8 @@ public AzureSqlDatabaseModel(string resourceGroup, string serverName, Management
272272

273273
LicenseType = database.LicenseType;
274274

275-
AutoPauseDelayMinutes = database.AutoPauseDelay;
276-
MinCapacity = database.MinCapacity;
275+
AutoPauseDelayInMinutes = database.AutoPauseDelay;
276+
MinimumCapacity = database.MinCapacity;
277277
}
278278
}
279279
}

src/Sql/Sql/Database/Services/AzureSqlDatabaseAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ internal AzureSqlDatabaseModel UpsertDatabaseWithNewSdk(string resourceGroup, st
158158
ZoneRedundant = model.Database.ZoneRedundant,
159159
ElasticPoolId = elasticPoolId,
160160
LicenseType = model.Database.LicenseType,
161-
AutoPauseDelay = model.Database.AutoPauseDelayMinutes,
162-
MinCapacity = model.Database.MinCapacity,
161+
AutoPauseDelay = model.Database.AutoPauseDelayInMinutes,
162+
MinCapacity = model.Database.MinimumCapacity,
163163
});
164164

165165
return CreateDatabaseModelFromResponse(resourceGroup, serverName, resp);

src/Sql/Sql/help/New-AzSqlDatabase.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Creates a database or an elastic database.
1818
New-AzSqlDatabase -DatabaseName <String> [-CollationName <String>] [-CatalogCollation <String>]
1919
[-MaxSizeBytes <Int64>] [-Edition <String>] [-RequestedServiceObjectiveName <String>]
2020
[-ElasticPoolName <String>] [-ReadScale <DatabaseReadScale>] [-Tags <Hashtable>] [-SampleName <String>]
21-
[-ZoneRedundant] [-AsJob] [-LicenseType <String>] [-AutoPauseDelayMinutes <Int32>] [-MinCapacity <Double>]
21+
[-ZoneRedundant] [-AsJob] [-LicenseType <String>] [-AutoPauseDelayInMinutes <Int32>] [-MinimumCapacity <Double>]
2222
[-ServerName] <String> [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
2323
[-Confirm] [<CommonParameters>]
2424
```
@@ -28,7 +28,7 @@ New-AzSqlDatabase -DatabaseName <String> [-CollationName <String>] [-CatalogColl
2828
New-AzSqlDatabase -DatabaseName <String> [-CollationName <String>] [-CatalogCollation <String>]
2929
[-MaxSizeBytes <Int64>] -Edition <String> [-ReadScale <DatabaseReadScale>] [-Tags <Hashtable>]
3030
[-SampleName <String>] [-ZoneRedundant] [-AsJob] -VCore <Int32> -ComputeGeneration <String>
31-
[-LicenseType <String>] [-ComputeModel <String>] [-AutoPauseDelayMinutes <Int32>] [-MinCapacity <Double>]
31+
[-LicenseType <String>] [-ComputeModel <String>] [-AutoPauseDelayInMinutes <Int32>] [-MinimumCapacity <Double>]
3232
[-ServerName] <String> [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
3333
[-Confirm] [<CommonParameters>]
3434
```
@@ -141,8 +141,8 @@ Capacity : 2
141141
Family : Gen5
142142
SkuName : GP_S_Gen5
143143
LicenseType : LicenseIncluded
144-
AutoPauseDelayMinutes : 360
145-
MinCapacity : 0.5
144+
AutoPauseDelayInMinutes : 360
145+
MinimumCapacity : 0.5
146146
```
147147

148148
This command creates a Serverless database named Database04 on server Server01.
@@ -164,11 +164,11 @@ Accept pipeline input: False
164164
Accept wildcard characters: False
165165
```
166166
167-
### -AutoPauseDelayMinutes
167+
### -AutoPauseDelayInMinutes
168168
The auto pause delay in minutes for database(serverless only), -1 to opt out
169169
170170
```yaml
171-
Type: System.Nullable`1[System.Int32]
171+
Type: System.Int32
172172
Parameter Sets: (All)
173173
Aliases:
174174

@@ -225,7 +225,7 @@ Accept wildcard characters: False
225225
```
226226
227227
### -ComputeModel
228-
The compute model for Azure Sql database
228+
The compute model for Azure Sql database. Serverless or Provisioned
229229
230230
```yaml
231231
Type: System.String
@@ -352,14 +352,14 @@ Accept pipeline input: False
352352
Accept wildcard characters: False
353353
```
354354
355-
### -MinCapacity
355+
### -MinimumCapacity
356356
The Minimal capacity that database will always have allocated, if not paused.
357357
For serverless Azure Sql databases only.
358358
359359
```yaml
360-
Type: System.Nullable`1[System.Double]
360+
Type: System.Double
361361
Parameter Sets: (All)
362-
Aliases: MinVCore
362+
Aliases: MinVCore, MinCapacity
363363

364364
Required: False
365365
Position: Named

src/Sql/Sql/help/Set-AzSqlDatabase.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Sets properties for a database, or moves an existing database into an elastic po
1818
Set-AzSqlDatabase [-DatabaseName] <String> [-MaxSizeBytes <Int64>] [-Edition <String>]
1919
[-RequestedServiceObjectiveName <String>] [-ElasticPoolName <String>] [-ReadScale <DatabaseReadScale>]
2020
[-Tags <Hashtable>] [-ZoneRedundant] [-AsJob] [-LicenseType <String>] [-ComputeModel <String>]
21-
[-AutoPauseDelayMinutes <Int32>] [-MinCapacity <Double>] [-ServerName] <String>
21+
[-AutoPauseDelayInMinutes <Int32>] [-MinimumCapacity <Double>] [-ServerName] <String>
2222
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
2323
[<CommonParameters>]
2424
```
@@ -28,7 +28,7 @@ Set-AzSqlDatabase [-DatabaseName] <String> [-MaxSizeBytes <Int64>] [-Edition <St
2828
Set-AzSqlDatabase [-DatabaseName] <String> [-MaxSizeBytes <Int64>] [-Edition <String>]
2929
[-ReadScale <DatabaseReadScale>] [-Tags <Hashtable>] [-ZoneRedundant] [-AsJob] [-VCore <Int32>]
3030
[-ComputeGeneration <String>] [-LicenseType <String>] [-ComputeModel <String>]
31-
[-AutoPauseDelayMinutes <Int32>] [-MinCapacity <Double>] [-ServerName] <String>
31+
[-AutoPauseDelayInMinutes <Int32>] [-MinimumCapacity <Double>] [-ServerName] <String>
3232
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
3333
[<CommonParameters>]
3434
```
@@ -137,11 +137,11 @@ Accept pipeline input: False
137137
Accept wildcard characters: False
138138
```
139139
140-
### -AutoPauseDelayMinutes
140+
### -AutoPauseDelayInMinutes
141141
The auto pause delay in minutes for database (serverless only), -1 to opt out
142142
143143
```yaml
144-
Type: System.Nullable`1[System.Int32]
144+
Type: System.Int32
145145
Parameter Sets: Update, VcoreBasedDatabase
146146
Aliases:
147147

@@ -168,7 +168,7 @@ Accept wildcard characters: False
168168
```
169169
170170
### -ComputeModel
171-
Computed model of Azure Sql database, serverless or preprovisioned
171+
Computed model of Azure Sql database. Serverless or Provisioned
172172
173173
```yaml
174174
Type: System.String
@@ -284,12 +284,12 @@ Accept pipeline input: False
284284
Accept wildcard characters: False
285285
```
286286
287-
### -MinCapacity
287+
### -MinimumCapacity
288288
The Minimal capacity that database will always have allocated, if not paused.
289289
For serverless Azure Sql databases only.
290290
291291
```yaml
292-
Type: System.Nullable`1[System.Double]
292+
Type: System.Double
293293
Parameter Sets: Update, VcoreBasedDatabase
294294
Aliases: MinVCore
295295

0 commit comments

Comments
 (0)