Skip to content

Commit

Permalink
start command POC
Browse files Browse the repository at this point in the history
Signed-off-by: jace-roell <[email protected]>
  • Loading branch information
jace-roell committed Oct 1, 2024
1 parent 113a983 commit b1b8130
Showing 1 changed file with 44 additions and 23 deletions.
67 changes: 44 additions & 23 deletions packages/zostso/src/StartTsoApp.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* 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.
*
*/
* 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.
*
*/

import { AbstractSession, Headers } from "@zowe/imperative";
import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk";
Expand All @@ -20,6 +20,8 @@ import { noAccountNumber, TsoConstants } from "./TsoConstants";
import { TsoResponseService } from "./TsoResponseService";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import TsoResponseService.
import { IStartASAppResponse } from "./doc/IStartASAppResponse";
import { IStartTsoAppParms } from "./doc/input/IStartTsoAppParms";
import { StartTso } from "./StartTso";
import { IIssueResponse } from "../lib";
/**
* Start TSO address space and receive servlet key
* @export
Expand All @@ -35,29 +37,48 @@ export class StartTsoApp {
* @returns {Promise<IStartASAppResponse>} command response on resolve, @see {IStartASAppResponse}
* @memberof StartTso
*/
public static async start(session: AbstractSession, accountNumber: string, params: IStartTsoAppParms, parms?: IStartTsoParms): Promise<IStartASAppResponse> {
public static async start(
session: AbstractSession,
accountNumber: string,
params: IStartTsoAppParms,
startParms: IStartTsoParms
): Promise<IStartASAppResponse> {
// Address space is not known
TsoValidator.validateSession(session);
TsoValidator.validateNotEmptyString(accountNumber, noAccountNumber.message);
if(!params.queueID || !params.servletKey)
{
console.log("NEEDS IMPLEMENTATION");
return undefined;
TsoValidator.validateNotEmptyString(
accountNumber,
noAccountNumber.message
);
if (!params.queueID || !params.servletKey) {
const response: IIssueResponse = {
success: false,
startResponse: await StartTso.start(
session,
accountNumber,
startParms
),
startReady: false,
zosmfResponse: null,
commandResponse: null,
stopResponse: null,
};
params.servletKey =
response.startResponse.zosmfTsoResponse.servletKey;
params.queueID = response.startResponse.zosmfTsoResponse.queueID;
}
// Address space is known
else
{
const endpoint = `${TsoConstants.RESOURCE}/app/${params.servletKey}/${params.appKey}`;
const apiResponse = await ZosmfRestClient.postExpectJSON<IStartASAppResponse>(
const endpoint = `${TsoConstants.RESOURCE}/app/${params.servletKey}/${params.appKey}`;
const apiResponse =
await ZosmfRestClient.postExpectJSON<IStartASAppResponse>(
session,
endpoint,
[Headers.APPLICATION_JSON],
{
"startcmd": `${params.startupCommand} '&1 &2 ${params.queueID}'`
startcmd: `${params.startupCommand} '&1 &2 ${params.queueID}'`,
}
);
return apiResponse;
}
apiResponse.queueID = params.queueID;
apiResponse.servletKey = params.servletKey;
return apiResponse;
}
}

0 comments on commit b1b8130

Please sign in to comment.