UNPKG

@zowe/cics-for-zowe-sdk

Version:
53 lines 1.95 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 }); exports.performAction = void 0; const rest_1 = require("../rest"); const Utils_1 = require("./Utils"); /** * Performs a generic action on a CICS resource * @param session - The CMCI session * @param resourceType - The CMCI resource type (e.g., "CICSLocalFile") * @param action - The action to perform (e.g., "CLOSE", "OPEN") * @param params - The resource parameters * @param criteriaField - The resource selection criteria field (e.g., "FILE") * @param additionalParams - Additional action-specific parameters (e.g., { name: "BUSY", value: "WAIT" }) * @returns The CMCI API response */ async function performAction(session, resourceType, action, params, criteriaField, additionalParams) { // Build CMCI resource URI using the existing Utils helper const options = { cicsPlex: params.cicsPlex, regionName: params.regionName, criteria: `${criteriaField}=${params.name}`, }; const cmciResource = Utils_1.Utils.getResourceUri(resourceType, options); // Build request body const requestBody = { request: { action: { $: { name: action, }, }, }, }; // Add additional parameters if provided if (additionalParams) { requestBody.request.action.parameter = { $: additionalParams, }; } return rest_1.CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody); } exports.performAction = performAction; //# sourceMappingURL=ResourceActions.js.map