From 0983d3e4572abfd76c8faaa5d1766908195769e5 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 29 Oct 2024 11:59:53 -0400 Subject: [PATCH 1/3] attributes passed to ussFile(), need to implement Signed-off-by: jace-roell --- .../download/uss/UssFile.definition.ts | 1 + .../zosfiles/download/uss/UssFile.handler.ts | 18 ++++++++++++++---- .../methods/download/doc/IDownloadOptions.ts | 7 +++++++ usstest.txt | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 usstest.txt diff --git a/packages/cli/src/zosfiles/download/uss/UssFile.definition.ts b/packages/cli/src/zosfiles/download/uss/UssFile.definition.ts index 80c5852a33..e06e1af84f 100644 --- a/packages/cli/src/zosfiles/download/uss/UssFile.definition.ts +++ b/packages/cli/src/zosfiles/download/uss/UssFile.definition.ts @@ -39,6 +39,7 @@ export const UssFileDefinition: ICommandDefinition = { } ], options: [ + DownloadOptions.attributes, DownloadOptions.file, DownloadOptions.binary, DownloadOptions.encoding diff --git a/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts b/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts index c62fb8ee3d..0462bfc8e4 100644 --- a/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts +++ b/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts @@ -11,7 +11,8 @@ import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler"; import { AbstractSession, IHandlerParameters, ITaskWithStatus, TaskStage } from "@zowe/imperative"; -import { Download, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; +import { Download, IDownloadOptions, IZosFilesResponse, ZosFilesAttributes } from "@zowe/zos-files-for-zowe-sdk"; +import { UploadOptions } from "../../upload/Upload.options"; /** * Handler to download an uss file @@ -25,13 +26,22 @@ export default class UssFileHandler extends ZosFilesBaseHandler { stageName: TaskStage.IN_PROGRESS }; commandParameters.response.progress.startBar({task}); - return Download.ussFile(session, commandParameters.arguments.ussFileName, { + + const downloadOptions: IDownloadOptions = { binary: commandParameters.arguments.binary, encoding: commandParameters.arguments.encoding, file: commandParameters.arguments.file, task, responseTimeout: commandParameters.arguments.responseTimeout, - overwrite: commandParameters.arguments.overwrite - }); + overwrite: commandParameters.arguments.overwrite, + }; + const attributes = ZosFilesAttributes.loadFromFile( + commandParameters.arguments.attributes, + commandParameters.arguments.inputDir + ); + if (attributes != null) { + downloadOptions.attributes = attributes; + } + return Download.ussFile(session, commandParameters.arguments.ussFileName, downloadOptions); } } diff --git a/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts b/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts index 103c496d2b..9773161f3c 100644 --- a/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts +++ b/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts @@ -61,6 +61,13 @@ export interface IDownloadSingleOptions extends IGetOptions { * Optional stream to read the file contents */ stream?: Writable; + /** + * The ZosFilesAttributes instance describe upload attributes for the files and directories + */ + attributes?: ZosFilesAttributes; + /** + * The map of files and their upload mode to be used for binary_files and ascii_files + */ } /** diff --git a/usstest.txt b/usstest.txt new file mode 100644 index 0000000000..98ce8af41b --- /dev/null +++ b/usstest.txt @@ -0,0 +1 @@ +á é í ó ú ñ Ç ß 12345 !@#$% \ No newline at end of file From bf60219ef07662eefb6c33b51a92b92407504d20 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 30 Oct 2024 10:26:11 -0400 Subject: [PATCH 2/3] poc work Signed-off-by: jace-roell --- packages/cli/src/zosfiles/download/uss/UssFile.handler.ts | 1 - packages/zosfiles/src/doc/IOptions.ts | 5 +++++ packages/zosfiles/src/methods/download/Download.ts | 2 ++ .../zosfiles/src/methods/download/doc/IDownloadOptions.ts | 5 +---- usstest.txt | 1 - 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts b/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts index 0462bfc8e4..8ffabe2469 100644 --- a/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts +++ b/packages/cli/src/zosfiles/download/uss/UssFile.handler.ts @@ -37,7 +37,6 @@ export default class UssFileHandler extends ZosFilesBaseHandler { }; const attributes = ZosFilesAttributes.loadFromFile( commandParameters.arguments.attributes, - commandParameters.arguments.inputDir ); if (attributes != null) { downloadOptions.attributes = attributes; diff --git a/packages/zosfiles/src/doc/IOptions.ts b/packages/zosfiles/src/doc/IOptions.ts index d3509356c7..698a030453 100644 --- a/packages/zosfiles/src/doc/IOptions.ts +++ b/packages/zosfiles/src/doc/IOptions.ts @@ -11,6 +11,7 @@ import { ITaskWithStatus } from "@zowe/imperative"; import { IZosFilesOptions } from "./IZosFilesOptions"; +import { ZosFilesAttributes } from "../utils/ZosFilesAttributes"; /** * This interface defines the options that can be sent to get a data set or USS file function @@ -57,4 +58,8 @@ export interface IOptions extends IZosFilesOptions { * @type {ITaskWithStatus} */ task?: ITaskWithStatus; + /** + * The path to a .zosattributes file used to control file conversion and tagging. + */ + attributes?: ZosFilesAttributes; } diff --git a/packages/zosfiles/src/methods/download/Download.ts b/packages/zosfiles/src/methods/download/Download.ts index 5944f6b6ee..bb26072406 100644 --- a/packages/zosfiles/src/methods/download/Download.ts +++ b/packages/zosfiles/src/methods/download/Download.ts @@ -531,6 +531,8 @@ export class Download { ussFileName = ZosFilesUtils.sanitizeUssPathForRestCall(ussFileName); const endpoint = posix.join(ZosFilesConstants.RESOURCE, ZosFilesConstants.RES_USS_FILES, ussFileName); + options.encoding = options.attributes.getRemoteEncoding(ussFileName) + const reqHeaders: IHeaderContent[] = this.generateHeadersBasedOnOptions(options); // Use specific options to mimic ZosmfRestClient.getStreamed() diff --git a/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts b/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts index 9773161f3c..076d7a5522 100644 --- a/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts +++ b/packages/zosfiles/src/methods/download/doc/IDownloadOptions.ts @@ -58,16 +58,13 @@ export interface IDownloadSingleOptions extends IGetOptions { overwrite?: boolean; /** - * Optional stream to read the file contents + * Optional stream to write the file contents */ stream?: Writable; /** * The ZosFilesAttributes instance describe upload attributes for the files and directories */ attributes?: ZosFilesAttributes; - /** - * The map of files and their upload mode to be used for binary_files and ascii_files - */ } /** diff --git a/usstest.txt b/usstest.txt index 98ce8af41b..e69de29bb2 100644 --- a/usstest.txt +++ b/usstest.txt @@ -1 +0,0 @@ -á é í ó ú ñ Ç ß 12345 !@#$% \ No newline at end of file From 284cfb6852b37b8ffcf285babacaf1941ad9861f Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 30 Oct 2024 10:34:14 -0400 Subject: [PATCH 3/3] changelog Signed-off-by: jace-roell --- packages/cli/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 2c571c6f39..2cada23679 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,9 +2,13 @@ All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes + +- Enhancement: Added support for running applications on TSO/E address spaces. Applications can be started, receive messages and transmit messages [#2280](https://github.com/zowe/zowe-cli/pull/2280) + ## `8.4.0` -- Enhancement: Added optional `--attributes` flag to `zowe zos-files upload file-to-uss` to allow passing a .zosattributes file path for upload encoding format. [#2319] (https://github.com/zowe/zowe-cli/pull/2319) +- Enhancement: Added optional `--attributes` flag to `zowe zos-files upload file-to-uss` to allow passing a .zosattributes file path for upload encoding format. [#2319](https://github.com/zowe/zowe-cli/pull/2319) ## `8.3.0`