@zowe/cli
Version:
Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.
59 lines • 2.89 kB
JavaScript
;
/*
* 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 imperative_1 = require("@zowe/imperative");
const rest_1 = require("../../../rest");
const TsoValidator_1 = require("./TsoValidator");
const TsoConstants_1 = require("./TsoConstants");
const TsoResponseService_1 = require("./TsoResponseService");
class PingTso {
/**
* Issue a TSO Ping command, returns @param {IPingResponse} result, @see {IPingResponse}
* @static
* @param {AbstractSession} session representing connection to this api
* @param {string} servletKey servletkey for address space to ping, generated by start command
* @param {IZosmfPingResponse} res raw ZOS/MF response
* @return {IPingResponse}, @see {IPingResponse}
* @memberof PingTso
*/
static ping(session, servletKey) {
return __awaiter(this, void 0, void 0, function* () {
TsoValidator_1.TsoValidator.validatePingParms(session, servletKey, TsoConstants_1.noPingInput.message);
const res = yield rest_1.ZosmfRestClient.putExpectJSON(session, PingTso.getResource(servletKey), [rest_1.ZosmfHeaders.X_CSRF_ZOSMF_HEADER, imperative_1.Headers.APPLICATION_JSON], null);
TsoValidator_1.TsoValidator.validateErrorMessageFromZosmf(res);
const result = TsoResponseService_1.TsoResponseService.populatePing(res);
return result;
});
}
/**
* Get resource path for ping command
* @static
* @param {string} servletKey servelet key from start API method
* @return {string} resource path
* @memberof PingTso
*/
static getResource(servletKey) {
TsoValidator_1.TsoValidator.validateNotEmptyString(servletKey, TsoConstants_1.noPingInput.message);
return TsoConstants_1.TsoConstants.RES_PING + "/" + servletKey;
}
}
exports.PingTso = PingTso;
//# sourceMappingURL=PingTso.js.map