@zowe/zosmf-for-zowe-sdk
Version:
Zowe SDK to interact with the z/OS Management Facility
63 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 });
exports.CheckStatus = void 0;
const imperative_1 = require("@zowe/imperative");
const path_1 = require("path");
const Zosmf_constants_1 = require("./constants/Zosmf.constants");
const Zosmf_messages_1 = require("./constants/Zosmf.messages");
const core_for_zowe_sdk_1 = require("@zowe/core-for-zowe-sdk");
/**
* This class holds the helper functions that are used to gather zosmf information throgh the
* z/OSMF APIs.
*/
class CheckStatus {
/**
* Get z/OSMF information
* @param {AbstractSession} session z/OSMF connection info.
* @returns {promise<IZosmfInfoResponse>} A response contains information from API call.
* @throws {ImperativeError} session must not be null or undefined. Any error threw by
* the REST API call.
*/
static getZosmfInfo(session) {
return __awaiter(this, void 0, void 0, function* () {
this.log.trace("getZosmfInfo called");
const infoEndpoint = path_1.posix.join(Zosmf_constants_1.ZosmfConstants.RESOURCE, Zosmf_constants_1.ZosmfConstants.INFO);
this.log.debug(`Endpoint: ${infoEndpoint}`);
imperative_1.ImperativeExpect.toNotBeNullOrUndefined(session, Zosmf_messages_1.ZosmfMessages.missingSession.message);
return core_for_zowe_sdk_1.ZosmfRestClient.getExpectJSON(session, infoEndpoint);
});
}
static isZosVersionAtLeast(session, version) {
return __awaiter(this, void 0, void 0, function* () {
return (yield CheckStatus.getZosmfInfo(session)).zosmf_version >= version;
});
}
/**
* Get Log
* @returns {Logger} applicationLogger.
*/
static get log() {
return imperative_1.Logger.getAppLogger();
}
}
exports.CheckStatus = CheckStatus;
//# sourceMappingURL=CheckStatus.js.map