/// <summary> /// execute command /// </summary> public override void ExecuteCmdlet() { IStorageBlobManagement localChannel = Channel; bool foundAFolder = false; DataLakeFileClient fileClient = null; DataLakeDirectoryClient dirClient = null; if (ParameterSetName == ManualParameterSet) { DataLakeFileSystemClient fileSystem = GetFileSystemClientByName(localChannel, this.FileSystem); foundAFolder = GetExistDataLakeGen2Item(fileSystem, this.Path, out fileClient, out dirClient); } else //BlobParameterSet { if (!InputObject.IsDirectory) { fileClient = InputObject.File; } else { dirClient = InputObject.Directory; foundAFolder = true; } } if (foundAFolder) { if (ShouldProcess(GetDataLakeItemUriWithoutSas(dirClient), "Update Directory: ")) { //Set Permission if (this.Permission != null || this.Owner != null || this.Group != null) { //PathAccessControl originPathAccessControl = dirClient.GetAccessControl().Value; dirClient.SetPermissions( this.Permission != null ? PathPermissions.ParseSymbolicPermissions(this.Permission) : null, this.Owner, this.Group); } //Set ACL if (this.Acl != null) { dirClient.SetAccessControlList(PSPathAccessControlEntry.ParseAccessControls(this.Acl)); } // Set Properties SetDatalakegen2ItemProperties(dirClient, this.BlobProperties, setToServer: true); //Set MetaData SetDatalakegen2ItemMetaData(dirClient, this.BlobMetadata, setToServer: true); WriteDataLakeGen2Item(localChannel, dirClient); } } else { if (ShouldProcess(GetDataLakeItemUriWithoutSas(fileClient), "Update File: ")) { //Set Permission if (this.Permission != null || this.Owner != null || this.Group != null) { fileClient.SetPermissions( this.Permission != null ? PathPermissions.ParseSymbolicPermissions(this.Permission) : null, this.Owner, this.Group); } //Set ACL if (this.Acl != null) { fileClient.SetAccessControlList(PSPathAccessControlEntry.ParseAccessControls(this.Acl)); } // Set Properties SetDatalakegen2ItemProperties(fileClient, this.BlobProperties, setToServer: true); //Set MetaData SetDatalakegen2ItemMetaData(fileClient, this.BlobMetadata, setToServer: true); WriteDataLakeGen2Item(localChannel, fileClient); } } }