Skip to content

Commit

Permalink
Updated commands to use Utils.getResourceURI
Browse files Browse the repository at this point in the history
Signed-off-by: EKhan <[email protected]>
  • Loading branch information
enamkhan committed Jan 6, 2025
1 parent 26fe31f commit ba2eaf7
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 122 deletions.
4 changes: 4 additions & 0 deletions packages/sdk/src/constants/CicsCmci.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ export const CicsCmciConstants = {
*/
CICS_CMCI_EXTERNAL_RESOURCES: ["CICSLocalTransaction", "CICSRemoteTransaction", "CICSDefinitionTransaction", "CICSLocalFile"],

/**
* CICSTask parameter
*/
CICS_CMCI_TASK: "CICSTask"
};
21 changes: 8 additions & 13 deletions packages/vsce/src/commands/closeLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
Expand Down Expand Up @@ -143,18 +143,13 @@ async function closeLocalFile(
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
"CICSLocalFile" + //CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3]
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(FILE=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `FILE='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3], options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -131,19 +131,13 @@ async function disableLocalFile(
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
"CICSLocalFile" + //CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3]
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(FILE=" +
parms.name +
")"; //+
//"&PARAMETER=('BUSY(WAIT).')";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `FILE='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3], options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -116,18 +116,13 @@ function disableProgram(session: imperative.AbstractSession, parms: { name: stri
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
CicsCmciConstants.CICS_PROGRAM_RESOURCE +
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(PROGRAM=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `PROGRAM='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_PROGRAM_RESOURCE, options);

return CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -124,17 +124,13 @@ async function disableTransaction(
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
CicsCmciConstants.CICS_LOCAL_TRANSACTION +
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(TRANID=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `TRANID='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_LOCAL_TRANSACTION, options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -110,18 +110,13 @@ async function enableLocalFile(session: imperative.AbstractSession, parms: { nam
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
"CICSLocalFile" + //CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3]
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(FILE=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `FILE='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3], options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
21 changes: 8 additions & 13 deletions packages/vsce/src/commands/enableCommands/enableProgramCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -115,18 +115,13 @@ async function enableProgram(session: imperative.AbstractSession, parms: { name:
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
CicsCmciConstants.CICS_PROGRAM_RESOURCE +
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(PROGRAM=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `PROGRAM='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_PROGRAM_RESOURCE, options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
Expand Down Expand Up @@ -110,18 +110,13 @@ async function enableTransaction(session: imperative.AbstractSession, parms: { n
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
CicsCmciConstants.CICS_LOCAL_TRANSACTION +
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(TRANID=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `TRANID='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_LOCAL_TRANSACTION, options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
21 changes: 8 additions & 13 deletions packages/vsce/src/commands/openLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
Expand Down Expand Up @@ -120,18 +120,13 @@ async function openLocalFile(session: imperative.AbstractSession, parms: { name:
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
"CICSLocalFile" + //CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3]
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(FILE=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `FILE='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_CMCI_EXTERNAL_RESOURCES[3], options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}
21 changes: 8 additions & 13 deletions packages/vsce/src/commands/phaseInCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
Expand Down Expand Up @@ -127,18 +127,13 @@ async function performPhaseIn(session: imperative.AbstractSession, parms: { cics
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" +
CicsCmciConstants.CICS_SYSTEM_MANAGEMENT +
"/" +
CicsCmciConstants.CICS_PROGRAM_RESOURCE +
"/" +
cicsPlex +
parms.regionName +
"?CRITERIA=(PROGRAM=" +
parms.name +
")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `PROGRAM='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_PROGRAM_RESOURCE, options);

return (await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody)) as any;
}
13 changes: 9 additions & 4 deletions packages/vsce/src/commands/purgeTaskCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { CicsCmciConstants, CicsCmciRestClient, ICMCIApiResponse, Utils, IGetResourceUriOptions } from "@zowe/cics-for-zowe-sdk";
import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
Expand Down Expand Up @@ -155,8 +155,13 @@ async function purgeTask(
},
};

const cicsPlex = parms.cicsPlex === undefined ? "" : parms.cicsPlex + "/";
const cmciResource =
"/" + CicsCmciConstants.CICS_SYSTEM_MANAGEMENT + "/" + "CICSTask" + "/" + cicsPlex + parms.regionName + "?CRITERIA=(TASK=" + parms.name + ")";
const options: IGetResourceUriOptions = {
"cicsPlex": parms.cicsPlex,
"regionName": parms.regionName,
"criteria": `TASK='${parms.name}'`
};

const cmciResource = Utils.getResourceUri(CicsCmciConstants.CICS_CMCI_TASK, options);

return await CicsCmciRestClient.putExpectParsedXml(session, cmciResource, [], requestBody);
}

0 comments on commit ba2eaf7

Please sign in to comment.