Skip to content

Commit 0d26df4

Browse files
ogailogail
authored andcommitted
Migrate storage management cmdlets
1 parent 826774f commit 0d26df4

13 files changed

+36
-31
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,5 @@ UpgradeLog*.htm
192192

193193
# Microsoft Fakes
194194
FakesAssemblies/
195+
196+
.vs/

src/ResourceManager.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights.Test", "R
9393
EndProject
9494
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.KeyVault.Test", "ResourceManager\KeyVault\Commands.KeyVault.Test\Commands.KeyVault.Test.csproj", "{080B0477-7E52-4455-90AB-23BD13D1B1CE}"
9595
EndProject
96+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Management.Storage.Test", "ResourceManager\Storage\Commands.Management.Storage.Test\Commands.Management.Storage.Test.csproj", "{7D1D3B56-4EB4-4819-86FD-43330DED8EE7}"
97+
EndProject
9698
Global
9799
GlobalSection(SolutionConfigurationPlatforms) = preSolution
98100
Debug|Any CPU = Debug|Any CPU
@@ -263,6 +265,10 @@ Global
263265
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
264266
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
265267
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.Build.0 = Release|Any CPU
268+
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
269+
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
270+
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
271+
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7}.Release|Any CPU.Build.0 = Release|Any CPU
266272
EndGlobalSection
267273
GlobalSection(SolutionProperties) = preSolution
268274
HideSolutionNode = FALSE
@@ -280,5 +286,6 @@ Global
280286
{5FBB9D19-B365-4C97-BEFF-BBD5506A6D25} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
281287
{469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
282288
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
289+
{7D1D3B56-4EB4-4819-86FD-43330DED8EE7} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
283290
EndGlobalSection
284291
EndGlobal

src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@
9898
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
9999
<Reference Include="System.Net" />
100100
<Reference Include="System.Net.Http" />
101-
<Reference Include="System.Net.Http.Extensions, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
102-
<SpecificVersion>False</SpecificVersion>
103-
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll</HintPath>
104-
</Reference>
105-
<Reference Include="System.Net.Http.Primitives, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
106-
<SpecificVersion>False</SpecificVersion>
107-
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll</HintPath>
108-
</Reference>
109101
<Reference Include="System.Net.Http.WebRequest" />
110102
<Reference Include="System.Xml.Linq" />
111103
<Reference Include="System.Data.DataSetExtensions" />

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/Common.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ function Retry-IfException
4949
{
5050
$iter += 1;
5151

52-
&$script;
52+
try
53+
{
54+
&$script;
55+
}
56+
catch
57+
{
58+
59+
}
5360

5461
if ($Error.Count -gt 0)
5562
{

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/StorageAccountTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515

1616
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
1718
using Xunit;
1819

1920
namespace Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests
2021
{
21-
public class StorageAccountTests
22+
public class StorageAccountTests : RMTestBase
2223
{
2324
[Fact]
2425
[Trait(Category.AcceptanceType, Category.CheckIn)]

src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@
136136
<None Include="packages.config" />
137137
</ItemGroup>
138138
<ItemGroup>
139-
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
140-
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
141-
<Name>Commands.Common</Name>
139+
<ProjectReference Include="..\..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
140+
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
141+
<Name>Commands.ResourceManager.Common</Name>
142142
</ProjectReference>
143143
<ProjectReference Include="..\..\Resources\Commands.Resources\Commands.Resources.csproj">
144144
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/GetAzureStorageAccount.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public class GetAzureStorageAccountCommand : StorageAccountBaseCmdlet
3838
[ValidateNotNullOrEmpty]
3939
public string Name { get; set; }
4040

41-
public override void ExecuteCmdlet()
41+
protected override void ProcessRecord()
4242
{
43-
base.ExecuteCmdlet();
43+
base.ProcessRecord();
4444

4545
if (string.IsNullOrEmpty(this.ResourceGroupName))
4646
{

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/GetAzureStorageAccountKey.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public class GetAzureStorageAccountKeyCommand : StorageAccountBaseCmdlet
3838
[ValidateNotNullOrEmpty]
3939
public string Name { get; set; }
4040

41-
public override void ExecuteCmdlet()
41+
protected override void ProcessRecord()
4242
{
43-
base.ExecuteCmdlet();
43+
base.ProcessRecord();
4444

4545
var listKeyResponse = this.StorageClient.StorageAccounts.ListKeys(
4646
this.ResourceGroupName,

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/NewAzureStorageAccount.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public class NewAzureStorageAccountCommand : StorageAccountBaseCmdlet
6060
[ValidateNotNullOrEmpty]
6161
public string Location { get; set; }
6262

63-
public override void ExecuteCmdlet()
63+
protected override void ProcessRecord()
6464
{
65-
base.ExecuteCmdlet();
65+
base.ProcessRecord();
6666

6767
StorageAccountCreateParameters createParameters = new StorageAccountCreateParameters()
6868
{

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/NewAzureStorageAccountKey.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public class NewAzureStorageAccountKeyCommand : StorageAccountBaseCmdlet
5252
[ValidateSet(Key1, Key2, IgnoreCase = true)]
5353
public string KeyName { get; set; }
5454

55-
public override void ExecuteCmdlet()
55+
protected override void ProcessRecord()
5656
{
57-
base.ExecuteCmdlet();
57+
base.ProcessRecord();
5858

5959
KeyName keyName = ParseKeyName(this.KeyName);
6060

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/RemoveAzureStorageAccount.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public class RemoveAzureStorageAccountCommand : StorageAccountBaseCmdlet
4040
[ValidateNotNullOrEmpty]
4141
public string Name { get; set; }
4242

43-
public override void ExecuteCmdlet()
43+
protected override void ProcessRecord()
4444
{
45-
base.ExecuteCmdlet();
45+
base.ProcessRecord();
4646

4747
var op = this.StorageClient.StorageAccounts.Delete(
4848
this.ResourceGroupName,

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureStorageAccount.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public class SetAzureStorageAccountCommand : StorageAccountBaseCmdlet
8989
[ValidateNotNullOrEmpty]
9090
public Hashtable[] Tags { get; set; }
9191

92-
public override void ExecuteCmdlet()
92+
protected override void ProcessRecord()
9393
{
94-
base.ExecuteCmdlet();
94+
base.ProcessRecord();
9595

9696
Dictionary<string, string> tagDictionary = null;
9797
StorageAccountUpdateParameters updateParameters = null;

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/StorageAccountBaseCmdlet.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
using System;
1616
using System.Collections.Generic;
1717
using Microsoft.Azure.Commands.Management.Storage.Models;
18+
using Microsoft.Azure.Commands.ResourceManager.Common;
1819
using Microsoft.Azure.Management.Storage;
1920
using Microsoft.Azure.Management.Storage.Models;
2021
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2122

2223
namespace Microsoft.Azure.Commands.Management.Storage
2324
{
24-
public abstract class StorageAccountBaseCmdlet : AzureSMCmdlet
25+
public abstract class StorageAccountBaseCmdlet : AzureRMCmdlet
2526
{
2627
private StorageManagementClientWrapper storageClientWrapper;
2728

@@ -70,11 +71,6 @@ public string SubscriptionId
7071
}
7172
}
7273

73-
public override void ExecuteCmdlet()
74-
{
75-
base.ExecuteCmdlet();
76-
}
77-
7874
protected static AccountType ParseAccountType(string accountType)
7975
{
8076
if ("Standard_LRS".Equals(accountType, StringComparison.OrdinalIgnoreCase))

0 commit comments

Comments
 (0)