Skip to content

Commit bb818e8

Browse files
authored
Adding PreferredEnclaveType support for Elastic Pools in Az.Sql cmdlets corresponding to 2022-08-01-preview swagger release (#21348)
* add support for preferred enclave type param and models in elastic pool * add elastic pool crud and database update tests * added changelog and updated help markdown files * added exampes for usage of new parameter * update README.md * fix failures * record tests * updated changelog * Update ChangeLog.md
1 parent 5c817b5 commit bb818e8

21 files changed

+2660
-22
lines changed

src/Sql/Sql.Sdk/Generated/ElasticPoolsOperations.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
518518
{
519519
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
520520
}
521-
string apiVersion = "2021-08-01-preview";
521+
string apiVersion = "2022-08-01-preview";
522522
// Tracing
523523
bool _shouldTrace = ServiceClientTracing.IsEnabled;
524524
string _invocationId = null;
@@ -725,7 +725,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
725725
{
726726
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
727727
}
728-
string apiVersion = "2021-08-01-preview";
728+
string apiVersion = "2022-08-01-preview";
729729
// Tracing
730730
bool _shouldTrace = ServiceClientTracing.IsEnabled;
731731
string _invocationId = null;
@@ -1050,7 +1050,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
10501050
{
10511051
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
10521052
}
1053-
string apiVersion = "2021-08-01-preview";
1053+
string apiVersion = "2022-08-01-preview";
10541054
// Tracing
10551055
bool _shouldTrace = ServiceClientTracing.IsEnabled;
10561056
string _invocationId = null;
@@ -1276,7 +1276,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
12761276
{
12771277
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
12781278
}
1279-
string apiVersion = "2021-08-01-preview";
1279+
string apiVersion = "2022-08-01-preview";
12801280
// Tracing
12811281
bool _shouldTrace = ServiceClientTracing.IsEnabled;
12821282
string _invocationId = null;
@@ -1469,7 +1469,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
14691469
{
14701470
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
14711471
}
1472-
string apiVersion = "2021-08-01-preview";
1472+
string apiVersion = "2022-08-01-preview";
14731473
// Tracing
14741474
bool _shouldTrace = ServiceClientTracing.IsEnabled;
14751475
string _invocationId = null;
@@ -1677,7 +1677,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
16771677
{
16781678
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
16791679
}
1680-
string apiVersion = "2021-08-01-preview";
1680+
string apiVersion = "2022-08-01-preview";
16811681
// Tracing
16821682
bool _shouldTrace = ServiceClientTracing.IsEnabled;
16831683
string _invocationId = null;

src/Sql/Sql.Sdk/Generated/Models/ElasticPool.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public ElasticPool()
5959
/// (ISO8601 format).</param>
6060
/// <param name="maxSizeBytes">The storage limit for the database
6161
/// elastic pool in bytes.</param>
62+
/// <param name="minCapacity">Minimal capacity that serverless pool
63+
/// will not shrink below, if not paused</param>
6264
/// <param name="perDatabaseSettings">The per database settings for the
6365
/// elastic pool.</param>
6466
/// <param name="zoneRedundant">Whether or not this elastic pool is
@@ -72,20 +74,29 @@ public ElasticPool()
7274
/// period when the maintenance updates will will occur.</param>
7375
/// <param name="highAvailabilityReplicaCount">The number of secondary
7476
/// replicas associated with the elastic pool that are used to provide
75-
/// high availability.</param>
76-
public ElasticPool(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Sku sku = default(Sku), string kind = default(string), string state = default(string), System.DateTime? creationDate = default(System.DateTime?), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?))
77+
/// high availability. Applicable only to Hyperscale elastic
78+
/// pools.</param>
79+
/// <param name="preferredEnclaveType">Type of enclave requested on the
80+
/// elastic pool. Possible values include: 'Default', 'VBS'</param>
81+
/// <param name="availabilityZone">Specifies the availability zone the
82+
/// pool's primary replica is pinned to. Possible values include:
83+
/// 'NoPreference', '1', '2', '3'</param>
84+
public ElasticPool(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Sku sku = default(Sku), string kind = default(string), string state = default(string), System.DateTime? creationDate = default(System.DateTime?), long? maxSizeBytes = default(long?), double? minCapacity = default(double?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?), string preferredEnclaveType = default(string), string availabilityZone = default(string))
7785
: base(location, id, name, type, tags)
7886
{
7987
Sku = sku;
8088
Kind = kind;
8189
State = state;
8290
CreationDate = creationDate;
8391
MaxSizeBytes = maxSizeBytes;
92+
MinCapacity = minCapacity;
8493
PerDatabaseSettings = perDatabaseSettings;
8594
ZoneRedundant = zoneRedundant;
8695
LicenseType = licenseType;
8796
MaintenanceConfigurationId = maintenanceConfigurationId;
8897
HighAvailabilityReplicaCount = highAvailabilityReplicaCount;
98+
PreferredEnclaveType = preferredEnclaveType;
99+
AvailabilityZone = availabilityZone;
89100
CustomInit();
90101
}
91102

