public override void ExecuteCmdlet()
        {
            WriteWarning(Resources.IncorrectOutputTypeWarning);
            ConfirmAction(
                string.Format(Resources.SetDataLakeStoreItemAcl, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account,
                                                                       Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList(), RequestedAclType.SetAcl, Concurrency, this, ShowProgress, CmdletCancellationToken);
                }
                else
                {
                    DataLakeStoreFileSystemClient.SetAcl(
                        Path.TransformedPath,
                        Account,
                        Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList());
                }

                if (PassThru)
                {
                    WriteObject(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath,
                                                                           Account).Entries.Select(entry => new DataLakeStoreItemAce(entry)));
                }
            });
        }
예제 #2
0
        public override void ExecuteCmdlet()
        {
            WriteWarning(Resources.IncorrectOutputTypeWarning);
            var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
                ? Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList()
                : new List <AclEntry>()
            {
                new AclEntry((AclType)AceType, Id.ToString(), Default ? AclScope.Default : AclScope.Access, (AclAction)Permissions)
            };

            ConfirmAction(
                string.Format(Resources.SetDataLakeStoreItemAcl, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account,
                                                                       Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList(), RequestedAclType.ModifyAcl, Concurrency);
                }
                else
                {
                    DataLakeStoreFileSystemClient.ModifyAcl(Path.TransformedPath, Account,
                                                            aclSpec);
                }

                if (PassThru)
                {
                    WriteObject(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath,
                                                                           Account).Entries.Select(entry => new DataLakeStoreItemAce(entry)));
                }
            });
        }
예제 #3
0
        public override void ExecuteCmdlet()
        {
            var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
                ? Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList()
                : new List <AclEntry>()
            {
                new AclEntry((AclType)AceType, Id.ToString(), Default ? AclScope.Default : AclScope.Access, AclAction.None)
            };                                                                                                                                         // Action doesnt have any affect here so just hardcoded some constant

            ConfirmAction(
                string.Format(Resources.RemoveDataLakeStoreItemAcl, string.Empty, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    // Currently SDK default thread calculation is not correct, so pass a default thread count
                    int threadCount = Concurrency == -1 ? DataLakeStoreFileSystemClient.ImportExportMaxThreads : Concurrency;

                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account, aclSpec, RequestedAclType.RemoveAcl, threadCount, this, ShowProgress, CmdletCancellationToken);
                }
                else
                {
                    DataLakeStoreFileSystemClient.RemoveAclEntries(Path.TransformedPath, Account, aclSpec);
                }

                if (PassThru)
                {
                    WriteObject(true);
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
                ? Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList()
                : new List <AclEntry>()
            {
                new AclEntry((AclType)AceType, Id.ToString(), Default ? AclScope.Default : AclScope.Access, AclAction.None)
            };                                                                                                                                         // Action doesnt have any affect here so just hardcoded some constant

            ConfirmAction(
                string.Format(Resources.RemoveDataLakeStoreItemAcl, string.Empty, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account, aclSpec, RequestedAclType.RemoveAcl, Concurrency);
                }
                else
                {
                    DataLakeStoreFileSystemClient.RemoveAclEntries(Path.TransformedPath, Account, aclSpec);
                }

                if (PassThru)
                {
                    WriteObject(true);
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            WriteWarning(Resources.IncorrectOutputTypeWarning);
            ConfirmAction(
                string.Format(Resources.SetDataLakeStoreItemAcl, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    // Currently SDK default thread calculation is not correct, so pass a default thread count
                    int threadCount = Concurrency == -1 ? DataLakeStoreFileSystemClient.ImportExportMaxThreads : Concurrency;

                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account,
                                                                       Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList(), RequestedAclType.SetAcl, threadCount, this, ShowProgress, CmdletCancellationToken);
                }
                else
                {
                    DataLakeStoreFileSystemClient.SetAcl(
                        Path.TransformedPath,
                        Account,
                        Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList());
                }

                if (PassThru)
                {
                    WriteObject(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath,
                                                                           Account).Entries.Select(entry => new DataLakeStoreItemAce(entry)));
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            WriteWarning(Resources.IncorrectOutputTypeWarning);
            var aclSpec = ParameterSetName.Equals(BaseParameterSetName)
                ? Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList()
                : new List <AclEntry> {
                new AclEntry((AclType)AceType, Id.ToString(), Default ? AclScope.Default : AclScope.Access, (AclAction)Permissions)
            };

            bool recurseAndDefaultAcls = Recurse && !aclSpec.Any(aclEntry => aclEntry.Scope == AclScope.Access);

            // For recurse and all acls are default, give a warning message
            if (recurseAndDefaultAcls)
            {
                WriteWarning(Resources.SetOnlyDefaultAclRecursively);
            }

            ConfirmAction(
                string.Format(Resources.SetDataLakeStoreItemAcl, Path.OriginalPath) + (recurseAndDefaultAcls ? "\n" + Resources.SetOnlyDefaultAclRecursively : ""),
                Path.OriginalPath,
                () =>
            {
                if (Recurse)
                {
                    // Currently SDK default thread calculation is not correct, so pass a default thread count
                    int threadCount = Concurrency == -1 ? DataLakeStoreFileSystemClient.ImportExportMaxThreads : Concurrency;

                    DataLakeStoreFileSystemClient.ChangeAclRecursively(Path.TransformedPath,
                                                                       Account,
                                                                       aclSpec, RequestedAclType.ModifyAcl, threadCount, this, ShowProgress, CmdletCancellationToken);
                }
                else
                {
                    DataLakeStoreFileSystemClient.ModifyAcl(Path.TransformedPath, Account,
                                                            aclSpec);
                }

                if (PassThru)
                {
                    WriteObject(DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath,
                                                                           Account).Entries.Select(entry => new DataLakeStoreItemAce(entry)));
                }
            });
        }
예제 #7
0
        public override void ExecuteCmdlet()
        {
            WriteWarning(Resources.IncorrectOutputTypeWarning);
            ConfirmAction(
                string.Format(Resources.SetDataLakeStoreItemAcl, Path.OriginalPath),
                Path.OriginalPath,
                () =>
            {
                DataLakeStoreFileSystemClient.SetAcl(
                    Path.TransformedPath,
                    Account,
                    Acl.Select(entry => entry.ParseDataLakeStoreItemAce()).ToList());

                if (PassThru)
                {
                    var toReturn = DataLakeStoreFileSystemClient.GetAclStatus(Path.TransformedPath,
                                                                              Account).Entries.Select(entry => new DataLakeStoreItemAce(entry));

                    WriteObject(toReturn);
                }
            });
        }