UNPKG

@zowe/cics-for-zowe-sdk

Version:
120 lines 7.24 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.deleteWebservice = exports.deleteUrimap = exports.deleteTransaction = exports.deleteProgram = void 0; const imperative_1 = require("@zowe/imperative"); const constants_1 = require("../../constants"); const rest_1 = require("../../rest"); const utils_1 = require("../../utils"); /** * Delete a program installed in CICS through CMCI REST API * @param {AbstractSession} session - the session to connect to CMCI with * @param {IProgramParms} parms - parameters for deleting your program * @returns {Promise<ICMCIApiResponse>} promise that resolves to the response (XML parsed into a javascript object) * when the request is complete * @throws {ImperativeError} CICS program name not defined or blank * @throws {ImperativeError} CICS region name not defined or blank * @throws {ImperativeError} CicsCmciRestClient request fails */ async function deleteProgram(session, parms) { imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.name, "CICS Program name", "CICS program name is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.csdGroup, "CICS CSD Group", "CICS CSD group is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.regionName, "CICS Region name", "CICS region name is required"); imperative_1.Logger.getAppLogger().debug("Attempting to delete a program with the following parameters:\n%s", JSON.stringify(parms)); const options = { cicsPlex: parms.cicsPlex, regionName: parms.regionName, criteria: `NAME=${parms.name}`, parameter: `CSDGROUP(${parms.csdGroup})`, }; const cmciResource = utils_1.Utils.getResourceUri(constants_1.CicsCmciConstants.CICS_DEFINITION_PROGRAM, options); return rest_1.CicsCmciRestClient.deleteExpectParsedXml(session, cmciResource, []); } exports.deleteProgram = deleteProgram; /** * Delete a transaction installed in CICS through CMCI REST API * @param {AbstractSession} session - the session to connect to CMCI with * @param {ITransactionParms} parms - parameters for deleting your transaction * @returns {Promise<ICMCIApiResponse>} promise that resolves to the response (XML parsed into a javascript object) * when the request is complete * @throws {ImperativeError} CICS transaction name not defined or blank * @throws {ImperativeError} CICS region name not defined or blank * @throws {ImperativeError} CicsCmciRestClient request fails */ async function deleteTransaction(session, parms) { imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.name, "CICS Transaction name", "CICS transaction name is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.csdGroup, "CICS CSD Group", "CICS CSD group is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.regionName, "CICS Region name", "CICS region name is required"); imperative_1.Logger.getAppLogger().debug("Attempting to delete a transaction with the following parameters:\n%s", JSON.stringify(parms)); const options = { cicsPlex: parms.cicsPlex, regionName: parms.regionName, criteria: `NAME=${parms.name}`, parameter: `CSDGROUP(${parms.csdGroup})`, }; const cmciResource = utils_1.Utils.getResourceUri(constants_1.CicsCmciConstants.CICS_DEFINITION_TRANSACTION, options); return rest_1.CicsCmciRestClient.deleteExpectParsedXml(session, cmciResource, []); } exports.deleteTransaction = deleteTransaction; /** * Delete a URIMap installed in CICS through CMCI REST API * @param {AbstractSession} session - the session to connect to CMCI with * @param {IURIMapParms} parms - parameters for deleting your URIMap * @returns {Promise<ICMCIApiResponse>} promise that resolves to the response (XML parsed into a javascript object) * when the request is complete * @throws {ImperativeError} CICS URIMap name not defined or blank * @throws {ImperativeError} CICS CSD group not defined or blank * @throws {ImperativeError} CICS region name not defined or blank * @throws {ImperativeError} CicsCmciRestClient request fails */ async function deleteUrimap(session, parms) { imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.name, "CICS URIMap name", "CICS URIMap name is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.csdGroup, "CICS CSD Group", "CICS CSD group is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.regionName, "CICS Region name", "CICS region name is required"); imperative_1.Logger.getAppLogger().debug("Attempting to delete a URIMap with the following parameters:\n%s", JSON.stringify(parms)); const options = { cicsPlex: parms.cicsPlex, regionName: parms.regionName, criteria: `NAME=${parms.name}`, parameter: `CSDGROUP(${parms.csdGroup})`, }; const cmciResource = utils_1.Utils.getResourceUri(constants_1.CicsCmciConstants.CICS_DEFINITION_URIMAP, options); return rest_1.CicsCmciRestClient.deleteExpectParsedXml(session, cmciResource, []); } exports.deleteUrimap = deleteUrimap; /** * Delete a web service installed in CICS through CMCI REST API * @param {AbstractSession} session - the session to connect to CMCI with * @param {IWebServiceParms} parms - parameters for deleting your web service * @returns {Promise<ICMCIApiResponse>} promise that resolves to the response (XML parsed into a javascript object) * when the request is complete * @throws {ImperativeError} CICS Web service name not defined or blank * @throws {ImperativeError} CICS CSD group not defined or blank * @throws {ImperativeError} CICS region name not defined or blank * @throws {ImperativeError} CicsCmciRestClient request fails */ async function deleteWebservice(session, parms) { imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.name, "CICS Web service name", "CICS Web service name is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.csdGroup, "CICS CSD Group", "CICS CSD group is required"); imperative_1.ImperativeExpect.toBeDefinedAndNonBlank(parms.regionName, "CICS Region name", "CICS region name is required"); imperative_1.Logger.getAppLogger().debug("Attempting to delete a web service with the following parameters:\n%s", JSON.stringify(parms)); const options = { cicsPlex: parms.cicsPlex, regionName: parms.regionName, criteria: `NAME=${parms.name}`, parameter: `CSDGROUP(${parms.csdGroup})`, }; const cmciResource = utils_1.Utils.getResourceUri(constants_1.CicsCmciConstants.CICS_DEFINITION_WEBSERVICE, options); return rest_1.CicsCmciRestClient.deleteExpectParsedXml(session, cmciResource, []); } exports.deleteWebservice = deleteWebservice; //# sourceMappingURL=Delete.js.map