18
18
using Microsoft . Azure . Commands . Sql . ElasticPool . Model ;
19
19
using Microsoft . Azure . Commands . Sql . Server . Adapter ;
20
20
using Microsoft . Azure . Commands . Sql . Services ;
21
- using Microsoft . Azure . Management . Sql . LegacySdk . Models ;
21
+ using Microsoft . Azure . Management . Sql . Models ;
22
22
using System ;
23
23
using System . Collections . Generic ;
24
24
using System . Linq ;
25
25
using Microsoft . Azure . Commands . ResourceManager . Common . Tags ;
26
+ using DatabaseEdition = Microsoft . Azure . Commands . Sql . Database . Model . DatabaseEdition ;
26
27
27
28
namespace Microsoft . Azure . Commands . Sql . ElasticPool . Services
28
29
{
@@ -96,18 +97,15 @@ internal ICollection<AzureSqlElasticPoolModel> ListElasticPools(string resourceG
96
97
/// <returns>The upserted Azure Sql Database ElasticPool</returns>
97
98
internal AzureSqlElasticPoolModel UpsertElasticPool ( AzureSqlElasticPoolModel model )
98
99
{
99
- var resp = Communicator . CreateOrUpdate ( model . ResourceGroupName , model . ServerName , model . ElasticPoolName , Util . GenerateTracingId ( ) , new ElasticPoolCreateOrUpdateParameters ( )
100
+ var resp = Communicator . CreateOrUpdate ( model . ResourceGroupName , model . ServerName , model . ElasticPoolName , Util . GenerateTracingId ( ) , new Management . Sql . Models . ElasticPool
100
101
{
101
102
Location = model . Location ,
102
103
Tags = model . Tags ,
103
- Properties = new ElasticPoolCreateOrUpdateProperties ( )
104
- {
105
- DatabaseDtuMax = model . DatabaseDtuMax ,
106
- DatabaseDtuMin = model . DatabaseDtuMin ,
107
- Edition = model . Edition . ToString ( ) ,
108
- Dtu = model . Dtu ,
109
- StorageMB = model . StorageMB
110
- }
104
+ DatabaseDtuMax = model . DatabaseDtuMax ,
105
+ DatabaseDtuMin = model . DatabaseDtuMin ,
106
+ Edition = model . Edition . ToString ( ) ,
107
+ Dtu = model . Dtu ,
108
+ StorageMB = model . StorageMB
111
109
} ) ;
112
110
113
111
return CreateElasticPoolModelFromResponse ( model . ResourceGroupName , model . ServerName , resp ) ;
@@ -224,24 +222,26 @@ private AzureSqlDatabaseActivityModel CreateDatabaseActivityModelFromResponse(El
224
222
/// <returns>The converted model</returns>
225
223
private AzureSqlElasticPoolActivityModel CreateActivityModelFromResponse ( ElasticPoolActivity model )
226
224
{
227
- AzureSqlElasticPoolActivityModel activity = new AzureSqlElasticPoolActivityModel ( ) ;
225
+ AzureSqlElasticPoolActivityModel activity = new AzureSqlElasticPoolActivityModel
226
+ {
227
+ ElasticPoolName = model . ElasticPoolName ,
228
+ EndTime = model . EndTime ,
229
+ ErrorCode = model . ErrorCode ,
230
+ ErrorMessage = model . ErrorMessage ,
231
+ ErrorSeverity = model . ErrorSeverity ,
232
+ Operation = model . Operation ,
233
+ OperationId = model . OperationId ,
234
+ PercentComplete = model . PercentComplete ,
235
+ RequestedDatabaseDtuMax = model . RequestedDatabaseDtuMax ,
236
+ RequestedDatabaseDtuMin = model . RequestedDatabaseDtuMin ,
237
+ RequestedDtu = model . RequestedDtu ,
238
+ RequestedElasticPoolName = model . RequestedElasticPoolName ,
239
+ RequestedStorageLimitInGB = model . RequestedStorageLimitInGB ,
240
+ ServerName = model . ServerName ,
241
+ StartTime = model . StartTime ,
242
+ State = model . State
243
+ } ;
228
244
229
- activity . ElasticPoolName = model . Properties . ElasticPoolName ;
230
- activity . EndTime = model . Properties . EndTime ;
231
- activity . ErrorCode = model . Properties . ErrorCode ;
232
- activity . ErrorMessage = model . Properties . ErrorMessage ;
233
- activity . ErrorSeverity = model . Properties . ErrorSeverity ;
234
- activity . Operation = model . Properties . Operation ;
235
- activity . OperationId = model . Properties . OperationId ;
236
- activity . PercentComplete = model . Properties . PercentComplete ;
237
- activity . RequestedDatabaseDtuMax = model . Properties . RequestedDatabaseDtuMax ;
238
- activity . RequestedDatabaseDtuMin = model . Properties . RequestedDatabaseDtuMin ;
239
- activity . RequestedDtu = model . Properties . RequestedDtu ;
240
- activity . RequestedElasticPoolName = model . Properties . RequestedElasticPoolName ;
241
- activity . RequestedStorageLimitInGB = model . Properties . RequestedStorageLimitInGB ;
242
- activity . ServerName = model . Properties . ServerName ;
243
- activity . StartTime = model . Properties . StartTime ;
244
- activity . State = model . Properties . State ;
245
245
246
246
return activity ;
247
247
}
@@ -266,26 +266,28 @@ public string GetServerLocation(string resourceGroupName, string serverName)
266
266
/// <param name="serverName">The name of the Azure Sql Database Server</param>
267
267
/// <param name="pool">The service response</param>
268
268
/// <returns>The converted model</returns>
269
- private AzureSqlElasticPoolModel CreateElasticPoolModelFromResponse ( string resourceGroup , string serverName , Management . Sql . LegacySdk . Models . ElasticPool pool )
269
+ private AzureSqlElasticPoolModel CreateElasticPoolModelFromResponse ( string resourceGroup , string serverName , Management . Sql . Models . ElasticPool pool )
270
270
{
271
- AzureSqlElasticPoolModel model = new AzureSqlElasticPoolModel ( ) ;
272
-
273
- model . ResourceId = pool . Id ;
274
- model . ResourceGroupName = resourceGroup ;
275
- model . ServerName = serverName ;
276
- model . ElasticPoolName = pool . Name ;
277
- model . CreationDate = pool . Properties . CreationDate ?? DateTime . MinValue ;
278
- model . DatabaseDtuMax = ( int ) pool . Properties . DatabaseDtuMax ;
279
- model . DatabaseDtuMin = ( int ) pool . Properties . DatabaseDtuMin ;
280
- model . Dtu = ( int ) pool . Properties . Dtu ;
281
- model . State = pool . Properties . State ;
282
- model . StorageMB = pool . Properties . StorageMB ;
283
- model . Tags = TagsConversionHelper . CreateTagDictionary ( TagsConversionHelper . CreateTagHashtable ( pool . Tags ) , false ) ;
284
- model . Location = pool . Location ;
285
-
286
271
DatabaseEdition edition = DatabaseEdition . None ;
287
- Enum . TryParse < DatabaseEdition > ( pool . Properties . Edition , out edition ) ;
288
- model . Edition = edition ;
272
+ Enum . TryParse < DatabaseEdition > ( pool . Edition , out edition ) ;
273
+
274
+ AzureSqlElasticPoolModel model = new AzureSqlElasticPoolModel
275
+ {
276
+ ResourceId = pool . Id ,
277
+ ResourceGroupName = resourceGroup ,
278
+ ServerName = serverName ,
279
+ ElasticPoolName = pool . Name ,
280
+ CreationDate = pool . CreationDate ?? DateTime . MinValue ,
281
+ DatabaseDtuMax = pool . DatabaseDtuMax . Value ,
282
+ DatabaseDtuMin = pool . DatabaseDtuMin . Value ,
283
+ Dtu = pool . Dtu ,
284
+ State = pool . State ,
285
+ StorageMB = pool . StorageMB ,
286
+ Tags =
287
+ TagsConversionHelper . CreateTagDictionary ( TagsConversionHelper . CreateTagHashtable ( pool . Tags ) , false ) ,
288
+ Location = pool . Location ,
289
+ Edition = edition
290
+ } ;
289
291
290
292
return model ;
291
293
}
0 commit comments