UNPKG

@zowe/cli

Version:

Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.

76 lines 4.27 kB
"use strict"; /* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html * * SPDX-License-Identifier: EPL-2.0 * * Copyright Contributors to the Zowe Project. * */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const TsoConstants_1 = require("./TsoConstants"); const SendTso_1 = require("./SendTso"); const StartTso_1 = require("./StartTso"); const StopTso_1 = require("./StopTso"); const TsoValidator_1 = require("./TsoValidator"); /** * Class to handle issue command to TSO * @class IssueTso */ class IssueTso { /** * API method to start a TSO address space, issue a command, collect responses until prompt is reached, and terminate the address space. * @param {AbstractSession} session - z/OSMF connection info * @param {string} accountNumber - accounting info for Jobs * @param {string} command - command text to issue to the TSO address space. * @param {IStartTsoParms} startParams - optional object with required parameters for starting TSO address space, @see {IStartTsoParms} * @returns {Promise<IIssueResponse>} IssueTso response object, @see {IIssueResponse} * @memberof IssueTso */ static issueTsoCommand(session, accountNumber, command, startParams) { return __awaiter(this, void 0, void 0, function* () { TsoValidator_1.TsoValidator.validateSession(session); TsoValidator_1.TsoValidator.validateNotEmptyString(accountNumber, TsoConstants_1.noAccountNumber.message); TsoValidator_1.TsoValidator.validateNotEmptyString(command, TsoConstants_1.noCommandInput.message); let response; response = { success: false, startResponse: null, startReady: false, zosmfResponse: null, commandResponse: null, stopResponse: null }; response.startResponse = yield StartTso_1.StartTso.start(session, accountNumber, startParams || {}); if (response.startResponse.success) { const sendResponse = yield SendTso_1.SendTso.sendDataToTSOCollect(session, response.startResponse.servletKey, command); response.success = sendResponse.success; response.zosmfResponse = sendResponse.zosmfResponse; response.commandResponse = sendResponse.commandResponse; } response.stopResponse = yield StopTso_1.StopTso.stop(session, response.startResponse.servletKey); return response; }); } /** * API method to start a TSO address space with provided parameters, issue a command, * collect responses until prompt is reached, and terminate the address space. * @param {AbstractSession} session - z/OSMF connection info * @param {IIssueTsoParms} commandParms - object with required parameters, @see {IIssueTsoParms} * @returns {Promise<IIssueResponse>} */ static issueTsoCommandCommon(session, commandParms) { return __awaiter(this, void 0, void 0, function* () { TsoValidator_1.TsoValidator.validateSession(session); TsoValidator_1.TsoValidator.validateIssueParams(commandParms); TsoValidator_1.TsoValidator.validateNotEmptyString(commandParms.command, TsoConstants_1.noCommandInput.message); return IssueTso.issueTsoCommand(session, commandParms.accountNumber, commandParms.command, commandParms.startParams); }); } } exports.IssueTso = IssueTso; //# sourceMappingURL=IssueTso.js.map