Skip to content

Commit

Permalink
implications
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 b1b8130 commit 607a7bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
12 changes: 4 additions & 8 deletions packages/cli/src/zostso/start/as-app/StartASApp.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,16 @@ export const StartASApp: ICommandDefinition = {
name: "queue-id",
aliases: ["qi"],
description: "Queue ID",
type: "string"
type: "string",
implies: ["servlet-key"]
},
{
name: "servlet-key",
aliases: ["sk"],
description: "Servlet Key",
type: "string"
type: "string",
implies: ["queue-id"]
}
] as ICommandOptionDefinition[]),
examples: [],
check: (argv: { [key: string]: any }) => {
if ((argv["queue-id"] && !argv["servlet-key"]) || (!argv["queue-id"] && argv["servlet-key"])) {
throw new Error("Both queue-id and servlet-key must be defined together.");
}
return true;
}
};
11 changes: 5 additions & 6 deletions packages/zostso/src/StartTsoApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@

import { AbstractSession, Headers } from "@zowe/imperative";
import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk";
import { SendTso } from "./SendTso";
import { IStartStopResponses } from "./doc/IStartStopResponses";
import { IStartTsoParms } from "./doc/input/IStartTsoParms";
import { IZosmfTsoResponse } from "./doc/zosmf/IZosmfTsoResponse";
import { TsoValidator } from "./TsoValidator";
import { noAccountNumber, TsoConstants } from "./TsoConstants";
import { TsoResponseService } from "./TsoResponseService";
import { IStartASAppResponse } from "./doc/IStartASAppResponse";
import { IStartTsoAppParms } from "./doc/input/IStartTsoAppParms";
import { StartTso } from "./StartTso";
Expand All @@ -43,12 +39,13 @@ export class StartTsoApp {
params: IStartTsoAppParms,
startParms: IStartTsoParms
): Promise<IStartASAppResponse> {
// Address space is not known

TsoValidator.validateSession(session);
TsoValidator.validateNotEmptyString(
accountNumber,
noAccountNumber.message
);
// Address space is not known and must be created
if (!params.queueID || !params.servletKey) {
const response: IIssueResponse = {
success: false,
Expand All @@ -62,11 +59,12 @@ export class StartTsoApp {
commandResponse: null,
stopResponse: null,
};
// Reassigning servletKey and queueID so the application can be started at the correct location
params.servletKey =
response.startResponse.zosmfTsoResponse.servletKey;
params.queueID = response.startResponse.zosmfTsoResponse.queueID;
}
// Address space is known
// Address space application starting
const endpoint = `${TsoConstants.RESOURCE}/app/${params.servletKey}/${params.appKey}`;
const apiResponse =
await ZosmfRestClient.postExpectJSON<IStartASAppResponse>(
Expand All @@ -77,6 +75,7 @@ export class StartTsoApp {
startcmd: `${params.startupCommand} '&1 &2 ${params.queueID}'`,
}
);
// Add newly created queueID and servletKey information to return object.
apiResponse.queueID = params.queueID;
apiResponse.servletKey = params.servletKey;
return apiResponse;
Expand Down

0 comments on commit 607a7bd

Please sign in to comment.