@@ -139,6 +150,13 @@ public ElasticPool()
139150
[JsonProperty(PropertyName = "properties.maxSizeBytes")]
140151
public long? MaxSizeBytes { get; set; }
141152

153+
/// <summary>
154+
/// Gets or sets minimal capacity that serverless pool will not shrink
155+
/// below, if not paused
156+
/// </summary>
157+
[JsonProperty(PropertyName = "properties.minCapacity")]
158+
public double? MinCapacity { get; set; }
159+
142160
/// <summary>
143161
/// Gets or sets the per database settings for the elastic pool.
144162
/// </summary>
@@ -170,11 +188,27 @@ public ElasticPool()
170188

171189
/// <summary>
172190
/// Gets or sets the number of secondary replicas associated with the
173-
/// elastic pool that are used to provide high availability.
191+
/// elastic pool that are used to provide high availability. Applicable
192+
/// only to Hyperscale elastic pools.
174193
/// </summary>
175194
[JsonProperty(PropertyName = "properties.highAvailabilityReplicaCount")]
176195
public int? HighAvailabilityReplicaCount { get; set; }
177196

197+
/// <summary>
198+
/// Gets or sets type of enclave requested on the elastic pool.
199+
/// Possible values include: 'Default', 'VBS'
200+
/// </summary>
201+
[JsonProperty(PropertyName = "properties.preferredEnclaveType")]
202+
public string PreferredEnclaveType { get; set; }
203+
204+
/// <summary>
205+
/// Gets or sets specifies the availability zone the pool's primary
206+
/// replica is pinned to. Possible values include: 'NoPreference', '1',
207+
/// '2', '3'
208+
/// </summary>
209+
[JsonProperty(PropertyName = "properties.availabilityZone")]
210+
public string AvailabilityZone { get; set; }
211+
178212
/// <summary>
179213
/// Validate the object.
180214
/// </summary>

src/Sql/Sql.Sdk/Generated/Models/ElasticPoolUpdate.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public ElasticPoolUpdate()
3636
/// </summary>
3737
/// <param name="maxSizeBytes">The storage limit for the database
3838
/// elastic pool in bytes.</param>
39+
/// <param name="minCapacity">Minimal capacity that serverless pool
40+
/// will not shrink below, if not paused</param>
3941
/// <param name="perDatabaseSettings">The per database settings for the
4042
/// elastic pool.</param>
4143
/// <param name="zoneRedundant">Whether or not this elastic pool is
@@ -51,16 +53,24 @@ public ElasticPoolUpdate()
5153
/// replicas associated with the elastic pool that are used to provide
5254
/// high availability. Applicable only to Hyperscale elastic
5355
/// pools.</param>
56+
/// <param name="preferredEnclaveType">Type of enclave requested on the
57+
/// elastic pool. Possible values include: 'Default', 'VBS'</param>
58+
/// <param name="availabilityZone">Specifies the availability zone the
59+
/// pool's primary replica is pinned to. Possible values include:
60+
/// 'NoPreference', '1', '2', '3'</param>
5461
/// <param name="tags">Resource tags.</param>
55-
public ElasticPoolUpdate(Sku sku = default(Sku), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?), IDictionary<string, string> tags = default(IDictionary<string, string>))
62+
public ElasticPoolUpdate(Sku sku = default(Sku), long? maxSizeBytes = default(long?), double? minCapacity = default(double?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?), string preferredEnclaveType = default(string), string availabilityZone = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>))
5663
{
5764
Sku = sku;
5865
MaxSizeBytes = maxSizeBytes;
66+
MinCapacity = minCapacity;
5967
PerDatabaseSettings = perDatabaseSettings;
6068
ZoneRedundant = zoneRedundant;
6169
LicenseType = licenseType;
6270
MaintenanceConfigurationId = maintenanceConfigurationId;
6371
HighAvailabilityReplicaCount = highAvailabilityReplicaCount;
72+
PreferredEnclaveType = preferredEnclaveType;
73+
AvailabilityZone = availabilityZone;
6474
Tags = tags;
6575
CustomInit();
6676
}
@@ -82,6 +92,13 @@ public ElasticPoolUpdate()
8292
[JsonProperty(PropertyName = "properties.maxSizeBytes")]
8393
public long? MaxSizeBytes { get; set; }
8494

