Options
All
  • Public
  • Public/Protected
  • All
Menu

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

z/OS Console Package

Contains APIs to interact with the z/OS console (using z/OSMF console REST endpoints).

API Examples

Submit a command to the z/OS console

import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
         CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { IssueCommand, IIssueParms, IConsoleResponse } from "@zowe/zos-console-for-zowe-sdk";

(async () => {
    //Initialize the Imperative Credential Manager Factory and Logger
    Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
    // Uncommment the below line if the Secure Credential Store is in use
    // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});

    // Get the default z/OSMF profile and create a z/OSMF session with it
    let defaultZosmfProfile: IProfile;
    try {
        defaultZosmfProfile = await getDefaultProfile("zosmf", true);
    } catch (err) {
        throw new ImperativeError({msg: "Failed to get a profile."});
    }

    // Console Options
    const parms: IIssueParms = {
        command: "D IPLINFO",
        sysplexSystem: undefined,
        solicitedKeyword: undefined,
        async: "N"
    }

    const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
    let response: IConsoleResponse;
    response = await IssueCommand.issue(session, parms);
    console.log(response);
    process.exit(0);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Get the response from a command sent to the z/OS console

import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
         CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { CollectCommand, ICollectParms, IConsoleResponse } from "@zowe/zos-console-for-zowe-sdk";

(async () => {
    //Initialize the Imperative Credential Manager Factory and Logger
    Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
    // Uncommment the below line if the Secure Credential Store is in use
    // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});

    // Get the default z/OSMF profile and create a z/OSMF session with it
    let defaultZosmfProfile: IProfile;
    try {
        defaultZosmfProfile = await getDefaultProfile("zosmf", true);
    } catch (err) {
        throw new ImperativeError({msg: "Failed to get a profile."});
    }

    const parms: ICollectParms = {
        commandResponseKey: "KEY",
        waitToCollect: undefined,
        followUpAttempts: undefined
    }

    const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
    let response: IConsoleResponse;
    response = await CollectCommand.collect(session, parms);
    console.log(response);
    process.exit(0);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Index

Type aliases

ConsoleResponse

ConsoleResponse: (response: IConsoleResponse) => void

Type declaration

Object literals

Const collectProcessingDetails

collectProcessingDetails: object

message

message: string = `Collect processing - timeout: {{timer}}, followUpCounter: {{counter}}`

Const decreaseCounter

decreaseCounter: object

message

message: string = `Decreasing follow up counter`

Const displayCollectError

displayCollectError: object

message

message: string = apiErrorHeader.message + ` Collect error: {{data}}`

Const displayCollectResponse

displayCollectResponse: object

message

message: string = `Collect response: {{data}}`

Const displayError

displayError: object

message

message: string = apiErrorHeader.message + ` Populating console error: {{data}}`

Const displayResponse

displayResponse: object

message

message: string = `Populating console response: {{data}}`

Const noCollectParameters

noCollectParameters: object

message

message: string = apiErrorHeader.message + ` No console collect parameters were supplied.`

Const noCommandKey

noCommandKey: object

message

message: string = apiErrorHeader.message + ` No command response key was supplied.`

Const noConsoleInput

noConsoleInput: object

message

message: string = apiErrorHeader.message + ` No console issue parameters were supplied.`

Const noConsoleName

noConsoleName: object

message

message: string = apiErrorHeader.message + ` No console name was supplied.`

Const noZosmfInput

noZosmfInput: object

message

message: string = apiErrorHeader.message + ` No zosmf console input parameters were supplied.`

Const resetCounter

resetCounter: object

message

message: string = `Reset follow up counter`

Generated using TypeDoc