# 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

- Shell
- SshBaseHandler
- SshSession

### Interfaces

- ISshSession

### Object literals

- ZosUssMessages
- ZosUssProfile

## Object literals

### Const ZosUssMessages

ZosUssMessages: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:19

Messages to be used as command responses for different scenarios

memberof

  ZosUssMessages

### allAuthMethodsFailed

allAuthMethodsFailed: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:24

Message indicating that the data set type is unsupported

### message

message: string = "All configured authentication methods failed"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:25

### connectionRefused

connectionRefused: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:27

### message

message: string = "Connection was refused"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:28

### expiredPassword

expiredPassword: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:36

### message

message: string = "Your password has expired"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:37

### handshakeTimeout

handshakeTimeout: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:30

### message

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

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:31

### unexpected

unexpected: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:33

### message

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

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.messages.ts:34

### Const ZosUssProfile

ZosUssProfile: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:20

Profile configuration for SSH profiles

memberof

  ZosUssProfile

### type

type: string = "ssh"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:21

### schema

schema: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:22

### description

description: string = "z/OS SSH Profile"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:25

### required

required: undefined[] = []

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:60

### title

title: string = "z/OS SSH Profile"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:24

### type

type: string = "object"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:23

### properties

properties: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:26

### handshakeTimeout

handshakeTimeout: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:55

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_HANDSHAKETIMEOUT

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:57

### type

type: string = "number"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:56

### host

host: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:27

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_HOST

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:29

### type

type: string = "string"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:28

### keyPassphrase

keyPassphrase: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:50

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_KEYPASSPHRASE

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:53

### secure

secure: boolean = true

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:52

### type

type: string = "string"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:51

### password

password: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:41

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PASSWORD

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:44

### secure

secure: boolean = true

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:43

### type

type: string = "string"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:42

### port

port: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:31

### includeInTemplate

includeInTemplate: boolean = true

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:34

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PORT

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:33

### type

type: string = "number"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:32

### privateKey

privateKey: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:46

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_PRIVATEKEY

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:48

### type

type: string = "string"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:47

### user

user: object

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:36

### optionDefinition

optionDefinition: any = SshSession.SSH_OPTION_USER

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:39

### secure

secure: boolean = true

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:38

### type

type: string = "string"

- Defined in @zowe/zos-uss-for-zowe-sdk/src/constants/ZosUss.profile.ts:37

Generated using TypeDoc