95+
/// <summary>
96+
/// Gets or sets minimal capacity that serverless pool will not shrink
97+
/// below, if not paused
98+
/// </summary>
99+
[JsonProperty(PropertyName = "properties.minCapacity")]
100+
public double? MinCapacity { get; set; }
101+
85102
/// <summary>
86103
/// Gets or sets the per database settings for the elastic pool.
87104
/// </summary>
@@ -119,6 +136,21 @@ public ElasticPoolUpdate()
119136
[JsonProperty(PropertyName = "properties.highAvailabilityReplicaCount")]
120137
public int? HighAvailabilityReplicaCount { get; set; }
121138

139+
/// <summary>
140+
/// Gets or sets type of enclave requested on the elastic pool.
141+
/// Possible values include: 'Default', 'VBS'
142+
/// </summary>
143+
[JsonProperty(PropertyName = "properties.preferredEnclaveType")]
144+
public string PreferredEnclaveType { get; set; }
145+
146+
/// <summary>
147+
/// Gets or sets specifies the availability zone the pool's primary
148+
/// replica is pinned to. Possible values include: 'NoPreference', '1',
149+
/// '2', '3'
150+
/// </summary>
151+
[JsonProperty(PropertyName = "properties.availabilityZone")]
152+
public string AvailabilityZone { get; set; }
153+
122154
/// <summary>
123155
/// Gets or sets resource tags.
124156
/// </summary>

src/Sql/Sql.Sdk/Generated/SdkInfo_SqlManagementClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static IEnumerable<Tuple<string, string, string>> ApiInfo_SqlManagementCl
3636
new Tuple<string, string, string>("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"),
3737
new Tuple<string, string, string>("Sql", "ElasticPoolOperations", "2020-11-01-preview"),
3838
new Tuple<string, string, string>("Sql", "ElasticPools", "2014-04-01"),
39-
new Tuple<string, string, string>("Sql", "ElasticPools", "2021-08-01-preview"),
39+
new Tuple<string, string, string>("Sql", "ElasticPools", "2022-08-01-preview"),
4040
new Tuple<string, string, string>("Sql", "EncryptionProtectors", "2020-11-01-preview"),
4141
new Tuple<string, string, string>("Sql", "EndpointCertificates", "2021-11-01-preview"),
4242
new Tuple<string, string, string>("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2021-11-01-preview"),

src/Sql/Sql.Sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ input-file:
8989
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/RestorableDroppedManagedDatabases.json
9090
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/DistributedAvailabilityGroups.json
9191
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/ServerTrustCertificates.json
92-
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/ElasticPools.json
9392
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/EndpointCertificates.json
9493
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/ManagedDatabaseSensitivityLabels.json
9594
- https://github.com/Azure/azure-rest-api-specs/blob/e8c0c73d5f11f9f2b7cde8e1ac33638bb3c5695d/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/SensitivityLabels.json
@@ -112,6 +111,7 @@ input-file:
112111
- https://github.com/Azure/azure-rest-api-specs/blob/549bc277952e66577d69ce137eea810c9815ef22/specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/InstanceFailoverGroups.json
113112
- https://github.com/Azure/azure-rest-api-specs/blob/62bb0d101c8aee92e4d77ad14b20e4cf14bb181c/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/Servers.json
114113
- https://github.com/Azure/azure-rest-api-specs/blob/8e7fbe5d8c0e33f99ad365951485107a0ad8a181/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/ServerConfigurationOptions.json
114+
- https://github.com/Azure/azure-rest-api-specs/blob/a67a24b139cab94d66d85546bcdafe6053e71329/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/ElasticPools.json
115115

116116
output-folder: Generated
117117

src/Sql/Sql.Test/ScenarioTests/DatabaseCrudTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ public void TestDatabaseUpdateWithMaintenanceConfigurationId()
116116
TestRunner.RunTestScript("Test-UpdateDatabaseWithMaintenanceConfigurationId");
117117
}
118118

119+
[Fact(Skip = "Cannot re-record.")]
120+
[Trait(Category.AcceptanceType, Category.CheckIn)]
121+
public void TestDatabaseUpdateWithPreferredEnclaveType()
122+
{
123+
TestRunner.RunTestScript("Test-UpdateDatabaseWithPreferredEnclaveType");
124+
}
119125

120126
[Fact]
121127
[Trait(Category.AcceptanceType, Category.CheckIn)]
@@ -189,7 +195,7 @@ public void TestDatabaseCreateWithGeoZoneBackupStorageRedundancy()
189195

