Skip to content

Commit 893887b

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
2 parents 6df2bce + ef5a076 commit 893887b

File tree

16 files changed

+218
-18
lines changed

16 files changed

+218
-18
lines changed

setup/azurecmdfiles.wxi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@
500500
</Component>
501501
</Directory>
502502
<Directory Id="dir75F2C4F350248207C418DE5A1C651FB6" Name="AzureRM.Cdn">
503-
<Component Id="cmpD18084727DDF26BDFCE36BE4EF3E3FBC" Guid="*">
504-
<File Id="fil94E16717A827E81C325C0FF864D01FFC" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\AzureRm.Cdn.psd1" />
503+
<Component Id="cmpB7108FC1E0DA3A2DABE2F5A549025C62" Guid="*">
504+
<File Id="filB74B1CDF4E2C5B548CAC901E51955AA5" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\AzureRM.Cdn.psd1" />
505505
</Component>
506506
<Component Id="cmp87DFE6BA28632B552074C8A05968ED49" Guid="*">
507507
<File Id="filB29D13A0412832DF84301430FAF5C2EB" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\AzureRM.Tags.psd1" />
@@ -5064,7 +5064,7 @@
50645064
<ComponentRef Id="cmp8E6B2CBC9EF2E6C9012C5090F2932C68" />
50655065
<ComponentRef Id="cmp30F0EC1B207C0F4C59F81099974C18E3" />
50665066
<ComponentRef Id="cmp22BC5873E0018F5801CD486C6CBCE0C5" />
5067-
<ComponentRef Id="cmpD18084727DDF26BDFCE36BE4EF3E3FBC" />
5067+
<ComponentRef Id="cmpB7108FC1E0DA3A2DABE2F5A549025C62" />
50685068
<ComponentRef Id="cmp87DFE6BA28632B552074C8A05968ED49" />
50695069
<ComponentRef Id="cmpFCC54BA077C7C12B0A49F42DD3039435" />
50705070
<ComponentRef Id="cmp984FE30B4A873A5B1BC8F7E85B1CEF85" />

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/TestController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void RunPsTestWorkflow(
135135
"ScenarioTests\\" + callingClassName + ".ps1",
136136
_helper.RMProfileModule,
137137
_helper.RMResourceModule,
138-
@"AzureRm.Cdn.psd1");
138+
@"AzureRM.Cdn.psd1");
139139

