Skip to content

Commit 23d2ddf

Browse files
committed
ADL PowerShell updates for code freeze
Update to latest packages Re-add support for Get/Set permissions Re-add support for removing full ACLs Update functionality of the ACL listing and setting logic Missed a save.
1 parent 8d87ffa commit 23d2ddf

17 files changed

+1358
-756
lines changed

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/GetAzureRmDataLakeAnalyticsDataSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class GetAzureDataLakeAnalyticsDataSource : DataLakeAnalyticsCmdletBase
2626
{
2727
internal const string DataLakeParameterSetName = "Get a Data Lake Store account";
2828
internal const string BlobParameterSetName = "Get a Blob storage account";
29-
internal const string ListStorageParameterSetName = "List a data source";
29+
internal const string ListStorageParameterSetName = "List all data sources";
3030

3131
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,
3232
ParameterSetName = DataLakeParameterSetName, HelpMessage = "Name of the account to add the data source to.")

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/NewAzureRmDataLakeAnalyticsCatalogSecret.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class NewAzureDataLakeAnalyticsCatalogSecret : DataLakeAnalyticsCmdletBas
5555

5656
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 3,
5757
Mandatory = true, HelpMessage = "The host of the database to connect to in the format 'myhost.dns.com'.")]
58-
public string Host { get; set; }
58+
public string DatabaseHost { get; set; }
5959

6060
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 4,
6161
Mandatory = true, HelpMessage = "The Port associated with the host for the database to connect to.")]
@@ -68,7 +68,7 @@ public override void ExecuteCmdlet()
6868
WriteWarning(string.Format(Resources.NoPortSpecified, Uri));
6969
}
7070

71-
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", Host, Port));
71+
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", DatabaseHost, Port));
7272

7373
WriteObject(DataLakeAnalyticsClient.CreateSecret(Account, DatabaseName, Secret.UserName,
7474
Secret.GetNetworkCredential().Password, toUse.AbsoluteUri));

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/SetAzureRmDataLakeAnalyticsCatalogSecret.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class SetAzureDataLakeAnalyticsCatalogSecret : DataLakeAnalyticsCmdletBas
5555

5656
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 3,
5757
Mandatory = true, HelpMessage = "The host of the database to connect to in the format 'myhost.dns.com'.")]
58-
public string Host { get; set; }
58+
public string DatabaseHost { get; set; }
5959

6060
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = BaseParameterSetName, Position = 4,
6161
Mandatory = true, HelpMessage = "The Port associated with the host for the database to connect to.")]
@@ -68,7 +68,7 @@ public override void ExecuteCmdlet()
6868
WriteWarning(string.Format(Resources.NoPortSpecified, Uri));
6969
}
7070

71-
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", Host, Port));
71+
var toUse = Uri ?? new Uri(string.Format("https://{0}:{1}", DatabaseHost, Port));
7272