190196
[Fact]
191197
[Trait(Category.AcceptanceType, Category.CheckIn)]
192-
public void TestDatabaseCreateWithPreferredEnclaveType ()
198+
public void TestDatabaseCreateWithPreferredEnclaveType()
193199
{
194200
TestRunner.RunTestScript("Test-CreateDatabaseWithPreferredEnclaveType");
195201
}

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,43 @@ function Test-UpdateDatabaseWithMaintenanceConfigurationId
730730
}
731731
}
732732

733+
<#
734+
.SYNOPSIS
735+
Tests updating a database with preferred enclave type
736+
#>
737+
function Test-UpdateDatabaseWithPreferredEnclaveType()
738+
{
739+
# Setup
740+
$location = "eastus2euap"
741+
$rg = Create-ResourceGroupForTest $location
742+
$server = Create-ServerForTest $rg $location
743+
744+
# Create vcore database
745+
$databaseName = Get-DatabaseName
746+
$db = New-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName -RequestedServiceObjectiveName GP_Gen5_2 -Edition GeneralPurpose -PreferredEnclaveType Default -Force
747+
Assert-AreEqual $databaseName $db.DatabaseName
748+
Assert-AreEqual Default $db.PreferredEnclaveType
749+
750+
try
751+
{
752+
# Alter with preferred enclave type - VBS
753+
$db1 = Set-AzSqlDatabase -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName -PreferredEnclaveType VBS
754+
Assert-AreEqual VBS $db1.PreferredEnclaveType
755+
756+
# Test piping - Default PreferredEnclaveType
757+
$db1 = $db1 | Set-AzSqlDatabase -PreferredEnclaveType Default
758+
Assert-AreEqual Default $db1.PreferredEnclaveType
759+
760+
# Test piping - VBS PreferredEnclaveType
761+
$db1 = $db1 | Set-AzSqlDatabase -PreferredEnclaveType VBS
762+
Assert-AreEqual VBS $db1.PreferredEnclaveType
763+
}
764+
finally
765+
{
766+
Remove-ResourceGroupForTest $rg
767+
}
768+
}
769+
733770
<#
734771
.SYNOPSIS
735772
Tests updating a vcore database

src/Sql/Sql.Test/ScenarioTests/ElasticPoolCrudTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ public void TestHyperscaleElasticPoolCreateWithReplica()
7676
TestRunner.RunTestScript("Test-CreateHyperscaleElasticPoolWithReplica");
7777
}
7878

79+
[Fact(Skip = "Cannot re-record. Need MS changes to deploy till canary region.")]
80+
[Trait(Category.AcceptanceType, Category.CheckIn)]
81+
public void TestElasticPoolCreateWithPreferredEnclaveType()
82+
{
83+
TestRunner.RunTestScript("Test-CreateElasticPoolWithPreferredEnclaveType");
84+
}
85+
7986
[Fact]
8087
[Trait(Category.AcceptanceType, Category.CheckIn)]
8188
public void TestElasticPoolUpdate()
@@ -118,6 +125,13 @@ public void TestHyperscaleElasticPoolUpdateReplicaCount()
118125
TestRunner.RunTestScript("Test-UpdateHyperscaleElasticPoolReplicaCount");
119126
}
120127

128+
[Fact(Skip = "Cannot re-record. Need MS changes to deploy till canary region.")]
129+
[Trait(Category.AcceptanceType, Category.CheckIn)]
130+
public void TestElasticPoolUpdateWithPreferredEnclaveType()
131+
{
132+
TestRunner.RunTestScript("Test-UpdateElasticPoolWithPreferredEnclaveType");
133+
}
134+
121135
[Fact]
122136
[Trait(Category.AcceptanceType, Category.CheckIn)]
123137
public void TestMoveDatabaseOutHyperscaleElasticPool()
@@ -146,6 +160,13 @@ public void TestElasticPoolGetWithMaintenanceConfigurationId()
146160
TestRunner.RunTestScript("Test-GetElasticPoolWithMaintenanceConfigurationId");
147161
}
148162

163+
[Fact(Skip = "Cannot re-record. Need MS changes to deploy till canary region.")]
164+
[Trait(Category.AcceptanceType, Category.CheckIn)]
165+
public void TestElasticPoolGetWithPreferredEnclaveType()
166+
{
167+
TestRunner.RunTestScript("Test-GetElasticPoolWithPreferredEnclaveType");
168+
}
169+
149170
[Fact]
150171
[Trait(Category.AcceptanceType, Category.CheckIn)]
151172
public void TestHyperscaleElasticPoolGet()

0 commit comments

Comments
 (0)