1
1
// ----------------------------------------------------------------------------------
2
- // ----------------------------------------------------------------------------------
3
2
//
4
3
// Copyright Microsoft Corporation
5
4
// Licensed under the Apache License, Version 2.0 (the "License");
13
12
// limitations under the License.
14
13
// ----------------------------------------------------------------------------------
15
14
16
- using Track2 = Azure . ResourceManager . Storage ;
17
- using Track2Models = Azure . ResourceManager . Storage . Models ;
18
15
using Azure . ResourceManager . Storage . Models ;
19
16
using Microsoft . WindowsAzure . Commands . Common . Attributes ;
20
17
using System ;
21
18
using System . Collections . Generic ;
19
+ using Track2 = Azure . ResourceManager . Storage ;
20
+ using Track2Models = Azure . ResourceManager . Storage . Models ;
22
21
23
22
namespace Microsoft . Azure . Commands . Management . Storage . Models
24
23
{
@@ -94,20 +93,20 @@ public static PSManagementPolicyRule[] GetPSManagementPolicyRules(IList<Track2Mo
94
93
return null ;
95
94
}
96
95
List < PSManagementPolicyRule > psrules = new List < PSManagementPolicyRule > ( ) ;
97
- foreach ( Track2 . Models . ManagementPolicyRule rule in rules )
96
+ foreach ( Track2Models . ManagementPolicyRule rule in rules )
98
97
{
99
98
psrules . Add ( new PSManagementPolicyRule ( rule ) ) ;
100
99
}
101
100
return psrules . ToArray ( ) ;
102
101
}
103
102
104
- public static List < Track2 . Models . ManagementPolicyRule > ParseManagementPolicyRules ( PSManagementPolicyRule [ ] psrules )
103
+ public static List < Track2Models . ManagementPolicyRule > ParseManagementPolicyRules ( PSManagementPolicyRule [ ] psrules )
105
104
{
106
105
if ( psrules == null )
107
106
{
108
107
return null ;
109
108
}
110
- List < Track2 . Models . ManagementPolicyRule > rules = new List < Track2 . Models . ManagementPolicyRule > ( ) ;
109
+ List < Track2Models . ManagementPolicyRule > rules = new List < Track2Models . ManagementPolicyRule > ( ) ;
111
110
foreach ( PSManagementPolicyRule psrule in psrules )
112
111
{
113
112
rules . Add ( psrule . ParseManagementPolicyRule ( ) ) ;
@@ -128,15 +127,15 @@ public PSManagementPolicyDefinition()
128
127
{
129
128
}
130
129
131
- public PSManagementPolicyDefinition ( Track2 . Models . ManagementPolicyDefinition defination )
130
+ public PSManagementPolicyDefinition ( Track2Models . ManagementPolicyDefinition defination )
132
131
{
133
132
this . Actions = defination . Actions is null ? null : new PSManagementPolicyActionGroup ( defination . Actions ) ;
134
133
this . Filters = defination . Filters is null ? null : new PSManagementPolicyRuleFilter ( defination . Filters ) ;
135
134
}
136
- public Track2 . Models . ManagementPolicyDefinition ParseManagementPolicyDefination ( )
135
+ public Track2Models . ManagementPolicyDefinition ParseManagementPolicyDefination ( )
137
136
{
138
- Track2 . Models . ManagementPolicyAction actions = this . Actions ? . ParseManagementPolicyAction ( ) ;
139
- Track2 . Models . ManagementPolicyDefinition policyDefinition = new Track2 . Models . ManagementPolicyDefinition ( actions ) ;
137
+ Track2Models . ManagementPolicyAction actions = this . Actions ? . ParseManagementPolicyAction ( ) ;
138
+ Track2Models . ManagementPolicyDefinition policyDefinition = new Track2Models . ManagementPolicyDefinition ( actions ) ;
140
139
policyDefinition . Filters = this . Filters ? . ParseManagementPolicyFilter ( ) ;
141
140
142
141
return policyDefinition ;
@@ -159,14 +158,14 @@ public class PSManagementPolicyRuleFilter
159
158
public PSManagementPolicyRuleFilter ( )
160
159
{ }
161
160
162
- public PSManagementPolicyRuleFilter ( Track2 . Models . ManagementPolicyFilter filter )
161
+ public PSManagementPolicyRuleFilter ( Track2Models . ManagementPolicyFilter filter )
163
162
{
164
163
this . PrefixMatch = StringListToArray ( filter . PrefixMatch ) ;
165
164
this . BlobTypes = StringListToArray ( filter . BlobTypes ) ;
166
165
}
167
- public Track2 . Models . ManagementPolicyFilter ParseManagementPolicyFilter ( )
166
+ public Track2Models . ManagementPolicyFilter ParseManagementPolicyFilter ( )
168
167
{
169
- Track2 . Models . ManagementPolicyFilter policyFilter = new Track2 . Models . ManagementPolicyFilter ( StringArrayToList ( this . BlobTypes ) ) ;
168
+ Track2Models . ManagementPolicyFilter policyFilter = new Track2Models . ManagementPolicyFilter ( StringArrayToList ( this . BlobTypes ) ) ;
170
169
if ( this . PrefixMatch != null )
171
170
{
172
171
foreach ( string prefixMatch in this . PrefixMatch )
@@ -211,15 +210,15 @@ public class PSManagementPolicyActionGroup
211
210
public PSManagementPolicyActionGroup ( )
212
211
{ }
213
212
214
- public PSManagementPolicyActionGroup ( Track2 . Models . ManagementPolicyAction action )
213
+ public PSManagementPolicyActionGroup ( Track2Models . ManagementPolicyAction action )
215
214
{
216
215
this . BaseBlob = ( action is null || action . BaseBlob is null ) ? null : new PSManagementPolicyBaseBlob ( action . BaseBlob ) ;
217
216
this . Snapshot = ( action is null || action . Snapshot is null ) ? null : new PSManagementPolicySnapShot ( action . Snapshot ) ;
218
217
this . Version = ( action is null || action . Version is null ) ? null : new PSManagementPolicyVersion ( action . Version ) ;
219
218
}
220
- public Track2 . Models . ManagementPolicyAction ParseManagementPolicyAction ( )
219
+ public Track2Models . ManagementPolicyAction ParseManagementPolicyAction ( )
221
220
{
222
- return new Track2 . Models . ManagementPolicyAction ( )
221
+ return new Track2Models . ManagementPolicyAction ( )
223
222
{
224
223
BaseBlob = this . BaseBlob ? . ParseManagementPolicyBaseBlob ( ) ,
225
224
Snapshot = this . Snapshot ? . ParseManagementPolicySnapShot ( ) ,
@@ -241,16 +240,16 @@ public class PSManagementPolicyBaseBlob
241
240
public PSManagementPolicyBaseBlob ( )
242
241
{ }
243
242
244
- public PSManagementPolicyBaseBlob ( Track2 . Models . ManagementPolicyBaseBlob blobAction )
243
+ public PSManagementPolicyBaseBlob ( Track2Models . ManagementPolicyBaseBlob blobAction )
245
244
{
246
245
this . TierToCool = blobAction . TierToCool is null ? null : new PSDateAfterModification ( blobAction . TierToCool ) ;
247
246
this . TierToArchive = blobAction . TierToArchive is null ? null : new PSDateAfterModification ( blobAction . TierToArchive ) ;
248
247
this . Delete = blobAction . Delete is null ? null : new PSDateAfterModification ( blobAction . Delete ) ;
249
248
this . EnableAutoTierToHotFromCool = blobAction . EnableAutoTierToHotFromCool ;
250
249
}
251
- public Track2 . Models . ManagementPolicyBaseBlob ParseManagementPolicyBaseBlob ( )
250
+ public Track2Models . ManagementPolicyBaseBlob ParseManagementPolicyBaseBlob ( )
252
251
{
253
- return new Track2 . Models . ManagementPolicyBaseBlob ( )
252
+ return new Track2Models . ManagementPolicyBaseBlob ( )
254
253
{
255
254
TierToCool = this . TierToCool ? . ParseDateAfterModification ( ) ,
256
255
TierToArchive = this . TierToArchive ? . ParseDateAfterModification ( ) ,
@@ -272,31 +271,29 @@ public class PSManagementPolicySnapShot
272
271
public PSManagementPolicySnapShot ( )
273
272
{ }
274
273
275
- public PSManagementPolicySnapShot ( Track2 . Models . ManagementPolicySnapShot blobAction )
274
+ public PSManagementPolicySnapShot ( Track2Models . ManagementPolicySnapShot blobAction )
276
275
{
277
276
278
277
this . Delete = blobAction . Delete is null ? null : new PSDateAfterCreation ( ( int ) blobAction . Delete . DaysAfterCreationGreaterThan ) ;
279
278
this . TierToCool = blobAction . TierToCool is null ? null : new PSDateAfterCreation ( ( int ) blobAction . TierToCool . DaysAfterCreationGreaterThan ) ;
280
279
TierToArchive = blobAction . TierToArchive is null ? null : new PSDateAfterCreation ( ( int ) blobAction . TierToArchive . DaysAfterCreationGreaterThan ) ;
281
280
}
282
- public Track2 . Models . ManagementPolicySnapShot ParseManagementPolicySnapShot ( )
281
+ public Track2Models . ManagementPolicySnapShot ParseManagementPolicySnapShot ( )
283
282
{
284
283
285
- Track2 . Models . ManagementPolicySnapShot snapShot = new Track2 . Models . ManagementPolicySnapShot ( ) ;
284
+ Track2Models . ManagementPolicySnapShot snapShot = new Track2Models . ManagementPolicySnapShot ( ) ;
286
285
287
286
if ( this . Delete != null )
288
287
{
289
- snapShot . Delete = new Track2 . Models . DateAfterCreation ( this . Delete . DaysAfterCreationGreaterThan ) ;
288
+ snapShot . Delete = new Track2Models . DateAfterCreation ( this . Delete . DaysAfterCreationGreaterThan ) ;
290
289
}
291
290
if ( this . TierToCool != null )
292
291
{
293
- snapShot . TierToCool = new Track2 . Models . DateAfterCreation ( this . TierToCool . DaysAfterCreationGreaterThan ) ;
294
- //snapShot.TierToCoolDaysAfterCreationGreaterThan = this.TierToCool.DaysAfterCreationGreaterThan;
292
+ snapShot . TierToCool = new Track2Models . DateAfterCreation ( this . TierToCool . DaysAfterCreationGreaterThan ) ;
295
293
}
296
294
if ( this . TierToArchive != null )
297
295
{
298
- snapShot . TierToArchive = new Track2 . Models . DateAfterCreation ( this . TierToArchive . DaysAfterCreationGreaterThan ) ;
299
- //snapShot.TierToArchiveDaysAfterCreationGreaterThan = this.TierToArchive.DaysAfterCreationGreaterThan;
296
+ snapShot . TierToArchive = new Track2Models . DateAfterCreation ( this . TierToArchive . DaysAfterCreationGreaterThan ) ;
300
297
}
301
298
302
299
return snapShot ;
@@ -315,29 +312,26 @@ public class PSManagementPolicyVersion
315
312
public PSManagementPolicyVersion ( )
316
313
{ }
317
314
318
- public PSManagementPolicyVersion ( Track2 . Models . ManagementPolicyVersion blobAction )
315
+ public PSManagementPolicyVersion ( Track2Models . ManagementPolicyVersion blobAction )
319
316
{
320
317
this . Delete = blobAction . Delete is null ? null : new PSDateAfterCreation ( ( int ) blobAction . Delete . DaysAfterCreationGreaterThan ) ;
321
318
this . TierToCool = blobAction . TierToCool is null ? null : new PSDateAfterCreation ( ( int ) blobAction . TierToCool . DaysAfterCreationGreaterThan ) ;
322
319
this . TierToArchive = blobAction . TierToArchive is null ? null : new PSDateAfterCreation ( ( int ) blobAction . TierToArchive . DaysAfterCreationGreaterThan ) ;
323
320
}
324
- public Track2 . Models . ManagementPolicyVersion ParseManagementPolicyVersion ( )
321
+ public Track2Models . ManagementPolicyVersion ParseManagementPolicyVersion ( )
325
322
{
326
- Track2 . Models . ManagementPolicyVersion policyVersion = new Track2 . Models . ManagementPolicyVersion ( ) ;
323
+ Track2Models . ManagementPolicyVersion policyVersion = new Track2Models . ManagementPolicyVersion ( ) ;
327
324
if ( this . Delete != null )
328
325
{
329
326
policyVersion . Delete = new DateAfterCreation ( this . Delete . DaysAfterCreationGreaterThan ) ;
330
- //policyVersion.DeleteDaysAfterCreationGreaterThan = this.Delete.DaysAfterCreationGreaterThan;
331
327
}
332
328
if ( this . TierToCool != null )
333
329
{
334
330
policyVersion . TierToCool = new DateAfterCreation ( this . TierToCool . DaysAfterCreationGreaterThan ) ;
335
- //policyVersion.TierToCoolDaysAfterCreationGreaterThan = this.TierToCool.DaysAfterCreationGreaterThan;
336
331
}
337
332
if ( this . TierToArchive != null )
338
333
{
339
334
policyVersion . TierToArchive = new DateAfterCreation ( this . TierToArchive . DaysAfterCreationGreaterThan ) ;
340
- //policyVersion.TierToArchiveDaysAfterCreationGreaterThan = this.TierToArchive.DaysAfterCreationGreaterThan;
341
335
}
342
336
343
337
return policyVersion ;
@@ -380,7 +374,7 @@ public PSDateAfterModification(int? daysAfterModificationGreaterThan, int? daysA
380
374
this . DaysAfterLastTierChangeGreaterThan = DaysAfterLastTierChangeGreaterThan ;
381
375
}
382
376
383
- public PSDateAfterModification ( Track2 . Models . DateAfterModification data )
377
+ public PSDateAfterModification ( Track2Models . DateAfterModification data )
384
378
{
385
379
if ( data . DaysAfterModificationGreaterThan is null )
386
380
{
@@ -399,9 +393,9 @@ public PSDateAfterModification(Track2.Models.DateAfterModification data)
399
393
this . DaysAfterLastAccessTimeGreaterThan = Convert . ToInt32 ( data . DaysAfterLastAccessTimeGreaterThan ) ;
400
394
}
401
395
}
402
- public Track2 . Models . DateAfterModification ParseDateAfterModification ( )
396
+ public Track2Models . DateAfterModification ParseDateAfterModification ( )
403
397
{
404
- Track2 . Models . DateAfterModification dateAfterModification = new Track2 . Models . DateAfterModification ( ) ;
398
+ Track2Models . DateAfterModification dateAfterModification = new Track2Models . DateAfterModification ( ) ;
405
399
dateAfterModification . DaysAfterLastAccessTimeGreaterThan = this . DaysAfterLastAccessTimeGreaterThan ;
406
400
dateAfterModification . DaysAfterModificationGreaterThan = this . DaysAfterModificationGreaterThan ;
407
401
// TODO: Add DaysAfterLastTierChangeGreaterThan once supported by Track2 SDK
0 commit comments