140140
try
141141
{
Binary file not shown.

src/ResourceManager/Cdn/Commands.Cdn/Commands.Cdn.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@
168168
</ProjectReference>
169169
</ItemGroup>
170170
<ItemGroup>
171-
<None Include="AzureRm.Cdn.psd1">
171+
<None Include="..\AzureRM.Cdn.psd1">
172+
<Link>AzureRM.Cdn.psd1</Link>
172173
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
173174
</None>
174175
<None Include="Microsoft.Azure.Commands.Cdn.dll-help.psd1" />

src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</Reference>
5353
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5454
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.10-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.12-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
5858
<SpecificVersion>False</SpecificVersion>
@@ -163,6 +163,7 @@
163163
</ItemGroup>
164164
<ItemGroup>
165165
<Compile Include="HDInsightTestBase.cs" />
166+
<Compile Include="UnitTests\PremiumClusterTests.cs" />
166167
<Compile Include="UnitTests\ScriptActionTests.cs" />
167168
<None Include="ScenarioTests\HDInsightConfigurationTests.ps1">
168169
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/HDInsightConfigurationTests.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
Tests pipelining with creating the config
1919
#>
2020
function Test-ConfigurationPipelining{
21-
#test New-AzureRmHDInsightClusterConfig
22-
$config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop
21+
#test New-AzureRmHDInsightClusterConfig
22+
$config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop -ClusterTier Standard
2323
Assert-NotNull $config.ClusterType
24+
Assert-NotNull $config.ClusterTier
2425

2526
#test Add-AzureRmHDInsightStorage
2627
Assert-AreEqual $config.AdditionalStorageAccounts.Count 0
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Collections.Generic;
16+
using System.Management.Automation;
17+
using Microsoft.Azure.Commands.HDInsight.Models;
18+
using Microsoft.Azure.Management.HDInsight.Models;
19+
using Microsoft.WindowsAzure.Commands.Common;
20+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
21+
using Moq;
22+
using Newtonsoft.Json;
23+
using Xunit;
24+
25+
namespace Microsoft.Azure.Commands.HDInsight.Test
26+
{
27+
public class PremiumClusterTests : HDInsightTestBase
28+
{
29+
private NewAzureHDInsightClusterCommand cmdlet;
30+
private const string StorageName = "PlaceStorageName";
31+
private const string StorageKey = "PlaceStorageKey";
32+
private const int ClusterSize = 4;
33+
34+
private readonly PSCredential _httpCred;
35+
36+
public PremiumClusterTests()
37+
{
38+
base.SetupTestsForManagement();
39+
_httpCred = new PSCredential("hadoopuser", string.Format("Password1!").ConvertToSecureString());
40+
cmdlet = new NewAzureHDInsightClusterCommand
41+
{
42+
CommandRuntime = commandRuntimeMock.Object,
43+
HDInsightManagementClient = hdinsightManagementMock.Object
44+
};
45+
}
46+
47+
[Fact]
48+
[Trait(Category.AcceptanceType, Category.CheckIn)]
49+
public void CanCreateNewPremiumHDInsightCluster()
50+
{
51+
cmdlet.ClusterName = ClusterName;
52+
cmdlet.ResourceGroupName = ResourceGroupName;
53+
cmdlet.ClusterSizeInNodes = ClusterSize;
54+
cmdlet.Location = Location;
55+
cmdlet.HttpCredential = _httpCred;
56+
cmdlet.DefaultStorageAccountName = StorageName;
57+
cmdlet.DefaultStorageAccountKey = StorageKey;
58+
cmdlet.ClusterType = ClusterType;
59+
cmdlet.OSType = OSType.Linux;
60+
cmdlet.ClusterTier = Tier.Premium;
61+
cmdlet.SshCredential = _httpCred;
62+
var cluster = new Cluster
63+
{
64+
Id = "id",
65+
Name = ClusterName,
66+
Location = Location,
67+
Properties = new ClusterGetProperties
68+
{
69+
ClusterVersion = "3.2",
70+
ClusterState = "Running",
71+
ClusterDefinition = new ClusterDefinition
72+
{
73+
ClusterType = ClusterType
74+
},
75+
QuotaInfo = new QuotaInfo
76+
{
77+
CoresUsed = 24
78+
},
79+
OperatingSystemType = OSType.Linux,
80+
ClusterTier = Tier.Premium
81+
}
82+
};
83+
var coreConfigs = new Dictionary<string, string>
84+
{
85+
{"fs.defaultFS", "wasb://giyertestcsmv2@" + StorageName},
86+
{
87+
"fs.azure.account.key." + StorageName,
88+
StorageKey
89+
}
90+
};
91+
var gatewayConfigs = new Dictionary<string, string>
92+
{
93+
{"restAuthCredential.isEnabled", "true"},
94+
{"restAuthCredential.username", _httpCred.UserName},
95+
{"restAuthCredential.password", _httpCred.Password.ConvertToString()}
96+
};
97+
98+
var configurations = new Dictionary<string, Dictionary<string, string>>
99+
{
100+
{"core-site", coreConfigs},
101+
{"gateway", gatewayConfigs}
102+
};
103+
var serializedConfig = JsonConvert.SerializeObject(configurations);
104+
cluster.Properties.ClusterDefinition.Configurations = serializedConfig;
105+
106+
var getresponse = new ClusterGetResponse {Cluster = cluster};
107+
108+
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, It.Is<ClusterCreateParameters>(
109+
parameters =>
110+
parameters.ClusterSizeInNodes == ClusterSize &&
111+
parameters.DefaultStorageAccountName == StorageName &&
112+
parameters.DefaultStorageAccountKey == StorageKey &&
113+
parameters.Location == Location &&
114+
parameters.UserName == _httpCred.UserName &&
115+
parameters.Password == _httpCred.Password.ConvertToString() &&
116+
parameters.SshUserName == _httpCred.UserName &&
117+
parameters.SshPassword == _httpCred.Password.ConvertToString() &&
118+
parameters.ClusterType == ClusterType &&
119+
parameters.OSType == OSType.Linux &&
120+
parameters.ClusterTier == Tier.Premium)))
121+
.Returns(getresponse)
122+
.Verifiable();
123+
124+
cmdlet.ExecuteCmdlet();
125+
126+
commandRuntimeMock.VerifyAll();
127+
commandRuntimeMock.Verify(f => f.WriteObject(It.Is<AzureHDInsightCluster>(
128+
clusterout =>
129+
clusterout.ClusterState == "Running" &&
130+
clusterout.ClusterType == ClusterType &&
131+
clusterout.ClusterVersion == "3.2" &&
132+
clusterout.CoresUsed == 24 &&
133+
clusterout.Location == Location &&
134+
clusterout.Name == ClusterName &&
135+
clusterout.OperatingSystemType == OSType.Linux &&
136+
clusterout.ClusterTier == Tier.Premium)),
137+
Times.Once);
138+
}
139+
}
140+
}

