Skip to content

Commit 67e64d3

Browse files
[SQL DB] Update DatabaseOperations Api to version 2024-11-01-preview (#28264)
1 parent 3a95ab7 commit 67e64d3

File tree

10 files changed

+1307
-647
lines changed

10 files changed

+1307
-647
lines changed

src/Sql/Sql.Management.Sdk/Generated/DatabaseOperations.cs

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ internal DatabaseOperations (SqlManagementClient client)
4242
/// Gets a list of operations performed on the database.
4343
/// </summary>
4444
/// <param name='resourceGroupName'>
45-
/// The name of the resource group that contains the resource. You can obtain
46-
/// this value from the Azure Resource Manager API or the portal.
45+
/// The name of the resource group that contains the resource.
4746
/// </param>
4847
/// <param name='serverName'>
4948
/// The name of the server.
@@ -82,23 +81,65 @@ internal DatabaseOperations (SqlManagementClient client)
8281
{
8382
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
8483
}
85-
84+
if (resourceGroupName != null)
85+
{
86+
if (resourceGroupName.Length > 90)
87+
{
88+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
89+
}
90+
if (resourceGroupName.Length < 1)
91+
{
92+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
93+
}
94+
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[\\p{L}\\p{N}_().-]*[\\p{L}\\p{N}_()-]$"))
95+
{
96+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[\\p{L}\\p{N}_().-]*[\\p{L}\\p{N}_()-]$");
97+
}
98+
}
8699
if (serverName == null)
87100
{
88101
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serverName");
89102
}
90-
103+
if (serverName != null)
104+
{
105+
if (serverName.Length > 63)
106+
{
107+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "serverName", 63);
108+
}
109+
if (serverName.Length < 1)
110+
{
111+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "serverName", 1);
112+
}
113+
if (!System.Text.RegularExpressions.Regex.IsMatch(serverName, "^[a-z0-9]+(-*[a-z0-9]+)*$"))
114+
{
115+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "serverName", "^[a-z0-9]+(-*[a-z0-9]+)*$");
116+
}
117+
}
91118
if (databaseName == null)
92119
{
93120
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "databaseName");
94121
}
95-
122+
if (databaseName != null)
123+
{
124+
if (databaseName.Length > 128)
125+
{
126+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "databaseName", 128);
127+
}
128+
if (databaseName.Length < 1)
129+
{
130+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "databaseName", 1);
131+
}
132+
if (!System.Text.RegularExpressions.Regex.IsMatch(databaseName, "^[^<>*%&:\\\\\\/?\\x00-\\x1F]*[^.<>*%&:\\\\\\/?\\s\\x00-\\x1F]$"))
133+
{
134+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "databaseName", "^[^<>*%&:\\\\\\/?\\x00-\\x1F]*[^.<>*%&:\\\\\\/?\\s\\x00-\\x1F]$");
135+
}
136+
}
96137
if (this.Client.SubscriptionId == null)
97138
{
98139
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
99140
}
100141

101-
string apiVersion = "2022-11-01-preview";
142+
string apiVersion = "2024-11-01-preview";
102143
// Tracing
103144
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
104145
string _invocationId = null;
@@ -189,14 +230,13 @@ internal DatabaseOperations (SqlManagementClient client)
189230

190231
if ((int)_statusCode != 200)
191232
{
192-
var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
233+
var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
193234
try
194235
{
195236
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
196-
CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, this.Client.DeserializationSettings);
237+
ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
197238
if (_errorBody != null)
198239
{
199-
ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
200240
ex.Body = _errorBody;
201241
}
202242
}
@@ -206,10 +246,6 @@ internal DatabaseOperations (SqlManagementClient client)
206246
}
207247
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
208248
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
209-
if (_httpResponse.Headers.Contains("x-ms-request-id"))
210-
{
211-
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
212-
}
213249
if (_shouldTrace)
214250
{
215251
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
@@ -320,7 +356,7 @@ internal DatabaseOperations (SqlManagementClient client)
320356
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
321357
}
322358

323-
string apiVersion = "2022-11-01-preview";
359+
string apiVersion = "2024-11-01-preview";
324360
// Tracing
325361
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
326362
string _invocationId = null;
@@ -413,14 +449,13 @@ internal DatabaseOperations (SqlManagementClient client)
413449

414450
if ((int)_statusCode != 200)
415451
{
416-
var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
452+
var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
417453
try
418454
{
419455
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
420-
CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, this.Client.DeserializationSettings);
456+
ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
421457
if (_errorBody != null)
422458
{
423-
ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
424459
ex.Body = _errorBody;
425460
}
426461
}
@@ -430,10 +465,6 @@ internal DatabaseOperations (SqlManagementClient client)
430465
}
431466
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
432467
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
433-
if (_httpResponse.Headers.Contains("x-ms-request-id"))
434-
{
435-
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
436-
}
437468
if (_shouldTrace)
438469
{
439470
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
@@ -577,14 +608,13 @@ internal DatabaseOperations (SqlManagementClient client)
577608

578609
if ((int)_statusCode != 200)
579610
{
580-
var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
611+
var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
581612
try
582613
{
583614
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
584-
CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, this.Client.DeserializationSettings);
615+
ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, this.Client.DeserializationSettings);
585616
if (_errorBody != null)
586617
{
587-
ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
588618
ex.Body = _errorBody;
589619
}
590620
}
@@ -594,10 +624,6 @@ internal DatabaseOperations (SqlManagementClient client)
594624
}
595625
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
596626
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
597-
if (_httpResponse.Headers.Contains("x-ms-request-id"))
598-
{
599-
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
600-
}
601627
if (_shouldTrace)
602628
{
603629
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);