7373
WriteObject(DataLakeAnalyticsClient.UpdateSecret(Account, DatabaseName, Secret.UserName,
7474
Secret.GetNetworkCredential().Password, toUse.AbsoluteUri));

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<Compile Include="Models\DataLakeStoreFileSystemClient.cs" />
153153
<Compile Include="Models\DataLakeStoreFileSystemCmdletBase.cs" />
154154
<Compile Include="Models\DataLakeStoreItem.cs" />
155-
<Compile Include="Models\DataLakeStoreItemAcl.cs" />
155+
<Compile Include="Models\DataLakeStoreItemAce.cs" />
156156
<Compile Include="Models\DataLakeStoreItemPermissionInstance.cs" />
157157
<Compile Include="Models\DataLakeStorePathInstance.cs" />
158158
<Compile Include="Models\GlobalMembers.cs" />

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/GetAzureRmDataLakeStoreItemAcl.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace Microsoft.Azure.Commands.DataLakeStore
1919
{
20-
[Cmdlet(VerbsCommon.Get, "AzureRmDataLakeStoreItemAcl"), OutputType(typeof(DataLakeStoreItemAcl))]
20+
[Cmdlet(VerbsCommon.Get, "AzureRmDataLakeStoreItemAcl"), OutputType(typeof(DataLakeStoreItemAce))]
2121
[Alias("Get-AdlStoreItemAcl")]
2222
public class GetAzureDataLakeStoreItemAcl : DataLakeStoreFileSystemCmdletBase
2323
{
@@ -37,9 +37,8 @@ public class GetAzureDataLakeStoreItemAcl : DataLakeStoreFileSystemCmdletBase
3737

3838
public override void ExecuteCmdlet()
3939
{
40-
var toReturn = new DataLakeStoreItemAcl();
41-
toReturn.InitializeAces(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath, Account));
42-
WriteObject(toReturn);
40+
var toReturn = DataLakeStoreItemAce.GetAclFromStatus(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath, Account));
41+
WriteObject(toReturn, true);
4342
}
4443
}
4544
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/GetAzureRmDataLakeStoreItemPermissions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace Microsoft.Azure.Commands.DataLakeStore
1919
{
20-
// [Cmdlet(VerbsCommon.Get, "AzureRmDataLakeStoreItemPermissions"), OutputType(typeof(DataLakeStoreItemPermissionInstance))]
21-
// [Alias("Get-AdlStoreItemPermissions")]
20+
[Cmdlet(VerbsCommon.Get, "AzureRmDataLakeStoreItemPermissions"), OutputType(typeof(string))]
21+
[Alias("Get-AdlStoreItemPermissions")]
2222
public class GetAzureDataLakeStoreItemPermissions : DataLakeStoreFileSystemCmdletBase
2323
{
2424
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,
@@ -37,9 +37,7 @@ public class GetAzureDataLakeStoreItemPermissions : DataLakeStoreFileSystemCmdle
3737

3838
public override void ExecuteCmdlet()
3939
{
40-
WriteObject(
41-
DataLakeStoreItemPermissionInstance.Parse(
42-
DataLakeStoreFileSystemClient.GetFileStatus(Path.TransformedPath, Account).Permission));
40+
WriteObject(DataLakeStoreFileSystemClient.GetFileStatus(Path.TransformedPath, Account).Permission);
4341
}
4442
}
4543
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/RemoveAzureRmDataLakeStoreItemAcl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
namespace Microsoft.Azure.Commands.DataLakeStore
2020
{
21-
//[Cmdlet(VerbsCommon.Remove, "AzureRmDataLakeStoreItemAcl"), OutputType(typeof (bool))]
22-
//[Alias("Remove-AdlStoreItemAcl")]
21+
[Cmdlet(VerbsCommon.Remove, "AzureRmDataLakeStoreItemAcl"), OutputType(typeof (bool))]
22+
[Alias("Remove-AdlStoreItemAcl")]
2323
public class RemoveAzureDataLakeStoreItemAcl : DataLakeStoreFileSystemCmdletBase
2424
{
2525
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/RemoveAzureRmDataLakeStoreItemAclEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class RemoveAzureDataLakeStoreItemAclEntry : DataLakeStoreFileSystemCmdle
5757
"The ACL spec containing the entries to remove. These entries MUST exist in the ACL spec for the file already. This can be a modified ACL from Get-AzureDataLakeStoreItemAcl or it can be the string " +
5858
" representation of an ACL as defined in the apache webhdfs specification. Note that this is only supported for named ACEs." +
5959
"This cmdlet is not to be used for setting the owner or owning group.")]
60-
public DataLakeStoreItemAcl Acl { get; set; }
60+
public DataLakeStoreItemAce[] Acl { get; set; }
6161

6262
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = SpecificAceParameterSetName, Position = 2,
6363
Mandatory = true, HelpMessage = "Indicates the type of ACE to remove (user, group, mask, other)")]
@@ -76,10 +76,10 @@ public class RemoveAzureDataLakeStoreItemAclEntry : DataLakeStoreFileSystemCmdle
7676
public SwitchParameter Default { get; set; }
7777

