Skip to content

Commit 2444c9b

Browse files
committed
Initial package updates for ADL PS
This is a prep commit for a PR to the release candidate while I wait on PR approval for SDK. Unchecked changes. Updates to make the compiler happy. Compilation fix that wasn't caught by VS for some reason. Make static analysis happy.
1 parent 23d2ddf commit 2444c9b

24 files changed

+1987
-719
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
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.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.11.5-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
65+
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=0.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.12.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
6767
<Private>True</Private>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=0.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -256,4 +256,4 @@
256256
<ItemGroup />
257257
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
258258
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
259-
</Project>
259+
</Project>

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
<Reference Include="Microsoft.Azure.Common.NetFramework">
4646
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4747
</Reference>
48-
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=0.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.11.5-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
48+
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=0.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.0.12.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
5252
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -117,7 +117,10 @@
117117
</ItemGroup>
118118
<ItemGroup>
119119
<Compile Include="Commands\GetAzureRmDataLakeAnalyticsDataSource.cs" />
120+
<Compile Include="Commands\NewAzureRmDataLakeAnalyticsCatalogCredential.cs" />
121+
<Compile Include="Commands\RemoveAzureRmDataLakeAnalyticsCatalogCredential.cs" />
120122
<Compile Include="Commands\RemoveAzureRmDataLakeAnalyticsCatalogSecret.cs" />
123+
<Compile Include="Commands\SetAzureRmDataLakeAnalyticsCatalogCredential.cs" />
121124
<Compile Include="Commands\SetAzureRmDataLakeAnalyticsCatalogSecret.cs" />
122125
<Compile Include="Commands\NewAzureRmDataLakeAnalyticsCatalogSecret.cs" />
123126
<Compile Include="Commands\TestAzureRmDataLakeAnalyticsCatalogItem.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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 Microsoft.Azure.Commands.DataLakeAnalytics.Models;
16+
using Microsoft.Azure.Commands.DataLakeAnalytics.Properties;
17+
using Microsoft.Azure.Management.DataLake.Analytics.Models;
18+
using System;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.DataLakeAnalytics
22+
{
23+
[Cmdlet(VerbsCommon.New, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
24+
[Alias("New-AdlCatalogCredential")]
25+
public class NewAzureDataLakeAnalyticsCatalogCredential : DataLakeAnalyticsCmdletBase
26+
{
27+
internal const string BaseParameterSetName = "Specify full URI";
28+
internal const string HostAndPortParameterSetName = "Specify host name and port";
29+
30+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 0,
31+
Mandatory = true, HelpMessage = "The account name that contains the catalog to create the credential in.")]
32+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 0,
33+
Mandatory = true, HelpMessage = "The account name that contains the catalog to create the credential in.")]
34+
[ValidateNotNullOrEmpty]
35+
[Alias("AccountName")]
36+
public string Account { get; set; }
37+
38+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 1,
39+
Mandatory = true, HelpMessage = "The name of the database to create the credential in.")]
40+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 1,
41+
Mandatory = true, HelpMessage = "The name of the database to create the credential in.")]
42+
[ValidateNotNullOrEmpty]
43+
public string DatabaseName { get; set; }
44+
45+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 2,
46+
Mandatory = true, HelpMessage = "The name of the credential to create.")]
47+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 2,
48+
Mandatory = true, HelpMessage = "The name of the credential to create.")]
49+
[ValidateNotNullOrEmpty]
50+
public string CredentialName { get; set; }
51+
52+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 3,
53+
Mandatory = true, HelpMessage = "The credential to create, which includes the user ID and password that can authenticate to the data source")]
54+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 3,
55+
Mandatory = true, HelpMessage = "The credential to create, which includes the user ID and password that can authenticate to the data source")]
56+
[ValidateNotNullOrEmpty]
57+
public PSCredential Credential { get; set; }
58+
59+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 4,
60+
Mandatory = true, HelpMessage = "The URI of the database to connect to.")]
61+
public Uri Uri { get; set; }
62+
63+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 4,
64+
Mandatory = true, HelpMessage = "The host of the database to connect to in the format 'myhost.dns.com'.")]
65+
public string DatabaseHost { get; set; }
66+
67+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 5,
68+
Mandatory = true, HelpMessage = "The Port associated with the host for the database to connect to.")]
69+
public int Port { get; set; }
70+
71+
public override void ExecuteCmdlet()
72+
{
73+
if (Uri != null && Uri.Port <= 0)
74+
{
75+
WriteWarning(string.Format(Resources.NoPortSpecified, Uri));
76+
}
77+
78+
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", DatabaseHost, Port));
79+
80+
DataLakeAnalyticsClient.CreateCredential(Account, DatabaseName, CredentialName, Credential.UserName,
81+
Credential.GetNetworkCredential().Password, toUse.AbsoluteUri);
82+
}
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 Microsoft.Azure.Commands.DataLakeAnalytics.Models;
16+
using Microsoft.Azure.Commands.DataLakeAnalytics.Properties;
17+
using System.Management.Automation;
18+
19+
namespace Microsoft.Azure.Commands.DataLakeAnalytics
20+
{
21+
[Cmdlet(VerbsCommon.Remove, "AzureRmDataLakeAnalyticsCatalogCredential", SupportsShouldProcess = true), OutputType(typeof(bool))]
22+
[Alias("Remove-AdlCatalogCredential")]
23+
public class RemoveAzureDataLakeAnalyticsCredential : DataLakeAnalyticsCmdletBase
24+
{
25+
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,
26+
HelpMessage = "The account name that contains the catalog to remove the credential from.")]
27+
[ValidateNotNullOrEmpty]
28+
[Alias("AccountName")]
29+
public string Account { get; set; }
30+
31+
[Parameter(ValueFromPipelineByPropertyName = true, Position = 1, Mandatory = true,
32+
HelpMessage = "The name of the database to remove the credential from.")]
33+
[ValidateNotNullOrEmpty]
34+
public string DatabaseName { get; set; }
35+
36+
[Parameter(ValueFromPipelineByPropertyName = true, Position = 2, Mandatory = true,
37+
HelpMessage =
38+
"Name of credential to be removed.")]
39+
[ValidateNotNullOrEmpty]
40+
public string Name { get; set; }
41+
42+
[Parameter(ValueFromPipelineByPropertyName = true, Position = 3, Mandatory = false,
43+
HelpMessage =
44+
"The password for the credential. This is required if the caller is not the owner of the account.")]
45+
[ValidateNotNull]
46+
public PSCredential Password { get; set; }
47+
48+
[Parameter(Position = 4, Mandatory = false, HelpMessage = "Do not ask for confirmation.")]
49+
public SwitchParameter Force { get; set; }
50+
51+
[Parameter(Position = 5, Mandatory = false)]
52+
public SwitchParameter PassThru { get; set; }
53+
54+
public override void ExecuteCmdlet()
55+
{
56+
ConfirmAction(
57+
Force.IsPresent,
58+
string.Format(Resources.RemovingDataLakeAnalyticsCatalogCredential, Name),
59+
string.Format(Resources.RemoveDataLakeAnalyticsCatalogCredential, Name),
60+
Name,
61+
() =>
62+
{
63+
DataLakeAnalyticsClient.DeleteCredential(Account, DatabaseName, Name, Password != null ? Password.GetNetworkCredential().Password : null);
64+
if (PassThru)
65+
{
66+
WriteObject(true);
67+
}
68+
});
69+
}
70+
}
71+
}
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 Microsoft.Azure.Commands.DataLakeAnalytics.Models;
16+
using Microsoft.Azure.Commands.DataLakeAnalytics.Properties;
17+
using Microsoft.Azure.Management.DataLake.Analytics.Models;
18+
using System;
19+
using System.Management.Automation;
20+
using System.Security;
21+
22+
namespace Microsoft.Azure.Commands.DataLakeAnalytics
23+
{
24+
[Cmdlet(VerbsCommon.Set, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
25+
[Alias("Set-AdlCatalogCredential")]
26+
public class SetAzureDataLakeAnalyticsCatalogCredential : DataLakeAnalyticsCmdletBase
27+
{
28+
internal const string BaseParameterSetName = "Specify full URI";
29+
internal const string HostAndPortParameterSetName = "Specify host name and port";
30+
31+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 0,
32+
Mandatory = true, HelpMessage = "The account name that contains the catalog to create the credential in.")]
33+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 0,
34+
Mandatory = true, HelpMessage = "The account name that contains the catalog to create the credential in.")]
35+
[ValidateNotNullOrEmpty]
36+
[Alias("AccountName")]
37+
public string Account { get; set; }
38+
39+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 1,
40+
Mandatory = true, HelpMessage = "The name of the database to create the credential in.")]
41+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 1,
42+
Mandatory = true, HelpMessage = "The name of the database to create the credential in.")]
43+
[ValidateNotNullOrEmpty]
44+
public string DatabaseName { get; set; }
45+
46+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 1,
47+
Mandatory = true, HelpMessage = "The name of the credential to create.")]
48+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 1,
49+
Mandatory = true, HelpMessage = "The name of the credential to create.")]
50+
[ValidateNotNullOrEmpty]
51+
public string CredentialName { get; set; }
52+
53+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 2,
54+
Mandatory = true, HelpMessage = "The credential to create, which includes the user ID and password that can authenticate to the data source")]
55+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 2,
56+
Mandatory = true, HelpMessage = "The credential to create, which includes the user ID and password that can authenticate to the data source")]
57+
[ValidateNotNullOrEmpty]
58+
public PSCredential Credential { get; set; }
59+
60+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 3,
61+
Mandatory = true, HelpMessage = "The new password for the credential")]
62+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 3,
63+
Mandatory = true, HelpMessage = "The new password for the credential")]
64+
[ValidateNotNullOrEmpty]
65+
public PSCredential NewPassword { get; set; }
66+
67+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = HostAndPortParameterSetName, Position = 4,
68+
Mandatory = true, HelpMessage = "The URI of the database to connect to.")]
69+
public Uri Uri { get; set; }
70+
71+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 4,
72+
Mandatory = true, HelpMessage = "The host of the database to connect to in the format 'myhost.dns.com'.")]
73+
public string DatabaseHost { get; set; }
74+
75+
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 5,
76+
Mandatory = true, HelpMessage = "The Port associated with the host for the database to connect to.")]
77+
public int Port { get; set; }
78+
79+
public override void ExecuteCmdlet()
80+
{
81+
if (Uri != null && Uri.Port <= 0)
82+
{
83+
WriteWarning(string.Format(Resources.NoPortSpecified, Uri));
84+
}
85+
86+
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", DatabaseHost, Port));
87+
88+
DataLakeAnalyticsClient.UpdateCredentialPassword(Account, DatabaseName, CredentialName, Credential.UserName,
89+
Credential.GetNetworkCredential().Password, NewPassword.GetNetworkCredential().Password, toUse.AbsoluteUri);
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)