src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.10-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.12-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.19.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />

src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
</Reference>
124124
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
125125
<SpecificVersion>False</SpecificVersion>
126-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.10-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
126+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.12-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
127127
</Reference>
128128
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
129129
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public AzureHDInsightConfig Config
108108
var result = new AzureHDInsightConfig
109109
{
110110
ClusterType = parameters.ClusterType,
111+
ClusterTier = parameters.ClusterTier,
111112
DefaultStorageAccountName = parameters.DefaultStorageAccountName,
112113
DefaultStorageAccountKey = parameters.DefaultStorageAccountKey,
113114
WorkerNodeSize = parameters.WorkerNodeSize,
@@ -140,6 +141,7 @@ var storageAccount in
140141
set
141142
{
142143
parameters.ClusterType = value.ClusterType;
144+
parameters.ClusterTier = value.ClusterTier;
143145
if (parameters.DefaultStorageAccountName == null)
144146
{
145147
parameters.DefaultStorageAccountName = value.DefaultStorageAccountName;
@@ -197,9 +199,9 @@ public string DefaultStorageContainer
197199
get { return parameters.DefaultStorageContainer; }
198200
set { parameters.DefaultStorageContainer = value; }
199201
}
200-
202+
201203
[Parameter(HelpMessage = "Gets or sets the version of the HDInsight cluster.")]
202-
public string Version
204+
public string Version
203205
{
204206
get { return parameters.Version; }
205207
set { parameters.Version = value; }
@@ -213,7 +215,7 @@ public string HeadNodeSize
213215
}
214216

215217
[Parameter(HelpMessage = "Gets or sets the size of the Data Node.")]
216-
public string WorkerNodeSize
218+
public string WorkerNodeSize
217219
{
218220
get { return parameters.WorkerNodeSize; }
219221
set { parameters.WorkerNodeSize = value; }
@@ -254,6 +256,13 @@ public OSType OSType
254256
set { parameters.OSType = value; }
255257
}
256258

259+
[Parameter(HelpMessage = "Gets or sets the cluster tier for this HDInsight cluster.")]
260+
public Tier ClusterTier
261+
{
262+
get { return parameters.ClusterTier; }
263+
set { parameters.ClusterTier = value; }
264+
}
265+
257266
[Parameter(HelpMessage = "Gets or sets SSH credential.")]
258267
public PSCredential SshCredential { get; set; }
259268

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterConfigCommand.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public class NewAzureHDInsightClusterConfigCommand : HDInsightCmdletBase
3232
#region Input Parameter Definitions
3333

3434
[Parameter(HelpMessage = "Gets or sets the StorageName for the default Azure Storage Account.")]
35-
public string DefaultStorageAccountName {
35+
public string DefaultStorageAccountName
36+
{
3637
get { return _config.DefaultStorageAccountName; }
3738
set { _config.DefaultStorageAccountName = value; }
3839
}
@@ -86,6 +87,14 @@ public string ClusterType
8687
set { _config.ClusterType = value; }
8788
}
8889

90+
[Parameter(HelpMessage = "Gets or sets the cluster tier for this HDInsight cluster.")]
91+
public Tier ClusterTier
92+
{
93+
get { return _config.ClusterTier; }
94+
set { _config.ClusterTier = value; }
95+
}
96+
97+
8998
[Parameter(HelpMessage = "Gets or sets the Service Principal Object Id for accessing Azure Data Lake.")]
9099
public Guid ObjectId
91100
{

src/ResourceManager/HDInsight/Commands.HDInsight/Microsoft.Azure.Commands.HDInsight.dll-help.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,6 +3065,13 @@
30653065
</maml:description>
30663066
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
30673067
</command:parameter>
3068+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
3069+
<maml:name>ClusterTier</maml:name>
3070+
<maml:description>
3071+
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
3072+
</maml:description>
3073+
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
3074+
</command:parameter>
30683075
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
30693076
<maml:name>VirtualNetworkId</maml:name>
30703077
<maml:description>
@@ -3387,6 +3394,13 @@
33873394
</dev:type>
33883395
<dev:defaultValue></dev:defaultValue>
33893396
</command:parameter>
3397+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
3398+
<maml:name>ClusterTier</maml:name>
3399+
<maml:description>
3400+
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
3401+
</maml:description>
3402+
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
3403+
</command:parameter>
33903404
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
33913405
<maml:name>VirtualNetworkId</maml:name>
33923406
<maml:description>
@@ -3671,6 +3685,13 @@
36713685
</maml:description>
36723686
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
36733687
</command:parameter>
3688+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
3689+
<maml:name>ClusterTier</maml:name>
3690+
<maml:description>
3691+
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
3692+
</maml:description>
3693+
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
3694+
</command:parameter>
36743695
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
36753696
<maml:name>ObjectId</maml:name>
36763697
<maml:description>
@@ -3812,6 +3833,13 @@
38123833
</dev:type>
38133834
<dev:defaultValue></dev:defaultValue>
38143835
</command:parameter>
3836+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
3837+
<maml:name>ClusterTier</maml:name>
3838+
<maml:description>
3839+
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
3840+
</maml:description>
3841+
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
3842+
</command:parameter>
38153843
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
38163844
<maml:name>ObjectId</maml:name>
38173845
<maml:description>

src/ResourceManager/HDInsight/Commands.HDInsight/Models/Management/AzureHDInsightCluster.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public AzureHDInsightCluster(Cluster cluster)
2929
Location = cluster.Location;
3030
ClusterVersion = cluster.Properties.ClusterVersion;
3131
OperatingSystemType = cluster.Properties.OperatingSystemType;
32+
ClusterTier = cluster.Properties.ClusterTier;
3233
ClusterState = cluster.Properties.ClusterState;
3334
ClusterType = cluster.Properties.ClusterDefinition.ClusterType;
3435
CoresUsed = cluster.Properties.QuotaInfo.CoresUsed;
@@ -80,6 +81,11 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
8081
/// </summary>
8182
public OSType OperatingSystemType { get; set; }
8283

84+
/// <summary>
85+
/// Gets or sets the cluster tier.
86+
/// </summary>
87+
public Tier ClusterTier { get; set; }
88+
8389
/// <summary>
8490
/// The state of the cluster.
8591
/// </summary>
@@ -123,6 +129,6 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
123129
/// <summary>
124130
/// Additional storage accounts for this cluster
125131
/// </summary>
126-
public List<string> AdditionalStorageAccounts { get; set; }
132+
public List<string> AdditionalStorageAccounts { get; set; }
127133
}
128134
}

0 commit comments

Comments
 (0)