Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @zowe/zos-uss-for-zowe-sdk

z/OS USS Package

Contains APIs to interact with USS on z/OS (using the z/OS SSH service).

Installation Instructions

The z/OS USS SDK has a dependency on the ssh2 package. This package allows for more secure cryptographic ciphers to be used first on supporting hardware. In order to do this, the dependency attempts to build some native modules at install time.

If these modules cannot be built, the dependency will continue to function, without the optimal cipher list order. However, some error messaging may be visible. These errors can be safely ignored, if desired.

To consume the optimal cipher list and build the native modules, the following software is pre-requisite:

Windows

We recommend NodeJS be installed with Chocolatey, which includes most of the required tooling. An additional tool, CMake, will need to be installed in addition to Chocolatey.

Alternatively, install the following:

  • Python 3.7 or greater
  • CMake
  • Choose one of the following:
    • Visual Studio Build Tools
      • "Visual C++ build tools" workload
    • Visual Studio Community
      • "Desktop development with C++" workload

Unix

  • Python 3.7 or greater
  • CMake
  • make
  • A C/C++ Compiler (i.e. gcc-c++, g++)

MacOS

  • Python 3.7 or greater
  • CMake
  • XCode
    • Including XCode Command Line Tools

API Examples

Check disk space on file system containing home directory

import { ProfileInfo } from "@zowe/imperative";
import { Shell, SshSession } from "@zowe/zos-uss-for-zowe-sdk";

(async () => {
    // Load connection info from default SSH profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const sshProfAttrs = profInfo.getDefaultProfile("ssh");
    const sshMergedArgs = profInfo.mergeArgsForProfile(sshProfAttrs, { getSecureVals: true });
    const session = new SshSession(ProfileInfo.initSessCfg(sshMergedArgs.knownArgs));

    await Shell.executeSsh(session, "df .", (data: string) => {
        if (data.trim()) console.log(data);
    });
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Make a script executable

import { ProfileInfo } from "@zowe/imperative";
import { Shell, SshSession } from "@zowe/zos-uss-for-zowe-sdk";

(async () => {
    // Load connection info from default SSH profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const sshProfAttrs = profInfo.getDefaultProfile("ssh");
    const sshMergedArgs = profInfo.mergeArgsForProfile(sshProfAttrs, { getSecureVals: true });
    const session = new SshSession(ProfileInfo.initSessCfg(sshMergedArgs.knownArgs));

    await Shell.executeSshCwd(session, "chmod +x test.sh", "/tmp", (data: string) => {
        if (data.trim()) throw new Error(data);
    });
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Index

Classes

Interfaces

Variables

Object literals

Variables

Const startCmdFlag

startCmdFlag: "@@START OF COMMAND@@" = Shell.startCmdFlag
deprecated

Use Shell.startCmdFlag instead.

Object literals

Const ZosUssMessages

ZosUssMessages: object

Messages to be used as command responses for different scenarios

memberof

ZosUssMessages

allAuthMethodsFailed

allAuthMethodsFailed: object

Message indicating that the data set type is unsupported

message

message: string = "All configured authentication methods failed"

connectionRefused

connectionRefused: object

message

message: string = "Connection was refused"

expiredPassword

expiredPassword: object

message

message: string = "Your password has expired"

handshakeTimeout

handshakeTimeout: object

message

message: string = "Timed out while waiting for handshake"

unexpected

unexpected: object

message

message: string = "Connection failed because of an unexpected error"

Const ZosUssProfile

ZosUssProfile: object

Profile configuration for SSH profiles

memberof

ZosUssProfile

createProfileExamples

createProfileExamples: { description: string; options: string }[] = [{options: "ssh111 --host sshhost --user ibmuser --password myp4ss",description: "Create a ssh profile called 'ssh111' to connect to z/OS SSH server at host 'zos123' and default port 22"},{options: "ssh222 --host sshhost --port 13022 --user ibmuser --password myp4ss",description: "Create a ssh profile called 'ssh222' to connect to z/OS SSH server at host 'zos123' and port 13022"},{options: "ssh333 --host sshhost --user ibmuser --privateKey /path/to/privatekey --keyPassphrase privateKeyPassphrase",description: "Create a ssh profile called 'ssh333' to connect to z/OS SSH server at host 'zos123' " +"using a privatekey '/path/to/privatekey' and its decryption passphrase 'privateKeyPassphrase' " +"for privatekey authentication"},{options: "ssh444 --privateKey /path/to/privatekey",description: "Create a ssh profile called 'ssh444' to connect to z/OS SSH server on default port 22, without specifying " +"username, host, or password, preventing those values from being stored on disk"}]

type

type: string = "ssh"

schema

schema: object

description

description: string = "z/OS SSH Profile"

required

required: undefined[] = []

title

title: string = "z/OS SSH Profile"

type

type: string = "object"

properties

properties: object

handshakeTimeout

handshakeTimeout: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_HANDSHAKETIMEOUT

type

type: string = "number"

host

host: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_HOST

type

type: string = "string"

keyPassphrase

keyPassphrase: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_KEYPASSPHRASE

secure

secure: boolean = true

type

type: string = "string"

password

password: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PASSWORD

secure

secure: boolean = true

type

type: string = "string"

port

port: object

includeInTemplate

includeInTemplate: boolean = true

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PORT

type

type: string = "number"

privateKey

privateKey: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PRIVATEKEY

type

type: string = "string"

user

user: object

optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_USER

secure

secure: boolean = true

type

type: string = "string"

Generated using TypeDoc