UNPKG

@broadcom/ca7-for-zowe-cli

Version:

CA 7 Workload Automation Plug-in for Zowe CLI

159 lines 5.88 kB
"use strict"; /* * Copyright (c) 2025 Broadcom. All Rights Reserved. The term * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This software and all information contained therein is * confidential and proprietary and shall not be duplicated, * used, disclosed, or disseminated in any way except as * authorized by the applicable license agreement, without the * express written permission of Broadcom. All authorized * reproductions must be marked with this language. * * EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO * THE EXTENT PERMITTED BY APPLICABLE LAW, BROADCOM PROVIDES THIS * SOFTWARE WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT * LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL BROADCOM * BE LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR * DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS SOFTWARE, * INCLUDING WITHOUT LIMITATION, LOST PROFITS, BUSINESS * INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF BROADCOM IS * EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CA7SessionUtils = void 0; const imperative_1 = require("@zowe/imperative"); const CA7RestHeaders_1 = require("../util/CA7RestHeaders"); /** * Builds CA7 session and contains command definitions for it * @export */ class CA7SessionUtils { /* * Given command line arguments, create a REST Client Session. * @static * @param {ICommandArguments} args - The arguments specified by the user * @returns {Session} - A session for usage with the CA7 REST Service */ static createBasicCA7Session(args) { var _a; let basePath = (_a = args.basePath) !== null && _a !== void 0 ? _a : CA7RestHeaders_1.CA7RestHeaders.BASE_PATH; // strip "/" before and after sessionBasePath if (basePath.startsWith("/")) { basePath = basePath.substring(1, basePath.length); } if (basePath.endsWith("/")) { basePath = basePath.substring(0, basePath.length - 1); } return new imperative_1.Session({ type: "basic", basePath, hostname: args.host, port: args.port, user: args.user, password: args.password, protocol: args.protocol || "https", rejectUnauthorized: false, tokenType: args.tokenType, tokenValue: args.tokenValue }); } static get log() { return imperative_1.Logger.getAppLogger(); } } exports.CA7SessionUtils = CA7SessionUtils; CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP = "CA7 Connection Options"; /** * Option used in profile creation and commands for hostname for CA7 */ CA7SessionUtils.CA7_OPTION_HOST = { name: "host", aliases: ["H"], type: "string", description: "Host name of the CA7 API service that is running on the mainframe system.", required: true, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for port for CA7 */ CA7SessionUtils.CA7_OPTION_PORT = { name: "port", aliases: ["P"], type: "number", description: "Port for the CA7 API service that is running on the mainframe system.", required: true, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for user for CA7 */ CA7SessionUtils.CA7_OPTION_USER = { name: "user", aliases: ["u"], type: "string", description: "User name for authenticating connections to the CA7 API service that is running on the mainframe system.", required: true, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for password for CA7 */ CA7SessionUtils.CA7_OPTION_PASSWORD = { name: "password", aliases: ["pass", "pw"], type: "string", description: "Password for authenticating connections to the CA7 API service that is running on the mainframe system.", required: true, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for basePath setting for connecting to CA7 */ CA7SessionUtils.CA7_OPTION_BASE_PATH = { name: "base-path", aliases: ["bp"], description: "The base path for your API mediation layer instance." + " Specify this option to prepend the base path to all resources when making REST requests." + " Do not specify this option if you are not using an API mediation layer.", type: "string", group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for protocol for CA7 */ CA7SessionUtils.CA7_OPTION_PROTOCOL = { name: "protocol", aliases: ["o"], description: "Specifies protocol to use for CA7 connection (http or https).", type: "string", required: true, allowableValues: { values: ["http", "https"], caseSensitive: false }, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Option used in profile creation and commands for rejectUnauthorized setting for connecting to z/OSMF */ CA7SessionUtils.CA7_OPTION_REJECT_UNAUTHORIZED = { name: "reject-unauthorized", aliases: ["ru"], description: "Reject self-signed certificates.", type: "boolean", defaultValue: true, group: CA7SessionUtils.CA7_CONNECTION_OPTION_GROUP }; /** * Options related to connecting to CA7 * These options can be filled in if the user creates a profile */ CA7SessionUtils.CA7_CONNECTION_OPTIONS = [ CA7SessionUtils.CA7_OPTION_HOST, CA7SessionUtils.CA7_OPTION_PORT, CA7SessionUtils.CA7_OPTION_USER, CA7SessionUtils.CA7_OPTION_PASSWORD, CA7SessionUtils.CA7_OPTION_BASE_PATH, CA7SessionUtils.CA7_OPTION_PROTOCOL ]; //# sourceMappingURL=CA7SessionUtils.js.map