7878
public override void ExecuteCmdlet()
79-
{
79+
{
8080
var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
81-
? Acl.GetAclSpec(false)
82-
: string.Format("{0}{1}:{2}", Default ? "default:" : string.Empty, AceType, Id).ToLowerInvariant();
81+
? DataLakeStoreItemAce.GetAclSpec(Acl, false)
82+
: string.Format("{0}{1}{2}", Default ? "default:" : string.Empty, AceType + ":", !Default ? Id.ToString() : string.Empty).ToLowerInvariant();
8383
ConfirmAction(
8484
string.Format(Resources.RemoveDataLakeStoreItemAcl, string.Empty, Path.OriginalPath),
8585
Path.OriginalPath,

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/SetAzureRmDataLakeStoreItemAcl.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class SetAzureDataLakeStoreItemAcl : DataLakeStoreFileSystemCmdletBase
4343
"The ACL to set. This can be a modified ACL from Get-AzureDataLakeStoreItemAcl or it can be the string " +
4444
" representation of an ACL as defined in the apache webhdfs specification. Note that this is only supported for named ACEs." +
4545
"This cmdlet is not to be used for setting the owner or owning group.")]
46-
public DataLakeStoreItemAcl Acl { get; set; }
46+
public DataLakeStoreItemAce[] Acl { get; set; }
4747

4848
public override void ExecuteCmdlet()
4949
{
@@ -52,8 +52,7 @@ public override void ExecuteCmdlet()
5252
Path.OriginalPath,
5353
() =>
5454
DataLakeStoreFileSystemClient.SetAcl(Path.TransformedPath, Account,
55-
Acl.GetAclSpec()));
56-
55+
DataLakeStoreItemAce.GetAclSpec(Acl)));
5756
}
5857
}
5958
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/SetAzureRmDataLakeStoreItemAclEntry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class SetAzureDataLakeStoreItemAclEntry : DataLakeStoreFileSystemCmdletBa
5656
"The ACL spec containing the entries to set. These entries MUST exist in the ACL spec for the file already. This can be a modified ACL from Get-AzureDataLakeStoreItemAcl or it can be the string " +
5757
" representation of an ACL as defined in the apache webhdfs specification. Note that this is only supported for named ACEs." +
5858
"This cmdlet is not to be used for setting the owner or owning group.")]
59-
public DataLakeStoreItemAcl Acl { get; set; }
59+
public DataLakeStoreItemAce[] Acl { get; set; }
6060

6161
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = SpecificAceParameterSetName, Position = 2,
6262
Mandatory = true, HelpMessage = "Indicates the type of ACE to set (user, group, mask, other)")]
@@ -82,7 +82,7 @@ public class SetAzureDataLakeStoreItemAclEntry : DataLakeStoreFileSystemCmdletBa
8282
public override void ExecuteCmdlet()
8383
{
8484
var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
85-
? Acl.GetAclSpec()
85+
? DataLakeStoreItemAce.GetAclSpec(Acl)
8686
: string.Format("{0}{1}:{2}:{3}", Default ? "default:" : string.Empty, AceType, Id,
8787
DataLakeStoreItemPermissionInstance.GetPermissionString(Permissions)).ToLowerInvariant();
8888

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/SetAzureRmDataLakeStoreItemPermissions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace Microsoft.Azure.Commands.DataLakeStore
1919
{
20-
// [Cmdlet(VerbsCommon.Set, "AzureRmDataLakeStoreItemPermissions"), OutputType(typeof(bool))]
21-
// [Alias("Set-AdlStoreItemPermissions")]
20+
[Cmdlet(VerbsCommon.Set, "AzureRmDataLakeStoreItemPermissions"), OutputType(typeof(bool))]
21+
[Alias("Set-AdlStoreItemPermissions")]
2222
public class SetAzureDataLakeStoreItemPermissions : DataLakeStoreFileSystemCmdletBase
2323
{
2424
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,
@@ -39,12 +39,12 @@ public class SetAzureDataLakeStoreItemPermissions : DataLakeStoreFileSystemCmdle
3939
HelpMessage =
4040
"The permissions to set for the file or folder. This can be expressed as an octal (e.g. '777') or as a friendly string (e.g. 'rwxrwxrwx')"
4141
)]
42-
[ValidateNotNull]
43-
public DataLakeStoreItemPermissionInstance Permissions { get; set; }
42+
[ValidateRange(0, 1777)]
43+
public int Permissions { get; set; }
4444

4545
public override void ExecuteCmdlet()
4646
{
47-
DataLakeStoreFileSystemClient.SetPermission(Path.TransformedPath, Account, Permissions.PermissionsOctal);
47+
DataLakeStoreFileSystemClient.SetPermission(Path.TransformedPath, Account, Permissions.ToString());
4848
WriteObject(true);
4949
}
5050
}

0 commit comments

Comments
 (0)