UNPKG

@broadcom/ca7-for-zowe-cli

Version:

CA 7 Workload Automation Plug-in for Zowe CLI

102 lines 4.13 kB
"use strict"; /* * Copyright © 202X Broadcom Inc. and/or its subsidiaries * © 202X Broadcom Inc and/or its subsidiaries; All rights reserved */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CA7ResponseUtil = void 0; class CA7ResponseUtil { /** * Method to log the response with command, Ca7Messages and CA7# * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithCommandMessageCa7(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("command:" + ca7Response.command + ",ca7messages:" + ca7Response.ca7messages + ", ca7#:" + ca7Response["ca7#"]); } /** * Method to log the response with command, Ca7Messages * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithCommandMessage(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("command:" + ca7Response.command + ",ca7messages:" + ca7Response.ca7messages); } /** * Method to log the response with command, Ca7Messages * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithCa7Message(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("ca7#:" + ca7Response["ca7#"] + ",ca7messages:" + ca7Response.ca7messages); } /** * Method to log the response with command, Ca7Messages and CA7# * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithMessage(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("ca7messages:" + ca7Response.ca7messages); } /** * Method to log the response with jobs and job-count * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithJobCountJobs(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("job-count:" + ca7Response["job-count"] + " jobs:" + JSON.stringify(ca7Response.jobs)); } /** * Method to log the response with jobs, Database name, count, and timestamp * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithJobsDBCountTime(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("jobs:" + JSON.stringify(ca7Response.jobs) + " database-name:" + ca7Response["database-name"] + " count:" + ca7Response.count + " timestamp:" + ca7Response.timestamp); } static responseWithCountJobResource(params, ca7Response) { params.response.data.setObj(ca7Response); params.response.console.log("count:" + ca7Response.count + " job-resource:" + JSON.stringify(ca7Response["job-resource"])); } /** * Method to log the response with JSON response from CA7 REST client * @param {IHandlerParameters} params * @param ca7Response * @returns {Promise<void>} * @memberof CA7ResponseUtil */ static responseWithJSON(params, ca7Response) { params.response.data.setObj(ca7Response); let jsonResponse = JSON.stringify(ca7Response, null, 2); jsonResponse = jsonResponse.substring(2, jsonResponse.length - 2); if (ca7Response.ca7messages != undefined) { jsonResponse = jsonResponse.replace(/ +/g, " "); jsonResponse = jsonResponse.split(";").join("\n\t"); } params.response.console.log(jsonResponse); } } exports.CA7ResponseUtil = CA7ResponseUtil; //# sourceMappingURL=CA7ResponseUtil.js.map