Skip to content

Commit

Permalink
poc work
Browse files Browse the repository at this point in the history
Signed-off-by: jace-roell <[email protected]>
  • Loading branch information
jace-roell committed Sep 30, 2024
1 parent 450d26b commit 7d736ca
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/zostso/start/Start.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { ICommandDefinition } from "@zowe/imperative";
import { AddressSpaceDefinition } from "./address-space/AddressSpace.definition";
import { StartASApp } from "./address-space/StartASApp.definition";
import { StartASApp } from "./as-app/StartASApp.definition";

export const StartCommand: ICommandDefinition = {
name: "start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { ICommandDefinition } from "@zowe/imperative";
import { ICommandDefinition, ICommandOptionDefinition } from "@zowe/imperative";
import { TsoProfileConstants } from "@zowe/zos-tso-for-zowe-sdk";

export const StartASApp: ICommandDefinition = {
Expand All @@ -24,25 +24,37 @@ export const StartASApp: ICommandDefinition = {
},
options: TsoProfileConstants.TSO_PROFILE_OPTIONS.concat([
{
name: "app-key", aliases: ["ak"],
name: "app-key",
aliases: ["ak"],
description: "App Key",
type: "string"
type: "string",
required: true
},
{
name: "startup", aliases: ["s"],
name: "startup",
aliases: ["s"],
description: "Startup",
type: "string"
type: "string",
required: true
},
{
name: "queue-id", aliases: ["qi"],
name: "queue-id",
aliases: ["qi"],
description: "Queue ID",
type: "string"
},
{
name: "servlet-key", aliases: ["sk"],
name: "servlet-key",
aliases: ["sk"],
description: "Servlet Key",
type: "string"
}
]),
examples: []
] 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;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@

import { IHandlerParameters, ImperativeError } from "@zowe/imperative";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import ImperativeError.
import { StartTso, ZosTsoBaseHandler } from "@zowe/zos-tso-for-zowe-sdk";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import StartTso.
import { StartASApp } from "./StartASApp.definition";
import { StartTsoApp } from "../../../../../zostso/src/StartTsoApp"
import { StartTsoApp } from "@zowe/zos-tso-for-zowe-sdk";
import { IStartTsoAppParms } from "@zowe/zos-tso-for-zowe-sdk/lib/doc/input/IStartTsoAppParms";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import IStartTsoAppParms.

/**
* Handler to start app at an address space
* @export
* @class Handler
* @implements {ICommandHandler}
*/
export default class Handler extends ZosTsoBaseHandler {

// Process the command and produce the start response (returns servlet)

public async processCmd(commandParameters: IHandlerParameters) {
const response = await StartTsoApp.start(this.mSession, this.mArguments.account, this.mTsoStart);
const response = await StartTsoApp.start(

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable response.
this.mSession,
this.mArguments.account,
{
startupCommand: commandParameters.arguments.startup,
appKey: commandParameters.arguments.appKey,
servletKey: commandParameters.arguments.servletKey,
queueID: commandParameters.arguments.queueId,
},
this.mTsoStart
);
}
}
21 changes: 16 additions & 5 deletions packages/zostso/src/StartTsoApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { TsoValidator } from "./TsoValidator";
import { noAccountNumber, TsoConstants } from "./TsoConstants";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import 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";
/**
* Start TSO address space and receive servlet key
* @export
Expand All @@ -34,11 +35,21 @@ export class StartTsoApp {
* @returns {Promise<IStartASAppResponse>} command response on resolve, @see {IStartASAppResponse}
* @memberof StartTso
*/
public static async start(session: AbstractSession, accountNumber: string, parms?: IStartTsoParms): Promise<any> {

return "";


public static async start(session: AbstractSession, accountNumber: string, params: IStartTsoAppParms, parms?: 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;
}
// Address space is known
else
{
const response: string;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable response.
return undefined;
}
}
}

43 changes: 43 additions & 0 deletions packages/zostso/src/doc/input/IStartTsoAppParms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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.
*
*/

/**
* Interface for starting an app on a TSO Address Space
* @export
* @interface IStartTsoAppParms
*/
export interface IStartTsoAppParms {

/**
* Startup command to run at TSO address space
* @type {string}
* @memberof IStartTsoAppParms
*/
startupCommand: string;
/**
* App Key of application to be started at a TSO address space
* @type {string}
* @memberof IStartTsoAppParms
*/
appKey: string;
/**
* Queue ID of an active address space
* @type {string}
* @memberof IStartTsoAppParms
*/
queueID?: string;
/**
* Servlet key of an active address space
* @type {string}
* @memberof IStartTsoAppParms
*/
servletKey?: string;
}
1 change: 1 addition & 0 deletions packages/zostso/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export * from "./IssueTso";
export * from "./PingTso";
export * from "./SendTso";
export * from "./StartTso";
export * from "./StartTsoApp";
export * from "./StopTso";
export * from "./TsoConstants";
export * from "./TsoResponseService";
Expand Down

0 comments on commit 7d736ca

Please sign in to comment.