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.

115 lines 4.46 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. * */ Object.defineProperty(exports, "__esModule", { value: true }); const imperative_1 = require("@zowe/imperative"); const TsoConstants_1 = require("./TsoConstants"); /** * Class validates parameters for TSO commands * @export * @class TsoValidator */ class TsoValidator { /** * Validate session * @static * @param {AbstractSession} session - z/OSMF connection info * @memberOf TsoValidator */ static validateSession(session) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(session, imperative_1.TextUtils.formatMessage(TsoConstants_1.noSessionTso.message)); } /** * Validate TSO start command parameters * @param {IStartTsoParms} parms - object with required parameters, @see {IStartTsoParms} * @memberOf TsoValidator */ static validateStartParams(parms) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(parms, TsoConstants_1.noTsoStartInput.message); } /** * Validate TSO issue command parameters * @param {IStartTsoParms} parms - object with required parameters, @see {IIssueTsoParms} * @memberOf TsoValidator */ static validateIssueParams(parms) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(parms, TsoConstants_1.noTsoIssueInput.message); } /** * Validate TSO stop command parameters * @param {IStopTsoParms} parms - object with required parameters, @see {IStopTsoParms} * @memberOf TsoValidator */ static validateStopParams(parms) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(parms, TsoConstants_1.noTsoStopInput.message); } /** * Validate z/OSMF response, needed for service and filtering servlet key * @param {IZosmfTsoResponse} parms - object response from z/OSMF, @see {IZosmfTsoResponse} * @memberOf TsoValidator */ static validateStartZosmfResponse(parms) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(parms, TsoConstants_1.noZosmfResponse.message); } /** * Validate supplied parameters * @static * @param {AbstractSession} session - representing connection to this api * @param {string} text - string to check if not empty or undefined * @param {string} errorMsg - message to show in text case validation fails * @memberof TsoValidator */ static validatePingParms(session, text, errorMsg) { this.validateSession(session); this.validateNotEmptyString(text, errorMsg); } /** * Validate supplied parameters * @static * @param {string} text - string to check if not null or undefined * @param {string} errorMsg - message to show in text case validation fails * @memberof TsoValidator */ static validateString(text, errorMsg) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(text, errorMsg); } /** * Validate supplied parameters * @static * @param {string} text - string to check if empty * @param {string} errorMsg - message to show in text case validation fails * @memberof TsoValidator */ static validateNotEmptyString(text, errorMsg) { imperative_1.ImperativeExpect.toNotBeEqual("", text, errorMsg); TsoValidator.validateString(text, errorMsg); } /** * Validate z/OSMF response * @param {IZosmfPingResponseparms - object response from z/OSMF, @see {IZosmfPingResponse} * @memberOf TsoValidator */ static validatePingZosmfResponse(parms) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(parms, TsoConstants_1.noZosmfResponse.message); } /** * Validate z/OSMF response for errors * @param {IZosmfTsoResponse} zosmfResponse - object response from z/OSMF, @see {IZosmfTsoResponse} * @memberOf TsoValidator */ static validateErrorMessageFromZosmf(zosmfResponse) { if (zosmfResponse.msgData) { imperative_1.ImperativeExpect.toBeEqual(zosmfResponse.msgData, "undefined", zosmfResponse.msgData[0].messageText); } } } exports.TsoValidator = TsoValidator; //# sourceMappingURL=TsoValidator.js.map