UNPKG

@zowe/cics-for-zowe-sdk

Version:
47 lines 2.22 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.putResource = void 0; const imperative_1 = require("@zowe/imperative"); const rest_1 = require("../../rest"); const utils_1 = require("../../utils"); /** * Put resources on in CICS through CMCI REST API * @param {AbstractSession} session - the session to connect to CMCI with * @param {IResourceParms} parms - parameters for getting resources * @returns {Promise<ICMCIApiResponse>} promise that resolves to the response (XML parsed into a javascript object) * when the request is complete * @throws {ImperativeError} CICS resource name not defined or blank * @throws {ImperativeError} CICS region name not defined or blank * @throws {ImperativeError} CicsCmciRestClient request fails */ async function putResource(session, parms, headers = [], requestBody, requestOptions) { imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.name, "CICS Resource name", "CICS resource name is required"); const options = { cicsPlex: parms.cicsPlex, regionName: parms.regionName, criteria: parms.criteria, parameter: parms.parameter, queryParams: parms.queryParams, }; const cmciResource = utils_1.Utils.getResourceUri(parms.name, options); imperative_1.Logger.getAppLogger().debug("PUT request - Resource [" + parms.name + "]" + (parms.cicsPlex ? ", CICSplex [" + parms.cicsPlex + "]" : "") + (parms.regionName ? ", Region [" + parms.regionName + "]" : "") + (parms.criteria ? ", Criteria [" + parms.criteria + "]" : "") + (parms.parameter ? ", Parameter [" + parms.parameter + "]" : "")); return rest_1.CicsCmciRestClient.putExpectParsedXml(session, cmciResource, headers, requestBody, requestOptions); } exports.putResource = putResource; //# sourceMappingURL=Put.js.map