import { AbstractSession , ImperativeError } from "@zowe/imperative" ; import { IStartTsoParms } from "./doc/input/IStartTsoParms" ; import { noAccountNumber , noCommandInput } from "./TsoConstants" ; import { SendTso } from "./SendTso" ; import { StartTso } from "./StartTso" ; import { IIssueResponse } from "./doc/IIssueResponse" ; import { StopTso } from "./StopTso" ; import { TsoValidator } from "./TsoValidator" ; import { IIssueTsoParms } from "./doc/input/IIssueTsoParms" ; class export class IssueTso { param { AbstractSession } session param { string } accountNumber param { string } command param { IStartTsoParms } startParams see { IStartTsoParms } returns { Promise < IIssueResponse > } see { IIssueResponse } memberof public static async issueTsoCommand ( session , accountNumber , command , startParams ? ) { TsoValidator . validateSession ( session ) ; TsoValidator . validateNotEmptyString ( accountNumber , noAccountNumber . message ) ; TsoValidator . validateNotEmptyString ( command , noCommandInput . message ) ; const response = { success : false , startResponse : null , startReady : false , zosmfResponse : null , commandResponse : null , stopResponse : null } ; response . startResponse = await StartTso . start ( session , accountNumber , startParams || { } ) ; if ( ! response . startResponse . success ) { throw new ImperativeError ( { msg : `TSO address space failed to start.` , additionalDetails : response . startResponse . failureResponse ?. message } ) ; } const sendResponse = await SendTso . sendDataToTSOCollect ( session , response . startResponse . servletKey , command ) ; response . success = sendResponse . success ; response . zosmfResponse = sendResponse . zosmfResponse ; response . commandResponse = sendResponse . commandResponse ; response . stopResponse = await StopTso . stop ( session , response . startResponse . servletKey ) ; return response ; } param { AbstractSession } session param { IIssueTsoParms } commandParms see { IIssueTsoParms } returns { Promise < IIssueResponse > } public static async issueTsoCommandCommon ( session , commandParms ) { TsoValidator . validateSession ( session ) ; TsoValidator . validateIssueParams ( commandParms ) ; TsoValidator . validateNotEmptyString ( commandParms . command , noCommandInput . message ) ; return IssueTso . issueTsoCommand ( session , commandParms . accountNumber , commandParms . command , commandParms . startParams ) ; } }