Skip to content

Commit 85aba87

Browse files
authored
track2 initial setup and StorageAccount related cmdlets (#13)
* track2 initial setup and StorageAccount related cmdlets * fix bugs and formatting per comments * Fix AccountIdentityType
1 parent c11047e commit 85aba87

13 files changed

+857
-471
lines changed

src/Storage/Storage.Management/Models/PSAzureFilesIdentityBasedAuthentication.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Storage.Models;
15+
using Track2Models = Azure.ResourceManager.Storage.Models;
1616

1717
namespace Microsoft.Azure.Commands.Management.Storage.Models
1818
{
1919
public class PSAzureFilesIdentityBasedAuthentication
2020
{
21-
public PSAzureFilesIdentityBasedAuthentication(AzureFilesIdentityBasedAuthentication auth)
21+
public PSAzureFilesIdentityBasedAuthentication(Track2Models.AzureFilesIdentityBasedAuthentication auth)
2222
{
2323
if (auth != null)
2424
{
25-
this.DirectoryServiceOptions = auth.DirectoryServiceOptions;
25+
this.DirectoryServiceOptions = auth.DirectoryServiceOptions.ToString();
2626
this.ActiveDirectoryProperties = auth.ActiveDirectoryProperties != null ? new PSActiveDirectoryProperties(auth.ActiveDirectoryProperties) : null;
27-
this.DefaultSharePermission = auth.DefaultSharePermission;
27+
this.DefaultSharePermission = auth.DefaultSharePermission.ToString();
2828
}
2929
}
3030
// Gets or sets indicates the directory service used. Possible values include: 'None','AADDS', 'AD'
@@ -35,7 +35,7 @@ public PSAzureFilesIdentityBasedAuthentication(AzureFilesIdentityBasedAuthentica
3535

3636
public class PSActiveDirectoryProperties
3737
{
38-
public PSActiveDirectoryProperties(ActiveDirectoryProperties properties)
38+
public PSActiveDirectoryProperties(Track2Models.ActiveDirectoryProperties properties)
3939
{
4040
if (properties != null)
4141
{
@@ -46,7 +46,7 @@ public PSActiveDirectoryProperties(ActiveDirectoryProperties properties)
4646
this.DomainSid = properties.DomainSid;
4747
this.AzureStorageSid = properties.AzureStorageSid;
4848
this.SamAccountName = properties.SamAccountName;
49-
this.AccountType = properties.AccountType;
49+
this.AccountType = properties.AccountType != null ? properties.AccountType.ToString() : null;
5050
}
5151
}
5252
public string DomainName { get; set; }

src/Storage/Storage.Management/Models/PSBlobRestore.cs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1818
using System;
1919
using System.Collections.Generic;
20+
using Track2Models = Azure.ResourceManager.Storage.Models;
2021

2122
namespace Microsoft.Azure.Commands.Management.Storage.Models
2223
{
@@ -37,48 +38,40 @@ public PSBlobRestoreRange(string startRange, string endRange)
3738
this.EndRange = endRange;
3839
}
3940

40-
public PSBlobRestoreRange(BlobRestoreRange range)
41+
public PSBlobRestoreRange(Track2Models.BlobRestoreRange range)
4142
{
4243
this.StartRange = range.StartRange;
4344
this.EndRange = range.EndRange;
4445
}
4546

46-
public static IList<BlobRestoreRange> ParseBlobRestoreRanges(PSBlobRestoreRange[] ranges)
47+
public static IList<Track2Models.BlobRestoreRange> ParseBlobRestoreRanges(PSBlobRestoreRange[] ranges)
4748
{
48-
IList<BlobRestoreRange> re = new List<BlobRestoreRange>();
49+
IList<Track2Models.BlobRestoreRange> re = new List<Track2Models.BlobRestoreRange>();
4950
if (ranges == null)
5051
{
5152
re.Add(
52-
new BlobRestoreRange
53-
{
54-
StartRange = "",
55-
EndRange = ""
56-
});
53+
new Track2Models.BlobRestoreRange("", ""));
5754
}
5855
else
5956
{
6057
foreach (PSBlobRestoreRange range in ranges)
6158
{
6259
re.Add(
63-
new BlobRestoreRange
64-
{
65-
StartRange = range.StartRange,
66-
EndRange = range.EndRange
67-
});
60+
new Track2Models.BlobRestoreRange(range.EndRange, range.StartRange));
6861
}
6962
}
7063
return re;
7164
}
7265

73-
public static PSBlobRestoreRange[] ParsePSBlobRestoreRanges(IList<BlobRestoreRange> ranges)
66+
public static PSBlobRestoreRange[] ParsePSBlobRestoreRanges(IList<Track2Models.BlobRestoreRange> ranges)
7467
{
7568
if (ranges == null)
7669
{
7770
return null;
7871
}
7972

8073
List<PSBlobRestoreRange> re = new List<PSBlobRestoreRange>();
81-
foreach (BlobRestoreRange range in ranges)
74+
foreach (Track2Models.BlobRestoreRange range in ranges)
8275
{
8376
re.Add(
8477
new PSBlobRestoreRange
@@ -109,11 +102,11 @@ public class PSBlobRestoreStatus
109102
public PSBlobRestoreStatus()
110103
{ }
111104

112-
public PSBlobRestoreStatus(BlobRestoreStatus status)
105+
public PSBlobRestoreStatus(Track2Models.BlobRestoreStatus status)
113106
{
114107
if (status != null)
115108
{
116-
this.Status = status.Status;
109+
this.Status = status.Status != null ? status.Status.ToString() : null;
117110
this.FailureReason = status.FailureReason;
118111
this.RestoreId = status.RestoreId;
119112
this.Parameters = status.Parameters is null ? null : new PSBlobRestoreParameters(status.Parameters);
@@ -126,13 +119,13 @@ public PSBlobRestoreStatus(BlobRestoreStatus status)
126119
/// </summary>
127120
public class PSBlobRestoreParameters
128121
{
129-
public DateTime TimeToRestore { get; set; }
122+
public DateTimeOffset TimeToRestore { get; set; }
130123
public PSBlobRestoreRange[] BlobRanges { get; set; }
131124

132125
public PSBlobRestoreParameters()
133126
{ }
134127

135-
public PSBlobRestoreParameters(BlobRestoreParameters parameters)
128+
public PSBlobRestoreParameters(Track2Models.BlobRestoreContent parameters)
136129
{
137130
this.TimeToRestore = parameters.TimeToRestore;
138131
this.BlobRanges = PSBlobRestoreRange.ParsePSBlobRestoreRanges(parameters.BlobRanges);

src/Storage/Storage.Management/Models/PSGeoReplicationStats.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Storage.Models;
15+
using Track2Models = Azure.ResourceManager.Storage.Models;
1616
using System;
1717

1818
namespace Microsoft.Azure.Commands.Management.Storage.Models
1919
{
2020
public class PSGeoReplicationStats
2121
{
22-
//Parse GeoReplicationStats in SDK to wrapped property PSGeoReplicationStats
23-
public static PSGeoReplicationStats ParsePSGeoReplicationStats(GeoReplicationStats geoReplicationStats)
22+
//Parse GeoReplicationStats in SDK to wrapped property PSGeoReplicationStats
23+
public static PSGeoReplicationStats ParsePSGeoReplicationStats(Track2Models.GeoReplicationStats geoReplicationStats)
2424
{
2525
if (geoReplicationStats == null)
2626
{
2727
return null;
2828
}
2929

30-
PSGeoReplicationStats pSGeoReplicationStats = new PSGeoReplicationStats();
31-
32-
pSGeoReplicationStats.Status = geoReplicationStats.Status;
33-
pSGeoReplicationStats.LastSyncTime = geoReplicationStats.LastSyncTime;
34-
pSGeoReplicationStats.CanFailover = geoReplicationStats.CanFailover;
35-
30+
PSGeoReplicationStats pSGeoReplicationStats = new PSGeoReplicationStats
31+
{
32+
Status = geoReplicationStats.Status != null ? geoReplicationStats.Status.ToString() : null,
33+
LastSyncTime = geoReplicationStats.LastSyncOn,
34+
CanFailover = geoReplicationStats.CanFailover != null ? geoReplicationStats.CanFailover : null
35+
};
3636
return pSGeoReplicationStats;
3737
}
3838

3939
public string Status { get; set; }
40-
public DateTime? LastSyncTime { get; set; }
40+
public DateTimeOffset? LastSyncTime { get; set; }
4141
public bool? CanFailover { get; set; }
4242
}
4343
}

0 commit comments

Comments
 (0)