Skip to content

Commit bf09620

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into release
2 parents a9eb505 + 09c1d0d commit bf09620

File tree

40 files changed

+6190
-4722
lines changed

40 files changed

+6190
-4722
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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.Management.Automation;
16+
using Microsoft.Azure.Management.Storage;
17+
using Microsoft.WindowsAzure.Commands.Common.Storage;
18+
19+
namespace Microsoft.Azure.Commands.Management.Storage.Models
20+
{
21+
public class ARMStorageProvider : IStorageServiceProvider
22+
{
23+
IStorageManagementClient _client;
24+
25+
public ARMStorageProvider(IStorageManagementClient client)
26+
{
27+
_client = client;
28+
}
29+
public IStorageService GetStorageService(string name, string resourceGroupName)
30+
{
31+
var account = _client.StorageAccounts.GetProperties(resourceGroupName, name);
32+
var keys = _client.StorageAccounts.ListKeys(resourceGroupName, name);
33+
return new ARMStorageService(account, keys.Keys[0].Value,
34+
keys.Keys[1].Value);
35+
}
36+
}
37+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
using Microsoft.WindowsAzure.Commands.Common.Storage;
21+
22+
namespace Microsoft.Azure.Commands.Management.Storage.Models
23+
{
24+
public class ARMStorageService : IStorageService
25+
{
26+
Azure.Management.Storage.Models.StorageAccount _account;
27+
List<string> _authenticationKeys = new List<string>();
28+
public ARMStorageService(Azure.Management.Storage.Models.StorageAccount account,
29+
params string[] authenticationKeys)
30+
{
31+
_account = account;
32+
foreach (var key in authenticationKeys)
33+
{
34+
_authenticationKeys.Add(key);
35+
}
36+
}
37+
38+
public Uri BlobEndpoint
39+
{
40+
get { return GetUri(_account.PrimaryEndpoints.Blob); }
41+
}
42+
43+
public Uri FileEndpoint
44+
{
45+
get { return GetUri(_account.PrimaryEndpoints.File); }
46+
}
47+
48+
public Uri QueueEndpoint
49+
{
50+
get { return GetUri(_account.PrimaryEndpoints.Queue); }
51+
}
52+
53+
public Uri TableEndpoint
54+
{
55+
get { return GetUri(_account.PrimaryEndpoints.Table); }
56+
}
57+
58+
public string Name
59+
{
60+
get { return _account.Name; }
61+
}
62+
63+
public List<string> AuthenticationKeys
64+
{
65+
get { return _authenticationKeys; }
66+
}
67+
68+
/// <summary>
69+
/// Get the resource group name from a storage account resource Id
70+
/// </summary>
71+
/// <param name="resourceId">The resource Id for the storage account</param>
72+
/// <returns>The resource group containing the storage account</returns>
73+
public static string ParseResourceGroupFromId(string resourceId)
74+
{
75+
if (!string.IsNullOrEmpty(resourceId))
76+
{
77+
string[] tokens = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
78+
if (tokens == null || tokens.Length < 4)
79+
{
80+
throw new ArgumentOutOfRangeException("resourceId");
81+
}
82+
return tokens[3];
83+
}
84+
return null;
85+
}
86+
87+
public static Uri GetUri(string uriString)
88+
{
89+
return uriString == null ? null : new Uri(uriString);
90+
}
91+
}
92+
}

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6363
<Private>True</Private>
6464
</Reference>
65-
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=0.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65+
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=0.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.10.2-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.11.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
70-
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=0.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=0.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.0.10.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
72+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.0.11.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
7373
<Private>True</Private>
7474
</Reference>
7575
<Reference Include="Microsoft.Azure.Management.Storage">

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ function Test-DataLakeAnalyticsAccount
1919
{
2020
# Creating Account and initial setup
2121
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
22+
23+
# Test to make sure the account doesn't exist
24+
Assert-False {Test-AzureRMDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName}
25+
# Test it without specifying a resource group
26+
Assert-False {Test-AzureRMDataLakeAnalyticsAccount -Name $accountName}
27+
2228
New-AzureRmDataLakeStoreAccount -ResourceGroupName $resourceGroupName -Name $dataLakeAccountName -Location $location
2329
New-AzureRmDataLakeStoreAccount -ResourceGroupName $resourceGroupName -Name $secondDataLakeAccountName -Location $location
2430
$accountCreated = New-AzureRmDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Location $location -DefaultDataLakeStore $dataLakeAccountName
@@ -46,6 +52,11 @@ function Test-DataLakeAnalyticsAccount
4652
Assert-False {$i -eq 60} "dataLakeAnalytics account is not in succeeded state even after 30 min."
4753
}
4854

55+
# Test to make sure the account does exist now
56+
Assert-True {Test-AzureRMDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName}
57+
# Test it without specifying a resource group
58+
Assert-True {Test-AzureRMDataLakeAnalyticsAccount -Name $accountName}
59+
4960
# Updating Account
5061
$tagsToUpdate = @{"Name" = "TestTag"; "Value" = "TestUpdate"}
5162
$accountUpdated = Set-AzureRmDataLakeAnalyticsAccount -ResourceGroupName $resourceGroupName -Name $accountName -Tags $tagsToUpdate

0 commit comments

Comments
 (0)