@@ -42,8 +42,7 @@ internal DatabaseOperations (SqlManagementClient client)
42
42
/// Gets a list of operations performed on the database.
43
43
/// </summary>
44
44
/// <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.
47
46
/// </param>
48
47
/// <param name='serverName'>
49
48
/// The name of the server.
@@ -82,23 +81,65 @@ internal DatabaseOperations (SqlManagementClient client)
82
81
{
83
82
throw new Microsoft . Rest . ValidationException ( Microsoft . Rest . ValidationRules . CannotBeNull , "resourceGroupName" ) ;
84
83
}
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
+ }
86
99
if ( serverName == null )
87
100
{
88
101
throw new Microsoft . Rest . ValidationException ( Microsoft . Rest . ValidationRules . CannotBeNull , "serverName" ) ;
89
102
}
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
+ }
91
118
if ( databaseName == null )
92
119
{
93
120
throw new Microsoft . Rest . ValidationException ( Microsoft . Rest . ValidationRules . CannotBeNull , "databaseName" ) ;
94
121
}
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
+ }
96
137
if ( this . Client . SubscriptionId == null )
97
138
{
98
139
throw new Microsoft . Rest . ValidationException ( Microsoft . Rest . ValidationRules . CannotBeNull , "this.Client.SubscriptionId" ) ;
99
140
}
100
141
101
- string apiVersion = "2022 -11-01-preview" ;
142
+ string apiVersion = "2024 -11-01-preview" ;
102
143
// Tracing
103
144
bool _shouldTrace = Microsoft . Rest . ServiceClientTracing . IsEnabled ;
104
145
string _invocationId = null ;
@@ -189,14 +230,13 @@ internal DatabaseOperations (SqlManagementClient client)
189
230
190
231
if ( ( int ) _statusCode != 200 )
191
232
{
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 ) ) ;
193
234
try
194
235
{
195
236
_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 ) ;
197
238
if ( _errorBody != null )
198
239
{
199
- ex = new Microsoft . Rest . Azure . CloudException ( _errorBody . Message ) ;
200
240
ex . Body = _errorBody ;
201
241
}
202
242
}
@@ -206,10 +246,6 @@ internal DatabaseOperations (SqlManagementClient client)
206
246
}
207
247
ex . Request = new Microsoft . Rest . HttpRequestMessageWrapper ( _httpRequest , _requestContent ) ;
208
248
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
- }
213
249
if ( _shouldTrace )
214
250
{
215
251
Microsoft . Rest . ServiceClientTracing . Error ( _invocationId , ex ) ;
@@ -320,7 +356,7 @@ internal DatabaseOperations (SqlManagementClient client)
320
356
throw new Microsoft . Rest . ValidationException ( Microsoft . Rest . ValidationRules . CannotBeNull , "this.Client.SubscriptionId" ) ;
321
357
}
322
358
323
- string apiVersion = "2022 -11-01-preview" ;
359
+ string apiVersion = "2024 -11-01-preview" ;
324
360
// Tracing
325
361
bool _shouldTrace = Microsoft . Rest . ServiceClientTracing . IsEnabled ;
326
362
string _invocationId = null ;
@@ -413,14 +449,13 @@ internal DatabaseOperations (SqlManagementClient client)
413
449
414
450
if ( ( int ) _statusCode != 200 )
415
451
{
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 ) ) ;
417
453
try
418
454
{
419
455
_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 ) ;
421
457
if ( _errorBody != null )
422
458
{
423
- ex = new Microsoft . Rest . Azure . CloudException ( _errorBody . Message ) ;
424
459
ex . Body = _errorBody ;
425
460
}
426
461
}
@@ -430,10 +465,6 @@ internal DatabaseOperations (SqlManagementClient client)
430
465
}
431
466
ex . Request = new Microsoft . Rest . HttpRequestMessageWrapper ( _httpRequest , _requestContent ) ;
432
467
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
- }
437
468
if ( _shouldTrace )
438
469
{
439
470
Microsoft . Rest . ServiceClientTracing . Error ( _invocationId , ex ) ;
@@ -577,14 +608,13 @@ internal DatabaseOperations (SqlManagementClient client)
577
608
578
609
if ( ( int ) _statusCode != 200 )
579
610
{
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 ) ) ;
581
612
try
582
613
{
583
614
_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 ) ;
585
616
if ( _errorBody != null )
586
617
{
587
- ex = new Microsoft . Rest . Azure . CloudException ( _errorBody . Message ) ;
588
618
ex . Body = _errorBody ;
589
619
}
590
620
}
@@ -594,10 +624,6 @@ internal DatabaseOperations (SqlManagementClient client)
594
624
}
595
625
ex . Request = new Microsoft . Rest . HttpRequestMessageWrapper ( _httpRequest , _requestContent ) ;
596
626
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
- }
601
627
if ( _shouldTrace )
602
628
{
603
629
Microsoft . Rest . ServiceClientTracing . Error ( _invocationId , ex ) ;
0 commit comments