Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zos download attributes #2335

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0983d3e
attributes passed to ussFile(), need to implement
jace-roell Oct 29, 2024
bf60219
poc work
jace-roell Oct 30, 2024
4b5c6fc
progress checkpoint
jace-roell Oct 30, 2024
c87ee64
progress
jace-roell Oct 30, 2024
b2781ce
handle binary in .zos attributes files
jace-roell Oct 31, 2024
3a1a16e
binary fix
jace-roell Oct 31, 2024
2483f41
unused import
jace-roell Oct 31, 2024
1f57ce6
system test work
jace-roell Nov 1, 2024
dff1a43
remove temp files
jace-roell Nov 1, 2024
60d81b4
system test start
jace-roell Nov 1, 2024
59f18a8
system test fix with file extensions for remoteEncoding
jace-roell Nov 1, 2024
8406831
changelog, system tests, unit tests
jace-roell Nov 4, 2024
29d9e5c
changelog
jace-roell Nov 4, 2024
fe613e3
change encoding on test
jace-roell Nov 4, 2024
d0c9178
integration test snapshot
jace-roell Nov 4, 2024
fe263c5
fixed changed test encoding
jace-roell Nov 4, 2024
4056a4f
left over package.json data from canceled integration tests
jace-roell Nov 4, 2024
54a0ff0
Merge branch 'master' into zos-download-attributes
jace-roell Nov 4, 2024
f4177de
changelog
jace-roell Nov 4, 2024
b5d768b
changelog fix
jace-roell Nov 4, 2024
73ae952
condensed attributes assignment to downloadOptions and removed unnece…
jace-roell Nov 5, 2024
e9e1953
Merge branch 'master' into zos-download-attributes
jace-roell Nov 5, 2024
59df2f0
linting
jace-roell Nov 5, 2024
8dd118f
changelog
jace-roell Nov 5, 2024
055baa1
changelog
jace-roell Nov 5, 2024
35dc5d1
changelog
jace-roell Nov 5, 2024
4f23a0f
Merge branch 'master' into zos-download-attributes
jace-roell Nov 5, 2024
6edee45
changelog
jace-roell Nov 5, 2024
299557c
changelog
jace-roell Nov 5, 2024
685fa54
Update packages/zosfiles/CHANGELOG.md
jace-roell Nov 6, 2024
35a2351
Merge branch 'master' into zos-download-attributes
jace-roell Nov 6, 2024
c0002e7
condenses attributes being passed to download options object
jace-roell Nov 6, 2024
d0be449
remove unneccesary property
jace-roell Nov 6, 2024
75aaab8
import
jace-roell Nov 6, 2024
b05be48
shell script for system test fix
jace-roell Nov 6, 2024
a2494c8
added local encoding support and updated system tests
jace-roell Nov 6, 2024
7872472
changelog and linting
jace-roell Nov 6, 2024
49325e9
changelog
jace-roell Nov 6, 2024
47b3ed0
changelog
jace-roell Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const UssFileDefinition: ICommandDefinition = {
}
],
options: [
DownloadOptions.attributes,
DownloadOptions.file,
DownloadOptions.binary,
DownloadOptions.encoding
Expand Down
17 changes: 13 additions & 4 deletions packages/cli/src/zosfiles/download/uss/UssFile.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Fixed Show fixed Hide fixed

/**
* Handler to download an uss file
Expand All @@ -25,13 +26,21 @@
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,
);
if (attributes != null) {
downloadOptions.attributes = attributes;
}
return Download.ussFile(session, commandParameters.arguments.ussFileName, downloadOptions);
jace-roell marked this conversation as resolved.
Show resolved Hide resolved
}
}
5 changes: 5 additions & 0 deletions packages/zosfiles/src/doc/IOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import { ITaskWithStatus } from "@zowe/imperative";
import { IZosFilesOptions } from "./IZosFilesOptions";
import { ZosFilesAttributes } from "../utils/ZosFilesAttributes";
Fixed Show fixed Hide fixed

/**
* This interface defines the options that can be sent to get a data set or USS file function
Expand Down Expand Up @@ -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;
jace-roell marked this conversation as resolved.
Show resolved Hide resolved
}
5 changes: 5 additions & 0 deletions packages/zosfiles/src/methods/download/Download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ export class Download {
ussFileName = ZosFilesUtils.sanitizeUssPathForRestCall(ussFileName);
const endpoint = posix.join(ZosFilesConstants.RESOURCE, ZosFilesConstants.RES_USS_FILES, ussFileName);

if(options.attributes)
{
options.encoding = options.attributes.getRemoteEncoding(ussFileName);
}

const reqHeaders: IHeaderContent[] = this.generateHeadersBasedOnOptions(options);

// Use specific options to mimic ZosmfRestClient.getStreamed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +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;
}

/**
Expand Down
1 change: 1 addition & 0 deletions usstest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
E@Q@U@�@�@I@h@Y@�����@Z|{[l@_@�@�@[@�@?
Loading