public override void ExecuteCmdlet() { WriteWarning(Resources.IncorrectOutputTypeWarning); string processMessage = string.Empty; string target = string.Empty; switch (this.ParameterSetName) { case UserCatalogParameterSetName: case GroupCatalogParameterSetName: case OtherCatalogParameterSetName: case UserOwnerCatalogParameterSetName: case GroupOwnerCatalogParameterSetName: processMessage = string.Format(Resources.SetDataLakeCatalogAclEntry, Account); target = Account; break; case UserCatalogItemParameterSetName: case GroupCatalogItemParameterSetName: case OtherCatalogItemParameterSetName: case UserOwnerCatalogItemParameterSetName: case GroupOwnerCatalogItemParameterSetName: processMessage = string.Format(Resources.SetDataLakeCatalogItemAclEntry, Path.FullCatalogItemPath); target = Path.FullCatalogItemPath; break; default: throw new ArgumentException($"Invalid parameter set: {this.ParameterSetName}"); } string aceType = string.Empty; string[] returnedAceTypes; switch (this.ParameterSetName) { case UserCatalogParameterSetName: case UserCatalogItemParameterSetName: aceType = AclType.User; returnedAceTypes = new[] { AclType.User, AclType.Group, AclType.Other }; break; case GroupCatalogParameterSetName: case GroupCatalogItemParameterSetName: aceType = AclType.Group; returnedAceTypes = new[] { AclType.User, AclType.Group, AclType.Other }; break; case OtherCatalogParameterSetName: case OtherCatalogItemParameterSetName: aceType = AclType.Other; returnedAceTypes = new[] { AclType.User, AclType.Group, AclType.Other }; break; case UserOwnerCatalogParameterSetName: case UserOwnerCatalogItemParameterSetName: aceType = AclType.UserObj; returnedAceTypes = new[] { AclType.UserObj }; break; case GroupOwnerCatalogParameterSetName: case GroupOwnerCatalogItemParameterSetName: aceType = AclType.GroupObj; returnedAceTypes = new[] { AclType.GroupObj }; break; default: throw new ArgumentException($"Invalid parameter set: {this.ParameterSetName}"); } ConfirmAction( processMessage, target, () => { DataLakeAnalyticsClient.AddOrUpdateCatalogItemAclEntry(Account, Path, ItemType, aceType, ObjectId, Permissions); var toReturn = DataLakeAnalyticsClient.GetCatalogItemAclEntry(Account, Path, ItemType, returnedAceTypes) .Select(acl => new PSDataLakeAnalyticsAcl(acl)) .ToList(); if (toReturn.Count == 1) { WriteObject(toReturn[0]); } else { WriteObject(toReturn, true); } }); }