src/Sql/Sql.Management.Sdk/Generated/DatabaseOperationsExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public static partial class DatabaseOperationsExtensions
1919
/// The operations group for this extension method.
2020
/// </param>
2121
/// <param name='resourceGroupName'>
22-
/// The name of the resource group that contains the resource. You can obtain
23-
/// this value from the Azure Resource Manager API or the portal.
22+
/// The name of the resource group that contains the resource.
2423
/// </param>
2524
/// <param name='serverName'>
2625
/// The name of the server.
@@ -40,8 +39,7 @@ public static Microsoft.Rest.Azure.IPage<DatabaseOperation> ListByDatabase(this
4039
/// The operations group for this extension method.
4140
/// </param>
4241
/// <param name='resourceGroupName'>
43-
/// The name of the resource group that contains the resource. You can obtain
44-
/// this value from the Azure Resource Manager API or the portal.
42+
/// The name of the resource group that contains the resource.
4543
/// </param>
4644
/// <param name='serverName'>
4745
/// The name of the server.

src/Sql/Sql.Management.Sdk/Generated/IDatabaseOperations.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public partial interface IDatabaseOperations
2020
/// Gets a list of operations performed on the database.
2121
/// </remarks>
2222
/// <param name='resourceGroupName'>
23-
/// The name of the resource group that contains the resource. You can obtain
24-
/// this value from the Azure Resource Manager API or the portal.
23+
/// The name of the resource group that contains the resource.
2524
/// </param>
2625
/// <param name='serverName'>
2726
/// The name of the server.

src/Sql/Sql.Management.Sdk/Generated/Models/Phase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ namespace Microsoft.Azure.Management.Sql.Models
1313

1414
public static class Phase
1515
{
16+
public const string LogTransitionInProgress = "LogTransitionInProgress";
1617
public const string Copying = "Copying";
18+
public const string BuildingHyperscaleComponents = "BuildingHyperscaleComponents";
1719
public const string Catchup = "Catchup";
1820
public const string WaitingForCutover = "WaitingForCutover";
1921
public const string CutoverInProgress = "CutoverInProgress";

src/Sql/Sql.Management.Sdk/Generated/Models/PhaseDetails.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public PhaseDetails()
2525
/// </summary>
2626

2727
/// <param name="phase">The operation phase.
28-
/// Possible values include: &#39;Copying&#39;, &#39;Catchup&#39;, &#39;WaitingForCutover&#39;,
28+
/// Possible values include: &#39;LogTransitionInProgress&#39;, &#39;Copying&#39;,
29+
/// &#39;BuildingHyperscaleComponents&#39;, &#39;Catchup&#39;, &#39;WaitingForCutover&#39;,
2930
/// &#39;CutoverInProgress&#39;</param>
3031

3132
/// <param name="phaseInformation">The operation phase information.
@@ -45,7 +46,7 @@ public PhaseDetails()
4546

4647

4748
/// <summary>
48-
/// Gets the operation phase. Possible values include: &#39;Copying&#39;, &#39;Catchup&#39;, &#39;WaitingForCutover&#39;, &#39;CutoverInProgress&#39;
49+
/// Gets the operation phase. Possible values include: &#39;LogTransitionInProgress&#39;, &#39;Copying&#39;, &#39;BuildingHyperscaleComponents&#39;, &#39;Catchup&#39;, &#39;WaitingForCutover&#39;, &#39;CutoverInProgress&#39;
4950
/// </summary>
5051
[Newtonsoft.Json.JsonProperty(PropertyName = "phase")]
5152
public string Phase {get; private set; }

src/Sql/Sql.Management.Sdk/Generated/SqlManagementClient.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ public SqlManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCrede
633633
/// <param name='rootHandler'>
634634
/// Optional. The http client handler used to handle http transport.
635635
/// </param>
636+
/// <param name='handlers'>
637+
/// Optional. The delegating handlers to add to the http client pipeline.
638+
/// </param>
636639
/// <exception cref="System.ArgumentNullException">
637640
/// Thrown when a required parameter is null
638641
/// </exception>

src/Sql/Sql.Management.Sdk/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use-extension:
2626
2727
###
2828
``` yaml
29-
commit: a21edd5a33e0db83bde8d1dfe706a0cf3db6409e
29+
commit: 37d29762e68000fc58e03dcefada999f3876f0af
3030
input-file:
3131
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/metrics.json
3232
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/sql.core_legacy.json
@@ -80,7 +80,7 @@ input-file:
8080
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/VirtualNetworkRules.json
8181
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/TransparentDataEncryptions.json
8282
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/BackupShortTermRetentionPolicies.json
83-
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/DatabaseOperations.json
83+
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2024-11-01-preview/DatabaseOperations.json
8484
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/LedgerDigestUploads.json
8585
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/OutboundFirewallRules.json
8686
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/Usages.json

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ function Test-CancelDatabaseOperationInternal
13491349
}
13501350
Catch
13511351
{
1352-
$ErrorMessage = $_.Exception.Message
1352+
$ErrorMessage = (ConvertFrom-Json $_.Exception.Response.Content).error.message
13531353
Assert-AreEqual True $ErrorMessage.Contains("Cannot cancel management operation '" + $dbactivityId + "' in the current state")
13541354
}
13551355
}

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudTests/TestDatabaseCancelOperation.json

Lines changed: 1238 additions & 608 deletions
Large diffs are not rendered by default.

src/Sql/Sql/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Updated `DatabaseOperations` Api to version `2024-11-01-preview` for .Net Sdk
2122

2223
## Version 6.0.4
2324
* Added server level action groups in enum of action groups to be able to be configured via auditing.

0 commit comments

Comments
 (0)